Results 1 to 5 of 5
  1. #1
    neononxxx's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    why do you wanna know?? so you can kill me?
    Posts
    1,227
    Reputation
    36
    Thanks
    341
    My Mood
    Goofy

    [Source] HSupdate

    De-compiled HSupdate.exe.
    Totally mine, and up to date.
    Did this today.
    This is only part of it.You can DL the whole thing when i put up the attachment.
    Code:
    */
    
    
    */
    
    #include <defs.h>
    
    #include <stdarg.h>
    
    
    //-------------------------------------------------------------------------
    // Data declarations
    extern _UNKNOWN loc_4032A8; // weak
    extern int (__cdecl *wsprintfA)(_DWORD, _DWORD, _DWORD, _DWORD); // weak
    extern int (__thiscall *off_41526C)(LPVOID lpMem, char); // weak
    extern int (__thiscall *off_4152E0)(LPVOID lpMem, char); // weak
    extern _UNKNOWN unk_4152E8; // weak
    extern _UNKNOWN unk_4152F8; // weak
    extern _UNKNOWN unk_415308; // weak
    extern _UNKNOWN unk_415328; // weak
    extern _UNKNOWN unk_415358; // weak
    extern char aGlobal[8]; // weak
    extern char aAhnlabsupdatea[44]; // weak
    extern _UNKNOWN unk_4153C8; // weak
    extern _UNKNOWN unk_4153D8; // weak
    extern _UNKNOWN unk_4153E8; // weak
    extern int (__thiscall *off_415408)(LPVOID lpMem, char); // weak
    extern char Str1[]; // idb
    extern char Name[]; // idb
    extern _UNKNOWN unk_4154B0; // weak
    extern char SubBlock[]; // idb
    extern char aExecute[]; // idb
    extern char aUpdatefiletype[]; // idb
    extern char ValueName[]; // idb
    extern char aTemporarysetti[]; // idb
    extern char SubKey[]; // idb
    extern int dword_4170AC; // weak
    extern char aAb649b064e5243[]; // idb
    extern char a9d7efed4Df344b[]; // idb
    extern char aFd82e3da8e4843[]; // idb
    extern char a3e14efc2Cf3c4e[]; // idb
    extern char a1a7e24ed52a447[]; // idb
    extern char a9dcbd79b95494d[]; // idb
    extern char a385a998e5cb24c[]; // idb
    extern char aSupdate[10]; // weak
    extern char aDe30886dAbb64b[]; // idb
    extern char aV3ine***_dll[13]; // weak
    extern char aAhnupgs_dll[12]; // weak
    extern char a9a6ed342Bbae4f[]; // idb
    extern char aHsupdate_exe[13]; // weak
    extern char a8d70560f1e7146[]; // idb
    extern char aFedeba5c59b04b[]; // idb
    extern char aGlobalC886b01d[]; // idb
    extern char aSS[]; // idb
    extern char aHsupdate_env[13]; // weak
    extern char aTimeout[]; // idb
    extern char aLl[3]; // weak
    extern char aBc89c1b3227946[]; // idb
    extern char aErrorUnknownAr[]; // idb
    extern char aDD[5]; // weak
    extern char aDf3329ce4bbb4e[]; // idb
    extern char aBb898529175a49[]; // idb
    extern char a4b6e8c596cbf40[]; // idb
    extern char a7bb92fa9Be594e[]; // idb
    extern char aEe2906d1F13c4c[]; // idb
    extern char a28f7db7687354c[]; // idb
    extern char aHsupdate_timeo[]; // idb
    extern char aD9eeb3fe3c1744[]; // idb
    extern char a67d1c48d5edd4c[]; // idb
    extern char a0c77ed694a6f4f[]; // idb
    extern char a1e3c30fdDb1641[]; // idb
    extern char a7f60374cD6b747[]; // idb
    extern char a7086c03aEa6b4c[]; // idb
    extern char a23aba781151d4d[]; // idb
    extern char aDfd25cddA3554a[]; // idb
    extern char a7bdcc6983c8e43[]; // idb
    extern char aE283ce2382704d[]; // idb
    extern char a8d0b444dD1464b[]; // idb
    extern char aCb0a8181E81e42[]; // idb
    extern char aHttpSDS[]; // idb
    extern char a_ftpuserpass[]; // idb
    extern char a_ftpuserid[]; // idb
    extern char a_protocol[]; // idb
    extern char a_server[]; // idb
    extern char a_ahnproductid[]; // idb
    extern char a_port[]; // idb
    extern wchar_t asc_4177A8[2]; // weak
    extern char a_address[]; // idb
    extern char aSD[5]; // weak
    extern char Caption[]; // idb
    extern char a0x8_8x[]; // idb
    extern char aA1c3450aD2e34a[]; // idb
    extern char ClassName[]; // idb
    extern char aE93e9763458948[]; // idb
    extern char a7a59f36101064f[]; // idb
    extern char aAa129829F28f42[]; // idb
    extern char aE740187e02ff4a[39]; // weak
    extern char aA381684415ce42[39]; // weak
    extern char a47a8e9568fb24c[]; // idb
    extern char a0a1984d05a9043[]; // idb
    extern char aFb1e371348ce4a[]; // idb
    extern char aS[]; // idb
    extern char asc_417A04[3]; // weak
    extern char a42cab631Afde40[42]; // weak
    extern char a1626b473Fd1e40[]; // idb
    extern char aF3c766abB02046[]; // idb
    extern char aQwhuvxbfrg9jda[17]; // weak
    extern char aQwhudxbhuy5kbg[17]; // weak
    extern char aGlobalEf81ba4b[]; // idb
    extern char aD_D_D_D[]; // idb
    extern char LibFileName[]; // idb
    extern char Mode[]; // idb
    extern char aWb[3]; // weak
    extern char aSS_0[]; // idb
    extern char aSupdate_log[12]; // weak
    extern char Format[]; // idb
    extern char aD8212412931247[]; // idb
    extern char a5069fb05A9ad_0[]; // idb
    extern char a5069fb05A9ad4a[]; // idb
    extern char aAdd40f2bD435_0[]; // idb
    extern char aAdd40f2bD43543[]; // idb
    extern char aStart04d02d02d[]; // idb
    extern char asc_417E38[]; // idb
    extern char aOsr2[]; // idb
    extern char aWindows95[]; // idb
    extern char aWindowsMeOrLat[]; // idb
    extern char aWindowsMe[]; // idb
    extern char aSe[]; // idb
    extern char aWindows98[]; // idb
    extern char aX86[7]; // weak
    extern char aIa64[8]; // weak
    extern char aX64[7]; // weak
    extern char aSSD_D_D[]; // idb
    extern char aProcessor0xX[]; // idb
    extern char aKernel32_dll_1[]; // idb
    extern char aGetnativesyste[]; // idb
    extern char aAdvancedServer[]; // idb
    extern char aServernt[]; // idb
    extern char aLanmannt[]; // idb
    extern char Str2[]; // idb
    extern char phkResult[]; // idb
    extern char aProducttype[]; // idb
    extern char aStandardEditio[18]; // weak
    extern char aWebEdition[13]; // weak
    extern char aEnterpriseEdit[20]; // weak
    extern char aDatacenterEdit[20]; // weak
    extern char aServer[8]; // weak
    extern char aDatacenterServ[19]; // weak
    extern char aServer4_0[12]; // weak
    extern char aServer4_0Enter[32]; // weak
    extern char aHomeEdition[14]; // weak
    extern char aEmbedded[10]; // weak
    extern char aStarterEdition[17]; // weak
    extern char aTabletPcEditio[19]; // weak
    extern char aMediaCenterEdi[22]; // weak
    extern char aProfessional[14]; // weak
    extern char aWorkstation4_0[17]; // weak
    extern char aUnlicensed[14]; // weak
    extern char aUnknownEdition[]; // idb
    extern char aEnterpriseWi_0[35]; // weak
    extern char aDatacenterWi_0[35]; // weak
    extern char aStandardWith_0[33]; // weak
    extern char aEnterpriseWith[28]; // weak
    extern char aStandardWithou[26]; // weak
    extern char aWindowsEssen_1[51]; // weak
    extern char aWindowsEssen_0[52]; // weak
    extern char aDatacenterWith[28]; // weak
    extern char aWindowsEssenti[53]; // weak
    extern char aWebServerCore[19]; // weak
    extern char aUltimateN[12]; // weak
    extern char aStorageServerW[26]; // weak
    extern char aStorageServerS[25]; // weak
    extern char aStorageServe_0[27]; // weak
    extern char aSmallBusines_0[31]; // weak
    extern char aServerForSmall[27]; // weak
    extern char aHomePremiumN[16]; // weak
    extern char aEnterpriseN[14]; // weak
    extern char aStorageServerE[24]; // weak
    extern char aUnknownProduct[19]; // weak
    extern char aWebServer[12]; // weak
    extern char aUltimate[10]; // weak
    extern char aStarter[9]; // weak
    extern char aStandardCore[17]; // weak
    extern char aStandard[10]; // weak
    extern char aSmallBusinessS[23]; // weak
    extern char aHomeServer[13]; // weak
    extern char aHomePremium[14]; // weak
    extern char aHomeBasicN[14]; // weak
    extern char aHomeBasic[12]; // weak
    extern char aEnterpriseForI[21]; // weak
    extern char aEnterpriseCore[19]; // weak
    extern char aEnterprise[12]; // weak
    extern char aDatacenterCore[19]; // weak
    extern char aDatacenter[12]; // weak
    extern char aClusterServer[16]; // weak
    extern char aBusinessN[12]; // weak
    extern char aBusiness[10]; // weak
    extern char ModuleName[]; // idb
    extern char ProcName[]; // idb
    extern char String2[]; // idb
    extern char aWindows7OrLate[20]; // weak
    extern char aWindowsServe_2[24]; // weak
    extern char aWindows7[11]; // weak
    extern char aWindowsServe_1[21]; // weak
    extern char aWindowsVista[15]; // weak
    extern char aWindowsServe_0[21]; // weak
    extern char aWindowsServer2[24]; // weak
    extern char aWindowsXp[12]; // weak
    extern char aWindows_net[14]; // weak
    extern char aWindows2000[14]; // weak
    extern char aWindowsNtD_D[]; // idb
    extern char aPlatformidD[]; // idb
    extern char aSoftwareMicros[]; // idb
    extern char aVersion[]; // idb
    extern char aSSAdministrato[]; // idb
    extern char aNo[3]; // weak
    extern char aYes[4]; // weak
    extern char a_2fgb[]; // idb
    extern char aUmb[]; // idb
    extern char aSSS[]; // idb
    extern char aGetdiskfreespa[]; // idb
    extern char aIswow64message[]; // idb
    extern char aGetsystemwow64[]; // idb
    extern char aWow64enablewow[]; // idb
    extern char aIswow64process[]; // idb
    extern char aUser32_dll_1[]; // idb
    extern char aKernel32_dll_0[]; // idb
    extern int dword_418680; // weak
    extern void *off_4186B8; // weak
    extern LPVOID off_4186BC; // idb
    extern int dword_4186C8; // weak
    extern void **off_41A6D8; // weak
    extern int dword_41A6DC; // weak
    extern int (__cdecl *off_41A6F4)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
    extern _UNKNOWN unk_41AF48; // weak
    extern _UNKNOWN unk_41AF60; // weak
    extern const CHAR byte_41B360; // idb
    extern _UNKNOWN unk_41B364; // weak
    extern int dword_41B384; // weak
    extern int dword_41B388; // weak
    extern HWND dword_41B38C; // idb
    extern int dword_41B390; // weak
    extern int dword_41B5E0; // weak
    extern HWND hWnd; // idb
    extern HINSTANCE hInstance; // idb
    extern int dword_41B5F4; // weak
    extern int dword_41B5F8; // weak
    extern int dword_41B604; // weak
    extern char arglist[]; // idb
    extern HMODULE hModule; // idb
    extern int dword_41B610; // weak
    extern int dword_41B614; // weak
    extern int dword_41B618; // weak
    extern int dword_41B61C; // weak
    extern int dword_41B620; // weak
    extern int dword_41B624; // weak
    extern int dword_41B628; // weak
    extern char String[]; // idb
    extern int dword_41B754; // weak
    extern int dword_41B758; // weak
    extern int dword_41B79C; // weak
    extern int dword_41B7A0; // weak
    extern int dword_41CD8C; // weak
    extern int dword_41CD90; // weak
    extern void *Dst; // idb
    extern int dword_41CD9C; // weak
    extern LPVOID lpMem; // idb
    extern int dword_41CDA4; // weak
    extern HANDLE hHeap; // idb
    extern int dword_41CDAC; // weak
    
    //-------------------------------------------------------------------------
    // Function declarations
    
    #define __thiscall __cdecl // Test compile in C mode
    
    void *__thiscall sub_401000(void *this);
    int __thiscall sub_401010(int lpMem, char a2);
    void __thiscall sub_401030(void *this);
    void *__cdecl sub_401210(int a1);
    char __cdecl sub_401400(signed int a1);
    int __cdecl sub_401450(char a1);
    void *__cdecl sub_4014A0();
    void __cdecl sub_4014C0(int *lpMem);
    void *__cdecl sub_4014F0(const void *a1, int a2);
    int __thiscall sub_4016A0(void *this, HKEY cbData, LPCSTR phkResult, LPCSTR lpValueName, int a5);
    int __cdecl sub_4018F0(int, HKEY cchName, DWORD dwIndex, int); // idb
    const CHAR *__cdecl sub_401A00(HKEY cchName, LSTATUS lpString2);
    int __thiscall sub_401CF0(int this);
    int __thiscall sub_401D00(int this, LPCSTR lpString2, int a3);
    int __thiscall sub_401D30(int this, int a2);
    int __thiscall sub_401D80(_DWORD); // weak
    int __thiscall sub_401D90(int this);
    int __thiscall sub_401DA0(int this, LPCSTR lpString2, int a3);
    LPCSTR __thiscall sub_401E00(int this, int a2);
    int __thiscall sub_401E90(LPCSTR *this);
    void __thiscall sub_401EB0(int this, LPCSTR lpString2);
    int __thiscall sub_4020E0(void *this, UINT uID, HINSTANCE hInstance);
    _DWORD sub_4021D0(_DWORD arg0, UINT uID, HINSTANCE hInstance, ...);
    int __thiscall sub_4022A0(int this);
    char __thiscall sub_4022D0(int this, int a2);
    int __thiscall sub_402310(void *this);
    int __thiscall sub_4027A0(void *this, int a2);
    int __thiscall sub_4027F0(int this, LPCSTR lpString2);
    int __thiscall sub_402BA0(int this);
    int __thiscall nullsub_1(_DWORD); // weak
    int __thiscall sub_402BC0(int this);
    LSTATUS __thiscall sub_402BF0(void *lpData);
    int loc_402E80(); // weak
    LSTATUS __thiscall sub_402EA0(void *this);
    signed int __cdecl sub_402EC0(signed int a1, int a2);
    signed int __cdecl sub_402FC0(int a1);
    void __stdcall sub_4030D0(int a1);
    signed int __cdecl StartAddress(int a1);
    int __thiscall sub_4033B0(int lpMem, char a2);
    void __thiscall sub_4033D0(void *this);
    signed int __thiscall sub_4033E0(int this, int a2, int a3, HWND a4, int a5);
    void __thiscall sub_403840(void *this);
    LRESULT __thiscall sub_4038C0(int this, LRESULT a2, WPARAM wParam, LPARAM lParam);
    __int16 __thiscall sub_4038F0(void *this);
    // DWORD __usercall sub_403AB0<eax>(LPVOID lpParameter<ecx>, int a2<eax>);
    // signed int __userpurge sub_403CC0<eax>(int a1<eax>, int a2<ecx>, int a3);
    // signed int __usercall sub_404380<eax>(int a1<eax>, LPCSTR lpFileName, int a3, int a4, int a5, int a6);
    // int __usercall sub_4052CC<eax>(int a1<esi>);
    int __cdecl sub_405300(HANDLE hFile, int, int, char); // idb
    int __cdecl sub_405410(HANDLE hObject, int, int, char); // idb
    int __cdecl sub_405530(HANDLE hObject, __int32 Value, char); // idb
    int __cdecl sub_405650(HANDLE hFile, int, char); // idb
    // signed int __usercall sub_405770<eax>(int a1<eax>, LPCSTR lptstrFilename, int a3, int a4);
    // void __usercall sub_40583C(void *a1<esi>);
    int __cdecl sub_405860(HANDLE hFile); // idb
    // int __usercall sub_405B6F<eax>(int a1<esi>);
    // int __usercall sub_405EA7<eax>(int a1<esi>);
    // signed int __usercall sub_405ED0<eax>(int a1<eax>, LPCSTR lpFileName, int a3);
    // int __usercall sub_406232<eax>(int a1<esi>);
    signed int sub_406340(char *Dest, unsigned int a2, const char *Format, ...);
    int __cdecl sub_406710(HWND hWnd, UINT uID, int Args);
    int __stdcall sub_4067F0(int, int, int, int); // weak
    int __cdecl sub_406AA0(HINSTANCE hInstance); // idb
    HWND __cdecl sub_406B30(HINSTANCE hInstance);
    int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
    signed int __cdecl sub_4070A0(int a1);
    int __cdecl sub_407110(LPCSTR Str1, LPSTR lpString1, int); // idb
    signed int __cdecl sub_407200(char *a1, unsigned int a2, int a3);
    BOOL __cdecl sub_407310(HWND a1, HWND hWnd);
    signed int __cdecl sub_4074A0(const void *a1, char *Dest);
    // int __usercall sub_407590<eax>(int a1<eax>, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15);
    DWORD __cdecl sub_407A60();
    // DWORD __usercall sub_407AA0<eax>(int a1<eax>, LPCSTR lptstrFilename, char *Dest, unsigned int a4);
    // void __usercall sub_407C11(void *a1<ebx>);
    int __cdecl sub_407C30(int a1);
    int __cdecl sub_407C60(int a1, int a2);
    HMODULE __cdecl sub_407CB0();
    BOOL __cdecl sub_407D90();
    signed int __cdecl sub_407DE0(void *a1, unsigned int a2, int a3, int a4, int a5);
    LPCSTR sub_407EE0(char a1, LPCSTR a2, ...);
    LPCSTR __cdecl sub_4080D0();
    int __cdecl sub_4081F0(_DWORD, _DWORD, _DWORD); // weak
    int __cdecl sub_408200(LPCSTR lpString2); // idb
    int __cdecl sub_4082F0(LPSTR lpString1, CHAR *a2);
    int __cdecl sub_408CF0(LPBYTE lpData); // idb
    int __cdecl sub_408E80(LPSTR lpString1); // idb
    int __cdecl sub_408F60(HKEY Type, LPCSTR phkResult, LPCSTR lpValueName, LPBYTE lpData); // idb
    int __cdecl sub_408FE0(TOKEN_INFORMATION_CLASS TokenInformationClass); // idb
    void __cdecl sub_4090B0(int lpMem);
    int __cdecl sub_4090C0(LPSTR lpString1); // idb
    int __cdecl sub_409130(PSID Sid, LPSTR lpString1); // idb
    int __cdecl sub_409290();
    int __cdecl sub_409350(__int64, char *Dest); // idb
    int __cdecl sub_4093B0(unsigned int a1, char *Dest);
    int __cdecl sub_409410(int, LPSTR lpString1); // idb
    int __cdecl sub_4095F0();
    int __thiscall sub_409640(int lpMem, char a2);
    int __thiscall sub_409660(int this);
    int __thiscall sub_4096A0(int this);
    int __thiscall sub_409730(int this);
    signed int __thiscall sub_4097B0(int this);
    signed int __thiscall sub_4097E0(int this);
    int __thiscall sub_409870(int this, int a2);
    BOOL __stdcall j_VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen);
    BOOL __stdcall j_GetFileVersionInfoA(LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData);
    DWORD __stdcall j_GetFileVersionInfoSizeA(LPCSTR lptstrFilename, LPDWORD lpdwHandle);
    void __cdecl sub_409AB2(int lpMem);
    void *__cdecl sub_409ABD(size_t Size, int a2);
    void __cdecl sub_409B6E(int lpMem);
    // int __cdecl __CxxFrameHandler(struct _s_HandlerType *, struct EHRegistrationNode *, int, int); idb
    int __cdecl sub_409FCA(int a1);
    // int __cdecl _vsnprintf(char *Dest, size_t Count, const char *Format, va_list Args);
    // int __cdecl _strnicmp(const char *Str1, const char *Str2, size_t MaxCount);
    // _DWORD __cdecl _mbspbrk(_DWORD, _DWORD); weak
    int __cdecl sub_40A2B2(int a1);
    // int __cdecl rand();
    // void *__cdecl malloc(size_t Size);
    // _DWORD __cdecl _nh_malloc(_DWORD, _DWORD); weak
    LPVOID __cdecl sub_40A318(unsigned int a1);
    // __int32 __cdecl atol(const char *Str);
    // int __cdecl atoi(const char *Str);
    // int __cdecl unknown_libname_5(int, int, int); weak
    // int sprintf(char *Dest, const char *Format, ...);
    // char *__cdecl strchr(const char *Str, int Val);
    // int __cdecl strncmp(const char *Str1, const char *Str2, size_t MaxCount);
    // int __cdecl _mbsnbicmp(char *Str1, char *Str2, size_t MaxCount); idb
    // void __cdecl _splitpath(const char *FullPath, char *Drive, char *Dir, char *Filename, char *Ext);
    // int __cdecl _mbsnbcpy(char *Dest, char *Source, size_t Count); idb
    // int __cdecl fclose(FILE *File);
    // size_t __cdecl fwrite(const void *Str, size_t Size, size_t Count, FILE *File);
    // FILE *__cdecl fopen(const char *Filename, const char *Mode);
    // char *__cdecl _strtime(char *Buffer);
    // char *__cdecl _strdate(char *Buffer);
    // void *__cdecl memset(void *Dst, int Val, size_t Size);
    // _DWORD __cdecl _callnewh(_DWORD); weak
    char __cdecl sub_40B129(int a1);
    __int32 __cdecl sub_40B156();
    signed int __cdecl sub_40B29E(int a1);
    // _DWORD __cdecl __sbh_heap_init(_DWORD); weak
    // _DWORD __cdecl __sbh_find_block(_DWORD); weak
    unsigned int __cdecl sub_40B4E8(unsigned int a1, int a2);
    // _DWORD __cdecl __sbh_alloc_block(_DWORD); weak
    // _DWORD __cdecl __sbh_resize_block(_DWORD, _DWORD, _DWORD); weak
    LPVOID __cdecl sub_40C3DE();
    BOOL __cdecl sub_40C522(void **lpMem);
    void __cdecl sub_40C578(int a1);
    int __cdecl sub_40C63A(unsigned int a1, int a2, int a3);
    void __cdecl sub_40C691(int a1, int a2, int a3);
    int __cdecl sub_40C6D6(unsigned int a1);
    int __cdecl sub_40C8DE(int a1, unsigned int a2, unsigned int a3);
    signed int __cdecl sub_40CA02(int a1, int a2, unsigned int a3, unsigned int a4);
    // int sub_40D45C(void); weak
    // void __usercall sub_40D4C2(int a1<eax>, int a2<ecx>, int a3<ebx>, int a4<edi>, int a5<esi>);
    int loc_40D4FD(); // weak
    // char *__cdecl strstr(const char *Str, const char *SubStr);
    void *__cdecl sub_40E534(LPVOID lpMem, signed int Size);
    SIZE_T __cdecl sub_40E7D4(unsigned int lpMem);
    int __cdecl sub_40EAB3();
    // _DWORD __cdecl flsall(_DWORD); weak
    // void *__cdecl memcpy(void *Dst, const void *Src, size_t Size);
    // __int32 __cdecl strtol(const char *Str, char **EndPtr, int Radix);
    // void *__cdecl memcpy_0(void *Dst, const void *Src, size_t Size);
    // _DWORD __cdecl _dosmaperr(_DWORD); weak
    // _DWORD __cdecl _ld12cvt(_DWORD, _DWORD, _DWORD); weak
    int __cdecl sub_41192D(int a1, int a2);
    int __cdecl sub_411943(int a1, int a2);
    int __cdecl sub_4119D3(int a1, int a2);
    int __cdecl sub_411A2E(int a1, int a2);
    // _DWORD __cdecl __strgtold12(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
    int __cdecl sub_4132D8(LPCSTR lpPathName); // idb
    // char *__cdecl _ltoa(__int32 Value, char *Dest, int Radix);
    // int __cdecl _stat(LPCSTR Path, int); idb
    // int __usercall sub_414A10<eax>(int a1<ebp>);
    // int __usercall sub_414A18<eax>(int a1<ebp>);
    // int __usercall sub_414A2F<eax>(int a1<ebp>);
    // int __usercall sub_414A50<eax>(int a1<ebp>);
    // int __usercall sub_414A58<eax>(int a1<ebp>);
    // int __usercall sub_414A6F<eax>(int a1<ebp>);
    int __cdecl SEH_4018F0(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414A90<eax>(int a1<ebp>);
    // int __usercall sub_414A98<eax>(int a1<ebp>);
    int __cdecl SEH_401A00(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414AB0<eax>(int a1<ebp>);
    // int __usercall sub_414AD0<eax>(int a1<ebp>);
    // int __usercall sub_414AD8<eax>(int a1<ebp>);
    // int __usercall sub_414B00<eax>(int a1<ebp>);
    int __cdecl SEH_401E00(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414B20<eax>(int a1<ebp>);
    // int __usercall sub_414B40<eax>(int a1<ebp>);
    int __cdecl SEH_4021D0(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414B60<eax>(int a1<ebp>);
    // int __usercall sub_414B68<eax>(int a1<ebp>);
    // int __usercall sub_414B90<eax>(int a1<ebp>);
    // int __usercall sub_414B98<eax>(int a1<ebp>);
    // int __usercall sub_414BC0<eax>(int a1<ebp>);
    // int __usercall sub_414BC8<eax>(int a1<ebp>);
    // int __usercall sub_414BF0<eax>(int a1<ebp>);
    // int __usercall sub_414BF8<eax>(int a1<ebp>);
    // int __usercall sub_414C20<eax>(int a1<ebp>);
    // int __usercall sub_414C28<eax>(int a1<ebp>);
    // int __usercall sub_414C50<eax>(int a1<ebp>);
    // int __usercall sub_414C58<eax>(int a1<ebp>);
    // int __usercall sub_414C80<eax>(int a1<ebp>);
    // int __usercall sub_414C88<eax>(int a1<ebp>);
    // int __usercall sub_414CB0<eax>(int a1<ebp>);
    // int __usercall sub_414CB8<eax>(int a1<ebp>);
    // int __usercall sub_414CE0<eax>(int a1<ebp>);
    // int __usercall sub_414CE8<eax>(int a1<ebp>);
    // LSTATUS __usercall sub_414D10<eax>(int a1<ebp>);
    void __cdecl sub_414D18();
    int __cdecl SEH_402BF0(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414D30<eax>(int a1<ebp>);
    int __cdecl SEH_4030D0(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // int __usercall sub_414D50<eax>(int a1<ebp>);
    int __cdecl SEH_406710(struct _s_HandlerType *a1, struct EHRegistrationNode *a2, int a3, int a4);
    // void __usercall sub_414D70(void *this<ecx>, int a2<ebp>);
    LSTATUS __stdcall RegDeleteKeyA(HKEY hKey, LPCSTR lpSubKey);
    LSTATUS __stdcall RegCloseKey(HKEY hKey);
    LSTATUS __stdcall RegQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
    LSTATUS __stdcall RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
    LSTATUS __stdcall RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE *lpData, DWORD cbData);
    LSTATUS __stdcall RegCreateKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition);
    LSTATUS __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcchName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcchClass, PFILETIME lpftLastWriteTime);
    LSTATUS __stdcall RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcchClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime);
    BOOL __stdcall GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength);
    BOOL __stdcall OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle);
    BOOL __stdcall OpenThreadToken(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle);
    BOOL __stdcall LookupAccountSidA(LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
    PVOID __stdcall FreeSid(PSID pSid);
    BOOL __stdcall EqualSid(PSID pSid1, PSID pSid2);
    BOOL __stdcall AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid);
    HGDIOBJ __stdcall GetStockObject(int i);
    BOOL __stdcall GetExitCodeThread(HANDLE hThread, LPDWORD lpExitCode);
    HANDLE __stdcall CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
    HANDLE __stdcall CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName);
    void __stdcall Sleep(DWORD dwMilliseconds);
    BOOL __stdcall ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
    DWORD __stdcall SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
    BOOL __stdcall GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
    HANDLE __stdcall CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
    DWORD __stdcall GetModuleFileNameA(HMODULE hModule, LPCH lpFilename, DWORD nSize);
    HMODULE __stdcall GetModuleHandleA(LPCSTR lpModuleName);
    BOOL __stdcall WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
    BOOL __stdcall HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
    LPVOID __stdcall HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);
    HANDLE __stdcall GetProcessHeap();
    DWORD __stdcall GetVersion();
    LPSTR __stdcall GetCommandLineA();
    BOOL __stdcall GetComputerNameA(LPSTR lpBuffer, LPDWORD nSize);
    BOOL __stdcall FreeLibrary(HMODULE hLibModule);
    HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName);
    HANDLE __stdcall OpenEventA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName);
    void __stdcall OutputDebugStringA(LPCSTR lpOutputString);
    HLOCAL __stdcall LocalAlloc(UINT uFlags, SIZE_T uBytes);
    void __stdcall GetLocalTime(LPSYSTEMTIME lpSystemTime);
    LPSTR __stdcall lstrcatA(LPSTR lpString1, LPCSTR lpString2);
    void __stdcall GetSystemInfo(LPSYSTEM_INFO lpSystemInfo);
    HANDLE __stdcall GetCurrentProcess();
    HANDLE __stdcall GetCurrentThread();
    BOOL __stdcall GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
    BOOL __stdcall GetVolumeInformationA(LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize);
    UINT __stdcall GetDriveTypeA(LPCSTR lpRootPathName);
    BOOL __stdcall SetEvent(HANDLE hEvent);
    HANDLE __stdcall CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName);
    DWORD __stdcall GetLastError();
    DWORD __stdcall WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
    BOOL __stdcall CloseHandle(HANDLE hObject);
    DWORD __stdcall GetTickCount();
    LPSTR __stdcall lstrcpyA(LPSTR lpString1, LPCSTR lpString2);
    void __stdcall ExitThread(DWORD dwExitCode);
    DWORD __stdcall FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list *Arguments);
    HLOCAL __stdcall LocalFree(HLOCAL hMem);
    LPSTR __stdcall lstrcpynA(LPSTR lpString1, LPCSTR lpString2, int iMaxLength);
    int __stdcall lstrlenA(LPCSTR lpString);
    FARPROC __stdcall GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
    BOOL __stdcall VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
    LPVOID __stdcall VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
    BOOL __stdcall CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
    DWORD __stdcall GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
    BOOL __stdcall HeapDestroy(HANDLE hHeap);
    HANDLE __stdcall HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
    LPVOID __stdcall HeapReAlloc(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes);
    SIZE_T __stdcall HeapSize(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);
    int __stdcall LoadStringA(HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int cchBufferMax);
    LRESULT __stdcall DispatchMessageA(const MSG *lpMsg);
    LRESULT __stdcall SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
    int __stdcall MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
    BOOL __stdcall TranslateMessage(const MSG *lpMsg);
    BOOL __stdcall PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
    HCURSOR __stdcall LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName);
    ATOM __stdcall RegisterClassA(const WNDCLASSA *lpWndClass);
    BOOL __stdcall SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
    HICON __stdcall LoadIconA(HINSTANCE hInstance, LPCSTR lpIconName);
    HWND __stdcall GetParent(HWND hWnd);
    BOOL __stdcall ShowWindow(HWND hWnd, int nCmdShow);
    BOOL __stdcall SystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
    int __stdcall wvsprintfA(LPSTR, LPCSTR, va_list arglist);
    int __stdcall GetSystemMetrics(int nIndex);
    HWND __stdcall CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
    BOOL __stdcall GetWindowRect(HWND hWnd, LPRECT lpRect);
    
    
    //----- (00401000) --------------------------------------------------------
    void *__thiscall sub_401000(void *this)
    {
      void *result; // eax@1
    
      result = this;
      *(_DWORD *)this = &off_41526C;
      return result;
    }
    // 41526C: using guessed type int (__thiscall *off_41526C)(LPVOID lpMem, char);
    
    //----- (00401010) --------------------------------------------------------
    int __thiscall sub_401010(int lpMem, char a2)
    {
      int v2; // esi@1
    
      v2 = lpMem;
      sub_401030((void *)lpMem);
      if ( a2 & 1 )
        sub_409AB2(v2);
      return v2;
    }
    
    //----- (00401030) --------------------------------------------------------
    void __thiscall sub_401030(void *this)
    {
      *(_DWORD *)this = &off_41526C;
    }
    // 41526C: using guessed type int (__thiscall *off_41526C)(LPVOID lpMem, char);
    
    //----- (00401210) --------------------------------------------------------
    void *__cdecl sub_401210(int a1)
    {
      char v1; // zf@1
      signed int v2; // eax@1
      void *v3; // ebx@1
      int v4; // ebp@1
      int v5; // edi@1
      signed int v6; // esi@1
      int v7; // ecx@4
      int v8; // esi@9
      void *v9; // eax@11
      void *result; // eax@12
      signed int v11; // ecx@14
      signed int v12; // esi@14
      int v13; // esi@14
      int v14; // esi@14
      int v15; // esi@14
      signed int v16; // edx@15
      unsigned __int8 v17; // sf@16
      unsigned __int8 v18; // of@16
      int v19; // ebp@18
      int v20; // ebp@18
      signed int v21; // ebp@18
      int v22; // esi@20
      signed int v23; // [sp+10h] [bp-Ch]@1
      int v24; // [sp+14h] [bp-8h]@1
      int v25; // [sp+18h] [bp-4h]@11
      int v26; // [sp+20h] [bp+4h]@13
    
      v4 = 0;
      v6 = 0;
      v23 = 0;
      v24 = 0;
      v5 = a1;
      v3 = sub_4014A0();
      v2 = *(_DWORD *)(a1 + 4);
      v1 = (*(_DWORD *)(a1 + 4) & 0x80000003) == 0;
      if ( (*(_DWORD *)(a1 + 4) & 0x80000003) < 0 )
        v1 = (((*(_DWORD *)(a1 + 4) & 0x80000003) - 1) | 0xFFFFFFFC) == -1;
      if ( !v1 )
        goto LABEL_24;
      v7 = v2 + *(_DWORD *)a1;
      if ( *(_BYTE *)(v7 - 1) == 61 )
      {
        v23 = 1;
        v6 = 1;
      }
      if ( *(_BYTE *)(v7 - 2) == 61 )
      {
        ++v6;
        v23 = v6;
      }
      if ( v6 )
      {
        *((_DWORD *)v3 + 1) = 3 * ((v2 - 1) / 4 + 1) - v6;
        v8 = *(_DWORD *)(a1 + 4) - 4;
      }
      else
      {
        *((_DWORD *)v3 + 1) = 3 * v2 / 4;
        v8 = *(_DWORD *)(a1 + 4);
      }
      v25 = v8;
      v9 = sub_409ABD(1u, *((_DWORD *)v3 + 1) + 1);
      *(_DWORD *)v3 = v9;
      if ( v9 )
      {
        v26 = 0;
        if ( v8 > 0 )
        {
          do
          {
            v13 = sub_401450(*(_BYTE *)(*(_DWORD *)v5 + v4)) << 6;
            v14 = (sub_401450(*(_BYTE *)(v4 + 1 + *(_DWORD *)v5)) + v13) << 6;
            v15 = (sub_401450(*(_BYTE *)(v4 + 2 + *(_DWORD *)v5)) + v14) << 6;
            v12 = sub_401450(*(_BYTE *)(v4 + 3 + *(_DWORD *)v5)) + v15;
            v11 = 16;
            do
            {
              v16 = v12 >> v11;
              v11 -= 8;
              ++v24;
              *(_BYTE *)(v24 - 1 + *(_DWORD *)v3) = v16;
            }
            while ( v11 > -8 );
            v4 = v26 + 4;
            v18 = __SETO__(v26 + 4, v25);
            v17 = v26 + 4 - v25 < 0;
            v26 += 4;
          }
          while ( v17 ^ v18 );
        }
        if ( v23 == 1 )
        {
          v19 = sub_401450(*(_BYTE *)(*(_DWORD *)v5 + *(_DWORD *)(v5 + 4) - 4)) << 6;
          v20 = (sub_401450(*(_BYTE *)(*(_DWORD *)v5 + *(_DWORD *)(v5 + 4) - 3)) + v19) << 6;
          v21 = (sub_401450(*(_BYTE *)(*(_DWORD *)v5 + *(_DWORD *)(v5 + 4) - 2)) + v20) << 6;
          *(_BYTE *)(*(_DWORD *)v3 + v24) = v21 >> 16;
          *(_BYTE *)(*(_DWORD *)v3 + v24 + 1) = BYTE1(v21);
          result = v3;
        }
        else
        {
          if ( v23 == 2 )
          {
            v22 = sub_401450(*(_BYTE *)(*(_DWORD *)v5 + *(_DWORD *)(v5 + 4) - 4)) << 6;
            *(_BYTE *)(*(_DWORD *)v3 + v24) = (sub_401450(*(_BYTE *)(*(_DWORD *)v5 + *(_DWORD *)(v5 + 4) - 3)) + v22) << 12 >> 16;
          }
          result = v3;
        }
      }
      else
      {
    LABEL_24:
        sub_4014C0((int *)v3);
        result = 0;
      }
      return result;
    }
    
    //----- (00401400) --------------------------------------------------------
    char __cdecl sub_401400(signed int a1)
    {
      int v1; // eax@3
      int v2; // eax@12
    
      if ( a1 < 0 || a1 > 25 )
      {
        if ( a1 < 26 || a1 > 51 )
        {
          if ( a1 < 52 || a1 > 61 )
          {
            if ( a1 == 62 )
            {
              LOBYTE(v1) = 43;
            }
            else
            {
              v2 = a1 - 1;
              LOBYTE(v2) = (a1 - 1) & 0xF0;
              v1 = v2 + 63;
            }
          }
          else
          {
            v1 = a1 - 4;
          }
        }
        else
        {
          v1 = a1 + 71;
        }
      }
      else
      {
        v1 = a1 + 65;
      }
      return v1;
    }
    
    //----- (00401450) --------------------------------------------------------
    int __cdecl sub_401450(char a1)
    {
      int result; // eax@3
    
      if ( a1 < 65 || a1 > 90 )
      {
        if ( a1 < 97 || a1 > 122 )
        {
          if ( a1 < 48 || a1 > 57 )
          {
            if ( a1 == 43 )
            {
              result = 62;
            }
            else
            {
              if ( a1 == 47 )
                result = 63;
              else
                result = -(a1 != 61);
            }
          }
          else
          {
            result = a1 + 4;
          }
        }
        else
        {
          result = a1 - 71;
        }
      }
      else
      {
        result = a1 - 65;
      }
      return result;
    }
    
    //----- (004014A0) --------------------------------------------------------
    void *__cdecl sub_4014A0()
    {
      void *result; // eax@1
    
      result = sub_409ABD(1u, 8);
      if ( result )
      {
        *((_DWORD *)result + 1) = 0;
        *(_DWORD *)result = 0;
      }
      return result;
    }
    
    //----- (004014C0) --------------------------------------------------------
    void __cdecl sub_4014C0(int *lpMem)
    {
      if ( lpMem )
      {
        if ( *lpMem )
          sub_409B6E(*lpMem);
        sub_409B6E((int)lpMem);
      }
    }
    
    //----- (004014F0) --------------------------------------------------------
    void *__cdecl sub_4014F0(const void *a1, int a2)
    {
      void *v2; // ebx@1
      void *v3; // edi@2
      void *result; // eax@3
      int i; // ecx@4
      int v6; // edi@4
      void *v7; // edi@7
    
      v2 = sub_4014A0();
      if ( v2 && (v3 = sub_409ABD(1u, a2), *(_DWORD *)v2 = v3, v3) )
      {
        memset(v3, 0, 4 * ((unsigned int)a2 >> 2));
        v6 = (int)((char *)v3 + 4 * ((unsigned int)a2 >> 2));
        for ( i = a2 & 3; i; --i )
          *(_BYTE *)v6++ = 0;
        v7 = *(void **)v2;
        memcpy(*(void **)v2, a1, 4 * ((unsigned int)a2 >> 2));
        result = v2;
        memcpy((char *)v7 + 4 * ((unsigned int)a2 >> 2), (char *)a1 + 4 * ((unsigned int)a2 >> 2), a2 & 3);
        *((_DWORD *)v2 + 1) = a2;
      }
      else
      {
        sub_4014C0((int *)v2);
        result = 0;
      }
      return result;
    }
    
    //----- (004016A0) --------------------------------------------------------
    int __thiscall sub_4016A0(void *this, HKEY cbData, LPCSTR phkResult, LPCSTR lpValueName, int a5)
    {
      int result; // eax@2
      LSTATUS v6; // esi@2
      BYTE Data[4]; // [sp+0h] [bp-4h]@1
    
      *(_DWORD *)Data = this;
      if ( RegOpenKeyExA(cbData, phkResult, 0, 0x20019u, (PHKEY)&phkResult)
        || (cbData = (HKEY)4,
            v6 = RegQueryValueExA((HKEY)phkResult, lpValueName, 0, 0, Data, (LPDWORD)&cbData),
            RegCloseKey((HKEY)phkResult),
            result = *(_DWORD *)Data,
            v6) )
        result = a5;
      return result;
    }
    
    //----- (004018F0) --------------------------------------------------------
    int __cdecl sub_4018F0(int a1, HKEY cchName, DWORD dwIndex, int a4)
    {
      char v4; // bl@1
      HKEY v5; // edi@1
      LSTATUS v6; // esi@1
      CHAR *v7; // eax@2
      int v8; // eax@6
      DWORD cbMaxSubKeyLen; // [sp+10h] [bp-28h]@1
      char v11; // [sp+14h] [bp-24h]@1
      char v12; // [sp+20h] [bp-18h]@7
      int v13; // [sp+34h] [bp-4h]@1
    
      v4 = 0;
      sub_401CF0((int)&v11);
      v5 = cchName;
      v13 = 1;
      v6 = RegQueryInfoKeyA(cchName, 0, 0, 0, 0, &cbMaxSubKeyLen, 0, 0, 0, 0, 0, 0);
      if ( !v6 )
      {
        cchName = (HKEY)(2 * cbMaxSubKeyLen + 2);
        v7 = (CHAR *)sub_401E00((int)&v11, 2 * cbMaxSubKeyLen + 2);
        v6 = RegEnumKeyExA(v5, dwIndex, v7, (LPDWORD)&cchName, 0, 0, 0, 0);
        sub_401E90((LPCSTR *)&v11);
      }
      if ( a4 )
        *(_DWORD *)a4 = v6;
      if ( v6 )
      {
        v8 = sub_401D00((int)&v12, &byte_41B360, -1);
        v4 = 1;
        LOBYTE(v13) = 2;
      }
      else
      {
        v8 = (int)&v11;
      }
      sub_401D30(a1, v8);
      v13 = 1;
      if ( ((unsigned __int8)v4 | 2) & 1 )
        sub_401D80(&v12);
      LOBYTE(v13) = 0;
      sub_401D80(&v11);
      return a1;
    }
    // 401D80: using guessed type int __thiscall sub_401D80(_DWORD);
    
    //----- (00401A00) --------------------------------------------------------
    const CHAR *__cdecl sub_401A00(HKEY cchName, LSTATUS lpString2)
    {
      const CHAR *result; // eax@1
      HKEY v3; // edi@1
      const CHAR *v4; // esi@1
      int v5; // eax@4
      int v6; // eax@5
      int v7; // [sp+Ch] [bp-24h]@2
      char v8; // [sp+18h] [bp-18h]@4
      int v9; // [sp+2Ch] [bp-4h]@2
    
      v4 = (const CHAR *)lpString2;
      v3 = cchName;
      result = (const CHAR *)RegOpenKeyExA(cchName, (LPCSTR)lpString2, 0, 0x2001Fu, &cchName);
      lpString2 = (LSTATUS)result;
      if ( !result )
      {
        while ( 1 )
        {
          sub_4018F0((int)&v7, cchName, 0, (int)&lpString2);
          v9 = 0;
          if ( lpString2 == 259 )
            break;
          if ( !lpString2 )
          {
            sub_401D00((int)&v8, v4, -1);
            LOBYTE(v9) = 1;
            sub_4027A0(&v8, (int)&v7);
            v5 = sub_402310(&v8);
            lpString2 = sub_401A00(v3, (LPCSTR)v5);
            if ( !lpString2 )
            {
              v6 = sub_402310(&v7);
              lpString2 = RegDeleteKeyA(cchName, (LPCSTR)v6);
            }
            LOBYTE(v9) = 0;
            sub_401D80(&v8);
          }
          v9 = -1;
          sub_401D80(&v7);
          if ( lpString2 )
            goto LABEL_10;
        }
        lpString2 = 0;
        v9 = -1;
        sub_401D80(&v7);
    LABEL_10:
        RegCloseKey(cchName);
        result = (const CHAR *)lpString2;
      }
      return result;
    }
    // 401D80: using guessed type int __thiscall sub_401D80(_DWORD);
    
    //----- (00401CF0) --------------------------------------------------------
    int __thiscall sub_401CF0(int this)
    {
      int v2; // esi@1
    
      v2 = this;
      sub_401D90(this);
      return v2;
    }
    
    //----- (00401D00) --------------------------------------------------------
    int __thiscall sub_401D00(int this, LPCSTR lpString2, int a3)
    {
      int v3; // esi@1
      int v4; // eax@2
    
      v3 = this;
      sub_401D90(this);
      if ( lpString2 )
      {
        v4 = a3;
        if ( a3 < 0 )
          v4 = lstrlenA(lpString2);
        sub_401DA0(v3, lpString2, v4);
      }
      return v3;
    }
    
    //----- (00401D30) --------------------------------------------------------
    int __thiscall sub_401D30(int this, int a2)
    {
      int v3; // esi@1
      int v4; // ST04_4@1
      int v5; // eax@1
    
      v3 = this;
      sub_401D90(this);
      v4 = *(_DWORD *)(a2 + 8);
      v5 = sub_402310((void *)a2);
      sub_401DA0(v3, (LPCSTR)v5, v4);
      return v3;
    }
    
    //----- (00401D90) --------------------------------------------------------
    int __thiscall sub_401D90(int this)
    {
      int result; // eax@1
    
      result = 0;
      *(_DWORD *)this = &unk_41B364;
      *(_DWORD *)(this + 4) = 0;
      *(_DWORD *)(this + 8) = 0;
      return result;
    }
    
    //----- (00401DA0) --------------------------------------------------------
    int __thiscall sub_401DA0(int this, LPCSTR lpString2, int a3)
    {
      int result; // eax@1
      int v4; // esi@1
    
      v4 = this;
      sub_4022A0(this);
      result = a3;
      if ( a3 )
      {
        result = sub_409FCA(a3 + 1);
        *(_DWORD *)v4 = result;
        *(_DWORD *)(v4 + 4) = a3 + 1;
        if ( lpString2 )
        {
          lstrcpynA((LPSTR)result, lpString2, a3 + 1);
          result = lstrlenA(*(LPCSTR *)v4);
          *(_DWORD *)(v4 + 8) = result;
        }
        else
        {
          *(_BYTE *)result = 0;
          *(_DWORD *)(v4 + 8) = 0;
        }
      }
      return result;
    }
    
    //----- (00401E00) --------------------------------------------------------
    LPCSTR __thiscall sub_401E00(int this, int a2)
    {
      int v2; // esi@1
      LPCSTR result; // eax@2
      int v4; // eax@3
      const CHAR *v5; // esi@3
      char v6; // [sp+8h] [bp-18h]@3
      int v7; // [sp+1Ch] [bp-4h]@3
    
      v2 = this;
      if ( *(_DWORD *)(this + 4) < a2 )
      {
        sub_401D00((int)&v6, *(LPCSTR *)this, -1);
        v7 = 0;
        v4 = sub_402310(&v6);
        sub_401DA0(v2, (LPCSTR)v4, a2);
        v5 = *(const CHAR **)v2;
        v7 = -1;
        sub_401D80(&v6);
        result = v5;
      }
      else
      {
        result = *(LPCSTR *)this;
      }
      return result;
    }
    // 401D80: using guessed type int __thiscall sub_401D80(_DWORD);
    
    //----- (00401E90) --------------------------------------------------------
    int __thiscall sub_401E90(LPCSTR *this)
    {
      int result; // eax@1
      LPCSTR *v2; // esi@1
    
      v2 = this;
      result = lstrlenA(*this);
      v2[2] = (LPCSTR)result;
      return result;
    }
    
    //----- (00401EB0) --------------------------------------------------------
    void __thiscall sub_401EB0(int this, LPCSTR lpString2)
    {
      int v2; // ebx@1
      int v3; // eax@3
      int v4; // ebp@4
      const void *v5; // esi@4
      int v6; // ST14_4@4
    
      v2 = this;
      if ( lpString2 )
      {
        if ( *(_UNKNOWN **)this == &unk_41B364 )
        {
          v3 = lstrlenA(lpString2);
          sub_401DA0(v2, lpString2, v3);
        }
        else
        {
          v4 = *(_DWORD *)(this + 8) + lstrlenA(lpString2);
          v5 = *(const void **)v2;
          v6 = sub_409FCA(v4 + 1);
          memcpy((void *)v6, v5, *(_DWORD *)(v2 + 8));
          memcpy((void *)(*(_DWORD *)(v2 + 8) + v6), lpString2, lstrlenA(lpString2) + 1);
          sub_4022A0(v2);
          *(_DWORD *)(v2 + 8) = v4;
          *(_DWORD *)v2 = v6;
          *(_DWORD *)(v2 + 4) = v4 + 1;
        }
      }
    }
    
    //----- (004020E0) --------------------------------------------------------
    int __thiscall sub_4020E0(void *this, UINT uID, HINSTANCE hInstance)
    {
      int v3; // ebp@1
      int v4; // esi@1
      int result; // eax@2
      int v6; // ebx@2
      int v7; // edi@2
    
      v3 = (int)this;
      v4 = 32;
      while ( 1 )
      {
        v7 = 2 * v4;
        sub_401DA0(v3, 0, 2 * v4);
        result = LoadStringA(hInstance, uID, *(LPSTR *)v3, v4);
        v6 = result;
        if ( result < v4 - 2 )
          break;
        v4 *= 2;
        if ( v7 > 4096 )
          return result;
      }
      if ( result )
      {
        *(_DWORD *)(v3 + 8) = lstrlenA(*(LPCSTR *)v3);
        result = v6;
      }
      else
      {
        sub_4022A0(v3);
        result = 0;
      }
      return result;
    }
    
    //----- (004021D0) --------------------------------------------------------
    int sub_4021D0(int a1, UINT uID, HINSTANCE hInstance, ...)
    {
      int v3; // eax@2
      int v4; // eax@4
      CHAR lpString[4]; // [sp+0h] [bp-20h]@2
      va_list Arguments; // [sp+4h] [bp-1Ch]@2
      char v8; // [sp+8h] [bp-18h]@1
      int v9; // [sp+1Ch] [bp-4h]@1
      va_list va; // [sp+30h] [bp+10h]@1
    
      va_start(va, hInstance);
      sub_401CF0((int)&v8);
      v9 = 0;
      if ( sub_4020E0(&v8, uID, hInstance) > 0 )
      {
        Arguments = va;
        v3 = sub_402310(&v8);
        if ( FormatMessageA(0x500u, (LPCVOID)v3, 0, 0, lpString, 0, &Arguments) )
        {
          if ( *(_DWORD *)lpString )
          {
            v4 = lstrlenA(*(LPCSTR *)lpString);
            sub_401DA0(a1, *(LPCSTR *)lpString, v4);
            LocalFree(*(HLOCAL *)lpString);
            Arguments = 0;
          }
        }
      }
      v9 = -1;
      return sub_401D80(&v8);
    }
    // 401D80: using guessed type int __thiscall sub_401D80(_DWORD);
    
    //----- (004022A0) --------------------------------------------------------
    int __thiscall sub_4022A0(int this)
    {
      int result; // eax@1
      int v2; // esi@1
    
      v2 = this;
      result = *(_DWORD *)(this + 4);
      if ( result )
      {
        result = *(_DWORD *)this;
        if ( *(_UNKNOWN **)this != &unk_41B364 )
        {
          sub_409AB2(*(_DWORD *)this);
          result = sub_401D90(v2);
        }
      }
      return result;
    }
    
    //----- (004022D0) --------------------------------------------------------
    char __thiscall sub_4022D0(int this, int a2)
    {
      char result; // al@2
    
      if ( a2 < *(_DWORD *)(this + 8) )
        result = *(_BYTE *)(*(_DWORD *)this + a2);
      else
        result = 0;
      return result;
    }
    
    //----- (00402310) --------------------------------------------------------
    int __thiscall sub_402310(void *this)
    {
      return *(_DWORD *)this;
    }
    
    //----- (004027A0) --------------------------------------------------------
    int __thiscall sub_4027A0(void *this, int a2)
    {
      int v2; // esi@1
      int v3; // eax@2
      int v4; // eax@6
    
      v2 = (int)this;
      if ( *(_DWORD *)this != sub_402310((void *)a2) )
      {
        v3 = *(_DWORD *)(v2 + 8);
        if ( v3 )
        {
          if ( *(_DWORD *)(a2 + 8) )
          {
            if ( sub_4022D0(v2, v3 - 1) != 92 )
              sub_401EB0(v2, "\\");
          }
        }
        v4 = sub_402310((void *)a2);
        sub_401EB0(v2, (LPCSTR)v4);
      }
      return v2;
    }
    
    //----- (004027F0) --------------------------------------------------------
    int __thiscall sub_4027F0(int this, LPCSTR lpString2)
    {
      int v2; // esi@1
    
      v2 = this;
      if ( *(LPCSTR *)this != lpString2 )
      {
        if ( *(_DWORD *)(this + 8) )
        {
          if ( lpString2 )
          {
            if ( lstrlenA(lpString2) )
            {
              if ( sub_4022D0(v2, *(_DWORD *)(v2 + 8) - 1) != 92 )
                sub_401EB0(v2, "\\");
            }
          }
        }
        sub_401EB0(v2, lpString2);
      }
      return v2;
    }
    
    //----- (00402BA0) --------------------------------------------------------
    int __thiscall sub_402BA0(int this)
    {
      int v2; // esi@1
    
      v2 = this;
      sub_402BC0(this);
      return v2;
    }
    
    //----- (00402BC0) --------------------------------------------------------
    int __thiscall sub_402BC0(int this)
    {
      int result; // eax@1
    
      memset((void *)this, 0, 0x104u);
      *(_BYTE *)(this + 260) = 0;
      result = 0;
      memset((void *)(this + 261), 0, 0x104u);
      *(_BYTE *)(this + 521) = 0;
      *(_DWORD *)(this + 524) = 0;
      return result;
    }
    
    //----- (00402BF0) --------------------------------------------------------
    LSTATUS __thiscall sub_402BF0(void *lpData)
    {
      int (__stdcall *v1)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // ebp@1
      BYTE *v2; // edi@1
      HKEY v3; // ecx@2
      LSTATUS v4; // eax@2
      LSTATUS v5; // esi@3
      LSTATUS v6; // eax@4
      LSTATUS v7; // eax@6
      int (__stdcall *v8)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // ebp@11
      int v9; // eax@11
      int v10; // eax@12
      void (__stdcall *v11)(_DWORD); // edi@12
      HKEY v12; // eax@14
      int v13; // eax@19
      void (__stdcall *v15)(_DWORD); // esi@26
      HKEY v16; // [sp+78h] [bp-1Ch]@1
      HKEY hKey; // [sp+7Ch] [bp-18h]@1
      HKEY Data; // [sp+80h] [bp-14h]@1
      DWORD dwDisposition; // [sp+84h] [bp-10h]@3
      int v20; // [sp+90h] [bp-4h]@1
    
      v2 = (BYTE *)lpData;
      hKey = 0;
      v20 = 0;
      v16 = 0;
      v1 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))RegOpenKeyExA;
      LOBYTE(v20) = 1;
      Data = 0;
      if ( RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Ahnlab\\Autoup", 0, 983103u, &Data)
        || (v4 = sub_402EA0(&hKey), v3 = Data, hKey = Data, v4) )
      {
        Data = 0;
        v5 = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Ahnlab\\Autoup", 0, 0, 0, 0xF003Fu, 0, &Data, &dwDisposition);
        if ( v5 || (v6 = sub_402EA0(&hKey), v3 = Data, v5 = v6, hKey = Data, v6) )
          goto LABEL_25;
      }
      Data = 0;
      if ( v1(v3, "TemporarySettings", 0, 983103, &Data) || (v7 = sub_402EA0(&v16), v16 = Data, v7) )
      {
        Data = 0;
        v5 = RegCreateKeyExA(hKey, "TemporarySettings", 0, 0, 0, 0xF003Fu, 0, &Data, &dwDisposition);
        if ( v5 || (v5 = sub_402EA0(&v16), v16 = Data, v5) )
        {
          if ( hKey )
          {
            RegCloseKey(hKey);
    LABEL_24:
            hKey = 0;
          }
    LABEL_25:
          LOBYTE(v20) = 0;
          sub_402EA0(&v16);
          v20 = -1;
          sub_402EA0(&hKey);
          return v5;
        }
      }
      v9 = lstrlenA((LPCSTR)v2);
      v8 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))RegSetValueExA;
      v5 = RegSetValueExA(v16, "UpdateProduct", 0, 3u, v2, v9);
      if ( v5 )
      {
        v10 = (int)v16;
        v11 = *(void (__stdcall **)(_DWORD))RegCloseKey;
        if ( !v16 )
          goto LABEL_14;
        goto LABEL_13;
      }
      Data = (HKEY)*((_DWORD *)v2 + 131);
      v5 = v8(v16, "UpdateFileType", 0, 4, &Data, 4);
      if ( v5 )
      {
        v10 = (int)v16;
        v11 = *(void (__stdcall **)(_DWORD))RegCloseKey;
        if ( !v16 )
        {
    LABEL_14:
          v12 = hKey;
          if ( !hKey )
            goto LABEL_25;
    LABEL_23:
          v11(v12);
          goto LABEL_24;
        }
    LABEL_13:
        v11(v10);
        v16 = 0;
        goto LABEL_14;
      }
      v13 = lstrlenA((LPCSTR)v2 + 261);
      v5 = v8(v16, "Execute", 0, 1, v2 + 261, v13 + 1);
      if ( v5 )
      {
        v11 = *(void (__stdcall **)(_DWORD))RegCloseKey;
        if ( v16 )
        {
          RegCloseKey(v16);
          v16 = 0;
        }
        v12 = hKey;
        if ( !hKey )
          goto LABEL_25;
        goto LABEL_23;
      }
      v15 = *(void (__stdcall **)(_DWORD))RegCloseKey;
      if ( v16 )
      {
        RegCloseKey(v16);
        v16 = 0;
      }
      if ( hKey )
      {
        v15(hKey);
        hKey = 0;
      }
      LOBYTE(v20) = 0;
      sub_402EA0(&v16);
      v20 = -1;
      sub_402EA0(&hKey);
      return 0;
    }
    
    //----- (00402EA0) --------------------------------------------------------
    LSTATUS __thiscall sub_402EA0(void *this)
    {
      LSTATUS result; // eax@1
      HKEY v2; // ecx@1
      void *v3; // esi@1
    
      v3 = this;
      result = 0;
      v2 = *(HKEY *)this;
      if ( v2 )
      {
        result = RegCloseKey(v2);
        *(_DWORD *)v3 = 0;
      }
      return result;
    }
    
    //----- (00402EC0) --------------------------------------------------------
    signed int __cdecl sub_402EC0(signed int a1, int a2)
    {
      signed int result; // eax@6
      int v3; // ecx@6
    
      if ( dword_4170AC == 1 )
      {
        if ( a1 > 211 )
        {
          if ( a1 == 213 )
          {
            dword_41B390 = 0;
          }
          else
          {
            if ( a1 == 301 )
            {
              SendMessageA(dword_41B38C, 0x8824u, 0, 130);
              return 1;
            }
          }
        }
        else
        {
          if ( a1 == 211 )
          {
            dword_41B390 = 1;
            return 1;
          }
          if ( a1 == 5 )
          {
            if ( !dword_41B390 && dword_41B388 )
            {
              dword_41B384 += *(_DWORD *)(a2 + 1032);
              SendMessageA(dword_41B38C, 0x8824u, 0, 100 * dword_41B384 / (unsigned int)dword_41B388 + 30);
              return 1;
            }
          }
          else
          {
            if ( a1 == 102 )
            {
              v3 = *(_DWORD *)(a2 + 1032);
              dword_41B384 = 0;
              dword_41B388 = v3;
              return 1;
            }
          }
        }
        result = 1;
      }
      else
      {
        result = 0;
      }
      return result;
    }
    // 4170AC: using guessed type int dword_4170AC;
    // 41B384: using guessed type int dword_41B384;
    // 41B388: using guessed type int dword_41B388;
    // 41B390: using guessed type int dword_41B390;
    
    //----- (00402FC0) --------------------------------------------------------
    signed int __cdecl sub_402FC0(int a1)
    {
      unsigned int v1; // eax@3
      int v2; // eax@5
      int v3; // eax@7
      int v5; // eax@12
    
      if ( dword_4170AC == 1 && a1 )
      {
        v1 = *(_DWORD *)(a1 + 2060);
        if ( v1 > 0xD3 )
        {
          v5 = v1 - 213;
          if ( v5 )
          {
            if ( v5 == 88 )
            {
              SendMessageA(dword_41B38C, 0x8824u, 0, 130);
              return 1;
            }
          }
          else
          {
            dword_41B390 = 0;
          }
        }
        else
        {
          if ( v1 == 211 )
          {
            dword_41B390 = 1;
            return 1;
          }
          v2 = v1 - 1;
          if ( v2 )
          {
            if ( v2 == 101 )
            {
              v3 = *(_DWORD *)(a1 + 2048);
              dword_41B384 = 0;
              dword_41B388 = v3;
              return 1;
            }
          }
          else
          {
            if ( !dword_41B390 && dword_41B388 )
            {
              dword_41B384 += *(_DWORD *)(a1 + 2056);
              SendMessageA(dword_41B38C, 0x8824u, 0, 100 * dword_41B384 / (unsigned int)dword_41B388 + 30);
              return 1;
            }
          }
        }
      }
      return 1;
    }
    // 4170AC: using guessed type int dword_4170AC;
    // 41B384: using guessed type int dword_41B384;
    // 41B388: using guessed type int dword_41B388;
    // 41B390: using guessed type int dword_41B390;
    
    //----- (004030D0) --------------------------------------------------------
    void __stdcall sub_4030D0(int a1)
    {
      int v1; // eax@1
      unsigned int v2; // ecx@1
      void (__stdcall *v3)(HWND, signed int, _DWORD, int); // ebp@1
      int v4; // edi@1
      DWORD v5; // esi@1
      int v6; // eax@1
      unsigned int i; // edx@6
      unsigned int v8; // ecx@6
      int v9; // edi@6
      signed int v10; // eax@13
      int v11; // eax@13
      char v12; // cf@15
      int v13; // edi@18
      int v14; // eax@23
      unsigned int v15; // [sp+40h] [bp-230h]@1
      signed int v16; // [sp+44h] [bp-22Ch]@1
      int v17; // [sp+48h] [bp-228h]@1
      int v18; // [sp+4Ch] [bp-224h]@1
      int v19; // [sp+50h] [bp-220h]@8
      CHAR Data; // [sp+54h] [bp-21Ch]@23
      int v21; // [sp+260h] [bp-10h]@23
      int v22; // [sp+26Ch] [bp-4h]@23
    
      v5 = 0;
      v16 = 0;
      v6 = GetTickCount();
      sub_40A2B2(v6);
      v3 = *(void (__stdcall **)(HWND, signed int, _DWORD, int))SendMessageA;
      SendMessageA(dword_41B38C, 34850u, 0, 0);
      v2 = 0;
      v15 = 0;
      v4 = *(_DWORD *)(a1 + 548);
      v18 = *(_DWORD *)(a1 + 576);
      v17 = v4;
      v1 = *(_DWORD *)(v4 + 4);
      if ( v1 != v4 )
      {
        do
        {
          v1 = *(_DWORD *)(v1 + 4);
          ++v2;
        }
        while ( v1 != v4 );
        v15 = v2;
      }
      ((void (__fastcall *)(unsigned int, _DWORD, HWND, signed int, _DWORD, _DWORD))v3)(
        v2,
        *(_DWORD *)(a1 + 576),
        dword_41B38C,
        34856,
        0,
        0);
      while ( 1 )
      {
        v9 = *(_DWORD *)(v4 + 4);
        for ( i = rand() % v15; i; --i )
          v9 = *(_DWORD *)(v9 + 4);
        v19 = 0;
        if ( v15 )
        {
          while ( 1 )
          {
            if ( v9 == v17 )
              v9 = *(_DWORD *)(v9 + 4);
            if ( *(_DWORD *)(a1 + 552) != 1 )
              v3(dword_41B38C, 34855, 0, v9 + 40);
            v11 = ((int (__stdcall *)(HWND, signed int, _DWORD, _DWORD))v3)(dword_41B38C, 34851, 0, 0);
            v10 = sub_403CC0(v11, a1, v9 + 8);
            v5 = v10;
            if ( !v10 )
              break;
            if ( v10 == 805306608 )
              break;
            v8 = v15;
            v9 = *(_DWORD *)(v9 + 4);
            v12 = v19++ + 1 < v15;
            if ( !v12 )
              goto LABEL_18;
          }
          v16 = 1;
        }
    LABEL_18:
        v13 = v18-- - 1;
        if ( !v16 )
          sub_407EE0(1, "{AB649B06-4E52-43D7-B2DD-8E42DAE34D88} %d, %x", v13, v5);
        if ( !v13 || v16 == 1 )
        {
          if ( !v5 )
          {
            sub_402BA0((int)&Data);
            v14 = *(_DWORD *)(a1 + 548);
            v22 = 0;
            lstrcpyA(&Data, (LPCSTR)(*(_DWORD *)(v14 + 4) + 8));
            v21 = 6;
            sub_402BF0(&Data);
            v22 = -1;
            nullsub_1(&Data);
            i = (unsigned int)dword_41B38C;
          }
          ((void (__fastcall *)(unsigned int, unsigned int))v3)(v8, i);
          ExitThread(v5);
          JUMPOUT(loc_4032A8);
        }
        v4 = v17;
      }
    }
    // 402BB0: using guessed type int __thiscall nullsub_1(_DWORD);
    
    //----- (004032B0) --------------------------------------------------------
    signed int __cdecl StartAddress(int a1)
    {
      DWORD v1; // eax@1
    
      v1 = WaitForSingleObject(*(HANDLE *)(a1 + 564), *(_DWORD *)(a1 + 572));
      if ( v1 == 258 )
      {
        sub_407EE0(1, "{3E14EFC2-CF3C-4EC3-A03A-4F481F8D9077}");
      }
      else
      {
        if ( v1 )
          sub_407EE0(1, "{9D7EFED4-DF34-4B1B-B9AA-EDD200DF0636} %d", v1);
        else
          sub_407EE0(1, "{FD82E3DA-8E48-4355-9BCB-FB1AD63D5C5A}");
      }
      if ( *(_DWORD *)(a1 + 564) )
      {
        CloseHandle(*(HANDLE *)(a1 + 564));
        *(_DWORD *)(a1 + 564) = 0;
      }
      dword_4170AC = 0;
      return 1;
    }
    // 4170AC: using guessed type int dword_4170AC;
    
    //----- (004033B0) --------------------------------------------------------
    int __thiscall sub_4033B0(int lpMem, char a2)
    {
      int v2; // esi@1
    
      v2 = lpMem;
      sub_4033D0((void *)lpMem);
      if ( a2 & 1 )
        sub_409AB2(v2);
      return v2;
    }
    
    //----- (004033D0) --------------------------------------------------------
    void __thiscall sub_4033D0(void *this)
    {
      *(_DWORD *)this = &off_4152E0;
    }
    // 4152E0: using guessed type int (__thiscall *off_4152E0)(LPVOID lpMem, char);
    
    //----- (004033E0) --------------------------------------------------------
    signed int __thiscall sub_4033E0(int this, int a2, int a3, HWND a4, int a5)
    {
      int v5; // esi@1
      int (*v6)(const CHAR *, const char *, ...); // ebx@7
      int v7; // ebp@7
      HANDLE v8; // edi@7
      int v9; // eax@14
      signed int v10; // eax@18
      signed int result; // eax@20
      void *v12; // edx@22
      int i; // ecx@22
      int v14; // edi@22
      unsigned int v15; // edi@22
      char v16; // bl@22
      signed int v17; // eax@25
      int v18; // edi@25
      unsigned int v19; // edi@34
      const CHAR *v20; // esi@34
      bool v21; // [sp-Ch] [bp-398h]@27
      bool v22; // [sp-4h] [bp-390h]@8
      int v23; // [sp+10h] [bp-37Ch]@18
      int v24; // [sp+14h] [bp-378h]@1
      int v25; // [sp+18h] [bp-374h]@32
      int v26; // [sp+1Ch] [bp-370h]@32
      char String1; // [sp+20h] [bp-36Ch]@4
      char Dest; // [sp+60h] [bp-32Ch]@1
      char v29; // [sp+61h] [bp-32Bh]@1
      __int16 v30; // [sp+161h] [bp-22Bh]@1
      char v31; // [sp+163h] [bp-229h]@1
      const CHAR tstrFilename; // [sp+164h] [bp-228h]@1
      char v33; // [sp+165h] [bp-227h]@1
      __int16 v34; // [sp+275h] [bp-117h]@1
      char v35; // [sp+277h] [bp-115h]@1
      const CHAR FileName; // [sp+278h] [bp-114h]@1
      char v37; // [sp+279h] [bp-113h]@1
      __int16 v38; // [sp+389h] [bp-3h]@1
      char v39; // [sp+38Bh] [bp-1h]@1
    
      v5 = this;
      FileName = 0;
      tstrFilename = 0;
      memset(&v37, 0, 0x110u);
      v38 = 0;
      v39 = 0;
      Dest = 0;
      memset(&v33, 0, 0x110u);
      v34 = 0;
      v35 = 0;
      memset(&v29, 0, 0x100u);
      v30 = 0;
      v31 = 0;
      *(_DWORD *)(this + 8) = a3;
      *(_DWORD *)(this + 4) = a2;
      *(_DWORD *)(this + 556) = a4;
      dword_41B38C = a4;
      v24 = 260;
      *(_DWORD *)(this + 544) = a5;
      if ( sub_4070A0((int)"lL") )
        *(_DWORD *)(v5 + 568) = 1;
      if ( *(_DWORD *)(v5 + 568) == 1 )
      {
        String1 = 0;
        if ( sub_407110("TimeOut:", &String1, 64) )
        {
          if ( String1 )
            *(_DWORD *)(v5 + 572) = atol(&String1);
        }
      }
      v7 = v5 + 273;
      sub_407200((char *)(v5 + 273), 0x105u, (int)&v24);
      v6 = (int (*)(const CHAR *, const char *, ...))wsprintfA;
      ((void (*)(const CHAR *, const char *, ...))wsprintfA)(&FileName, "%s%s", v5 + 273, "HSUpdate.env");
      v8 = CreateMutexA(0, 0, "Global\\C886B01D-2DDD-466e-B6D7-43E0DC18F895");
      v22 = GetLastError() == 183;
      sub_407EE0(1, "{FEDEBA5C-59B0-4BE3-AE56-97799C54C4B8} %d", v22);
      if ( v8 )
        CloseHandle(v8);
      sub_407EE0(1, "{8D70560F-1E71-46D5-8553-8CA81F31AADE} %x", *(_DWORD *)(v5 + 544));
      v6(&tstrFilename, "%s%s", v5 + 273, "hsupdate.exe");
      if ( !sub_407AA0((int)&Dest, &tstrFilename, &Dest, 0x104u) )
        sub_407EE0(1, "{9A6ED342-BBAE-4F6B-B5AB-4082A449F5DE} %s, %s", "hsupdate.exe", &Dest);
      memset((void *)&tstrFilename, 0, 0x104u);
      memset(&Dest, 0, 0x104u);
      v9 = v6(&tstrFilename, "%s%s", v5 + 273, "ahnupgs.dll");
      if ( !sub_407AA0(v9, &tstrFilename, &Dest, 0x104u) )
        sub_407EE0(1, "{9A6ED342-BBAE-4F6B-B5AB-4082A449F5DE} %s, %s", "ahnupgs.dll", &Dest);
      memset((void *)&tstrFilename, 0, 0x104u);
      memset(&Dest, 0, 0x104u);
      v6(&tstrFilename, "%s%s", v5 + 273, "v3ine***.dll");
      if ( !sub_407AA0((int)&tstrFilename, &tstrFilename, &Dest, 0x104u) )
        sub_407EE0(1, "{9A6ED342-BBAE-4F6B-B5AB-4082A449F5DE} %s, %s", "v3ine***.dll", &Dest);
      v23 = 0;
      v10 = sub_404380((int)&FileName, &FileName, 0, (int)&v23, v5 + 576, 0);
      if ( v10 )
      {
        sub_407EE0(1, "{DE30886D-ABB6-4BA1-A8A0-A97B05C5B453} %d", v10);
        if ( *(_DWORD *)(v5 + 568) == 1 )
        {
          sub_4038C0(v5, 0, 1u, 805306384);
          result = 0;
        }
        else
        {
          sub_4038C0(v5, 1, 1u, 805306384);
          result = 0;
        }
      }
      else
      {
        v15 = 632 * (v23 + 1);
        v12 = malloc(632 * (v23 + 1));
        v16 = v15;
        memset(v12, 0, 4 * (v15 >> 2));
        v14 = (int)((char *)v12 + 4 * (v15 >> 2));
        for ( i = v16 & 3; i; --i )
          *(_BYTE *)v14++ = 0;
        v18 = v5 + 576;
        *(_DWORD *)(v5 + 548) = v12;
        v17 = sub_404380((int)&v23, &FileName, (int)v12, (int)&v23, v5 + 576, 0);
        if ( v17 )
        {
          sub_407EE0(1, "{DE30886D-ABB6-4BA1-A8A0-A97B05C5B453} %d", v17);
          v21 = *(_DWORD *)(v5 + 568) != 1;
          sub_4038C0(v5, v21, 1u, 805306384);
          if ( *(_DWORD *)(v5 + 548) )
          {
            sub_409B6E(*(_DWORD *)(v5 + 548));
            *(_DWORD *)(v5 + 548) = 0;
          }
          result = 0;
        }
        else
        {
          v25 = 0;
          v26 = 0;
          if ( !sub_405ED0((int)&FileName, &FileName, (int)&v25) )
            *(_DWORD *)(v5 + 552) = v26;
          v20 = (const CHAR *)(v5 + 12);
          ((void (*)(const CHAR *, const char *, ...))wsprintfA)(v20, "%sUpdate\\", v7);
          sub_4132D8(v20);
          sub_407EE0(1, "{385A998E-5CB2-4C60-BF42-59CFE4E29133} %s", v7);
          sub_407EE0(1, "{9DCBD79B-9549-4DEA-8A5A-1CAF6E7528CF} %s", v20);
          v19 = *(_DWORD *)v18;
          if ( v19 < 1 || v19 > 0xF )
            sub_407EE0(1, "{1A7E24ED-52A4-47BA-97EC-D716F9D62A37} %d ", v19);
          result = 1;
        }
      }
      return result;
    }
    // 4151D4: using guessed type int (__cdecl *wsprintfA)(_DWORD, _DWORD, _DWORD, _DWORD);
    
    //----- (00403840) --------------------------------------------------------
    void __thiscall sub_403840(void *this)
    {
      void (__stdcall *v1)(_DWORD); // edi@1
      void *v2; // esi@1
    
      v2 = this;
      sub_407EE0(1, "{BC89C1B3-2279-467A-A047-AB45C92F70C5}");
      sub_407A60();
      v1 = *(void (__stdcall **)(_DWORD))CloseHandle;
      if ( *((_DWORD *)v2 + 141) )
      {
        SetEvent(*((HANDLE *)v2 + 141));
        v1(*((_DWORD *)v2 + 141));
        *((_DWORD *)v2 + 141) = 0;
      }
      if ( !*((_DWORD *)v2 + 135) )
        v1(0);
      if ( !*((_DWORD *)v2 + 134) )
        v1(0);
      if ( *((_DWORD *)v2 + 137) )
      {
        sub_409B6E(*((_DWORD *)v2 + 137));
        *((_DWORD *)v2 + 137) = 0;
      }
    }
    
    //----- (004038C0) --------------------------------------------------------
    LRESULT __thiscall sub_4038C0(int this, LRESULT a2, WPARAM wParam, LPARAM lParam)
    {
      LRESULT result; // eax@1
    
      result = a2;
      if ( a2 )
        result = SendMessageA(*(HWND *)(this + 556), 0x8826u, wParam, lParam);
      return result;
    }
    
    //----- (004038F0) --------------------------------------------------------
    __int16 __thiscall sub_4038F0(void *this)
    {
      void *v1; // ebx@1
      signed int v2; // ebp@1
      int v3; // edi@1
      int v4; // esi@1
      int v5; // eax@8
      int v6; // eax@24
      char Str; // [sp+10h] [bp-C8h]@1
      int v9; // [sp+11h] [bp-C7h]@1
      int v10; // [sp+15h] [bp-C3h]@1
      int v11; // [sp+19h] [bp-BFh]@1
      __int16 v12; // [sp+1Dh] [bp-BBh]@1
      char v13; // [sp+1Fh] [bp-B9h]@1
      struct _SYSTEM_INFO SystemInfo; // [sp+20h] [bp-B8h]@1
      struct _OSVERSIONINFOA VersionInformation; // [sp+44h] [bp-94h]@1
    
      v9 = 0;
      v10 = 0;
      v11 = 0;
      v12 = 0;
      v1 = this;
      Str = 0;
      v13 = 0;
      v4 = sub_4095F0();
      v3 = 0;
      v2 = 0;
      VersionInformation.dwOSVersionInfoSize = 148;
      GetVersionExA(&VersionInformation);
      GetSystemInfo(&SystemInfo);
      if ( v4 )
      {
        v3 = sub_409730(v4);
        if ( v3 )
        {
          if ( sub_4097B0(v4) == 1 )
          {
            v2 = 6;
          }
          else
          {
            if ( sub_4097E0(v4) == 1 )
              v2 = 9;
          }
        }
        (**(void (__thiscall ***)(_DWORD, _DWORD))v4)(v4, 1);
      }
      ((void (*)(char *, const char *, ...))wsprintfA)(&Str, "%d%d", *(_QWORD *)&VersionInformation.dwMajorVersion);
      v5 = atoi(&Str);
      if ( v5 > 61 )
      {
        v6 = v5 - 410;
        if ( v6 )
        {
          v5 = v6 - 80;
          if ( v5 )
            goto LABEL_26;
        }
    LABEL_27:
        LOWORD(v5) = 1;
        if ( VersionInformation.dwPlatformId == 1 )
        {
          *((_WORD *)v1 + 290) = 1;
          return v5;
        }
        goto LABEL_29;
      }
      if ( v5 >= 60 )
        goto LABEL_13;
      if ( v5 == 40 )
        goto LABEL_27;
      if ( v5 <= 49 || v5 > 52 )
      {
    LABEL_26:
        *((_WORD *)v1 + 290) = 0;
        return v5;
      }
    LABEL_13:
      if ( !v3 )
      {
        LOWORD(v5) = SystemInfo.dwOemId;
        if ( (_WORD)SystemInfo.dwOemId == 6 )
        {
          *((_WORD *)v1 + 290) = 4;
          return v5;
        }
        if ( (_WORD)SystemInfo.dwOemId == 9 )
        {
          *((_WORD *)v1 + 290) = 8;
          return v5;
        }
        if ( (_WORD)SystemInfo.dwOemId )
          goto LABEL_23;
    LABEL_29:
        *((_WORD *)v1 + 290) = 2;
        return v5;
      }
      if ( v2 != 9 )
      {
        if ( v2 == 6 )
        {
          *((_WORD *)v1 + 290) = 4;
          return v5;
        }
    LABEL_23:
        LOWORD(v5) = (unsigned int)sub_407EE0(1, "**Error: Unknown architecture!!");
        return v5;
      }
      *((_WORD *)v1 + 290) = 8;
      return v5;
    }
    // 4151D4: using guessed type int (__cdecl *wsprintfA)(_DWORD, _DWORD, _DWORD, _DWORD);
    
    //----- (00403AB0) --------------------------------------------------------
    DWORD __usercall sub_403AB0<eax>(LPVOID lpParameter<ecx>, int a2<eax>)
    {
      DWORD v2; // edi@1
      LPVOID v3; // esi@1
      HANDLE v4; // eax@2
      HANDLE v5; // eax@3
      HANDLE v6; // eax@6
      int (__stdcall *v7)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // ebx@10
      char v9; // [sp-10h] [bp-5Ch]@1
      struct tagMSG Msg; // [sp+4h] [bp-48h]@12
      DWORD arglist; // [sp+20h] [bp-2Ch]@8
      int v12; // [sp+24h] [bp-28h]@8
      int v13; // [sp+28h] [bp-24h]@10
      DWORD ThreadId; // [sp+2Ch] [bp-20h]@3
      DWORD v15; // [sp+30h] [bp-1Ch]@4
      char *v16; // [sp+34h] [bp-18h]@1
      int v17; // [sp+3Ch] [bp-10h]@1
      int (__cdecl *v18)(int, int, int); // [sp+40h] [bp-Ch]@1
      _UNKNOWN *v19; // [sp+44h] [bp-8h]@1
      int v20; // [sp+48h] [bp-4h]@1
    
      v19 = &unk_4152E8;
      v18 = unknown_libname_5;
      v17 = a2;
      v16 = &v9;
      v3 = lpParameter;
      v2 = 0;
      v20 = 0;
      sub_407EE0(1, "{D9EEB3FE-3C17-44B7-AAAA-F59EB04E925D}");
      if ( *((_DWORD *)v3 + 143) <= 0u )
        goto LABEL_22;
      v4 = CreateEventA(0, 0, 0, "HSUPDATE_TIMEOUT");
      *((_DWORD *)v3 + 141) = v4;
      if ( !v4 )
      {
        v2 = GetLastError();
        v15 = v2;
        sub_407EE0(1, "{EE2906D1-F13C-4cb1-8BDD-DC8ADFCDF936} Error (0x%x) ", v2);
        return v2;
      }
      v5 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)StartAddress, v3, 0, &ThreadId);
      *((_DWORD *)v3 + 135) = v5;
      if ( v5 )
      {
    LABEL_22:
        v6 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sub_4030D0, v3, 0, &ThreadId);
        *((_DWORD *)v3 + 134) = v6;
        if ( v6 )
        {
          arglist = 0;
          v12 = 0;
          v12 = GetExitCodeThread(v6, &arglist);
          if ( v12 )
          {
            v13 = 0;
            v7 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))PeekMessageA;
            while ( arglist == 259 )
            {
              if ( v7(&Msg, 0, 0, 0, 1) == 1 )
              {
                TranslateMessage(&Msg);
                DispatchMessageA(&Msg);
              }
              if ( !GetExitCodeThread(*((HANDLE *)v3 + 134), &arglist) )
              {
                v2 = GetLastError();
                v15 = v2;
                sub_407EE0(1, "{BB898529-175A-4988-B622-90C371B63D8E} Error (0x%x) ", v2);
                return v2;
              }
              ++v13;
            }
            if ( arglist )
            {
              sub_407EE0(1, "{DF3329CE-4BBB-4e74-848C-5D92E8F891DF} 0x%x ", arglist);
              v2 = arglist;
              v15 = arglist;
            }
          }
          else
          {
            v2 = GetLastError();
            v15 = v2;
            sub_407EE0(1, "{4B6E8C59-6CBF-4083-9896-F99104BCAAE4} Error (0x%x) ", v2);
          }
        }
        else
        {
          v2 = GetLastError();
          v15 = v2;
          sub_407EE0(1, "{7BB92FA9-BE59-4eb5-98E1-C58C673C0C20} Error (0x%x) ", v2);
        }
      }
      else
      {
        v2 = GetLastError();
        v15 = v2;
        sub_407EE0(1, "{28F7DB76-8735-4cb6-8569-960C49DFD119} Error (0x%x) ", v2);
      }
      return v2;
    }
    // 40A4E4: using guessed type int __cdecl unknown_libname_5(int, int, int);
    
    //----- (00403CC0) --------------------------------------------------------
    signed int __userpurge sub_403CC0<eax>(int a1<eax>, int a2<ecx>, int a3)
    {
      int v3; // eax@1
      int v4; // ebx@1
      char *v5; // eax@2
      void (__stdcall *v6)(_DWORD, _DWORD); // edi@4
      int v7; // eax@7
      int v8; // eax@7
      signed int v9; // esi@11
      char v11; // [sp-10h] [bp-44Ch]@1
      char *v12; // [sp+4h] [bp-438h]@2
      CHAR Str; // [sp+8h] [bp-434h]@2
      char v14; // [sp+9h] [bp-433h]@2
      __int16 v15; // [sp+109h] [bp-333h]@2
      char v16; // [sp+10Bh] [bp-331h]@2
      int v17; // [sp+10Ch] [bp-330h]@7
      char Dest; // [sp+110h] [bp-32Ch]@1
      int v19; // [sp+2B8h] [bp-184h]@2
      CHAR String1; // [sp+2BCh] [bp-180h]@4
      char v21; // [sp+3BCh] [bp-80h]@4
      char v22; // [sp+3DCh] [bp-60h]@4
      __int16 v23; // [sp+3FCh] [bp-40h]@4
      int v24; // [sp+404h] [bp-38h]@7
      int v25; // [sp+408h] [bp-34h]@7
      char *v26; // [sp+40Ch] [bp-30h]@7
      int v27; // [sp+410h] [bp-2Ch]@7
      int v28; // [sp+414h] [bp-28h]@7
      int v29; // [sp+418h] [bp-24h]@7
      int v30; // [sp+41Ch] [bp-20h]@7
      int v31; // [sp+420h] [bp-1Ch]@11
      char *v32; // [sp+424h] [bp-18h]@1
      int v33; // [sp+42Ch] [bp-10h]@1
      int (__cdecl *v34)(int, int, int); // [sp+430h] [bp-Ch]@1
      _UNKNOWN *v35; // [sp+434h] [bp-8h]@1
      int v36; // [sp+438h] [bp-4h]@1
    
      v35 = &unk_4152F8;
      v34 = unknown_libname_5;
      v33 = a1;
      v32 = &v11;
      v4 = a2;
      v36 = 0;
      memset(&Dest, 0, 0x2F4u);
      v3 = *(_DWORD *)(a3 + 292);
      if ( v3 == 1 )
      {
        v19 = 0;
        Str = 0;
        memset(&v14, 0, 0x100u);
        v15 = 0;
        v16 = 0;
        lstrcpyA(&Str, (LPCSTR)(a3 + 296));
        v5 = strchr(&Str, 47);
        *v5 = 0;
        v12 = v5 + 1;
        sprintf(&Dest, "http://%s:%d/%s", &Str, *(_DWORD *)(a3 + 556), v5 + 1);
      }
      else
      {
        if ( v3 == 2 )
        {
          v19 = 1;
          v6 = *(void (__stdcall **)(_DWORD, _DWORD))lstrcpyA;
          lstrcpyA(&String1, (LPCSTR)(a3 + 296));
          v6(&v21, a3 + 560);
          v6(&v22, a3 + 591);
          v23 = *(_WORD *)(a3 + 556);
        }
      }
      sub_407EE0(1, "{CB0A8181-E81E-4243-95CE-6229BE2426ED} %d", *(_DWORD *)(a3 + 292));
      sub_407EE0(1, "{8D0B444D-D146-4BB3-8162-9DF775BC9074} %s", a3 + 32);
      sub_407EE0(1, "{E283CE23-8270-4DF8-885B-E673E3C1FD71} %s", a3 + 296);
      sub_407EE0(1, "{7BDCC698-3C8E-435B-B0E9-E9AD4E4B1E85} %d", *(_DWORD *)(a3 + 556));
      if ( *(_DWORD *)(a3 + 292) == 2 )
      {
        sub_407EE0(1, "{DFD25CDD-A355-4A2A-AD90-9535BB2C6CD0} %s", a3 + 560);
        sub_407EE0(1, "{23ABA781-151D-4D43-B5DF-8EB3510A12FC} %s", a3 + 591);
      }
      v28 = 0;
      v17 = 6;
      v24 = 0;
      v27 = 2;
      v29 = 0;
      v25 = 0;
      v26 = &Dest;
      v8 = (int)&Dest;
      LOWORD(v8) = *(_WORD *)(v4 + 580);
      v7 = sub_407590(
             v8,
             0,
             a3,
             6,
             v8,
             0,
             0,
             v4 + 12,
             2,
             (int)&v29,
             (int)sub_402EC0,
             (int)sub_402FC0,
             0,
             (int)&Dest,
             *(_DWORD *)(v4 + 544));
      v30 = v7;
      if ( v7 )
      {
        if ( v7 == 1 )
        {
          sub_407EE0(1, "{0C77ED69-4A6F-4FD8-B9A5-995073FF53C6}");
          Sleep(0x1F4u);
          v9 = 805306608;
          v31 = 805306608;
        }
        else
        {
          if ( v7 == 805306464 )
          {
            sub_407EE0(1, "{1E3C30FD-DB16-411E-946C-C268B29B2A36} %8x", 96);
            sub_4038C0(v4, 0, 0xEu, 805306464);
            v9 = 805306416;
            v31 = 805306416;
          }
          else
          {
            if ( dword_4170AC == 1 )
            {
              sub_407EE0(1, "{7086C03A-EA6B-4C48-A717-7254DACCC7F3} %8x", (unsigned __int16)v7);
              sub_4038C0(v4, 0, 0xEu, 805306416);
              v9 = 805306416;
              v31 = 805306416;
            }
            else
            {
              sub_407EE0(1, "{7F60374C-D6B7-47A3-9FFE-EE62558459D8} %8x", (unsigned __int16)v7);
              sub_4038C0(v4, 0, 0xEu, 805306512);
              v9 = 805306416;
              v31 = 805306416;
            }
          }
        }
      }
      else
      {
        sub_407EE0(1, "{67D1C48D-5EDD-4ccc-8D7D-3028A2EE30EF}");
        Sleep(0x1F4u);
        v9 = 0;
        v31 = 0;
      }
      return v9;
    }
    // 40A4E4: using guessed type int __cdecl unknown_libname_5(int, int, int);
    // 4170AC: using guessed type int dword_4170AC;
    
    //----- (00404380) --------------------------------------------------------
    signed int __usercall sub_404380<eax>(int a1<eax>, LPCSTR lpFileName, int a3, int a4, int a5, int a6)
    {
      HANDLE v6; // eax@1
      void *v7; // esi@1
      void (__stdcall *v9)(_DWORD, _DWORD, _DWORD, _DWORD); // ebx@3
      int (__stdcall *v10)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // edi@3
      int v11; // eax@17
      char v12; // zf@17
      int v13; // eax@33
      char v14; // zf@33
      int v15; // esi@41
      int v16; // eax@45
      int v17; // esi@47
      int v18; // ecx@48
      HANDLE v19; // ebx@49
      DWORD v20; // edi@55
      DWORD v21; // edx@57
      int v22; // ecx@57
      char v23; // al@59
      char v24; // al@59
      int v25; // ebx@65
      signed int v26; // ecx@67
      wchar_t v27[2]; // edi@67
      char v28; // zf@69
      unsigned int v29; // edx@71
      signed int v30; // ecx@71
      signed int v31; // ecx@71
      int v32; // edi@71
      const void *v33; // esi@71
      char v34; // zf@73
      HANDLE v35; // edi@87
      int (__stdcall *v36)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // esi@87
      unsigned __int8 v37; // cf@94
      char v38; // [sp-Ch] [bp-2A8h]@1
      __int16 v39; // [sp+0h] [bp-29Ch]@87
      int v40; // [sp+4h] [bp-298h]@92
      char v41; // [sp+8h] [bp-294h]@94
      int v42; // [sp+Ch] [bp-290h]@92
      int v43; // [sp+10h] [bp-28Ch]@47
      int v44; // [sp+14h] [bp-288h]@47
      int v45; // [sp+18h] [bp-284h]@45
      int v46; // [sp+1Ch] [bp-280h]@45
      HANDLE hFile; // [sp+20h] [bp-27Ch]@1
      char *v48; // [sp+24h] [bp-278h]@19
      int v49; // [sp+28h] [bp-274h]@1
      int v50; // [sp+2Ch] [bp-270h]@1
      DWORD nNumberOfBytesToRead; // [sp+30h] [bp-26Ch]@49
      int v52; // [sp+34h] [bp-268h]@59
      int v53; // [sp+38h] [bp-264h]@57
      DWORD NumberOfBytesRead; // [sp+3Ch] [bp-260h]@3
      char Buffer; // [sp+40h] [bp-25Ch]@1
      char v56; // [sp+41h] [bp-25Bh]@1
      int v57; // [sp+44h] [bp-258h]@1
      int v58; // [sp+48h] [bp-254h]@9
      char v59[4]; // [sp+4Ch] [bp-250h]@19
      CHAR Str; // [sp+50h] [bp-24Ch]@1
      char v61; // [sp+51h] [bp-24Bh]@1
      int v62; // [sp+54h] [bp-248h]@1
      int v63; // [sp+58h] [bp-244h]@13
      char v64[8]; // [sp+5Ch] [bp-240h]@53
      char Str1; // [sp+64h] [bp-238h]@60
      const CHAR String2; // [sp+72h] [bp-22Ah]@61
      CHAR String1; // [sp+25Ch] [bp-40h]@1
      char v68; // [sp+25Dh] [bp-3Fh]@1
      __int16 v69; // [sp+279h] [bp-23h]@1
      char v70; // [sp+27Bh] [bp-21h]@1
      int v71; // [sp+27Ch] [bp-20h]@1
      DWORD v72; // [sp+280h] [bp-1Ch]@57
      char *v73; // [sp+284h] [bp-18h]@1
      int v74; // [sp+28Ch] [bp-10h]@1
      int (__cdecl *v75)(int, int, int); // [sp+290h] [bp-Ch]@1
      _UNKNOWN *v76; // [sp+294h] [bp-8h]@1
      int v77; // [sp+298h] [bp-4h]@1
    
      v77 = -1;
      v76 = &unk_415308;
      v75 = unknown_libname_5;
      v74 = a1;
      v73 = &v38;
      String1 = 0;
      memset(&v68, 0, 0x1Cu);
      v69 = 0;
      v70 = 0;
      Str = 0;
      v61 = 0;
      Buffer = 0;
      v56 = 0;
      v49 = 0;
      v71 = 0;
      v50 = 0;
      v62 = 1;
      v57 = 0;
      v6 = CreateFileA(lpFileName, 0x80000000u, 1u, 0, 3u, 0x80u, 0);
      v7 = v6;
      hFile = v6;
      if ( v6 == (HANDLE)-1 )
        return 805306385;
      v77 = 0;
      v9 = *(void (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD))SetFilePointer;
      SetFilePointer(v6, 0, 0, 0);
      v10 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))ReadFile;
      if ( ReadFile(v7, &Buffer, 2u, &NumberOfBytesRead, 0) )
      {
        if ( NumberOfBytesRead == 2 )
        {
          if ( Buffer != 85 || v56 != 69 )
          {
            v9(v7, 0, 0, 0);
            if ( !v10(v7, &v58, 4, &NumberOfBytesRead, 0) )
            {
              v57 = 805306386;
              goto LABEL_99;
            }
            if ( NumberOfBytesRead != 4 )
            {
              v57 = 805306387;
              goto LABEL_99;
            }
            if ( !v10(v7, &v63, 4, &NumberOfBytesRead, 0) )
            {
              v57 = 805306388;
              goto LABEL_99;
            }
            if ( NumberOfBytesRead != 4 )
            {
              v57 = 805306389;
              goto LABEL_99;
            }
            v13 = (unsigned __int8)(v58 ^ (_BYTE)v63);
            v14 = (unsigned __int8)(v58 ^ (_BYTE)v63) == 0;
            v63 = (unsigned __int8)(v58 ^ (_BYTE)v63);
            if ( v14 )
            {
              v57 = 805306390;
              goto LABEL_99;
            }
            *(_DWORD *)v59 = v58 ^ v13;
            v48 = v59;
            if ( !v10(v7, &v50, 4, &NumberOfBytesRead, 0) )
            {
              v57 = 805306386;
              goto LABEL_99;
            }
            if ( NumberOfBytesRead != 4 )
            {
              v57 = 805306387;
              goto LABEL_99;
            }
          }
          else
          {
            if ( !v10(v7, &v58, 4, &NumberOfBytesRead, 0) )
            {
              v57 = 805306386;
              goto LABEL_99;
            }
            if ( NumberOfBytesRead != 4 )
            {
              v57 = 805306387;
              goto LABEL_99;
            }
            if ( !v10(v7, &v63, 4, &NumberOfBytesRead, 0) )
            {
              v57 = 805306388;
              goto LABEL_99;
            }
            if ( NumberOfBytesRead != 4 )
            {
              v57 = 805306389;
              goto LABEL_99;
            }
            v11 = (unsigned __int8)(v58 ^ (_BYTE)v63);
            v12 = (unsigned __int8)(v58 ^ (_BYTE)v63) == 0;
            v63 = (unsigned __int8)(v58 ^ (_BYTE)v63);
            if ( v12 )
            {
              v57 = 805306390;
              goto LABEL_99;
            }
            *(_DWORD *)v59 = v58 ^ v11;
            v48 = v59;
            v57 = sub_405650(v7, (int)&v49, v58 ^ v11);
            if ( v57
              || (v57 = sub_405650(hFile, (int)&v71, v59[0])) != 0
              || (v57 = sub_405650(hFile, (int)&v50, v59[0])) != 0
              || (v57 = sub_405650(hFile, (int)&v62, v59[0])) != 0 )
              goto LABEL_99;
            if ( !v62 )
            {
              v57 = 805306390;
              goto LABEL_99;
            }
          }
          if ( a4 )
            *(_DWORD *)a4 = v50;
          v15 = a3;
          if ( a3 )
          {
            if ( a5 )
              *(_DWORD *)a5 = v62;
            v46 = a3;
            sub_407C30(a3);
            v16 = 0;
            v45 = 0;
            while ( v16 < (unsigned int)v50 )
            {
              v17 = v15 + 632 * (v16 + 1);
              v43 = v17;
              v44 = v63;
              while ( 1 )
              {
                v18 = v44--;
                if ( !v18 )
                  break;
                v19 = hFile;
                if ( !ReadFile(hFile, &nNumberOfBytesToRead, 4u, &NumberOfBytesRead, 0) )
                {
                  v57 = 805306391;
                  goto LABEL_99;
                }
                if ( NumberOfBytesRead != 4 || nNumberOfBytesToRead >= 0x200 )
                {
                  v57 = 805306392;
                  goto LABEL_99;
                }
                memset(v64, 0, 0x200u);
                if ( !ReadFile(v19, v64, nNumberOfBytesToRead, &NumberOfBytesRead, 0) )
                {
                  v57 = 805306393;
                  goto LABEL_99;
                }
                v20 = nNumberOfBytesToRead;
                if ( NumberOfBytesRead != nNumberOfBytesToRead )
                {
                  v57 = 805306394;
                  goto LABEL_99;
                }
                v22 = 0;
                v53 = 0;
                v21 = nNumberOfBytesToRead;
                v72 = nNumberOfBytesToRead;
                while ( v22 < v20 )
                {
                  v23 = v64[v22];
                  LOBYTE(v52) = v23;
                  v24 = v21 ^ v23;
                  v64[v22] = v24;
                  v64[v22] = v24 ^ v48[v22 & 3];
                  v21 += (unsigned __int8)v52;
                  v72 = v21;
                  ++v22;
                  v53 = v22;
                  v17 = v43;
                }
                if ( strncmp(&Str1, "_PROTOCOL    =", 0xEu) )
                {
                  if ( strncmp(&Str1, "_AHNPRODUCTID=", 0xEu) )
                  {
                    if ( strncmp(&Str1, "_ADDRESS     =", 0xEu) )
                    {
                      if ( strncmp(&Str1, "_SERVER      =", 0xEu) )
                      {
                        if ( strncmp(&Str1, "_PORT        =", 0xEu) )
                        {
                          if ( strncmp(&Str1, "_FTPUSERID   =", 0xEu) )
                          {
                            if ( strncmp(&Str1, "_FTPUSERPASS =", 0xEu) )
                              goto LABEL_6;
                            lstrcpyA((LPSTR)(v17 + 599), &String2);
                          }
                          else
                          {
                            lstrcpyA((LPSTR)(v17 + 568), &String2);
                          }
                        }
                        else
                        {
                          lstrcpyA(&String1, &String2);
                          *(_DWORD *)(v17 + 564) = atoi(&String1);
                        }
                      }
                      else
                      {
                        lstrcpyA((LPSTR)(v17 + 40), &String2);
                      }
                    }
                    else
                    {
                      v25 = v17 + 304;
                      lstrcpyA((LPSTR)(v17 + 304), &String2);
                      if ( strlen((const char *)(v17 + 304)) != 1 )
                      {
                        if ( *(_BYTE *)(strlen((const char *)(v17 + 304)) - 1 + v17 + 303) != 47 )
                        {
                          *(_DWORD *)v27 = L"/";
                          v26 = -1;
                          do
                          {
                            if ( !v26 )
                              break;
                            v28 = **(_BYTE **)v27 == 0;
                            ++*(_DWORD *)v27;
                            --v26;
                          }
                          while ( !v28 );
                          v31 = ~v26;
                          v33 = (const void *)(*(_DWORD *)v27 - v31);
                          v29 = v31;
                          v32 = v25;
                          v30 = -1;
                          do
                          {
                            if ( !v30 )
                              break;
                            v34 = *(_BYTE *)v32++ == 0;
                            --v30;
                          }
                          while ( !v34 );
                          memcpy((void *)(v32 - 1), v33, v29);
                          v17 = v43;
                        }
                      }
                    }
                  }
                  else
                  {
                    lstrcpyA((LPSTR)(v17 + 8), &String2);
                  }
                }
                else
                {
                  lstrcpyA(&Str, &String2);
                  *(_DWORD *)(v17 + 300) = atoi(&Str);
                }
              }
              sub_407C60(v46, v17);
              v16 = v45++ + 1;
              v15 = a3;
            }
            if ( a6 )
            {
              memset((void *)a6, 0, 0x18u);
              v35 = hFile;
              v36 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))ReadFile;
              if ( ReadFile(hFile, &v39, 2u, &NumberOfBytesRead, 0) )
              {
                if ( (_BYTE)v39 == 72 )
                {
                  if ( HIBYTE(v39) == 77 )
                  {
                    if ( !sub_405650(v35, a6, v59[0]) )
                    {
                      if ( !sub_405650(v35, a6 + 4, v59[0]) )
                      {
                        v40 = 0;
                        v42 = 0;
                        if ( !sub_405650(v35, (int)&v40, v59[0]) )
                        {
                          if ( !sub_405650(v35, (int)&v42, v59[0]) )
                          {
                            *(_DWORD *)(a6 + 8) = v42;
                            *(_DWORD *)(a6 + 12) = 0;
                            *(_QWORD *)(a6 + 8) <<= 32;
                            v37 = v40 >= (unsigned int)-*(_DWORD *)(a6 + 8);
                            *(_DWORD *)(a6 + 8) += v40;
                            *(_DWORD *)(a6 + 12) += v37;
                            if ( v36(v35, &v41, 2, &NumberOfBytesRead, 0) )
                            {
                              if ( (_BYTE)v39 == 73 )
                              {
                                if ( HIBYTE(v39) == 80 )
                                {
                                  if ( !sub_405650(v35, a6 + 16, v59[0]) )
                                    sub_405650(v35, a6 + 20, v59[0]);
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          else
          {
            v57 = a3;
          }
          goto LABEL_99;
        }
    LABEL_6:
        v57 = 805306395;
      }
      else
      {
        v57 = 805306393;
      }
    LABEL_99:
      v77 = -1;
      CloseHandle(hFile);
      return v57;
    }
    // 40A4E4: using guessed type int __cdecl unknown_libname_5(int, int, int);
    // 4177A8: using guessed type wchar_t asc_4177A8[2];
    // 404380: using guessed type char var_240[8];
    
    //----- (004052CC) --------------------------------------------------------
    int __usercall sub_4052CC<eax>(int a1<esi>)
    {
      HANDLE v2; // ST0C_4@1
    
      CloseHandle(v2);
      return a1;
    }
    // 4052CC: could not find valid save-restore pair for ebp
    // 4052CC: could not find valid save-restore pair for edi
    
    //----- (00405300) --------------------------------------------------------
    int __cdecl sub_405300(HANDLE hFile, int a2, int a3, char a4)
    {
      int (__stdcall *v4)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // ebx@1
      int result; // eax@2
      int v6; // edx@5
      unsigned int v7; // ecx@5
      int v8; // esi@5
      unsigned __int8 v9; // al@6
      unsigned int Buffer; // [sp+28h] [bp-208h]@1
      DWORD NumberOfBytesWritten; // [sp+2Ch] [bp-204h]@1
      char v12; // [sp+30h] [bp-200h]@1
      char v13; // [sp+31h] [bp-1FFh]@1
      __int16 v14; // [sp+22Dh] [bp-3h]@1
      char v15; // [sp+22Fh] [bp-1h]@1
    
      v12 = 0;
      memset(&v13, 0, 0x1FCu);
      v14 = 0;
      v15 = 0;
      ((void (*)(char *, const char *, ...))wsprintfA)(&v12, "%s%s", a2, a3);
      v4 = *(int (__stdcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))WriteFile;
      Buffer = strlen(&v12) - 1;
      if ( WriteFile(hFile, &Buffer, 4u, &NumberOfBytesWritten, 0) )
      {
        if ( NumberOfBytesWritten == 4 )
        {
          v8 = Buffer;
          v7 = 0;
          v6 = Buffer;
          if ( Buffer )
          {
            do
            {
              v9 = v6 ^ *(&v12 + v7) ^ *(&a4 + (v7 & 3));
              *(&v12 + v7) = v9;
              v6 += v9;
              ++v7;
            }
            while ( v7 < v8 );
          }
          if ( v4(hFile, &v12, v8, &NumberOfBytesWritten, 0) )
            result = NumberOfBytesWritten != Buffer ? 0x30000029 : 0;
          else
            result = 805306408;
        }
        else
        {
          result = 805306407;
        }
      }
      else
      {
        result = 805306406;
      }
      return result;
    }
    // 4151D4: using guessed type int (__cdecl *wsprintfA)(_DWORD, _DWORD, _DWORD, _DWORD);
    
    
    }


    Maybe some one can use this.
    I'll also add De-compiled Combatarms_direct.exe and EHSvc.dll
    momentarily to the attachment
    .

    I also have it in .c format for C++ viewing
    If anyone needs that format besides .txt

    I had to .rar the engine file because it was HUGE!!!

    ok the EHSvc.dll is givving me problems. ill load it up when i can.
    Last edited by neononxxx; 02-09-2010 at 05:08 PM.
    Loading content... Please wait while the rest of this post loads.

  2. The Following 3 Users Say Thank You to neononxxx For This Useful Post:

    crazygamer53 (02-09-2010),powerfear (02-09-2010),why06 (02-09-2010)

  3. #2
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,305
    Reputation
    170
    Thanks
    2,194
    My Mood
    Flirty
    Well.... at least its something. Can't expect much from decompilers. I suppose it would be a good reference if your while disassembling, can't really use it by itself because its damned-near not understandable. =/

    Thanks for the effort though. Must have taken a long time to run the decompiler long enough to get all that.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  4. #3
    neononxxx's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    why do you wanna know?? so you can kill me?
    Posts
    1,227
    Reputation
    36
    Thanks
    341
    My Mood
    Goofy
    Quote Originally Posted by why06 View Post
    Well.... at least its something. Can't expect much from decompilers. I suppose it would be a good reference if your while disassembling, can't really use it by itself because its damned-near not understandable. =/

    Thanks for the effort though. Must have taken a long time to run the decompiler long enough to get all that.
    Lolz.
    it is, it is. press the button don't say it.
    took 2hrs and still disassembling the Engine.exe.
    and im working on all the files of CA.

    Edit: I can make some heads and tails of it.
    If you carefully read through all the files,
    you can get an idea of what is doing what.
    Last edited by neononxxx; 02-09-2010 at 12:21 PM.
    Loading content... Please wait while the rest of this post loads.

  5. #4
    sommotommo's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Italy
    Posts
    343
    Reputation
    12
    Thanks
    141
    My Mood
    Confused
    What we can do whit these codes?

  6. #5
    neononxxx's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    why do you wanna know?? so you can kill me?
    Posts
    1,227
    Reputation
    36
    Thanks
    341
    My Mood
    Goofy
    lots of stuff. like how to unpack it ect....
    Loading content... Please wait while the rest of this post loads.

Similar Threads

  1. CS Source Clan/Server
    By Dave84311 in forum General
    Replies: 20
    Last Post: 10-04-2006, 01:21 PM
  2. HALO 2 (XBOX) Source Code
    By mirelesmichael in forum General Game Hacking
    Replies: 12
    Last Post: 09-23-2006, 05:35 AM
  3. Counter Strike: Source
    By Flawless in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 15
    Last Post: 06-03-2006, 09:28 PM