1#ifndef TESTS_WRAPPERS_H
2#define TESTS_WRAPPERS_H
4#ifndef check_expected_int
5#define check_expected_int(parameter) check_expected(parameter)
6#define check_expected_uint(parameter) check_expected(parameter)
7#define expect_int_value(function, parameter, value) expect_value(function, parameter, value)
8#define expect_uint_value(function, parameter, value) expect_value(function, parameter, value)
9#define expect_uint_value_count(function, parameter, value, count) \
10 expect_value_count(function, parameter, value, (int)(count))
11#define will_return_uint_always(function, value) will_return_always(function, value)
12#define will_return_ptr_always(function, value) will_return_always(function, value)
13#define will_return_uint_count(function, value, count) will_return_count(function, value, count)
16#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
18#define UINT64 uint64_t
21typedef CHAR *LPSTR, *LPCCH;
33typedef char byte, BYTE, *PBYTE, *LPBYTE;
34typedef unsigned long DWORD, LCID, *LPDWORD, REGSAM;
35typedef unsigned long long QWORD;
37typedef LONG HRESULT, LSTATUS;
40typedef const WCHAR *LPCWSTR;
41typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
42typedef unsigned int UINT;
43typedef void *HANDLE, *PHANDLE, *LPVOID, *LPOVERLAPPED, *HWND;
44typedef const void *LPCVOID;
47 LPVOID lpSecurityDescriptor;
49} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
61 DWORD dwFillAttribute;
69} STARTUPINFO, *LPSTARTUPINFO;
75} PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
76typedef HANDLE HKEY, *PHKEY;
94} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
98#define CREATE_ALWAYS 2
99#define CREATE_NO_WINDOW 0
100#define CSIDL_APPDATA 0
101#define ERROR_ACCESS_DENIED 802
102#define ERROR_ALREADY_EXISTS 803
103#define ERROR_MORE_DATA 800
104#define ERROR_NO_MORE_ITEMS 801
105#define ERROR_SUCCESS 0
107#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
108#define FILE_ATTRIBUTE_NORMAL 0x00000080
109#define FORMAT_MESSAGE_FROM_SYSTEM 2
110#define FORMAT_MESSAGE_IGNORE_INSERTS 1
111#define GENERIC_READ 0
112#define GENERIC_WRITE 1
113#define HKEY_CLASSES_ROOT (HKEY)2
114#define HKEY_CURRENT_CONFIG (HKEY)4
115#define HKEY_CURRENT_USER (HKEY)1
116#define HKEY_DYN_DATA (HKEY)6
117#define HKEY_LOCAL_MACHINE (HKEY)3
118#define HKEY_USERS (HKEY)5
119#define INFINITE 0xFFFFFFFF
120#define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
121#define INVALID_HANDLE_VALUE (void *)3
122#define IsWindowsVistaOrGreater() 0
125#define LOCALE_USER_DEFAULT 0
126#define MAKELANGID(x, y) 0
129#define STARTF_USESHOWWINDOW 1
130#define STARTF_USESTDHANDLES 2
131#define STD_OUTPUT_HANDLE 0
132#define SUCCEEDED(x) x == 0
134#define WAIT_OBJECT_0 0
137#define SECURITY_NT_AUTHORITY {0, 0, 0, 0, 0, 5}
139#define SECURITY_BUILTIN_DOMAIN_RID 0x00000020
140#define DOMAIN_ALIAS_RID_ADMINS 0x00000220
143#define min(a, b) (((a) < (b)) ? (a) : (b))
146#define TEXT(quote) L##quote
149DWORD GetFileAttributes(
wchar_t *path);
150int GetTimeFormat(LCID Locale,
152 const SYSTEMTIME *lpTime,
156int GetDateFormat(LCID Locale,
158 const SYSTEMTIME *lpDate,
162bool CreatePipe(PHANDLE hReadPipe,
164 LPSECURITY_ATTRIBUTES lpPipeAttributes,
166bool CloseHandle(HANDLE hObject);
167DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
168bool PeekNamedPipe(HANDLE hNamedPipe,
172 LPDWORD lpTotalBytesAvail,
173 LPDWORD lpBytesLeftThisMessage);
174bool ReadFile(HANDLE hFile,
176 DWORD nNumberOfBytesToRead,
177 LPDWORD lpNumberOfBytesRead,
178 LPOVERLAPPED lpOverlapped);
179int MultiByteToWideChar(UINT CodePage,
181 LPCCH lpMultiByteStr,
183 LPWSTR lpWideCharStr,
185int WideCharToMultiByte(UINT CodePage,
187 LPCWCH lpWideCharStr,
189 LPSTR lpMultiByteStr,
192 bool *lpUsedDefaultChar);
193void PathStripPath(LPWSTR pszPath);
194bool CreateProcess(LPCWSTR lpApplicationName,
195 LPWSTR lpCommandLine,
196 SECURITY_ATTRIBUTES *lpProcessAttributes,
197 SECURITY_ATTRIBUTES *lpThreadAttributes,
198 bool bInheritHandles,
199 DWORD dwCreationFlags,
201 LPCWSTR lpCurrentDirectory,
202 LPSTARTUPINFO lpStartupInfo,
203 LPPROCESS_INFORMATION lpProcessInformation);
204bool WriteFile(HANDLE hFile,
206 DWORD nNumberOfBytesToWrite,
207 LPDWORD lpNumberOfBytesWritten,
208 LPOVERLAPPED lpOverlapped);
209LSTATUS RegEnumValue(HKEY hKey,
212 LPDWORD lpcchValueName,
218bool CreateDirectory(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
219bool PathAppend(LPWSTR pszPath, LPCWSTR pszMore);
220HANDLE GetStdHandle(DWORD nStdHandle);
222RegOpenKeyEx(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
223LSTATUS RegEnumKeyEx(HKEY hKey,
230 PFILETIME lpftLastWriteTime);
231LSTATUS RegCloseKey(HKEY hKey);
232HANDLE CreateFile(LPCWSTR lpFileName,
233 DWORD dwDesiredAccess,
235 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
236 DWORD dwCreationDisposition,
237 DWORD dwFlagsAndAttributes,
238 HANDLE hTemplateFile);
239LSTATUS RegQueryInfoKey(HKEY hKey,
244 LPDWORD lpcbMaxSubKeyLen,
245 LPDWORD lpcbMaxClassLen,
247 LPDWORD lpcbMaxValueNameLen,
248 LPDWORD lpcbMaxValueLen,
249 LPDWORD lpcbSecurityDescriptor,
250 PFILETIME lpftLastWriteTime);
251LSTATUS RegQueryValueEx(HKEY hKey,
257HRESULT SHGetFolderPath(HWND hwnd,
int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
258wchar_t *_wfullpath(
wchar_t *absPath,
const wchar_t *relPath,
size_t maxLength);
259wchar_t *_wgetcwd(
wchar_t *buffer,
int maxlen);
260int _wchdir(
const wchar_t *dirname);
261int _snwprintf(
wchar_t *buffer,
size_t count,
const wchar_t *format, ...);
262int _wcsicmp(
const wchar_t *a,
const wchar_t *b);
263bool _CrtDumpMemoryLeaks();
264DWORD FormatMessage(DWORD dwFlags,
271bool GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode);
272bool StrTrim(
wchar_t *str,
const wchar_t *trimChars);
273bool PathMatchSpec(
const wchar_t *pszFile,
const wchar_t *pszSpec);
274LSTATUS RegSetValueEx(
275 HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType,
const BYTE *lpData, DWORD cbData);
276LSTATUS RegCreateKeyEx(HKEY hKey,
282 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
284 LPDWORD disposition);
285bool AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
286 BYTE nSubAuthorityCount,
287 DWORD nSubAuthority0,
288 DWORD nSubAuthority1,
289 DWORD nSubAuthority2,
290 DWORD nSubAuthority3,
291 DWORD nSubAuthority4,
292 DWORD nSubAuthority5,
293 DWORD nSubAuthority6,
294 DWORD nSubAuthority7,
296bool CheckTokenMembership(HANDLE TokenHandle, PSID SidToCheck,
bool *IsMember);
297void FreeSid(PSID pSid);