winprefs v0.3.2
A registry exporter for programmers.
Loading...
Searching...
No Matches
wrappers.h
1#ifndef TESTS_WRAPPERS_H
2#define TESTS_WRAPPERS_H
3
4#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
5
6#define UINT64 uint64_t
7typedef short WORD;
8typedef char CHAR;
9typedef CHAR *LPSTR, *LPCCH;
10typedef struct _SYSTEMTIME {
11 WORD wYear;
12 WORD wMonth;
13 WORD wDayOfWeek;
14 WORD wDay;
15 WORD wHour;
16 WORD wMinute;
17 WORD wSecond;
18 WORD wMilliseconds;
19} SYSTEMTIME;
20typedef char byte, BYTE, *PBYTE, *LPBYTE;
21typedef unsigned long DWORD, LCID, *LPDWORD, REGSAM;
22typedef unsigned long long QWORD;
23typedef long LONG;
24typedef LONG HRESULT, LSTATUS;
25typedef wchar_t WCHAR;
26typedef WCHAR *LPWSTR;
27typedef const WCHAR *LPCWSTR;
28typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
29typedef unsigned int UINT;
30typedef void *HANDLE, *PHANDLE, *LPVOID, *LPOVERLAPPED, *HWND;
31typedef const void *LPCVOID;
32typedef struct _SECURITY_ATTRIBUTES {
33 DWORD nLength;
34 LPVOID lpSecurityDescriptor;
35 bool bInheritHandle;
36} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
37typedef struct _STARTUPINFO {
38 DWORD cb;
39 LPWSTR lpReserved;
40 LPWSTR lpDesktop;
41 LPWSTR lpTitle;
42 DWORD dwX;
43 DWORD dwY;
44 DWORD dwXSize;
45 DWORD dwYSize;
46 DWORD dwXCountChars;
47 DWORD dwYCountChars;
48 DWORD dwFillAttribute;
49 DWORD dwFlags;
50 WORD wShowWindow;
51 WORD cbReserved2;
52 LPBYTE lpReserved2;
53 HANDLE hStdInput;
54 HANDLE hStdOutput;
55 HANDLE hStdError;
56} STARTUPINFO, *LPSTARTUPINFO;
57typedef struct _PROCESS_INFORMATION {
58 HANDLE hProcess;
59 HANDLE hThread;
60 DWORD dwProcessId;
61 DWORD dwThreadId;
62} PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
63typedef HANDLE HKEY, *PHKEY;
64typedef struct _FILETIME {
65 DWORD dwLowDateTime;
66 DWORD dwHighDateTime;
67} FILETIME;
68typedef struct _FILETIME *PFILETIME;
69typedef WCHAR *LPTSTR;
70const enum REG_TYPES {
71 REG_BINARY,
72 REG_DWORD,
73 REG_EXPAND_SZ,
74 REG_MULTI_SZ,
75 REG_NONE,
76 REG_QWORD,
77 REG_SZ,
78};
79
80#define CP_UTF8 0
81#define CREATE_ALWAYS 2
82#define CREATE_NO_WINDOW 0
83#define CSIDL_APPDATA 0
84#define ERROR_ACCESS_DENIED 802
85#define ERROR_ALREADY_EXISTS 803
86#define ERROR_MORE_DATA 800
87#define ERROR_NO_MORE_ITEMS 801
88#define ERROR_SUCCESS 0
89
90#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
91#define FILE_ATTRIBUTE_NORMAL 0x00000080
92#define FORMAT_MESSAGE_FROM_SYSTEM 2
93#define FORMAT_MESSAGE_IGNORE_INSERTS 1
94#define GENERIC_READ 0
95#define GENERIC_WRITE 1
96#define HKEY_CLASSES_ROOT (HKEY)2
97#define HKEY_CURRENT_CONFIG (HKEY)4
98#define HKEY_CURRENT_USER (HKEY)1
99#define HKEY_DYN_DATA (HKEY)6
100#define HKEY_LOCAL_MACHINE (HKEY)3
101#define HKEY_USERS (HKEY)5
102#define INFINITE 0xFFFFFFFF
103#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
104#define INVALID_HANDLE_VALUE (void *)3
105#define IsWindowsVistaOrGreater() 0
106#define KEY_READ 0
107#define LOCALE_USER_DEFAULT 0
108#define MAKELANGID(x, y) 0
109#define MAX_PATH 260
110#define P_WAIT 0
111#define STARTF_USESHOWWINDOW 1
112#define STARTF_USESTDHANDLES 2
113#define STD_OUTPUT_HANDLE 0
114#define SUCCEEDED(x) x == 0
115#define SW_HIDE 0
116#define WAIT_OBJECT_0 0
117
118#ifndef min
119#define min(a, b) (((a) < (b)) ? (a) : (b))
120#endif
121#ifndef TEXT
122#define TEXT(quote) L##quote
123#endif
124
125DWORD GetFileAttributes(wchar_t *path);
126int GetTimeFormat(LCID Locale,
127 DWORD dwFlags,
128 const SYSTEMTIME *lpTime,
129 LPCWSTR lpFormat,
130 LPWSTR lpTimeStr,
131 int cchTime);
132int GetDateFormat(LCID Locale,
133 DWORD dwFlags,
134 const SYSTEMTIME *lpDate,
135 LPCWSTR lpFormat,
136 LPWSTR lpDateStr,
137 int cchDate);
138bool CreatePipe(PHANDLE hReadPipe,
139 PHANDLE hWritePipe,
140 LPSECURITY_ATTRIBUTES lpPipeAttributes,
141 DWORD nSize);
142bool CloseHandle(HANDLE hObject);
143DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
144bool PeekNamedPipe(HANDLE hNamedPipe,
145 LPVOID lpBuffer,
146 DWORD nBufferSize,
147 LPDWORD lpBytesRead,
148 LPDWORD lpTotalBytesAvail,
149 LPDWORD lpBytesLeftThisMessage);
150bool ReadFile(HANDLE hFile,
151 LPVOID lpBuffer,
152 DWORD nNumberOfBytesToRead,
153 LPDWORD lpNumberOfBytesRead,
154 LPOVERLAPPED lpOverlapped);
155int MultiByteToWideChar(UINT CodePage,
156 DWORD dwFlags,
157 LPCCH lpMultiByteStr,
158 int cbMultiByte,
159 LPWSTR lpWideCharStr,
160 int cchWideChar);
161int WideCharToMultiByte(UINT CodePage,
162 DWORD dwFlags,
163 LPCWCH lpWideCharStr,
164 int cchWideChar,
165 LPSTR lpMultiByteStr,
166 int cbMultiByte,
167 LPCCH lpDefaultChar,
168 bool *lpUsedDefaultChar);
169void PathStripPath(LPWSTR pszPath);
170bool CreateProcess(LPCWSTR lpApplicationName,
171 LPWSTR lpCommandLine,
172 SECURITY_ATTRIBUTES *lpProcessAttributes,
173 SECURITY_ATTRIBUTES *lpThreadAttributes,
174 bool bInheritHandles,
175 DWORD dwCreationFlags,
176 void *lpEnvironment,
177 LPCWSTR lpCurrentDirectory,
178 LPSTARTUPINFO lpStartupInfo,
179 LPPROCESS_INFORMATION lpProcessInformation);
180bool WriteFile(HANDLE hFile,
181 LPCVOID lpBuffer,
182 DWORD nNumberOfBytesToWrite,
183 LPDWORD lpNumberOfBytesWritten,
184 LPOVERLAPPED lpOverlapped);
185LSTATUS RegEnumValue(HKEY hKey,
186 DWORD dwIndex,
187 LPWSTR lpValueName,
188 LPDWORD lpcchValueName,
189 LPDWORD lpReserved,
190 LPDWORD lpType,
191 LPBYTE lpData,
192 LPDWORD lpcbData);
193DWORD GetLastError();
194bool CreateDirectory(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
195bool PathAppend(LPWSTR pszPath, LPCWSTR pszMore);
196HANDLE GetStdHandle(DWORD nStdHandle);
197LSTATUS
198RegOpenKeyEx(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
199LSTATUS RegEnumKeyEx(HKEY hKey,
200 DWORD dwIndex,
201 LPWSTR lpName,
202 LPDWORD lpcchName,
203 LPDWORD lpReserved,
204 LPWSTR lpClass,
205 LPDWORD lpcchClass,
206 PFILETIME lpftLastWriteTime);
207LSTATUS RegCloseKey(HKEY hKey);
208HANDLE CreateFile(LPCWSTR lpFileName,
209 DWORD dwDesiredAccess,
210 DWORD dwShareMode,
211 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
212 DWORD dwCreationDisposition,
213 DWORD dwFlagsAndAttributes,
214 HANDLE hTemplateFile);
215LSTATUS RegQueryInfoKey(HKEY hKey,
216 LPWSTR lpClass,
217 LPDWORD lpcchClass,
218 LPDWORD lpReserved,
219 LPDWORD lpcSubKeys,
220 LPDWORD lpcbMaxSubKeyLen,
221 LPDWORD lpcbMaxClassLen,
222 LPDWORD lpcValues,
223 LPDWORD lpcbMaxValueNameLen,
224 LPDWORD lpcbMaxValueLen,
225 LPDWORD lpcbSecurityDescriptor,
226 PFILETIME lpftLastWriteTime);
227LSTATUS RegQueryValueEx(HKEY hKey,
228 LPCWSTR lpValueName,
229 LPDWORD lpReserved,
230 LPDWORD lpType,
231 LPBYTE lpData,
232 LPDWORD lpcbData);
233HRESULT SHGetFolderPath(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
234wchar_t *_wfullpath(wchar_t *absPath, const wchar_t *relPath, size_t maxLength);
235wchar_t *_wgetcwd(wchar_t *buffer, int maxlen);
236int _wchdir(const wchar_t *dirname);
237int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format, ...);
238int _wcsicmp(const wchar_t *a, const wchar_t *b);
239bool _CrtDumpMemoryLeaks();
240DWORD FormatMessage(DWORD dwFlags,
241 LPCVOID lpSource,
242 DWORD dwMessageId,
243 DWORD dwLanguageId,
244 LPWSTR lpBuffer,
245 DWORD nSize,
246 va_list *Arguments);
247bool GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode);
248
249#endif // TESTS_WRAPPERS_H