struct _RTL_CRITICAL_SECTION; typedef int BOOL; typedef unsigned char BYTE; typedef char CHAR; typedef unsigned long DWORD; typedef __stdcall int (*FARPROC)(); typedef void *HANDLE; struct HINSTANCE__ { int unused; }; struct HRSRC__ { int unused; }; typedef long LONG; typedef __int64 LONGLONG; typedef const void *LPCVOID; typedef void *LPVOID; typedef void *PVOID; struct SC_HANDLE__ { int unused; }; typedef short SHORT; typedef unsigned int UINT; typedef unsigned long ULONG_PTR; typedef unsigned short WORD; struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; struct _LIST_ENTRY *Blink; }; typedef unsigned short wchar_t; __stdcall BOOL CloseHandle __attribute__((dllimport))(HANDLE hObject); __stdcall PVOID DecodePointer __attribute__((dllimport))(PVOID Ptr); __stdcall PVOID EncodePointer __attribute__((dllimport))(PVOID Ptr); __stdcall void ExitProcess __attribute__((dllimport)) __attribute__((noreturn))(UINT uExitCode); __stdcall BOOL FlushFileBuffers __attribute__((dllimport))(HANDLE hFile); __stdcall UINT GetACP __attribute__((dllimport))(void); __stdcall UINT GetConsoleCP __attribute__((dllimport))(void); __stdcall UINT GetConsoleOutputCP __attribute__((dllimport))(void); __stdcall HANDLE GetCurrentProcess __attribute__((dllimport))(void); __stdcall DWORD GetCurrentProcessId __attribute__((dllimport))(void); __stdcall DWORD GetCurrentThreadId __attribute__((dllimport))(void); __stdcall DWORD GetFileType __attribute__((dllimport))(HANDLE hFile); __stdcall DWORD GetLastError __attribute__((dllimport))(void); __stdcall UINT GetOEMCP __attribute__((dllimport))(void); __stdcall HANDLE GetProcessHeap __attribute__((dllimport))(void); __stdcall HANDLE GetStdHandle __attribute__((dllimport))(DWORD nStdHandle); __stdcall DWORD GetTickCount __attribute__((dllimport))(void); typedef HANDLE HGLOBAL; typedef struct HINSTANCE__ *HINSTANCE; typedef struct HRSRC__ *HRSRC; __stdcall BOOL HeapDestroy __attribute__((dllimport))(HANDLE hHeap); __stdcall BOOL HeapFree __attribute__((dllimport))(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem); __stdcall LONG InterlockedDecrement __attribute__((dllimport))(volatile LONG *lpAddend); __stdcall LONG InterlockedIncrement __attribute__((dllimport))(volatile LONG *lpAddend); __stdcall BOOL IsDebuggerPresent __attribute__((dllimport))(void); typedef DWORD LCID; typedef DWORD LCTYPE; typedef struct _LIST_ENTRY LIST_ENTRY; typedef BOOL *LPBOOL; typedef BYTE *LPBYTE; typedef CHAR *LPCH; typedef const CHAR *LPCSTR; typedef DWORD *LPDWORD; typedef CHAR *LPSTR; typedef WORD *LPWORD; typedef LONG *PLONG; typedef struct SC_HANDLE__ *SC_HANDLE; typedef ULONG_PTR SIZE_T; __stdcall UINT SetHandleCount __attribute__((dllimport))(UINT uNumber); __stdcall void SetLastError __attribute__((dllimport))(DWORD dwErrCode); __stdcall BOOL SetStdHandle __attribute__((dllimport))(DWORD nStdHandle, HANDLE hHandle); __stdcall void Sleep __attribute__((dllimport))(DWORD dwMilliseconds); __stdcall BOOL TerminateProcess __attribute__((dllimport))(HANDLE hProcess, UINT uExitCode); __stdcall DWORD TlsAlloc __attribute__((dllimport))(void); __stdcall BOOL TlsFree __attribute__((dllimport))(DWORD dwTlsIndex); __stdcall LPVOID TlsGetValue __attribute__((dllimport))(DWORD dwTlsIndex); __stdcall BOOL TlsSetValue __attribute__((dllimport))(DWORD dwTlsIndex, LPVOID lpTlsValue); typedef wchar_t WCHAR; struct _COORD { SHORT X; SHORT Y; }; struct _EXCEPTION_RECORD { DWORD ExceptionCode; DWORD ExceptionFlags; struct _EXCEPTION_RECORD *ExceptionRecord; PVOID ExceptionAddress; DWORD NumberParameters; ULONG_PTR ExceptionInformation[15]; } __attribute__((pack(8))); struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; }; struct _FLOATING_SAVE_AREA { DWORD ControlWord; DWORD StatusWord; DWORD TagWord; DWORD ErrorOffset; DWORD ErrorSelector; DWORD DataOffset; DWORD DataSelector; BYTE RegisterArea[80]; DWORD Cr0NpxState; }; union _LARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; }; struct { DWORD LowPart; LONG HighPart; } u; LONGLONG QuadPart; }; struct _OSVERSIONINFOA { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[128]; }; struct _OVERLAPPED { ULONG_PTR Internal; ULONG_PTR InternalHigh; union { struct { DWORD Offset; DWORD OffsetHigh; }; PVOID Pointer; }; HANDLE hEvent; }; struct _SECURITY_ATTRIBUTES { DWORD nLength; LPVOID lpSecurityDescriptor; BOOL bInheritHandle; }; struct _SERVICE_STATUS { DWORD dwServiceType; DWORD dwCurrentState; DWORD dwControlsAccepted; DWORD dwWin32ExitCode; DWORD dwServiceSpecificExitCode; DWORD dwCheckPoint; DWORD dwWaitHint; }; struct _SMALL_RECT { SHORT Left; SHORT Top; SHORT Right; SHORT Bottom; }; struct _cpinfo { UINT MaxCharSize; BYTE DefaultChar[2]; BYTE LeadByte[12]; }; typedef struct _COORD COORD; __stdcall BOOL CloseServiceHandle __attribute__((dllimport))(SC_HANDLE hSCObject); __stdcall SC_HANDLE CreateServiceA __attribute__((dllimport))(SC_HANDLE hSCManager, LPCSTR lpServiceName, LPCSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCSTR lpBinaryPathName, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpPassword); __stdcall BOOL DeleteFileA __attribute__((dllimport))(LPCSTR lpFileName); __stdcall BOOL DeleteService __attribute__((dllimport))(SC_HANDLE hService); typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD; typedef struct _FLOATING_SAVE_AREA FLOATING_SAVE_AREA; __stdcall BOOL FreeEnvironmentStringsA __attribute__((dllimport))(LPCH); __stdcall BOOL FreeResource __attribute__((dllimport))(HGLOBAL hResData); __stdcall LPSTR GetCommandLineA __attribute__((dllimport))(void); __stdcall BOOL GetConsoleMode __attribute__((dllimport))(HANDLE hConsoleHandle, LPDWORD lpMode); __stdcall LPCH GetEnvironmentStrings __attribute__((dllimport))(void); __stdcall int GetLocaleInfoA __attribute__((dllimport))(LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData); __stdcall BOOL GetStringTypeA __attribute__((dllimport))(LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType); __stdcall UINT GetTempFileNameA __attribute__((dllimport))(LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName); __stdcall DWORD GetTempPathA __attribute__((dllimport))(DWORD nBufferLength, LPSTR lpBuffer); typedef HINSTANCE HMODULE; __stdcall LPVOID HeapAlloc __attribute__((dllimport))(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes); __stdcall HANDLE HeapCreate __attribute__((dllimport))(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize); __stdcall LPVOID HeapReAlloc __attribute__((dllimport))(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes); __stdcall SIZE_T HeapSize __attribute__((dllimport))(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem); typedef union _LARGE_INTEGER LARGE_INTEGER; __stdcall int LCMapStringA __attribute__((dllimport))(LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest); typedef struct _cpinfo *LPCPINFO; typedef const WCHAR *LPCWSTR; typedef struct _FILETIME *LPFILETIME; typedef struct _OSVERSIONINFOA *LPOSVERSIONINFOA; typedef struct _OVERLAPPED *LPOVERLAPPED; typedef struct _SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES; typedef struct _SERVICE_STATUS *LPSERVICE_STATUS; typedef WCHAR *LPWCH; typedef WCHAR *LPWSTR; __stdcall LPVOID LockResource __attribute__((dllimport))(HGLOBAL hResData); __stdcall SC_HANDLE OpenSCManagerA __attribute__((dllimport))(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess); __stdcall SC_HANDLE OpenServiceA __attribute__((dllimport))(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess); typedef struct _SMALL_RECT SMALL_RECT; __stdcall DWORD SetFilePointer __attribute__((dllimport))(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod); __stdcall BOOL StartServiceA __attribute__((dllimport))(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCSTR *lpServiceArgVectors); __stdcall LPVOID VirtualAlloc __attribute__((dllimport))(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect); __stdcall BOOL VirtualFree __attribute__((dllimport))(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType); __stdcall BOOL WriteConsoleA __attribute__((dllimport))(HANDLE hConsoleOutput, const void *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved); __stdcall BOOL WriteConsoleW __attribute__((dllimport))(HANDLE hConsoleOutput, const void *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved); struct _RTL_CRITICAL_SECTION_DEBUG { WORD Type; WORD CreatorBackTraceIndex; struct _RTL_CRITICAL_SECTION *CriticalSection; LIST_ENTRY ProcessLocksList; DWORD EntryCount; DWORD ContentionCount; DWORD Spare[2]; }; struct _STARTUPINFOA { DWORD cb; LPSTR lpReserved; LPSTR lpDesktop; LPSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; LPBYTE lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; }; __stdcall BOOL ControlService __attribute__((dllimport))(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus); __stdcall HANDLE CreateFileA __attribute__((dllimport))(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); __stdcall BOOL DeviceIoControl __attribute__((dllimport))(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); __stdcall BOOL FillConsoleOutputCharacterA __attribute__((dllimport))(HANDLE hConsoleOutput, CHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten); __stdcall HRSRC FindResourceA __attribute__((dllimport))(HMODULE hModule, LPCSTR lpName, LPCSTR lpType); __stdcall BOOL FreeEnvironmentStringsW __attribute__((dllimport))(LPWCH); __stdcall BOOL GetCPInfo __attribute__((dllimport))(UINT CodePage, LPCPINFO lpCPInfo); __stdcall LPWCH GetEnvironmentStringsW __attribute__((dllimport))(void); __stdcall DWORD GetModuleFileNameA __attribute__((dllimport))(HMODULE hModule, LPCH lpFilename, DWORD nSize); __stdcall HMODULE GetModuleHandleA __attribute__((dllimport))(LPCSTR lpModuleName); __stdcall FARPROC GetProcAddress __attribute__((dllimport))(HMODULE hModule, LPCSTR lpProcName); __stdcall BOOL GetStringTypeW __attribute__((dllimport))(DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType); __stdcall void GetSystemTimeAsFileTime __attribute__((dllimport))(LPFILETIME lpSystemTimeAsFileTime); __stdcall BOOL GetVersionExA __attribute__((dllimport))(LPOSVERSIONINFOA lpVersionInformation); __stdcall int LCMapStringW __attribute__((dllimport))(LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest); typedef struct _STARTUPINFOA *LPSTARTUPINFOA; __stdcall HMODULE LoadLibraryA __attribute__((dllimport))(LPCSTR lpLibFileName); __stdcall HGLOBAL LoadResource __attribute__((dllimport))(HMODULE hModule, HRSRC hResInfo); __stdcall int MultiByteToWideChar __attribute__((dllimport))(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar); typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; typedef struct _RTL_CRITICAL_SECTION_DEBUG *PRTL_CRITICAL_SECTION_DEBUG; __stdcall BOOL QueryPerformanceCounter __attribute__((dllimport))(LARGE_INTEGER *lpPerformanceCount); __stdcall BOOL ReadFile __attribute__((dllimport))(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); __stdcall BOOL SetConsoleCursorPosition __attribute__((dllimport))(HANDLE hConsoleOutput, COORD dwCursorPosition); __stdcall DWORD SizeofResource __attribute__((dllimport))(HMODULE hModule, HRSRC hResInfo); __stdcall int WideCharToMultiByte __attribute__((dllimport))(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar); __stdcall BOOL WriteFile __attribute__((dllimport))(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped); struct _CONSOLE_SCREEN_BUFFER_INFO { COORD dwSize; COORD dwCursorPosition; WORD wAttributes; SMALL_RECT srWindow; COORD dwMaximumWindowSize; }; struct _CONTEXT { DWORD ContextFlags; DWORD Dr0; DWORD Dr1; DWORD Dr2; DWORD Dr3; DWORD Dr6; DWORD Dr7; FLOATING_SAVE_AREA FloatSave; DWORD SegGs; DWORD SegFs; DWORD SegEs; DWORD SegDs; DWORD Edi; DWORD Esi; DWORD Ebx; DWORD Edx; DWORD Ecx; DWORD Eax; DWORD Ebp; DWORD Eip; DWORD SegCs; DWORD EFlags; DWORD Esp; DWORD SegSs; BYTE ExtendedRegisters[512]; } __attribute__((pack(8))); typedef struct _CONTEXT CONTEXT; __stdcall void GetStartupInfoA __attribute__((dllimport))(LPSTARTUPINFOA lpStartupInfo); typedef struct _CONSOLE_SCREEN_BUFFER_INFO *PCONSOLE_SCREEN_BUFFER_INFO; void RtlUnwind(PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue); struct _RTL_CRITICAL_SECTION { PRTL_CRITICAL_SECTION_DEBUG DebugInfo; LONG LockCount; LONG RecursionCount; HANDLE OwningThread; HANDLE LockSemaphore; ULONG_PTR SpinCount; }; __stdcall BOOL GetConsoleScreenBufferInfo __attribute__((dllimport))(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); typedef CONTEXT *PCONTEXT; typedef struct _RTL_CRITICAL_SECTION *PRTL_CRITICAL_SECTION; typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION; struct _EXCEPTION_POINTERS { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT ContextRecord; }; __stdcall void DeleteCriticalSection __attribute__((dllimport))(LPCRITICAL_SECTION lpCriticalSection); __stdcall void EnterCriticalSection __attribute__((dllimport))(LPCRITICAL_SECTION lpCriticalSection); __stdcall void InitializeCriticalSection __attribute__((dllimport))(LPCRITICAL_SECTION lpCriticalSection); __stdcall BOOL InitializeCriticalSectionAndSpinCount __attribute__((dllimport))(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount); __stdcall void LeaveCriticalSection __attribute__((dllimport))(LPCRITICAL_SECTION lpCriticalSection); typedef __stdcall LONG (*PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *ExceptionInfo); __stdcall LONG UnhandledExceptionFilter __attribute__((dllimport))(struct _EXCEPTION_POINTERS *ExceptionInfo); typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; __stdcall LPTOP_LEVEL_EXCEPTION_FILTER SetUnhandledExceptionFilter __attribute__((dllimport))(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); __stdcall void CorExitProcess(int) __attribute__((noreturn));