1#ifndef TESTS_WRAPPERS_H
2#define TESTS_WRAPPERS_H
4#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
9typedef CHAR *LPSTR, *LPCCH;
10typedef struct _SYSTEMTIME {
20typedef char byte, BYTE, *PBYTE, *LPBYTE;
21typedef unsigned long DWORD, LCID, *LPDWORD, REGSAM;
22typedef unsigned long long QWORD;
24typedef LONG HRESULT, LSTATUS;
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 {
34 LPVOID lpSecurityDescriptor;
36} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
37typedef struct _STARTUPINFO {
48 DWORD dwFillAttribute;
56} STARTUPINFO, *LPSTARTUPINFO;
57typedef struct _PROCESS_INFORMATION {
62} PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
63typedef HANDLE HKEY, *PHKEY;
64typedef struct _FILETIME {
68typedef struct _FILETIME *PFILETIME;
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
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
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
107#define LOCALE_USER_DEFAULT 0
108#define MAKELANGID(x, y) 0
111#define STARTF_USESHOWWINDOW 1
112#define STARTF_USESTDHANDLES 2
113#define STD_OUTPUT_HANDLE 0
114#define SUCCEEDED(x) x == 0
116#define WAIT_OBJECT_0 0
119#define min(a, b) (((a) < (b)) ? (a) : (b))
122#define TEXT(quote) L##quote
125DWORD GetFileAttributes(
wchar_t *path);
126int GetTimeFormat(LCID Locale,
128 const SYSTEMTIME *lpTime,
132int GetDateFormat(LCID Locale,
134 const SYSTEMTIME *lpDate,
138bool CreatePipe(PHANDLE hReadPipe,
140 LPSECURITY_ATTRIBUTES lpPipeAttributes,
142bool CloseHandle(HANDLE hObject);
143DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
144bool PeekNamedPipe(HANDLE hNamedPipe,
148 LPDWORD lpTotalBytesAvail,
149 LPDWORD lpBytesLeftThisMessage);
150bool ReadFile(HANDLE hFile,
152 DWORD nNumberOfBytesToRead,
153 LPDWORD lpNumberOfBytesRead,
154 LPOVERLAPPED lpOverlapped);
155int MultiByteToWideChar(UINT CodePage,
157 LPCCH lpMultiByteStr,
159 LPWSTR lpWideCharStr,
161int WideCharToMultiByte(UINT CodePage,
163 LPCWCH lpWideCharStr,
165 LPSTR lpMultiByteStr,
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,
177 LPCWSTR lpCurrentDirectory,
178 LPSTARTUPINFO lpStartupInfo,
179 LPPROCESS_INFORMATION lpProcessInformation);
180bool WriteFile(HANDLE hFile,
182 DWORD nNumberOfBytesToWrite,
183 LPDWORD lpNumberOfBytesWritten,
184 LPOVERLAPPED lpOverlapped);
185LSTATUS RegEnumValue(HKEY hKey,
188 LPDWORD lpcchValueName,
194bool CreateDirectory(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
195bool PathAppend(LPWSTR pszPath, LPCWSTR pszMore);
196HANDLE GetStdHandle(DWORD nStdHandle);
198RegOpenKeyEx(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
199LSTATUS RegEnumKeyEx(HKEY hKey,
206 PFILETIME lpftLastWriteTime);
207LSTATUS RegCloseKey(HKEY hKey);
208HANDLE CreateFile(LPCWSTR lpFileName,
209 DWORD dwDesiredAccess,
211 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
212 DWORD dwCreationDisposition,
213 DWORD dwFlagsAndAttributes,
214 HANDLE hTemplateFile);
215LSTATUS RegQueryInfoKey(HKEY hKey,
220 LPDWORD lpcbMaxSubKeyLen,
221 LPDWORD lpcbMaxClassLen,
223 LPDWORD lpcbMaxValueNameLen,
224 LPDWORD lpcbMaxValueLen,
225 LPDWORD lpcbSecurityDescriptor,
226 PFILETIME lpftLastWriteTime);
227LSTATUS RegQueryValueEx(HKEY hKey,
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,
247bool GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode);