1#ifndef TESTS_WRAPPERS_H
2#define TESTS_WRAPPERS_H
4#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
9typedef CHAR *LPSTR, *LPCCH;
21typedef char byte, BYTE, *PBYTE, *LPBYTE;
22typedef unsigned long DWORD, LCID, *LPDWORD, REGSAM;
23typedef unsigned long long QWORD;
25typedef LONG HRESULT, LSTATUS;
28typedef const WCHAR *LPCWSTR;
29typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
30typedef unsigned int UINT;
31typedef void *HANDLE, *PHANDLE, *LPVOID, *LPOVERLAPPED, *HWND;
32typedef const void *LPCVOID;
35 LPVOID lpSecurityDescriptor;
49 DWORD dwFillAttribute;
64typedef HANDLE HKEY, *PHKEY;
86#define CREATE_ALWAYS 2
87#define CREATE_NO_WINDOW 0
88#define CSIDL_APPDATA 0
89#define ERROR_ACCESS_DENIED 802
90#define ERROR_ALREADY_EXISTS 803
91#define ERROR_MORE_DATA 800
92#define ERROR_NO_MORE_ITEMS 801
93#define ERROR_SUCCESS 0
95#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
96#define FILE_ATTRIBUTE_NORMAL 0x00000080
97#define FORMAT_MESSAGE_FROM_SYSTEM 2
98#define FORMAT_MESSAGE_IGNORE_INSERTS 1
100#define GENERIC_WRITE 1
101#define HKEY_CLASSES_ROOT (HKEY)2
102#define HKEY_CURRENT_CONFIG (HKEY)4
103#define HKEY_CURRENT_USER (HKEY)1
104#define HKEY_DYN_DATA (HKEY)6
105#define HKEY_LOCAL_MACHINE (HKEY)3
106#define HKEY_USERS (HKEY)5
107#define INFINITE 0xFFFFFFFF
108#define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
109#define INVALID_HANDLE_VALUE (void *)3
110#define IsWindowsVistaOrGreater() 0
113#define LOCALE_USER_DEFAULT 0
114#define MAKELANGID(x, y) 0
117#define STARTF_USESHOWWINDOW 1
118#define STARTF_USESTDHANDLES 2
119#define STD_OUTPUT_HANDLE 0
120#define SUCCEEDED(x) x == 0
122#define WAIT_OBJECT_0 0
123#define SECURITY_NT_AUTHORITY {0, 0, 0, 0, 0, 5}
124#define SECURITY_BUILTIN_DOMAIN_RID 0x00000020
125#define DOMAIN_ALIAS_RID_ADMINS 0x00000220
128#define min(a, b) (((a) < (b)) ? (a) : (b))
131#define TEXT(quote) L##quote
134DWORD GetFileAttributes(
wchar_t *path);
135int GetTimeFormat(LCID Locale,
141int GetDateFormat(LCID Locale,
147bool CreatePipe(PHANDLE hReadPipe,
151bool CloseHandle(HANDLE hObject);
152DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
153bool PeekNamedPipe(HANDLE hNamedPipe,
157 LPDWORD lpTotalBytesAvail,
158 LPDWORD lpBytesLeftThisMessage);
159bool ReadFile(HANDLE hFile,
161 DWORD nNumberOfBytesToRead,
162 LPDWORD lpNumberOfBytesRead,
163 LPOVERLAPPED lpOverlapped);
164int MultiByteToWideChar(UINT CodePage,
166 LPCCH lpMultiByteStr,
168 LPWSTR lpWideCharStr,
170int WideCharToMultiByte(UINT CodePage,
172 LPCWCH lpWideCharStr,
174 LPSTR lpMultiByteStr,
177 bool *lpUsedDefaultChar);
178void PathStripPath(LPWSTR pszPath);
179bool CreateProcess(LPCWSTR lpApplicationName,
180 LPWSTR lpCommandLine,
183 bool bInheritHandles,
184 DWORD dwCreationFlags,
186 LPCWSTR lpCurrentDirectory,
189bool WriteFile(HANDLE hFile,
191 DWORD nNumberOfBytesToWrite,
192 LPDWORD lpNumberOfBytesWritten,
193 LPOVERLAPPED lpOverlapped);
194LSTATUS RegEnumValue(HKEY hKey,
197 LPDWORD lpcchValueName,
204bool PathAppend(LPWSTR pszPath, LPCWSTR pszMore);
205HANDLE GetStdHandle(DWORD nStdHandle);
207RegOpenKeyEx(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
208LSTATUS RegEnumKeyEx(HKEY hKey,
216LSTATUS RegCloseKey(HKEY hKey);
217HANDLE CreateFile(LPCWSTR lpFileName,
218 DWORD dwDesiredAccess,
221 DWORD dwCreationDisposition,
222 DWORD dwFlagsAndAttributes,
223 HANDLE hTemplateFile);
224LSTATUS RegQueryInfoKey(HKEY hKey,
229 LPDWORD lpcbMaxSubKeyLen,
230 LPDWORD lpcbMaxClassLen,
232 LPDWORD lpcbMaxValueNameLen,
233 LPDWORD lpcbMaxValueLen,
234 LPDWORD lpcbSecurityDescriptor,
236LSTATUS RegQueryValueEx(HKEY hKey,
242HRESULT SHGetFolderPath(HWND hwnd,
int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
243wchar_t *_wfullpath(
wchar_t *absPath,
const wchar_t *relPath,
size_t maxLength);
244wchar_t *_wgetcwd(
wchar_t *buffer,
int maxlen);
245int _wchdir(
const wchar_t *dirname);
246int _snwprintf(
wchar_t *buffer,
size_t count,
const wchar_t *format, ...);
247int _wcsicmp(
const wchar_t *a,
const wchar_t *b);
248bool _CrtDumpMemoryLeaks();
249DWORD FormatMessage(DWORD dwFlags,
256bool GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode);
257bool StrTrim(
wchar_t *str,
const wchar_t *trimChars);
258bool PathMatchSpec(
const wchar_t *pszFile,
const wchar_t *pszSpec);
259LSTATUS RegSetValueEx(
260 HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType,
const BYTE *lpData, DWORD cbData);
261LSTATUS RegCreateKeyEx(HKEY hKey,
269 LPDWORD disposition);
271 BYTE nSubAuthorityCount,
272 DWORD nSubAuthority0,
273 DWORD nSubAuthority1,
274 DWORD nSubAuthority2,
275 DWORD nSubAuthority3,
276 DWORD nSubAuthority4,
277 DWORD nSubAuthority5,
278 DWORD nSubAuthority6,
279 DWORD nSubAuthority7,
281bool CheckTokenMembership(HANDLE TokenHandle, PSID SidToCheck,
bool *IsMember);
282void FreeSid(PSID pSid);