UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
windows.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2019-2023 CESNET
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, is permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of CESNET nor the names of its contributors may be
21 * used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef UTILS_WINDOWS_H_DA080A19_C6F3_48E1_A570_63665ED95C1F
39#define UTILS_WINDOWS_H_DA080A19_C6F3_48E1_A570_63665ED95C1F
40
41#ifndef __cplusplus
42#include <stdbool.h>
43#endif
44
45enum {
47};
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53//
54// common (defined also for other platforms for compatibility reasons
55//
56
60#define HRESULT_GET_ERROR_COMMON(res, errptr) \
61 switch (res) { \
62 case S_OK: errptr = "Operation successful"; break; \
63 case S_FALSE: errptr = "Operation completed"; break; \
64 case E_NOTIMPL: errptr = "Not implemented"; break; \
65 case E_NOINTERFACE: errptr = "No such interface supported"; break; \
66 case E_POINTER: errptr = "Pointer that is not valid"; break; \
67 case E_ABORT: errptr = "Operation aborted"; break; \
68 case E_FAIL: errptr = "Unspecified failure"; break; \
69 case E_UNEXPECTED: errptr = "Unexpected failure"; break; \
70 case E_ACCESSDENIED: errptr = "General access denied error"; break; \
71 case E_HANDLE: errptr = "Handle that is not valid"; break; \
72 case E_OUTOFMEMORY: errptr = "Failed to allocate necessary memory"; break; \
73 case E_INVALIDARG: errptr = "One or more arguments are not valid"; break; \
74 }
75
76bool com_initialize(bool *com_initialized, const char *err_prefix);
78void com_uninitialize(bool *com_initialized);
79
80//
81// Windows only (defined only for Windows)
82//
83#ifdef _WIN32
84#include <windef.h>
85const char *hresult_to_str(HRESULT res);
86const char *get_win32_error(DWORD error);
87const char *win_wstr_to_str(const wchar_t *wstr);
88bool win_has_ancestor_process(const char *name);
89unsigned long get_windows_build(void);
90void print_stacktrace_win(void);
91#endif // defined _WIN32
92
93#ifdef __cplusplus
94}
95#endif // __cplusplus
96
97#endif // define UTILS_WINDOWS_H_DA080A19_C6F3_48E1_A570_63665ED95C1F
98
const char * name
Definition settings.cpp:193
bool com_initialize(bool *com_initialized, const char *err_prefix)
Definition windows.c:65
void com_uninitialize(bool *com_initialized)
Definition windows.c:94
@ BUILD_WINDOWS_11_OR_LATER
Definition windows.h:46