/* This file has been generated by the Hex-Rays decompiler.
   Copyright (c) 2009 Hex-Rays <info@hex-rays.com>

   Detected compiler: Visual C++
*/

#include <windows.h>
#include <defs.h>


//-------------------------------------------------------------------------
// Data declarations

extern int (*off_411000)(); // weak
extern int (__stdcall *off_4111B0)(); // weak
extern int (*off_4111B8)(); // weak
extern int (*off_4111D8)(); // weak
extern int (*off_411294[5])(); // weak
extern int (*off_411398[5])(); // weak
extern int (*off_41149C[5])(); // weak
extern int (*off_411588[5])(); // weak
extern int (*off_411670[5])(); // weak
extern int (*off_411758[5])(); // weak
extern int (*off_411854)(); // weak
extern int (*off_41186C[5])(); // weak
extern int (__stdcall *off_411890[6])(); // weak
extern int (*off_411894[5])(); // weak
extern int (__stdcall *off_4118AC[2])(); // weak
extern int (*off_4118B0)(); // weak
extern int (*off_4118D8[5])(); // weak
extern int dword_4119DC; // weak
extern int dword_4119E0; // weak
extern int dword_4119E4; // weak
extern int dword_4119E8; // weak
extern __int16 word_4119EC; // weak
extern char byte_4119EE; // weak
extern int (__thiscall *off_4119F0[5])(void *, char); // weak
extern int (__thiscall *off_4119F4[4])(void *, char); // weak
extern int (__thiscall *off_4119F8[3])(void *, char); // weak
extern int (__thiscall *off_4119FC[2])(void *, char); // weak
extern int (__thiscall *off_411A00)(void *, char); // weak
extern int (__thiscall *off_411A50)(void *, char); // weak
extern _UNKNOWN unk_412C28; // weak
extern _UNKNOWN unk_413158; // weak
extern char aNoType[8]; // weak
extern char aUndefined[10]; // weak
extern char aA6201[6]; // weak
extern char aUpdatesPfuncre[48]; // weak
extern char aUnlockd[8]; // weak
extern char a45fd565f8fe640[81]; // weak
extern char aCcpfixdlgIniti[76]; // weak
extern char aUsb[4]; // weak
extern char aServicePack1[15]; // weak
extern char aWin2k[7]; // weak
extern char aNone[5]; // weak
extern char aWinXp[7]; // weak
extern char aService[8]; // weak
extern char aWin31[7]; // weak
extern char aWinMe[7]; // weak
extern char aWin98[7]; // weak
extern char aWin95[7]; // weak
extern char a3_51[5]; // weak
extern char a5_0[4]; // weak
extern char a4_0[4]; // weak
extern char aWinNt[7]; // weak
extern char aNotAbleToGetOs[31]; // weak
extern IID stru_4147F8; // idb
extern IID stru_414810; // idb
extern char aCcpfixdlgDecry[83]; // weak
extern char asc_414888[3]; // weak
extern char asc_41488C[3]; // weak
extern char aRemainingNumbe[41]; // weak
extern char aUser_select[12]; // weak
extern char aCcpfixdlgVerif[58]; // weak
extern wchar_t aM[2]; // weak
extern char aGetpfuncremnum[]; // idb
extern char aPfunccheckauth[]; // idb
extern char LibFileName[]; // idb
extern char aGetcurrentdire[55]; // weak
extern char aCcpfixdlgDecpf[84]; // weak
extern char ProcName[]; // idb
extern OLECHAR aFielddatatype[]; // idb
extern OLECHAR aFieldname[]; // idb
extern OLECHAR aNewvalue[]; // idb
extern OLECHAR aExpectedvalue[]; // idb
extern char aBranch[7]; // weak
extern char aCondition[10]; // weak
extern OLECHAR aNumofbits[]; // idb
extern OLECHAR aOffsetinbits[]; // idb
extern OLECHAR aBlockid[]; // idb
extern OLECHAR aBlocktype[]; // idb
extern OLECHAR aPartition[]; // idb
extern char aNavigate[9]; // weak
extern OLECHAR aActiontype[]; // idb
extern OLECHAR aCpfixitemcomme[]; // idb
extern OLECHAR aCpfixitemseria[]; // idb
extern OLECHAR psz[]; // idb
extern char aUserselect[11]; // weak
extern char aUncondition[12]; // weak
extern IID stru_414CD0; // idb
extern IID stru_414CE8; // idb
extern char aAstrospectrapl[17]; // weak
extern char aXts5000[8]; // weak
extern char aXts2500[8]; // weak
extern char aUnexpectedCpfi[25]; // weak
extern char aNavigateAction[45]; // weak
extern char aFailedInRidePu[24]; // weak
extern char aFailedInIshWri[28]; // weak
extern char aFailedToUpdate[38]; // weak
extern char aValueAlreadySe[80]; // weak
extern char aConditionalUpd[87]; // weak
extern char aInvalidRideC_1[30]; // weak
extern char aInvalidRideC_0[30]; // weak
extern char aInvalidRideCod[32]; // weak
extern char aFailedToGetIsh[24]; // weak
extern char aFailedToRead_2[36]; // weak
extern char aFailedToCloseI[27]; // weak
extern char aFailedToCloseR[28]; // weak
extern char aFailedToUnlock[28]; // weak
extern char aFailedToOpenRi[27]; // weak
extern char aFailedToOpenIs[26]; // weak
extern char aFailedToLoadNe[36]; // weak
extern char aCpfixItemDataE[23]; // weak
extern char aTheCommunicati[35]; // weak
extern char aCpfixitemNotIn[31]; // weak
extern char aFailedToInitia[40]; // weak
extern char aThisCpfixItemC[56]; // weak
extern char aFailedToRead_1[35]; // weak
extern char aFailedToRead_0[34]; // weak
extern char aFailedToReadRi[34]; // weak
extern char aFailedToReadIs[33]; // weak
extern char aCpfixPackage_0[29]; // weak
extern char aDigitalsignerF[41]; // weak
extern char aFailedToLoadTh[42]; // weak
extern char aXmlHandlerExce[30]; // weak
extern char aCpfixPackageFi[48]; // weak
extern char aEmptyPackage_0[25]; // weak
extern char aEmptyPackageFi[30]; // weak
extern char aSuccess[11]; // weak
extern char MultiByteStr[]; // idb
extern OLECHAR aCpfixpkcustome[]; // idb
extern OLECHAR aCpfixpkradioty[]; // idb
extern OLECHAR aCpfixpktargett[]; // idb
extern OLECHAR aCpfixpksignatu[]; // idb
extern char aCcpfixpackageV[60]; // weak
extern OLECHAR a5f854cea4e574b[]; // idb
extern OLECHAR aCpfixfilepacka[]; // idb
extern char a726a0a9053ab11[81]; // weak
extern char aTheNewValueCan[51]; // weak
extern char aInvalidInputTy[47]; // weak
extern char aDigital[8]; // weak
extern wchar_t asc_4155A0[2]; // weak
extern char aNewValueForF_0[42]; // weak
extern char aNewValueForFie[28]; // weak
extern char szProvider[]; // idb
extern char aCopyrightCSMot[]; // idb
extern char Format[]; // idb
extern IID rclsid; // idb
extern IID riid; // idb
extern _UNKNOWN unk_415698; // weak
extern _UNKNOWN unk_4156E0; // weak
extern _UNKNOWN unk_4156F0; // weak
extern _UNKNOWN unk_4159AC; // weak
extern char byte_4159B0; // weak
extern char Dest[264]; // idb
extern _UNKNOWN unk_415AD0; // weak
extern VARIANTARG pvarg; // idb
extern char byte_415AF0; // weak
// extern void *CDialog__messageMap; weak
// extern void *CWinApp__messageMap; weak

//-------------------------------------------------------------------------
// Function declarations

#define __thiscall __cdecl // Test compile in C mode

_DWORD __stdcall sub_40100A(BSTR lpWideCharStr, _DWORD); // weak
_DWORD __stdcall sub_401023(char, _DWORD, _DWORD); // weak
int __thiscall sub_401028(_DWORD); // weak
int loc_40102D(); // weak
int loc_401037(); // weak
_DWORD __stdcall sub_40104B(char); // weak
_DWORD __stdcall sub_401050(_DWORD); // weak
_DWORD __stdcall sub_401055(_DWORD); // weak
int __thiscall sub_40105A(_DWORD); // weak
int __thiscall sub_401087(_DWORD); // weak
_DWORD __stdcall sub_401091(char); // weak
_DWORD __stdcall sub_40109B(_DWORD, _DWORD); // weak
_DWORD __stdcall sub_4010A0(_DWORD, _DWORD); // weak
int __thiscall sub_4010A5(_DWORD); // weak
_DWORD __stdcall sub_4010AA(char, _DWORD); // weak
int __thiscall sub_4010AF(_DWORD); // weak
_DWORD __stdcall sub_4010B9(_DWORD); // weak
_DWORD __stdcall sub_4010BE(_DWORD); // weak
int __thiscall sub_4010C3(_DWORD); // weak
_DWORD __stdcall sub_4010C8(_DWORD, _DWORD, _DWORD); // weak
_DWORD __stdcall sub_4010CD(char); // weak
int sub_4010D7(void); // weak
_DWORD __stdcall sub_4010DC(_DWORD, unsigned int, _DWORD); // weak
_DWORD __stdcall sub_4010E6(_DWORD); // weak
_DWORD __stdcall sub_4010EB(_DWORD, BSTR bstrString); // weak
int sub_4010F5(void); // weak
_DWORD __stdcall sub_4010FA(_DWORD, _DWORD, _DWORD); // weak
int __thiscall sub_4010FF(_DWORD); // weak
int __thiscall sub_401113(_DWORD); // weak
_DWORD __stdcall sub_40111D(_DWORD); // weak
int __thiscall sub_401122(_DWORD); // weak
int __thiscall strstreambuf__strstreambuf(_DWORD); // weak
_DWORD __stdcall sub_401136(char); // weak
_DWORD __stdcall sub_401140(_DWORD); // weak
int __thiscall sub_40114A(_DWORD); // weak
_DWORD __stdcall sub_40114F(_DWORD); // weak
_DWORD __stdcall sub_401159(_DWORD, _DWORD, _DWORD); // weak
int __thiscall sub_401163(_DWORD); // weak
_DWORD __stdcall sub_401168(_DWORD, _DWORD); // weak
_DWORD __stdcall sub_40116D(_DWORD); // weak
int loc_401172(); // weak
int __thiscall sub_401177(_DWORD); // weak
_DWORD __stdcall sub_40117C(_DWORD, _DWORD); // weak
_DWORD __stdcall sub_401186(char); // weak
_DWORD __stdcall sub_40118B(_DWORD); // weak
_DWORD __stdcall sub_401195(_DWORD, _DWORD); // weak
int __thiscall j_j___1CDialog(_DWORD); // weak
int __thiscall sub_4011A4(_DWORD); // weak
int loc_4011B8(); // weak
int __thiscall sub_4011C7(_DWORD); // weak
int __thiscall sub_4011CC(_DWORD); // weak
_DWORD __stdcall sub_4011D6(_DWORD, _DWORD, _DWORD, _DWORD); // weak
int __thiscall sub_4011E0(_DWORD); // weak
int __thiscall sub_4011E5(_DWORD); // weak
int __thiscall sub_4011EF(_DWORD); // weak
int sub_4011F4(void); // weak
int __thiscall sub_4011F9(_DWORD); // weak
_DWORD __stdcall sub_4011FE(_DWORD, _DWORD, _DWORD); // weak
_DWORD __stdcall sub_401203(_DWORD); // weak
int __thiscall sub_401208(_DWORD); // weak
int __thiscall sub_40121C(_DWORD); // weak
int __thiscall sub_401226(_DWORD); // weak
_DWORD __stdcall sub_40122B(_DWORD); // weak
int __thiscall sub_401235(_DWORD); // weak
_DWORD __stdcall sub_40123F(_DWORD); // weak
int loc_401244(); // weak
_DWORD __stdcall sub_401249(_DWORD); // weak
int __thiscall sub_40124E(_DWORD); // weak
int __thiscall sub_401253(_DWORD); // weak
int __thiscall sub_401271(_DWORD); // weak
int sub_401285(void); // weak
int j_j___1CWinApp(void); // weak
int __thiscall j_j___1CPtrList(_DWORD); // weak
_DWORD __stdcall sub_4012B2(char, char, _DWORD, _DWORD); // weak
int __thiscall sub_4012B7(_DWORD); // weak
void *__cdecl sub_4015A0();
int (**__cdecl sub_4015C0())();
void *__thiscall sub_401670(void *this, char a2);
int __thiscall sub_401740(void *this);
void *__thiscall sub_401800(void *this);
void *__thiscall sub_4018E0(void *this, char a2);
int __thiscall sub_401910(int this);
void *__thiscall sub_4019E0(void *this);
void *__thiscall sub_401A10(void *this, char a2);
void *__cdecl sub_401A80();
int (**__cdecl sub_401AA0())();
void *__thiscall sub_401AC0(void *this, int a2);
void *__thiscall sub_401D20(void *this, char a2);
int __thiscall sub_401D50(int this);
int __thiscall sub_401F30(void *this, int a2);
void *__cdecl sub_401FB0();
int (**__cdecl sub_401FD0())();
signed int __thiscall sub_401FF0(void *this);
// int __usercall sub_402220<eax>(int a1<eax>, int a2<ecx>);
int __thiscall sub_4024D0(void *this);
bool __thiscall sub_4027F0(int this);
int __thiscall sub_402840(void *this, int a2, int *a3);
int __thiscall sub_402A00(void *this, __int16 a2, int a3);
int __thiscall sub_402AA0(int this);
int __thiscall sub_402BB0(int this);
int __thiscall sub_402BD0(void *this);
int __thiscall sub_402C40(void *this);
int __thiscall sub_402C70(void *this);
int __thiscall sub_402CC0(void *this, char a2);
int __thiscall sub_402DA0(void *this, char a2, int a3, int *a4);
signed int __thiscall sub_402F20(void *this);
void *__thiscall sub_403C10(void *this, char a2);
int __thiscall sub_403C40(void *this);
int __thiscall sub_403CB0(int this);
BOOL __thiscall sub_403ED0(int this);
BOOL __thiscall sub_403EF0(int this);
int __thiscall sub_403F10(void *this);
int __thiscall sub_404080(void *this);
int __thiscall sub_4040A0(int this);
signed int __thiscall sub_4040E0(void *this);
int __thiscall sub_4042F0(void *this);
void *__thiscall sub_404380(void *this, char a2);
void *__thiscall sub_4043D0(void *this, char a2);
void *__thiscall sub_404400(void *this, char a2);
void *__thiscall sub_404450(void *this, char a2);
void *__thiscall sub_404480(void *this);
int __thiscall sub_4046C0(void *this, int a2, int a3, int a4);
int __stdcall loc_404B54(int, unsigned int, int); // weak
// int (__stdcall *__usercall sub_404B6A<eax>(int a1<ebp>))(int, unsigned int, int);
signed int __stdcall sub_404CB0(int a1, int a2, int a3);
signed int __thiscall sub_404E10(int this, BSTR *a2, BSTR bstrString);
int __thiscall sub_404F90(void *this, void *a2, int a3);
signed int __stdcall sub_405050(int a1, int a2);
int __thiscall sub_4050F0(int this, int a2);
int __thiscall sub_4051B0(int this, int a2);
signed int __thiscall sub_405250(int this, char a2);
signed int __stdcall sub_405320(int a1, int a2, int a3);
signed int __stdcall sub_4053C0(int a1, int a2, int a3);
signed int __thiscall sub_405460(void *this, int a2);
signed int __stdcall sub_4063B0(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4);
signed int __thiscall sub_406470(void *this, int *a2);
signed int __stdcall sub_406B20(int a1, int a2, int a3);
signed int __stdcall sub_406BF0(const WCHAR *lpWideCharStr, int a2);
signed int __stdcall sub_406CE0(const char *a1);
char __stdcall sub_406DC0(const char *a1, void *a2);
signed int __stdcall sub_406F80(int a1, int a2);
signed int __thiscall sub_407070(void *this, char a2, int a3);
void *__thiscall sub_407220(void *this, int a2);
void *__thiscall sub_407270(void *this, char a2);
int __thiscall sub_4073E0(int this);
bool __thiscall sub_4074F0(int this);
int __thiscall sub_407530(int this);
int __thiscall sub_4075B0(void *this, int a2);
int __thiscall sub_407990(void *this, int a2);
int __thiscall sub_4079C0(void *this, int a2);
int __stdcall loc_407D6D(int); // weak
// int (__stdcall *__usercall sub_407DC4<eax>(int a1<ebp>))(int);
int __thiscall sub_407F60(int this);
int __stdcall sub_407F80(int a1);
int __thiscall sub_408010(int this);
int __stdcall sub_408030(int a1);
signed int __thiscall sub_4080C0(void *this, char a2);
int __thiscall sub_408160(int this, int a2, int a3);
int __stdcall loc_408308(int, int); // weak
// int (__stdcall *__usercall sub_408329<eax>(int a1<ebp>))(int, int);
signed int __thiscall sub_4083D0(int this, char a2);
signed int __thiscall sub_4084F0(int this);
signed int __thiscall sub_408560(int this);
signed int __thiscall sub_4085E0(int this);
signed int __thiscall sub_4086D0(int this, int a2);
void *__thiscall sub_408750(void *this);
void *__thiscall sub_4087E0(void *this, char a2);
int __thiscall sub_408810(void *this);
char __thiscall sub_408880(int this);
signed int __thiscall sub_4088B0(void *this);
int __thiscall sub_408BB0(void *this, char a2);
void __thiscall sub_408C30(int this);
signed int __thiscall sub_408CC0(int this, int a2);
void *__thiscall sub_408E60(void *this, char a2);
void *__thiscall sub_408E90(void *this, char a2, char a3, int a4, int a5);
int __thiscall sub_408FA0(void *this, int a2);
void *__cdecl sub_408FD0();
int (**__cdecl sub_408FF0())();
int __thiscall sub_409010(void *this);
signed int __thiscall sub_409170(void *this);
int __thiscall sub_4092B0(void *this, int a2);
int __thiscall sub_4092F0(int this);
void *__thiscall sub_409320(void *this, char a2);
signed int __thiscall sub_409340(int this);
int __thiscall sub_4093D0(void *this, const void *a2, unsigned int a3, void *a4, int a5, const BYTE *pbData);
int __thiscall sub_409660(void *this, const char *a2, int a3, int a4, const BYTE *pbData);
int __thiscall sub_409890(void *this, const WCHAR *Str, int a3, const WCHAR *a4);
int __thiscall sub_409920(void *this, signed int lpFileName, void *a3, int a4, const BYTE *pbData);
signed int __thiscall sub_409A40(int this);
// int (*__usercall sub_409BFE<eax>(int a1<ebp>))();
int sub_409C0A(); // weak
int __thiscall sub_409CB0(void *this, LPCSTR lpFileName, const char *a3, int a4, const BYTE *pbData);
int __stdcall loc_409DD4(LPCSTR lpFileName, int, int, int pbData); // weak
// int (__stdcall *__usercall sub_409DEA<eax>(int a1<ebp>))(LPCSTR, int, int, int);
int __thiscall sub_409E00(HCRYPTHASH this, const BYTE *pbData, HCRYPTKEY *phKey);
signed int __thiscall sub_409EA0(void *this, const void **a2, int a3, HCRYPTKEY *phKey);
signed int __thiscall sub_409F60(int this, HCRYPTKEY *phKey, void **a3, int a4);
void *__thiscall sub_40A0A0(void *this, char a2);
void __thiscall sub_40A0C0(void *this);
signed int __cdecl sub_40A0D0(BSTR lpWideCharStr, int a2, int *a3);
int __cdecl sub_40A120(LPCSTR lpMultiByteStr, UINT cbMultiByte, int); // idb
void *__thiscall sub_40A170(void *this, char a2);
void __thiscall sub_40A190(void *this);
int __cdecl sub_40A1A0();
int __thiscall sub_40A1F0(int this);
void *__thiscall sub_40A250(void *this, char a2);
int __thiscall sub_40A270(int this);
char __thiscall sub_40A390(int this, signed int a2, int a3);
char __thiscall sub_40A4C0(void *this);
char __thiscall sub_40A530(int this);
char __thiscall sub_40A540(int this);
char __thiscall sub_40A550(int this);
char __thiscall sub_40A580(int this, int a2);
char __thiscall sub_40A5B0(int this, int a2, signed int a3);
char __thiscall sub_40A6B0(int this, int a2);
int __thiscall sub_40AA30(int this, signed int a2);
char __thiscall sub_40ACF0(int this, int a2);
char __thiscall sub_40AD90(int this, int a2);
char __thiscall sub_40AED0(int this);
char __thiscall sub_40AF30(int this, int a2);
int unknown_libname_8(); // weak
int unknown_libname_9(); // weak
int unknown_libname_10(); // weak
int unknown_libname_12(); // weak
void *__thiscall sub_40B100(void *this, char a2);
void __thiscall sub_40B120(void *this);
DWORD __cdecl sub_40B1E0(signed int lpFileName, int a2);
// void __usercall sub_40B3B5(int a1<ebp>);
DWORD __cdecl sub_40B3E0(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, HANDLE hObject, DWORD dwCreationDisposition);
// void __cdecl operator delete(void *); idb
// int __thiscall CDialog__DoModal(_DWORD); weak
// int __thiscall CWinApp__Enable3dControls(_DWORD); weak
// int __cdecl AfxEnableControlContainer(_DWORD); weak
// int __thiscall CString___CString(_DWORD); weak
// int __thiscall CString__operator_(_DWORD, _DWORD); weak
// int __thiscall CString__CString(_DWORD); weak
// int __thiscall CDialog__OnOK(_DWORD); weak
// int CDialog__OnInitDialog(void); weak
// int __stdcall CDialog__CDialog(_DWORD, _DWORD); weak
// int __thiscall CDialog___CDialog(_DWORD); weak
// int __thiscall CButton___CButton(_DWORD); weak
// int __thiscall CEdit___CEdit(_DWORD); weak
// int __thiscall CProgressCtrl___CProgressCtrl(_DWORD); weak
// int __thiscall CComboBox___CComboBox(_DWORD); weak
// struct HINSTANCE__ *__stdcall AfxFindResourceHandle(const char *, const char *); idb
// int AfxGetModuleState(void); weak
// int __thiscall CWnd__CWnd(_DWORD); weak
// int __stdcall DDX_Control(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CWnd__UpdateData(_DWORD, _DWORD); weak
// int __thiscall CString__CString(_DWORD, _DWORD); weak
// int CString__Format(_DWORD, const char *, ...); weak
// int __thiscall CString__MakeUpper(_DWORD); weak
// int __thiscall CString__operator_(_DWORD, _DWORD); weak
// int __thiscall CString__CString(_DWORD, _DWORD); weak
// int __thiscall CString__LoadStringA(_DWORD, _DWORD); weak
// int __stdcall CMenu__FromHandle(_DWORD); weak
// int __thiscall CWnd__GetDlgItem(_DWORD, _DWORD); weak
// int __thiscall CString__Find(_DWORD, _DWORD); weak
// int __thiscall CString__Left(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CString__FreeExtra(_DWORD); weak
// int __thiscall COleSafeArray__Detach(_DWORD, _DWORD); weak
// int __thiscall COleSafeArray__UnaccessData(_DWORD); weak
// int __fastcall CString__operator__(_DWORD, _DWORD, _DWORD); weak
// int __thiscall COleSafeArray__GetOneDimSize(_DWORD); weak
// int __thiscall COleSafeArray__AccessData(_DWORD, _DWORD); weak
// int __thiscall COleSafeArray__Attach(_DWORD, _DWORD); weak
// int __thiscall CString__AllocSysString(_DWORD); weak
// int __stdcall AfxSafeArrayInit(_DWORD); weak
// int __thiscall CWnd__Default(_DWORD); weak
// int __thiscall CPaintDC___CPaintDC(_DWORD); weak
// int __thiscall CPaintDC__CPaintDC(_DWORD, _DWORD); weak
// int __thiscall CWnd__ShowWindow(_DWORD, _DWORD); weak
// int __thiscall CWnd__SetWindowTextA(_DWORD, _DWORD); weak
// int __thiscall CString__operator__(_DWORD, _DWORD); weak
// int __stdcall operator_(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CWnd__GetWindowTextA(_DWORD, _DWORD); weak
// int __stdcall operator_(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CString__Empty(_DWORD); weak
// int __thiscall CProgressCtrl__GetRange(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CFile___CFile(_DWORD); weak
// int __thiscall CWnd__EnableWindow(_DWORD, _DWORD); weak
// int __thiscall CComboBox__GetLBText(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CPtrList__CPtrList(_DWORD, _DWORD); weak
// int __thiscall CPtrList__AddTail(_DWORD, _DWORD); weak
// int __thiscall CString__ReleaseBuffer(_DWORD, _DWORD); weak
// int __thiscall CString__GetBuffer(_DWORD, _DWORD); weak
// void *__cdecl operator new(unsigned int); idb
// int __thiscall CString__operator_(_DWORD, _DWORD); weak
// void __stdcall AfxVariantInit(struct tagVARIANT *); idb
// int __thiscall CString__CString(_DWORD, _DWORD); weak
// int __thiscall CByteArray___CByteArray(_DWORD); weak
// int __thiscall CByteArray__SetAtGrow(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CByteArray__RemoveAt(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CByteArray__SetSize(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CByteArray__CByteArray(_DWORD); weak
// int __fastcall CString__Mid(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int __stdcall DDX_Text(_DWORD, _DWORD, _DWORD); weak
// int __stdcall AfxMessageBox(const char *, unsigned int, unsigned int); idb
// int __thiscall CString__FindOneOf(_DWORD, _DWORD); weak
// int __cdecl atexit(void (__cdecl *)());
// int _CxxFrameHandler(void); weak
// _DWORD __stdcall _eh_vector_constructor_iterator_(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// _DWORD __stdcall _eh_vector_destructor_iterator_(_DWORD, _DWORD, _DWORD, _DWORD); weak
// int __usercall sub_40BC18<eax>(int a1<ebp>);
// void __usercall sub_40BC2C(int a1<ebp>);
void *__thiscall sub_40BC43(void *this, char a2);
// int __stdcall CxxThrowException(_DWORD, _DWORD); weak
// int sprintf(char *Dest, const char *Format, ...);
// size_t __cdecl strftime(char *Buf, size_t SizeInBytes, const char *Format, const struct tm *Tm);
// struct tm *__cdecl localtime(const time_t *Time);
// time_t __cdecl time(time_t *Time);
// int __cdecl XcptFilter(_DWORD, _DWORD); weak
// int type_info___type_info(void); weak
void __stdcall sub_40BE24(int a1);
int __cdecl sub_40BE93(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7);
int __cdecl sub_40BECF(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7, void **a8);
int __cdecl sub_40C3B4(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7);
int __cdecl sub_40C4DC();
int __cdecl sub_40C4E6();
int __cdecl sub_40C504();
BSTR __stdcall sub_40C51A(LPCSTR lpMultiByteStr);
void *__stdcall sub_40C58F(LPCWSTR Str);
int __thiscall sub_40C603(int this, int a2, __int16 a3);
void __cdecl sub_40C65F(int a1, int a2);
int __thiscall sub_40C683(int this, int a2, int a3, char a4);
void *__thiscall sub_40C6B5(void *this, char a2);
int __thiscall sub_40C6D1(int this, int a2);
HLOCAL __thiscall sub_40C6FE(int this);
// size_t __cdecl wcslen(const wchar_t *Str);
// int __stdcall AfxInitialize(int, unsigned __int32); idb
int __cdecl sub_40C793();
// int __usercall sub_40E420<eax>(int a1<ebp>);
int __cdecl SEH_401740();
// int __usercall sub_40E440<eax>(int a1<ebp>);
// int __usercall sub_40E44B<eax>(int a1<ebp>);
// int __usercall sub_40E456<eax>(int a1<ebp>);
int __cdecl SEH_401800();
// int __usercall sub_40E480<eax>(int a1<ebp>);
// int __usercall sub_40E48B<eax>(int a1<ebp>);
// int __usercall sub_40E496<eax>(int a1<ebp>);
int __cdecl SEH_401910();
// int __usercall sub_40E4C0<eax>(int a1<ebp>);
// int __usercall sub_40E4C8<eax>(int a1<ebp>);
// int __usercall sub_40E4D3<eax>(int a1<ebp>);
// int __usercall sub_40E4E1<eax>(int a1<ebp>);
// int __usercall sub_40E4EF<eax>(int a1<ebp>);
// int __usercall sub_40E4FD<eax>(int a1<ebp>);
// int __usercall sub_40E50B<eax>(int a1<ebp>);
// int __usercall sub_40E519<eax>(int a1<ebp>);
// int __usercall sub_40E527<eax>(int a1<ebp>);
// int __usercall sub_40E535<eax>(int a1<ebp>);
// int __usercall sub_40E543<eax>(int a1<ebp>);
// int __usercall sub_40E551<eax>(int a1<ebp>);
// int __usercall sub_40E55F<eax>(int a1<ebp>);
// int __usercall sub_40E56D<eax>(int a1<ebp>);
// int __usercall sub_40E57B<eax>(int a1<ebp>);
// int __usercall sub_40E589<eax>(int a1<ebp>);
int __cdecl SEH_401AC0();
// int __usercall sub_40E5E0<eax>(int a1<ebp>);
// int __usercall sub_40E5E8<eax>(int a1<ebp>);
// int __usercall sub_40E5F3<eax>(int a1<ebp>);
// int __usercall sub_40E601<eax>(int a1<ebp>);
// int __usercall sub_40E60F<eax>(int a1<ebp>);
// int __usercall sub_40E61D<eax>(int a1<ebp>);
// int __usercall sub_40E62B<eax>(int a1<ebp>);
void __cdecl sub_40E639();
// int __usercall sub_40E647<eax>(int a1<ebp>);
// int __usercall sub_40E655<eax>(int a1<ebp>);
// int __usercall sub_40E663<eax>(int a1<ebp>);
// int __usercall sub_40E671<eax>(int a1<ebp>);
// int __usercall sub_40E67F<eax>(int a1<ebp>);
// int __usercall sub_40E68D<eax>(int a1<ebp>);
// int __usercall sub_40E69B<eax>(int a1<ebp>);
// int __usercall sub_40E6A9<eax>(int a1<ebp>);
int __cdecl SEH_401D50();
// int __usercall sub_40E700<eax>(int a1<ebp>);
// int __usercall sub_40E708<eax>(int a1<ebp>);
// int __usercall sub_40E710<eax>(int a1<ebp>);
int __cdecl SEH_401FF0();
// int __usercall sub_40E730<eax>(int a1<ebp>);
// int __usercall sub_40E73C<eax>(int a1<ebp>);
// int __usercall sub_40E747<eax>(int a1<ebp>);
int sub_40E752(); // weak
// int __usercall sub_40E770<eax>(int a1<ebp>);
// int __usercall sub_40E77B<eax>(int a1<ebp>);
// int __usercall sub_40E786<eax>(int a1<ebp>);
// int __usercall sub_40E791<eax>(int a1<ebp>);
// int __usercall sub_40E7C0<eax>(int a1<ebp>);
// HRESULT __usercall sub_40E7C8<eax>(int a1<ebp>);
// int __usercall sub_40E7D0<eax>(int a1<ebp>);
int __cdecl SEH_402840();
// int __usercall sub_40E800<eax>(int a1<ebp>);
int __cdecl SEH_402A00();
// int __usercall sub_40E820<eax>(int a1<ebp>);
// int __usercall sub_40E828<eax>(int a1<ebp>);
int __cdecl SEH_402CC0();
// int __usercall sub_40E840<eax>(int a1<ebp>);
// int __usercall sub_40E848<eax>(int a1<ebp>);
// int __usercall sub_40E850<eax>(int a1<ebp>);
// int __usercall sub_40E858<eax>(int a1<ebp>);
// int __usercall sub_40E860<eax>(int a1<ebp>);
// int __usercall sub_40E868<eax>(int a1<ebp>);
int __cdecl SEH_402DA0();
// int __usercall sub_40E890<eax>(int a1<ebp>);
// int __usercall sub_40E898<eax>(int a1<ebp>);
// int __usercall sub_40E8A0<eax>(int a1<ebp>);
// int __usercall sub_40E8A8<eax>(int a1<ebp>);
// int __usercall sub_40E8B0<eax>(int a1<ebp>);
// int __usercall sub_40E8B8<eax>(int a1<ebp>);
// int __usercall sub_40E8C0<eax>(int a1<ebp>);
// int __usercall sub_40E8C8<eax>(int a1<ebp>);
// int __usercall sub_40E8D0<eax>(int a1<ebp>);
int __cdecl SEH_402F20();
// int __usercall sub_40E900<eax>(int a1<ebp>);
// int __usercall sub_40E90B<eax>(int a1<ebp>);
// void __usercall sub_40E913(int a1<ebp>);
// int __usercall sub_40E91E<eax>(int a1<ebp>);
// int __usercall sub_40E929<eax>(int a1<ebp>);
// int __usercall sub_40E934<eax>(int a1<ebp>);
// int __usercall sub_40E93F<eax>(int a1<ebp>);
// int __usercall sub_40E94A<eax>(int a1<ebp>);
// int __usercall sub_40E955<eax>(int a1<ebp>);
// int __usercall sub_40E960<eax>(int a1<ebp>);
// int __usercall sub_40E96B<eax>(int a1<ebp>);
// int __usercall sub_40E976<eax>(int a1<ebp>);
void __cdecl sub_40E981();
void __cdecl sub_40E9C0();
int __cdecl SEH_403C40();
// int __usercall sub_40E9E0<eax>(int a1<ebp>);
// int __usercall sub_40E9E8<eax>(int a1<ebp>);
int __cdecl SEH_403CB0();
// int __usercall sub_40EA00<eax>(int a1<ebp>);
int __cdecl SEH_403F10();
// int __usercall sub_40EA20<eax>(int a1<ebp>);
// int __usercall sub_40EA2B<eax>(int a1<ebp>);
// int __usercall sub_40EA36<eax>(int a1<ebp>);
// int __usercall sub_40EA41<eax>(int a1<ebp>);
// int __usercall sub_40EA49<eax>(int a1<ebp>);
// int __usercall sub_40EA54<eax>(int a1<ebp>);
// int __usercall sub_40EA5C<eax>(int a1<ebp>);
// int __usercall sub_40EA64<eax>(int a1<ebp>);
int __cdecl SEH_4040E0();
// int __usercall sub_40EA90<eax>(int a1<ebp>);
// int __usercall sub_40EA98<eax>(int a1<ebp>);
// int __usercall sub_40EAA3<eax>(int a1<ebp>);
int __cdecl SEH_4042F0();
// int __usercall sub_40EAD0<eax>(int a1<ebp>);
// int __usercall sub_40EADB<eax>(int a1<ebp>);
// int __usercall sub_40EAE6<eax>(int a1<ebp>);
// int __usercall sub_40EAF1<eax>(int a1<ebp>);
// int __usercall sub_40EAFC<eax>(int a1<ebp>);
int __cdecl SEH_404480();
// int __usercall sub_40EB30<eax>(int a1<ebp>);
// int __usercall sub_40EB3B<eax>(int a1<ebp>);
// int __usercall sub_40EB46<eax>(int a1<ebp>);
// int __usercall sub_40EB51<eax>(int a1<ebp>);
// int __usercall sub_40EB5C<eax>(int a1<ebp>);
int __cdecl SEH_4045E0();
// int __usercall sub_40EB90<eax>(int a1<ebp>);
// int __usercall sub_40EB98<eax>(int a1<ebp>);
// void __usercall sub_40EBA0(int a1<ebp>);
int __cdecl SEH_4046C0();
// int __usercall sub_40EBC0<eax>(int a1<ebp>);
// int __usercall sub_40EBC8<eax>(int a1<ebp>);
// HRESULT __usercall sub_40EBD0<eax>(int a1<ebp>);
int __cdecl SEH_404CB0();
void __cdecl sub_40EBF0();
// int __usercall sub_40EBF8<eax>(int a1<ebp>);
// int __usercall sub_40EC00<eax>(int a1<ebp>);
int __cdecl SEH_404E10();
void __cdecl sub_40EC20();
int __cdecl SEH_404F90();
void __cdecl sub_40EC40();
int __cdecl SEH_405050();
// int __usercall sub_40EC60<eax>(int a1<ebp>);
// int __usercall sub_40EC68<eax>(int a1<ebp>);
int __cdecl SEH_4050F0();
// int __usercall sub_40ECA0<eax>(int a1<ebp>);
// int __usercall sub_40ECA8<eax>(int a1<ebp>);
int __cdecl SEH_4051B0();
// int __usercall sub_40ECE0<eax>(int a1<ebp>);
int __cdecl SEH_405250();
void __cdecl sub_40ED00();
int __cdecl SEH_405320();
void __cdecl sub_40ED20();
int __cdecl SEH_4053C0();
void __cdecl sub_40ED40();
// int __usercall sub_40ED48<eax>(int a1<ebp>);
void __cdecl sub_40ED50();
// int __usercall sub_40ED58<eax>(int a1<ebp>);
// int __usercall sub_40ED63<eax>(int a1<ebp>);
// int __usercall sub_40ED6B<eax>(int a1<ebp>);
int __cdecl SEH_405460();
void __cdecl sub_40ED90();
// int __usercall sub_40ED98<eax>(int a1<ebp>);
int __cdecl SEH_406470();
void __cdecl sub_40EDB0();
int __cdecl SEH_406B20();
// int __usercall sub_40EDD0<eax>(int a1<ebp>);
// int __usercall sub_40EDD8<eax>(int a1<ebp>);
int __cdecl SEH_406F80();
// int __usercall sub_40EDF0<eax>(int a1<ebp>);
// int __usercall sub_40EDF8<eax>(int a1<ebp>);
// int __usercall sub_40EE00<eax>(int a1<ebp>);
// int __usercall sub_40EE08<eax>(int a1<ebp>);
int __cdecl SEH_407070();
// int __usercall sub_40EE30<eax>(int this<ecx>, int a2<ebp>);
// int __usercall sub_40EE38<eax>(int a1<ebp>);
// int __usercall sub_40EE43<eax>(int a1<ebp>);
void __cdecl sub_40EE4E();
// int __usercall sub_40EE59<eax>(int a1<ebp>);
// int __usercall sub_40EE64<eax>(int a1<ebp>);
int __cdecl strstreambuf__strstreambuf();
// int __usercall sub_40EE90<eax>(int this<ecx>, int a2<ebp>);
// int __usercall sub_40EE98<eax>(int a1<ebp>);
// int __usercall sub_40EEA3<eax>(int a1<ebp>);
void __cdecl sub_40EEAE();
// int __usercall sub_40EEB9<eax>(int a1<ebp>);
// int __usercall sub_40EEC4<eax>(int a1<ebp>);
int __cdecl SEH_4073E0();
void __cdecl sub_40EEF0();
// int __usercall sub_40EEF8<eax>(int a1<ebp>);
// signed int __usercall sub_40EF00<eax>(int this<ecx>, int a2<ebp>);
void __cdecl sub_40EF08();
// void __usercall sub_40EF10(int a1<ebp>);
// void __usercall sub_40EF1B(int a1<ebp>);
int __cdecl SEH_4079C0();
// int __usercall sub_40EF40<eax>(int a1<ebp>);
// int __usercall sub_40EF48<eax>(int a1<ebp>);
int __cdecl SEH_407F80();
// int __usercall sub_40EF80<eax>(int a1<ebp>);
// int __usercall sub_40EF88<eax>(int a1<ebp>);
int __cdecl SEH_408030();
// int __usercall sub_40EFC0<eax>(int a1<ebp>);
int __cdecl SEH_4080C0();
// void __usercall sub_40EFE0(int a1<ebp>);
void __cdecl sub_40EFEB();
// void __usercall sub_40EFF3(int a1<ebp>);
int __cdecl SEH_408160();
// int __usercall sub_40F020<eax>(int a1<ebp>);
int __cdecl SEH_4083D0();
// int __usercall sub_40F040<eax>(int a1<ebp>);
int __cdecl SEH_408750();
// int __usercall sub_40F060<eax>(int a1<ebp>);
int __cdecl SEH_408810();
// void __usercall sub_40F080(int a1<ebp>);
// int __usercall sub_40F08B<eax>(int a1<ebp>);
int __cdecl SEH_4088B0();
// int __usercall sub_40F0C0<eax>(int a1<ebp>);
int __cdecl SEH_408BB0();
// int __usercall sub_40F0E0<eax>(int a1<ebp>);
// int __usercall sub_40F0E8<eax>(int a1<ebp>);
// int __usercall sub_40F0F3<eax>(int a1<ebp>);
// int __usercall sub_40F0FE<eax>(int a1<ebp>);
// int __usercall sub_40F120<eax>(int a1<ebp>);
// int __usercall sub_40F128<eax>(int a1<ebp>);
// int __usercall sub_40F130<eax>(int a1<ebp>);
// int __usercall sub_40F138<eax>(int a1<ebp>);
// int __usercall sub_40F143<eax>(int a1<ebp>);
// int __usercall sub_40F14E<eax>(int a1<ebp>);
int __cdecl SEH_408E90();
// int __usercall sub_40F180<eax>(int a1<ebp>);
int __cdecl SEH_409010();
// int __usercall sub_40F1A0<eax>(int a1<ebp>);
int __cdecl SEH_409170();
int __cdecl SEH_4093D0();
int __cdecl SEH_409660();
int __cdecl SEH_409920();
int __cdecl SEH_409CB0();
// int __usercall sub_40F21B<eax>(int a1<ebp>);
void __cdecl sub_40F226();
void __cdecl sub_40F231();
// int __usercall sub_40F23C<eax>(int a1<ebp>);
int __cdecl SEH_40A1F0();
void __cdecl sub_40F26B();
void __cdecl sub_40F276();
void __cdecl sub_40F281();
int __cdecl SEH_40A270();
// int __usercall sub_40F2A0<eax>(int a1<ebp>);
// int __usercall sub_40F2C0<eax>(int a1<ebp>);
int __cdecl SEH_40A390();
// int __usercall sub_40F2E0<eax>(int a1<ebp>);
int __cdecl SEH_40A5B0();
void __cdecl sub_40F300();
void __cdecl sub_40F320();
void __cdecl sub_40F340();
void __cdecl sub_40F360();
void __cdecl sub_40F380();
void __cdecl sub_40F3A0();
void __cdecl sub_40F3C0();
void __cdecl sub_40F3E0();
int __cdecl SEH_40ACF0();
void __cdecl sub_40F400();
void __cdecl sub_40F420();
int __cdecl SEH_40B3E0();
// BOOL __stdcall CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash);
// BOOL __stdcall CryptDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey);
// BOOL __stdcall CryptDestroyHash(HCRYPTHASH hHash);
// BOOL __stdcall CryptExportKey(HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
// BOOL __stdcall CryptImportKey(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
// BOOL __stdcall CryptGetUserKey(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
// BOOL __stdcall CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
// BOOL __stdcall CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags);
// BOOL __stdcall CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags);
// BOOL __stdcall CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
// BOOL __stdcall CryptDecrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
// BOOL __stdcall CryptDestroyKey(HCRYPTKEY hKey);
// BOOL __stdcall CryptHashData(HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
// BOOL __stdcall ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
// BOOL __stdcall CloseHandle(HANDLE hObject);
// HANDLE __stdcall CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
// BOOL __stdcall WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
// int __stdcall lstrlenW(LPCWSTR lpString);
// int __stdcall MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
// LONG __stdcall InterlockedDecrement(volatile LONG *lpAddend);
// int __stdcall WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
// DWORD __stdcall GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
// DWORD __stdcall GetLastError();
// HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName);
// int __stdcall lstrlenA(LPCSTR lpString);
// HLOCAL __stdcall LocalFree(HLOCAL hMem);
// DWORD __stdcall GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
// BOOL __stdcall GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
// FARPROC __stdcall GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
// void __cdecl exit(int Code);
// int __cdecl mbscmp(_DWORD, _DWORD); weak
// char *__cdecl itoa(int Val, char *DstBuf, int Radix);
// int __cdecl mbsicmp(_DWORD, _DWORD); weak
// char *__cdecl strncpy(char *Dest, const char *Source, size_t Count);
// int __cdecl isdigit(int C);
// int __cdecl toupper(int C);
// int __cdecl isalnum(int C);
// BSTR __stdcall SysAllocString(const OLECHAR *psz);
// HRESULT __stdcall CreateErrorInfo(ICreateErrorInfo **pperrinfo);
// HRESULT __stdcall VariantChangeType(VARIANTARG *pvargDest, const VARIANTARG *pvarSrc, USHORT wFlags, VARTYPE vt);
// HRESULT __stdcall SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo);
// HRESULT __stdcall VariantClear(VARIANTARG *pvarg);
// SAFEARRAY *__stdcall SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements);
// BSTR __stdcall SysAllocStringLen(const OLECHAR *strIn, UINT ui);
// UINT __stdcall SysStringLen(BSTR);
// void __stdcall VariantInit(VARIANTARG *pvarg);
// HRESULT __stdcall SafeArrayDestroy(SAFEARRAY *psa);
// HRESULT __stdcall SafeArrayAccessData(SAFEARRAY *psa, void **ppvData);
// HRESULT __stdcall SafeArrayUnaccessData(SAFEARRAY *psa);
// void __stdcall SysFreeString(BSTR bstrString);
// int __thiscall CPortManager__ListDevices(_DWORD, _DWORD, _DWORD); weak
// int __thiscall CPortManager__CPortManager(_DWORD); weak
// int __thiscall CPortManager___CPortManager(_DWORD); weak
// int __stdcall StrToIntA(_DWORD); weak
// BOOL __stdcall IsIconic(HWND hWnd);
// BOOL __stdcall UpdateWindow(HWND hWnd);
// BOOL __stdcall EnableWindow(HWND hWnd, BOOL bEnable);
// LRESULT __stdcall SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
// BOOL __stdcall AppendMenuA(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem);
// HMENU __stdcall GetSystemMenu(HWND hWnd, BOOL bRevert);
// HICON __stdcall LoadIconA(HINSTANCE hInstance, LPCSTR lpIconName);
// BOOL __stdcall DrawIcon(HDC hDC, int X, int Y, HICON hIcon);
// BOOL __stdcall GetClientRect(HWND hWnd, LPRECT lpRect);
// int __stdcall GetSystemMetrics(int nIndex);
// HRESULT __stdcall CoInitialize(LPVOID pvReserved);
// HRESULT __stdcall CoCreateInstance(const IID *const rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, const IID *const riid, LPVOID *ppv);
// void __stdcall CoUninitialize();


//----- (004015A0) --------------------------------------------------------
void *__cdecl sub_4015A0()
{
  return CWinApp__messageMap;
}
// 416AC0: using guessed type void *CWinApp__messageMap;

//----- (004015C0) --------------------------------------------------------
int (**__cdecl sub_4015C0())()
{
  return &off_411000;
}
// 411000: using guessed type int (*off_411000)();

//----- (00401670) --------------------------------------------------------
void *__thiscall sub_401670(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  j_j___1CWinApp();
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 401299: using guessed type int j_j_??1CWinApp(void);

//----- (00401740) --------------------------------------------------------
int __thiscall sub_401740(void *this)
{
  void *v2; // esi@1
  char v3; // [sp+4h] [bp-42Ch]@1
  int v4; // [sp+42Ch] [bp-4h]@1

  v2 = this;
  AfxEnableControlContainer(0);
  CWinApp__Enable3dControls(v2);
  sub_4010BE(0);
  v4 = 0;
  *((_DWORD *)v2 + 8) = &v3;
  CDialog__DoModal(&v3);
  v4 = -1;
  sub_4010AF(&v3);
  return 0;
}
// 4010AF: using guessed type int __thiscall sub_4010AF(_DWORD);
// 4010BE: using guessed type _DWORD __stdcall sub_4010BE(_DWORD);
// 40B5B0: using guessed type int __thiscall CDialog__DoModal(_DWORD);
// 40B5B6: using guessed type int __thiscall CWinApp__Enable3dControls(_DWORD);
// 40B5BC: using guessed type int __cdecl AfxEnableControlContainer(_DWORD);

//----- (00401800) --------------------------------------------------------
void *__thiscall sub_401800(void *this)
{
  void *v2; // esi@1
  int v3; // edi@1

  v2 = this;
  v3 = (int)((char *)this + 4);
  CString__CString((char *)this + 4);
  CString__CString((char *)v2 + 36);
  CString__CString((char *)v2 + 40);
  *(_DWORD *)v2 = &off_4111B0;
  CString__operator_(v3, "UNDEFINED");
  *((_DWORD *)v2 + 3) = 0;
  *((_DWORD *)v2 + 4) = 0;
  *((_DWORD *)v2 + 5) = 0;
  *((_DWORD *)v2 + 6) = 0;
  *((_DWORD *)v2 + 2) = 0;
  CString__operator_(v3, &unk_4159AC);
  CString__operator_((char *)v2 + 36, &unk_4159AC);
  *((_DWORD *)v2 + 7) = 0;
  *((_DWORD *)v2 + 8) = 0;
  CString__operator_((char *)v2 + 40, "NO-TYPE");
  return v2;
}
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 4111B0: using guessed type int (__stdcall *off_4111B0)();

//----- (004018E0) --------------------------------------------------------
void *__thiscall sub_4018E0(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_4011F4();
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 4011F4: using guessed type int sub_4011F4(void);

//----- (00401910) --------------------------------------------------------
int __thiscall sub_401910(int this)
{
  void *v1; // eax@1
  int v2; // esi@1

  v2 = this;
  *(_DWORD *)this = &off_4111B0;
  v1 = *(void **)(this + 28);
  if ( v1 )
  {
    operator delete(v1);
    *(_DWORD *)(v2 + 28) = 0;
  }
  if ( *(_DWORD *)(v2 + 32) )
  {
    operator delete(*(void **)(v2 + 32));
    *(_DWORD *)(v2 + 32) = 0;
  }
  CString___CString(v2 + 40);
  CString___CString(v2 + 36);
  return CString___CString(v2 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 4111B0: using guessed type int (__stdcall *off_4111B0)();

//----- (004019E0) --------------------------------------------------------
void *__thiscall sub_4019E0(void *this)
{
  void *v2; // esi@1

  v2 = this;
  CDialog__CDialog(100, 0);
  *(_DWORD *)v2 = off_411294;
  return v2;
}
// 40B694: using guessed type int __stdcall CDialog__CDialog(_DWORD, _DWORD);
// 411294: using guessed type int (*off_411294[5])();

//----- (00401A10) --------------------------------------------------------
void *__thiscall sub_401A10(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  j_j___1CDialog(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40119A: using guessed type int __thiscall j_j_??1CDialog(_DWORD);

//----- (00401A80) --------------------------------------------------------
void *__cdecl sub_401A80()
{
  return CDialog__messageMap;
}
// 4168F8: using guessed type void *CDialog__messageMap;

//----- (00401AA0) --------------------------------------------------------
int (**__cdecl sub_401AA0())()
{
  return &off_4111B8;
}
// 4111B8: using guessed type int (*off_4111B8)();

//----- (00401AC0) --------------------------------------------------------
void *__thiscall sub_401AC0(void *this, int a2)
{
  void *v3; // esi@1
  HINSTANCE v4; // eax@1

  v3 = this;
  CDialog__CDialog(102, a2);
  CWnd__CWnd((char *)v3 + 96);
  *((_DWORD *)v3 + 24) = off_411758;
  CWnd__CWnd((char *)v3 + 160);
  *((_DWORD *)v3 + 40) = off_411670;
  CWnd__CWnd((char *)v3 + 224);
  *((_DWORD *)v3 + 56) = off_411588;
  CWnd__CWnd((char *)v3 + 288);
  *((_DWORD *)v3 + 72) = off_41149C;
  CWnd__CWnd((char *)v3 + 352);
  *((_DWORD *)v3 + 88) = off_41149C;
  strstreambuf__strstreambuf((char *)v3 + 420);
  *((_DWORD *)v3 + 122) = 0;
  CString__CString((char *)v3 + 492);
  CString__CString((char *)v3 + 496);
  CString__CString((char *)v3 + 512);
  CString__CString((char *)v3 + 516);
  CString__CString((char *)v3 + 1040);
  CString__CString((char *)v3 + 1044);
  CString__CString((char *)v3 + 1048);
  CString__CString((char *)v3 + 1052);
  *(_DWORD *)v3 = off_411398;
  AfxGetModuleState();
  v4 = AfxFindResourceHandle((const char *)0x80, (const char *)0xE);
  *((_DWORD *)v3 + 104) = LoadIconA(v4, (LPCSTR)0x80);
  *((_BYTE *)v3 + 524) = 0;
  *((_DWORD *)v3 + 126) = 0;
  CString__operator_((char *)v3 + 496, &unk_4159AC);
  *((_DWORD *)v3 + 125) = 0;
  *((_DWORD *)v3 + 127) = 0;
  CString__operator_((char *)v3 + 512, &unk_4159AC);
  CString__operator_((char *)v3 + 516, "A6201");
  *((_DWORD *)v3 + 130) = -1;
  CString__operator_((char *)v3 + 492, &unk_4159AC);
  return v3;
}
// 401131: using guessed type int __thiscall strstreambuf__strstreambuf(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B694: using guessed type int __stdcall CDialog__CDialog(_DWORD, _DWORD);
// 40B718: using guessed type int AfxGetModuleState(void);
// 40B71E: using guessed type int __thiscall CWnd__CWnd(_DWORD);
// 411398: using guessed type int (*off_411398[5])();
// 41149C: using guessed type int (*off_41149C[5])();
// 411588: using guessed type int (*off_411588[5])();
// 411670: using guessed type int (*off_411670[5])();
// 411758: using guessed type int (*off_411758[5])();

//----- (00401D20) --------------------------------------------------------
void *__thiscall sub_401D20(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_4010AF(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 4010AF: using guessed type int __thiscall sub_4010AF(_DWORD);

//----- (00401D50) --------------------------------------------------------
int __thiscall sub_401D50(int this)
{
  int v1; // eax@1
  int v2; // esi@1
  int v3; // eax@4
  int v4; // eax@7

  v2 = this;
  *(_DWORD *)this = off_411398;
  v1 = *(_DWORD *)(this + 488);
  if ( v1 )
  {
    if ( v1 )
    {
      *(_DWORD *)(this + 488) = 0;
      (*(void (__stdcall **)(int))(*(_DWORD *)v1 + 8))(v1);
    }
    v3 = *(_DWORD *)(v2 + 488);
    if ( v3 )
      (*(void (__stdcall **)(_DWORD))(*(_DWORD *)v3 + 8))(*(_DWORD *)(v2 + 488));
    *(_DWORD *)(v2 + 488) = 0;
  }
  CoUninitialize();
  CString___CString(v2 + 1052);
  CString___CString(v2 + 1048);
  CString___CString(v2 + 1044);
  CString___CString(v2 + 1040);
  CString___CString(v2 + 516);
  CString___CString(v2 + 512);
  CString___CString(v2 + 496);
  CString___CString(v2 + 492);
  v4 = *(_DWORD *)(v2 + 488);
  if ( v4 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v4 + 8))(v4);
  sub_4011A4(v2 + 420);
  CButton___CButton(v2 + 352);
  CButton___CButton(v2 + 288);
  CEdit___CEdit(v2 + 224);
  CProgressCtrl___CProgressCtrl(v2 + 160);
  CComboBox___CComboBox(v2 + 96);
  return CDialog___CDialog(v2);
}
// 4011A4: using guessed type int __thiscall sub_4011A4(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);
// 40B700: using guessed type int __thiscall CEdit___CEdit(_DWORD);
// 40B706: using guessed type int __thiscall CProgressCtrl___CProgressCtrl(_DWORD);
// 40B70C: using guessed type int __thiscall CComboBox___CComboBox(_DWORD);
// 411398: using guessed type int (*off_411398[5])();

//----- (00401F30) --------------------------------------------------------
int __thiscall sub_401F30(void *this, int a2)
{
  void *v3; // esi@1

  v3 = this;
  DDX_Control(a2, 1008, (char *)this + 96);
  DDX_Control(a2, 1002, (char *)v3 + 160);
  DDX_Control(a2, 1001, (char *)v3 + 224);
  DDX_Control(a2, 1, (char *)v3 + 288);
  return DDX_Control(a2, 2, (char *)v3 + 352);
}
// 40B724: using guessed type int __stdcall DDX_Control(_DWORD, _DWORD, _DWORD);

//----- (00401FB0) --------------------------------------------------------
void *__cdecl sub_401FB0()
{
  return CDialog__messageMap;
}
// 4168F8: using guessed type void *CDialog__messageMap;

//----- (00401FD0) --------------------------------------------------------
int (**__cdecl sub_401FD0())()
{
  return &off_4111D8;
}
// 4111D8: using guessed type int (*off_4111D8)();

//----- (00401FF0) --------------------------------------------------------
signed int __thiscall sub_401FF0(void *this)
{
  int v1; // edi@1
  void *v2; // esi@1
  HMENU v3; // eax@1
  int v4; // eax@5
  int v6; // [sp-4h] [bp-28h]@7
  LPCSTR lpNewItem; // [sp+Ch] [bp-18h]@2
  char v8; // [sp+10h] [bp-14h]@5
  char v9; // [sp+14h] [bp-10h]@5
  int v10; // [sp+20h] [bp-4h]@2

  v2 = this;
  CDialog__OnInitDialog();
  CoInitialize(0);
  v3 = GetSystemMenu(*((HWND *)v2 + 8), 0);
  v1 = CMenu__FromHandle(v3);
  if ( v1 )
  {
    CString__CString(&lpNewItem);
    v10 = 0;
    CString__LoadStringA(&lpNewItem, 101);
    if ( *((_DWORD *)lpNewItem - 2) )
    {
      ((void (__thiscall *)(LPCSTR, _DWORD, signed int, _DWORD, _DWORD))AppendMenuA)(
        lpNewItem,
        *(_DWORD *)(v1 + 4),
        2048,
        0,
        0);
      AppendMenuA(*(HMENU *)(v1 + 4), 0, 0x10u, lpNewItem);
    }
    v10 = -1;
    CString___CString(&lpNewItem);
  }
  SendMessageA(*((HWND *)v2 + 8), 128u, 1u, *((_DWORD *)v2 + 104));
  SendMessageA(*((HWND *)v2 + 8), 0x80u, 0, *((_DWORD *)v2 + 104));
  sub_40121C(v2);
  sub_4011F9(v2);
  CString__CString(&v8, "45FD565F-8FE6-4026-98B7-53AE90CB89D8-6C001007-f908990e67fd01de0dec04ba6423e86a23");
  v10 = 1;
  v4 = sub_40117C(&v9, &v8);
  LOBYTE(v10) = 2;
  CString__operator_((char *)v2 + 512, v4);
  LOBYTE(v10) = 1;
  CString___CString(&v9);
  CString__MakeUpper((char *)v2 + 512);
  if ( mbscmp(*((_DWORD *)v2 + 128), "UNLOCKD") )
  {
    *((_DWORD *)v2 + 127) = 1;
    sub_4010FF(v2);
    if ( *((_DWORD *)v2 + 130) != -1 )
    {
      v6 = *((_DWORD *)v2 + 130);
      CString__Format((char *)v2 + 492, "Updates pFuncRemNumOfExecutionsaining : %4.4d\r\n");
      lpNewItem = (LPCSTR)&v6;
      CString__CString(&v6, (char *)v2 + 492);
      sub_40104B(v6);
    }
  }
  else
  {
    *((_DWORD *)v2 + 127) = 0;
  }
  CWnd__UpdateData(v2, 0);
  v10 = -1;
  CString___CString(&v8);
  return 1;
}
// 40104B: using guessed type _DWORD __stdcall sub_40104B(char);
// 4010FF: using guessed type int __thiscall sub_4010FF(_DWORD);
// 40117C: using guessed type _DWORD __stdcall sub_40117C(_DWORD, _DWORD);
// 4011F9: using guessed type int __thiscall sub_4011F9(_DWORD);
// 40121C: using guessed type int __thiscall sub_40121C(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B5F2: using guessed type int CDialog__OnInitDialog(void);
// 40B72A: using guessed type int __thiscall CWnd__UpdateData(_DWORD, _DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B736: using guessed type int CString__Format(_DWORD, const char *, ...);
// 40B73C: using guessed type int __thiscall CString__MakeUpper(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B74E: using guessed type int __thiscall CString__LoadStringA(_DWORD, _DWORD);
// 40B754: using guessed type int __stdcall CMenu__FromHandle(_DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (00402220) --------------------------------------------------------
int __usercall sub_402220<eax>(int a1<eax>, int a2<ecx>)
{
  int v2; // esi@1
  void *v3; // esp@1
  int v4; // eax@8
  int v5; // ebx@8
  int v6; // edi@8
  LPARAM v7; // esi@10
  char *v8; // ebx@11
  WPARAM v9; // eax@12
  WPARAM v10; // eax@14
  LPARAM *v11; // ecx@15
  int v12; // ecx@16
  int v14; // [sp-16h] [bp-6944h]@16
  signed int v15; // [sp-12h] [bp-6940h]@16
  int v16; // [sp-Eh] [bp-693Ch]@16
  char v17; // [sp+9h] [bp-6925h]@1
  LPARAM lParam; // [sp+Ah] [bp-6924h]@10
  LPARAM v19; // [sp+Eh] [bp-6920h]@8
  char v20; // [sp+12h] [bp-691Ch]@7
  char v21; // [sp+11Eh] [bp-6810h]@7
  char v22; // [sp+19Eh] [bp-6790h]@11
  __int32 v23; // [sp+691Eh] [bp-10h]@8
  int v24; // [sp+6922h] [bp-Ch]@1
  int (*v25)(); // [sp+6926h] [bp-8h]@1
  int v26; // [sp+692Ah] [bp-4h]@1

  v26 = -1;
  v25 = sub_40E752;
  v24 = a1;
  v3 = alloca(26908);
  v2 = a2;
  v17 = 0;
  sub_4010D7();
  if ( !mbscmp(*(_DWORD *)(v2 + 1040), "WIN-XP") && mbscmp(*(_DWORD *)(v2 + 1052), "None")
    || !mbscmp(*(_DWORD *)(v2 + 1040), "WIN-2K")
    && CString__Find(v2 + 1052, "Service Pack 1") == -1
    && mbscmp(*(_DWORD *)(v2 + 1052), "None") )
    v17 = 1;
  CPortManager__CPortManager(&v20);
  v26 = 0;
  if ( CPortManager__ListDevices(&v20, &v21, 4) )
  {
    CString__CString(&lParam, "CCpFixDlg::InitializeCOMPorts( ): PortManager unable to retrieve port lists");
    v16 = 0;
    v15 = 1;
    v14 = v12;
    v19 = (LPARAM)&v14;
    LOBYTE(v26) = 2;
    CString__CString(&v14, &lParam);
    sub_401023(v14, v15, v16);
    LOBYTE(v26) = 0;
    v11 = &lParam;
LABEL_17:
    CString___CString(v11);
    goto LABEL_18;
  }
  v5 = v23;
  v19 = v23;
  v4 = CWnd__GetDlgItem(v2, 1008);
  v6 = v4;
  if ( v5 && v4 )
  {
    SendMessageA(*(HWND *)(v4 + 32), 331u, 0, 0);
    CString__CString(&lParam);
    v7 = 0;
    LOBYTE(v26) = 1;
    if ( v5 > 0 )
    {
      v8 = &v22;
      do
      {
        CString__operator_(&lParam, v8);
        v9 = SendMessageA(*(HWND *)(v6 + 32), 0x143u, 0, lParam);
        SendMessageA(*(HWND *)(v6 + 32), 0x151u, v9, v7++);
        v8 += 208;
      }
      while ( v7 < v19 );
    }
    if ( v17 )
    {
      v10 = SendMessageA(*(HWND *)(v6 + 32), 0x143u, 0, (LPARAM)"USB");
      SendMessageA(*(HWND *)(v6 + 32), 0x151u, v10, v7);
    }
    SendMessageA(*(HWND *)(v6 + 32), 0x14Eu, 0, 0);
    LOBYTE(v26) = 0;
    v11 = &lParam;
    goto LABEL_17;
  }
LABEL_18:
  v26 = -1;
  return CPortManager___CPortManager(&v20);
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 4010D7: using guessed type int sub_4010D7(void);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B75A: using guessed type int __thiscall CWnd__GetDlgItem(_DWORD, _DWORD);
// 40B760: using guessed type int __thiscall CString__Find(_DWORD, _DWORD);
// 40E752: using guessed type int sub_40E752();
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);
// 416CB4: using guessed type int __thiscall CPortManager__ListDevices(_DWORD, _DWORD, _DWORD);
// 416CB8: using guessed type int __thiscall CPortManager__CPortManager(_DWORD);
// 416CBC: using guessed type int __thiscall CPortManager___CPortManager(_DWORD);

//----- (004024D0) --------------------------------------------------------
int __thiscall sub_4024D0(void *this)
{
  void *v1; // esi@1
  int v2; // ecx@2
  int v3; // eax@17
  int v4; // eax@25
  int result; // eax@27
  int v6; // esi@27
  int v7; // eax@27
  int v8; // eax@27
  char v9; // bl@27
  int v10; // [sp-Ch] [bp-D8h]@2
  int v11; // [sp-8h] [bp-D4h]@2
  char v12[4]; // [sp-4h] [bp-D0h]@2
  char v13; // [sp+Ch] [bp-C0h]@2
  char v14; // [sp+10h] [bp-BCh]@27
  int *v15; // [sp+14h] [bp-B8h]@2
  char DstBuf; // [sp+18h] [bp-B4h]@17
  struct _OSVERSIONINFOA VersionInformation; // [sp+2Ch] [bp-A0h]@1
  int v18; // [sp+C8h] [bp-4h]@2

  v1 = this;
  VersionInformation.dwOSVersionInfoSize = 148;
  if ( !GetVersionExA(&VersionInformation) )
  {
    CString__CString(&v13, "Not able to get OS information");
    *(_DWORD *)v12 = 1;
    v11 = 0;
    v10 = v2;
    v15 = &v10;
    v18 = 0;
    CString__CString(&v10, &v13);
    sub_401023(v10, v11, *(_DWORD *)v12);
    v18 = -1;
    CString___CString(&v13);
  }
  if ( VersionInformation.dwPlatformId == 2 )
  {
    if ( VersionInformation.dwMajorVersion == 5 )
    {
      if ( VersionInformation.dwMinorVersion == 1 )
        *(_DWORD *)v12 = "WIN-XP";
      else
        *(_DWORD *)v12 = "WIN-2K";
    }
    else
    {
      *(_DWORD *)v12 = "WIN-NT";
    }
    CString__operator_((char *)v1 + 1040, *(_DWORD *)v12);
    if ( VersionInformation.dwMajorVersion == 3 || VersionInformation.dwMinorVersion == 51 )
    {
      *(_DWORD *)v12 = "3.51";
    }
    else
    {
      if ( VersionInformation.dwMajorVersion == 4 )
      {
        *(_DWORD *)v12 = "4.0";
      }
      else
      {
        if ( VersionInformation.dwMajorVersion != 5 )
        {
LABEL_17:
          itoa(VersionInformation.dwBuildNumber, &DstBuf, 10);
          v3 = CString__CString(&v13, &DstBuf);
          v18 = 1;
          CString__operator_((char *)v1 + 1048, v3);
          v18 = -1;
          CString___CString(&v13);
          goto LABEL_27;
        }
        *(_DWORD *)v12 = "5.0";
      }
    }
    CString__operator_((char *)v1 + 1044, *(_DWORD *)v12);
    goto LABEL_17;
  }
  if ( VersionInformation.dwPlatformId == 1 )
  {
    CString__operator_((char *)v1 + 1040, "WIN-95");
    if ( VersionInformation.dwMajorVersion == 4 )
    {
      if ( VersionInformation.dwMinorVersion )
      {
        if ( VersionInformation.dwMinorVersion >= 0x5A )
          *(_DWORD *)v12 = "WIN-ME";
        else
          *(_DWORD *)v12 = "WIN-98";
        CString__operator_((char *)v1 + 1040, *(_DWORD *)v12);
      }
    }
    itoa(LOBYTE(VersionInformation.dwBuildNumber), &DstBuf, 10);
    v4 = CString__CString(&v13, &DstBuf);
    v18 = 2;
    CString__operator_((char *)v1 + 1048, v4);
    v18 = -1;
    CString___CString(&v13);
  }
  else
  {
    CString__operator_((char *)v1 + 1040, "WIN-31");
  }
LABEL_27:
  v7 = CString__CString(&v13, VersionInformation.szCSDVersion);
  v6 = (int)((char *)v1 + 1052);
  v18 = 3;
  CString__operator_(v6, v7);
  v18 = -1;
  CString___CString(&v13);
  CString__FreeExtra(v6);
  v8 = CString__Left(v6, &v14, 7);
  v9 = mbscmp(*(_DWORD *)v8, "Service") != 0;
  result = CString___CString(&v14);
  if ( v9 )
    result = CString__operator_(v6, "None");
  return result;
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B766: using guessed type int __thiscall CString__Left(_DWORD, _DWORD, _DWORD);
// 40B76C: using guessed type int __thiscall CString__FreeExtra(_DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (004027F0) --------------------------------------------------------
bool __thiscall sub_4027F0(int this)
{
  return *(_DWORD *)(this + 488) || CoCreateInstance(&stru_4147F8, 0, 7u, &stru_414810, (LPVOID *)(this + 488)) >= 0;
}

//----- (00402840) --------------------------------------------------------
int __thiscall sub_402840(void *this, int a2, int *a3)
{
  void *v3; // esi@1
  int v4; // eax@1
  int v5; // eax@2
  int v6; // edx@2
  int v7; // edi@2
  unsigned int v8; // esi@2
  int v9; // ecx@5
  int v11; // [sp-8h] [bp-60h]@5
  int v12; // [sp-4h] [bp-5Ch]@5
  signed int v13; // [sp+0h] [bp-58h]@5
  char v14; // [sp+Ch] [bp-4Ch]@1
  int v15; // [sp+10h] [bp-48h]@1
  char v16; // [sp+14h] [bp-44h]@1
  char v17; // [sp+24h] [bp-34h]@4
  VARIANTARG pvarg; // [sp+34h] [bp-24h]@1
  int v19; // [sp+54h] [bp-4h]@1

  v3 = this;
  v15 = 0;
  CString__CString(&v14, &unk_4159AC);
  v19 = 1;
  AfxSafeArrayInit(&pvarg);
  pvarg.vt = 0;
  LOBYTE(v19) = 2;
  v4 = CString__AllocSysString(a3);
  if ( (*(int (__stdcall **)(_DWORD, int, char *))(**((_DWORD **)v3 + 122) + 28))(*((_DWORD *)v3 + 122), v4, &v16) )
  {
    CString__operator_(
      (char *)v3 + 492,
      "CCpFixDlg::DecryptStopCopyAuthString(): Failed on pPtrDigitalSigner->decryptKey( )");
    v13 = 1;
    v12 = 0;
    v11 = v9;
    a3 = &v11;
    CString__CString(&v11, (char *)v3 + 492);
    sub_401023(v11, v12, v13);
  }
  else
  {
    COleSafeArray__Attach(&pvarg, &v16);
    COleSafeArray__AccessData(&pvarg, &a3);
    v7 = COleSafeArray__GetOneDimSize(&pvarg);
    v5 = CString__operator_(&v14, &unk_4159AC);
    v8 = 0;
    if ( v7 )
    {
      do
      {
        LOBYTE(v5) = *((_BYTE *)a3 + v8);
        v5 = CString__operator__(&v14, a3, v5);
        ++v8;
      }
      while ( v8 < v7 );
    }
    CString__operator__(&v14, v6, 0);
    COleSafeArray__UnaccessData(&pvarg);
    COleSafeArray__Detach(&pvarg, &v17);
  }
  CString__CString(a2, &v14);
  v15 = 1;
  VariantClear(&pvarg);
  LOBYTE(v19) = 0;
  CString___CString(&v14);
  return a2;
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B772: using guessed type int __thiscall COleSafeArray__Detach(_DWORD, _DWORD);
// 40B778: using guessed type int __thiscall COleSafeArray__UnaccessData(_DWORD);
// 40B77E: using guessed type int __fastcall CString__operator__(_DWORD, _DWORD, _DWORD);
// 40B784: using guessed type int __thiscall COleSafeArray__GetOneDimSize(_DWORD);
// 40B78A: using guessed type int __thiscall COleSafeArray__AccessData(_DWORD, _DWORD);
// 40B790: using guessed type int __thiscall COleSafeArray__Attach(_DWORD, _DWORD);
// 40B796: using guessed type int __thiscall CString__AllocSysString(_DWORD);
// 40B79C: using guessed type int __stdcall AfxSafeArrayInit(_DWORD);

//----- (00402A00) --------------------------------------------------------
int __thiscall sub_402A00(void *this, __int16 a2, int a3)
{
  int result; // eax@2
  char v4; // [sp+0h] [bp-6Ch]@2
  int v5; // [sp+68h] [bp-4h]@2

  if ( (unsigned __int16)(a2 & 0xFFF0) == 16 )
  {
    sub_4010A5(&v4);
    v5 = 0;
    CDialog__DoModal(&v4);
    v5 = -1;
    result = CDialog___CDialog(&v4);
  }
  else
  {
    result = CWnd__Default(this);
  }
  return result;
}
// 4010A5: using guessed type int __thiscall sub_4010A5(_DWORD);
// 40B5B0: using guessed type int __thiscall CDialog__DoModal(_DWORD);
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);
// 40B7A2: using guessed type int __thiscall CWnd__Default(_DWORD);

//----- (00402AA0) --------------------------------------------------------
int __thiscall sub_402AA0(int this)
{
  int v1; // esi@1
  int result; // eax@2
  int v3; // ebx@2
  int v4; // edi@2
  struct tagRECT Rect; // [sp+4h] [bp-64h]@2
  char v6; // [sp+14h] [bp-54h]@2
  HDC hDC; // [sp+18h] [bp-50h]@2

  v1 = this;
  if ( IsIconic(*(HWND *)(this + 32)) )
  {
    CPaintDC__CPaintDC(&v6, v1);
    SendMessageA(*(HWND *)(v1 + 32), 0x27u, &v6 != 0 ? (int)hDC : 0, 0);
    v3 = GetSystemMetrics(11);
    v4 = GetSystemMetrics(12);
    GetClientRect(*(HWND *)(v1 + 32), &Rect);
    DrawIcon(hDC, (Rect.right - Rect.left - v3 + 1) / 2, (Rect.bottom - Rect.top - v4 + 1) / 2, *(HICON *)(v1 + 416));
    result = CPaintDC___CPaintDC(&v6);
  }
  else
  {
    result = CWnd__Default(v1);
  }
  return result;
}
// 40B7A2: using guessed type int __thiscall CWnd__Default(_DWORD);
// 40B7A8: using guessed type int __thiscall CPaintDC___CPaintDC(_DWORD);
// 40B7AE: using guessed type int __thiscall CPaintDC__CPaintDC(_DWORD, _DWORD);

//----- (00402BB0) --------------------------------------------------------
int __thiscall sub_402BB0(int this)
{
  return *(_DWORD *)(this + 416);
}

//----- (00402BD0) --------------------------------------------------------
int __thiscall sub_402BD0(void *this)
{
  void *v2; // esi@1
  int v3; // edi@1

  v2 = this;
  v3 = (int)((char *)this + 352);
  CWnd__ShowWindow((char *)this + 352, 0);
  CWnd__ShowWindow((char *)v2 + 288, 0);
  sub_401113(v2);
  sub_40124E(v2);
  CWnd__ShowWindow(v3, 5);
  return CWnd__ShowWindow((char *)v2 + 288, 5);
}
// 401113: using guessed type int __thiscall sub_401113(_DWORD);
// 40124E: using guessed type int __thiscall sub_40124E(_DWORD);
// 40B7B4: using guessed type int __thiscall CWnd__ShowWindow(_DWORD, _DWORD);

//----- (00402C40) --------------------------------------------------------
int __thiscall sub_402C40(void *this)
{
  int result; // eax@1
  void *v2; // esi@1

  v2 = this;
  result = sub_40114A((char *)this + 420);
  if ( result )
    *((_DWORD *)v2 + 125) = 0;
  return result;
}
// 40114A: using guessed type int __thiscall sub_40114A(_DWORD);

//----- (00402C70) --------------------------------------------------------
int __thiscall sub_402C70(void *this)
{
  int result; // eax@1
  void *v2; // esi@1
  void *v3; // [sp-8h] [bp-Ch]@1
  void **v4; // [sp+0h] [bp-4h]@1

  v2 = this;
  v3 = this;
  v4 = &v3;
  CString__CString(&v3, (char *)this + 496);
  result = sub_4010CD((char)v3);
  if ( result )
    *((_DWORD *)v2 + 125) = 1;
  return result;
}
// 4010CD: using guessed type _DWORD __stdcall sub_4010CD(char);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (00402CC0) --------------------------------------------------------
int __thiscall sub_402CC0(void *this, char a2)
{
  void *v3; // esi@1
  int v4; // ebp@1
  int v5; // eax@1
  char v6; // [sp+Ch] [bp-10h]@1
  int v7; // [sp+18h] [bp-4h]@1

  v3 = this;
  v7 = 0;
  v4 = CWnd__GetDlgItem(this, 1001);
  CWnd__GetWindowTextA(v4, (char *)v3 + 492);
  UpdateWindow(*((HWND *)v3 + 64));
  v5 = operator_(&v6, &a2, "\r\n");
  LOBYTE(v7) = 1;
  CString__operator__((char *)v3 + 492, v5);
  LOBYTE(v7) = 0;
  CString___CString(&v6);
  CWnd__SetWindowTextA(v4, *((_DWORD *)v3 + 123));
  v7 = -1;
  return CString___CString(&a2);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B75A: using guessed type int __thiscall CWnd__GetDlgItem(_DWORD, _DWORD);
// 40B7BA: using guessed type int __thiscall CWnd__SetWindowTextA(_DWORD, _DWORD);
// 40B7C0: using guessed type int __thiscall CString__operator__(_DWORD, _DWORD);
// 40B7C6: using guessed type int __stdcall operator_(_DWORD, _DWORD, _DWORD);
// 40B7CC: using guessed type int __thiscall CWnd__GetWindowTextA(_DWORD, _DWORD);

//----- (00402DA0) --------------------------------------------------------
int __thiscall sub_402DA0(void *this, char a2, int a3, int *a4)
{
  int v4; // ecx@1
  void *v5; // esi@1
  int v6; // edi@1
  int v7; // eax@1
  int v8; // eax@1
  int v9; // eax@1
  int v11; // [sp-4h] [bp-28h]@2
  char v12; // [sp+8h] [bp-1Ch]@1
  char v13; // [sp+Ch] [bp-18h]@1
  char v14; // [sp+10h] [bp-14h]@1
  char v15; // [sp+14h] [bp-10h]@1
  int v16; // [sp+20h] [bp-4h]@1

  v5 = this;
  v16 = 0;
  CString__CString(&v12);
  LOBYTE(v16) = 1;
  CString__LoadStringA(&v12, a3);
  v6 = CString__CString(&v15, "\r\n");
  LOBYTE(v16) = 2;
  v7 = operator_(&v14, &v12, ": ");
  LOBYTE(v16) = 3;
  v8 = operator_(&v13, v7, &a2);
  LOBYTE(v16) = 4;
  v9 = operator_(&a3, v8, v6);
  LOBYTE(v16) = 5;
  CString__operator_((char *)v5 + 492, v9);
  LOBYTE(v16) = 4;
  CString___CString(&a3);
  LOBYTE(v16) = 3;
  CString___CString(&v13);
  LOBYTE(v16) = 2;
  CString___CString(&v14);
  LOBYTE(v16) = 1;
  CString___CString(&v15);
  if ( !a4 )
  {
    v11 = v4;
    a4 = &v11;
    CString__CString(&v11, (char *)v5 + 492);
    sub_40104B(v11);
  }
  LOBYTE(v16) = 0;
  CString___CString(&v12);
  v16 = -1;
  return CString___CString(&a2);
}
// 40104B: using guessed type _DWORD __stdcall sub_40104B(char);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B74E: using guessed type int __thiscall CString__LoadStringA(_DWORD, _DWORD);
// 40B7C6: using guessed type int __stdcall operator_(_DWORD, _DWORD, _DWORD);
// 40B7D2: using guessed type int __stdcall operator_(_DWORD, _DWORD, _DWORD);

//----- (00402F20) --------------------------------------------------------
signed int __thiscall sub_402F20(void *this)
{
  int v1; // ecx@1
  void *v2; // esi@1
  int v3; // edi@1
  int v4; // eax@1
  int v5; // eax@2
  int v6; // eax@8
  int v7; // ecx@8
  int v9; // eax@9
  int v10; // ecx@9
  int v11; // ecx@11
  int v12; // eax@12
  int v13; // ecx@12
  int v14; // ecx@15
  int v15; // eax@18
  int v16; // ecx@18
  int v17; // ecx@19
  int v18; // eax@20
  int v19; // ecx@20
  unsigned __int8 v20; // zf@22
  char v21; // sf@22
  unsigned __int8 v22; // of@22
  int v23; // ecx@29
  int *v24; // ecx@30
  int v25; // eax@31
  int v26; // ecx@31
  char *v27; // [sp-10h] [bp-60h]@30
  int v28; // [sp-Ch] [bp-5Ch]@6
  signed int v29; // [sp-8h] [bp-58h]@6
  char v30; // [sp-4h] [bp-54h]@2
  char v31; // [sp+10h] [bp-40h]@1
  WPARAM v32; // [sp+14h] [bp-3Ch]@1
  int v33; // [sp+18h] [bp-38h]@6
  int v34; // [sp+1Ch] [bp-34h]@6
  WPARAM wParam; // [sp+20h] [bp-30h]@1
  int v36; // [sp+24h] [bp-2Ch]@6
  int v37; // [sp+28h] [bp-28h]@6
  char v38; // [sp+2Ch] [bp-24h]@6
  char v39; // [sp+30h] [bp-20h]@8
  char v40; // [sp+34h] [bp-1Ch]@12
  int *v41; // [sp+38h] [bp-18h]@9
  char *v42; // [sp+3Ch] [bp-14h]@2
  char *v43; // [sp+40h] [bp-10h]@8
  int v44; // [sp+4Ch] [bp-4h]@1

  v2 = this;
  v3 = (int)((char *)this + 492);
  CString__operator_((char *)this + 492, &unk_4159AC);
  UpdateWindow(*((HWND *)v2 + 64));
  CWnd__SetWindowTextA((char *)v2 + 224, *(_DWORD *)v3);
  SendMessageA(*((HWND *)v2 + 48), 1025u, 0, 26214400);
  SendMessageA(*((HWND *)v2 + 48), 0x404u, 0x64u, 0);
  CProgressCtrl__GetRange((char *)v2 + 160, &wParam, &v32);
  SendMessageA(*((HWND *)v2 + 48), 0x404u, (signed int)(v32 - wParam) / 5, 0);
  SendMessageA(*((HWND *)v2 + 48), 0x402u, wParam, 0);
  CString__CString(&v31, &unk_4159AC);
  v4 = *((_DWORD *)v2 + 126);
  v44 = 0;
  if ( !v4 )
  {
    v5 = *((_DWORD *)v2 + 122);
    v42 = &v30;
    *(_DWORD *)&v30 = v5;
    if ( v5 )
      (*(void (__stdcall **)(int))(*(_DWORD *)v5 + 4))(v5);
    if ( !sub_40122B(*(_DWORD *)&v30) )
    {
      v9 = sub_40114F(&v37);
      LOBYTE(v44) = 1;
      CString__operator_(&v31, v9);
      LOBYTE(v44) = 0;
      CString___CString(&v37);
      *(_DWORD *)&v30 = 0;
      v29 = 105;
      v28 = v10;
      v41 = &v28;
      CString__CString(&v28, &v31);
      sub_401023(v28, v29, *(_DWORD *)&v30);
      CString__Empty(&v31);
      SendMessageA(*((HWND *)v2 + 48), 0x402u, v32, 0);
      v44 = -1;
      CString___CString(&v31);
      return 0;
    }
    *((_DWORD *)v2 + 126) = 1;
  }
  *(_DWORD *)&v30 = 0;
  v29 = 106;
  v28 = v1;
  v42 = (char *)&v28;
  CString__CString(&v28, &v31);
  sub_401023(v28, v29, *(_DWORD *)&v30);
  SendMessageA(*((HWND *)v2 + 48), 0x405u, 0, 0);
  v36 = sub_4010C3((char *)v2 + 420);
  v37 = 0;
  CString__CString(&v33);
  LOBYTE(v44) = 2;
  CString__CString(&v38);
  LOBYTE(v44) = 3;
  v34 = 1;
  if ( v36 >= 1 )
  {
    do
    {
      if ( sub_40109B(v34, &v33) )
      {
        if ( !mbscmp(v33, "USER_SELECT") )
        {
          if ( !sub_401028(v2) )
          {
            v12 = sub_40114F(&v40);
            LOBYTE(v44) = 5;
            CString__operator_(&v31, v12);
            LOBYTE(v44) = 3;
            CString___CString(&v40);
            *(_DWORD *)&v30 = 0;
            v29 = 111;
            v28 = v13;
            v43 = (char *)&v28;
            CString__CString(&v28, &v31);
            sub_401023(v28, v29, *(_DWORD *)&v30);
            CString__Empty(&v31);
            goto LABEL_22;
          }
          *(_DWORD *)&v30 = 0;
          v29 = 112;
          v28 = v11;
          v43 = (char *)&v28;
          CString__CString(&v28, &v31);
          sub_401023(v28, v29, *(_DWORD *)&v30);
        }
        if ( !*((_DWORD *)v2 + 125) )
        {
          if ( !sub_401163(v2) )
          {
            v25 = sub_40114F(&v41);
            LOBYTE(v44) = 6;
            CString__operator_(&v31, v25);
            LOBYTE(v44) = 3;
            CString___CString(&v41);
            *(_DWORD *)&v30 = 0;
            v29 = 115;
            v28 = v26;
            v43 = (char *)&v28;
            CString__CString(&v28, &v31);
            sub_401023(v28, v29, *(_DWORD *)&v30);
            CString__Empty(&v31);
            SendMessageA(*((HWND *)v2 + 48), 0x402u, v32, 0);
            LOBYTE(v44) = 2;
            CString___CString(&v38);
            LOBYTE(v44) = 0;
            CString___CString(&v33);
            v44 = -1;
            CString___CString(&v31);
            return 0;
          }
          *(_DWORD *)&v30 = 0;
          v29 = 116;
          v28 = v14;
          v43 = (char *)&v28;
          *((_DWORD *)v2 + 125) = 1;
          CString__CString(&v28, &v31);
          sub_401023(v28, v29, *(_DWORD *)&v30);
        }
        if ( sub_401271((char *)v2 + 420) )
        {
          if ( sub_401087((char *)v2 + 420) )
          {
            *(_DWORD *)&v30 = 0;
            v29 = 120;
            v28 = v17;
            v43 = (char *)&v28;
            CString__CString(&v28, &v31);
            sub_401023(v28, v29, *(_DWORD *)&v30);
            v37 = 1;
          }
          else
          {
            v18 = sub_40114F(&v42);
            LOBYTE(v44) = 8;
            CString__operator_(&v31, v18);
            LOBYTE(v44) = 3;
            CString___CString(&v42);
            *(_DWORD *)&v30 = 0;
            v29 = 119;
            v28 = v19;
            v43 = (char *)&v28;
            CString__CString(&v28, &v31);
            sub_401023(v28, v29, *(_DWORD *)&v30);
            CString__Empty(&v31);
          }
        }
        else
        {
          v15 = sub_40114F(&v41);
          LOBYTE(v44) = 7;
          CString__operator_(&v31, v15);
          LOBYTE(v44) = 3;
          CString___CString(&v41);
          *(_DWORD *)&v30 = 1;
          v29 = 117;
          v28 = v16;
          v43 = (char *)&v28;
          CString__CString(&v28, &v31);
          sub_401023(v28, v29, *(_DWORD *)&v30);
          CString__Empty(&v31);
        }
      }
      else
      {
        v6 = sub_40114F(&v39);
        LOBYTE(v44) = 4;
        CString__operator_(&v31, v6);
        LOBYTE(v44) = 3;
        CString___CString(&v39);
        *(_DWORD *)&v30 = 0;
        v29 = 107;
        v28 = v7;
        v43 = (char *)&v28;
        CString__CString(&v28, &v31);
        sub_401023(v28, v29, *(_DWORD *)&v30);
        CString__Empty(&v31);
      }
LABEL_22:
      v22 = __SETO__(v34 + 1, v36);
      v20 = v34 + 1 == v36;
      v21 = v34++ + 1 - v36 < 0;
    }
    while ( (unsigned __int8)(v21 ^ v22) | v20 );
  }
  SendMessageA(*((HWND *)v2 + 48), 0x405u, 0, 0);
  if ( v37 )
  {
    if ( *((_DWORD *)v2 + 127) == 1 )
      sub_40105A(v2);
    if ( *((_DWORD *)v2 + 130) != -1 )
    {
      *(_DWORD *)&v30 = *((_DWORD *)v2 + 130);
      CString__Format((char *)v2 + 492, "Remaining Number of Executions : %4.4d\r\n");
      v43 = &v30;
      CString__CString(&v30, (char *)v2 + 492);
      sub_40104B(v30);
    }
  }
  SendMessageA(*((HWND *)v2 + 48), 0x405u, 0, 0);
  CWnd__ShowWindow((char *)v2 + 352, 5);
  SendMessageA(*((HWND *)v2 + 48), 0x405u, 0, 0);
  if ( *((_DWORD *)v2 + 125) == 1 )
  {
    if ( sub_401177(v2) == 1 )
    {
      *(_DWORD *)&v30 = 0;
      v29 = 123;
      v28 = v23;
      v24 = &v28;
      v43 = (char *)&v28;
      *((_DWORD *)v2 + 125) = 0;
      v27 = &v31;
    }
    else
    {
      *(_DWORD *)&v30 = 0;
      v29 = 124;
      v28 = v23;
      v24 = &v28;
      v43 = (char *)&v28;
      v27 = &v31;
    }
    CString__CString(v24, v27);
    sub_401023(v28, v29, *(_DWORD *)&v30);
  }
  SendMessageA(*((HWND *)v2 + 48), 0x405u, 0, 0);
  SendMessageA(*((HWND *)v2 + 48), 0x402u, v32, 0);
  LOBYTE(v44) = 2;
  CString___CString(&v38);
  LOBYTE(v44) = 0;
  CString___CString(&v33);
  v44 = -1;
  CString___CString(&v31);
  return 1;
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 401028: using guessed type int __thiscall sub_401028(_DWORD);
// 40104B: using guessed type _DWORD __stdcall sub_40104B(char);
// 40105A: using guessed type int __thiscall sub_40105A(_DWORD);
// 401087: using guessed type int __thiscall sub_401087(_DWORD);
// 40109B: using guessed type _DWORD __stdcall sub_40109B(_DWORD, _DWORD);
// 4010C3: using guessed type int __thiscall sub_4010C3(_DWORD);
// 40114F: using guessed type _DWORD __stdcall sub_40114F(_DWORD);
// 401163: using guessed type int __thiscall sub_401163(_DWORD);
// 401177: using guessed type int __thiscall sub_401177(_DWORD);
// 40122B: using guessed type _DWORD __stdcall sub_40122B(_DWORD);
// 401271: using guessed type int __thiscall sub_401271(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B736: using guessed type int CString__Format(_DWORD, const char *, ...);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B7B4: using guessed type int __thiscall CWnd__ShowWindow(_DWORD, _DWORD);
// 40B7BA: using guessed type int __thiscall CWnd__SetWindowTextA(_DWORD, _DWORD);
// 40B7D8: using guessed type int __thiscall CString__Empty(_DWORD);
// 40B7DE: using guessed type int __thiscall CProgressCtrl__GetRange(_DWORD, _DWORD, _DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (00403C10) --------------------------------------------------------
void *__thiscall sub_403C10(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_401235(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 401235: using guessed type int __thiscall sub_401235(_DWORD);

//----- (00403C40) --------------------------------------------------------
int __thiscall sub_403C40(void *this)
{
  int result; // eax@1
  void *v2; // esi@1

  v2 = this;
  *(_DWORD *)this = off_41186C;
  result = CString___CString((char *)this + 16);
  *(_DWORD *)v2 = &off_411854;
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 411854: using guessed type int (*off_411854)();
// 41186C: using guessed type int (*off_41186C[5])();

//----- (00403CB0) --------------------------------------------------------
int __thiscall sub_403CB0(int this)
{
  int v1; // ebx@1
  int v2; // esi@1
  DWORD v3; // eax@2
  int v4; // ecx@2
  HMODULE v5; // eax@3
  HMODULE v6; // edi@3
  FARPROC v7; // edi@4
  int result; // eax@5
  int v9; // ecx@7
  int v10; // [sp-Ch] [bp-34h]@2
  int v11; // [sp-8h] [bp-30h]@2
  signed int v12; // [sp-4h] [bp-2Ch]@2
  int v13; // [sp+10h] [bp-18h]@2
  char v14; // [sp+14h] [bp-14h]@7
  int *v15; // [sp+18h] [bp-10h]@2
  int v16; // [sp+24h] [bp-4h]@2

  v2 = this;
  v1 = this + 525;
  if ( !GetCurrentDirectoryA(0x104u, (LPSTR)(this + 525)) )
  {
    CString__CString(&v13);
    v16 = 0;
    v3 = GetLastError();
    CString__Format(&v13, "GetCurrentDirectory failed: GetLastError returned %u\n ", v3);
    v12 = 1;
    v11 = 0;
    v10 = v4;
    v15 = &v10;
    CString__CString(&v10, &v13);
    sub_401023(v10, v11, v12);
    v16 = -1;
    CString___CString(&v13);
  }
  v5 = LoadLibraryA("scutil.dll");
  v6 = v5;
  if ( v5 )
  {
    v13 = (int)GetProcAddress(v5, "pFuncCheckAuthAuthorization");
    v7 = GetProcAddress(v6, "GetpFuncRemNumOfExecutionsainingExecutions");
    if ( ((int (__cdecl *)(int, _DWORD, _DWORD, wchar_t[2]))v13)(v1, *(_DWORD *)(v2 + 512), *(_DWORD *)(v2 + 516), L"m") == 255 )
    {
      result = ((int (__cdecl *)(int, _DWORD, _DWORD, wchar_t[2]))v7)(
                 v1,
                 *(_DWORD *)(v2 + 512),
                 *(_DWORD *)(v2 + 516),
                 L"m");
      *(_DWORD *)(v2 + 520) = result;
    }
    else
    {
      result = sub_4012B7(v2);
    }
  }
  else
  {
    CString__CString(&v14, "CCpFixDlg::VerifyAuthorization( ): Cannot load scutil.dll");
    v12 = 1;
    v11 = 0;
    v10 = v9;
    v15 = &v10;
    v16 = 1;
    CString__CString(&v10, &v14);
    sub_401023(v10, v11, v12);
    sub_4012B7(v2);
    v16 = -1;
    result = CString___CString(&v14);
  }
  return result;
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 4012B7: using guessed type int __thiscall sub_4012B7(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B736: using guessed type int CString__Format(_DWORD, const char *, ...);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 4149C4: using guessed type wchar_t aM[2];

//----- (00403ED0) --------------------------------------------------------
BOOL __thiscall sub_403ED0(int this)
{
  return EnableWindow(*(HWND *)(this + 32), 0);
}

//----- (00403EF0) --------------------------------------------------------
BOOL __thiscall sub_403EF0(int this)
{
  return EnableWindow(*(HWND *)(this + 32), 1);
}

//----- (00403F10) --------------------------------------------------------
int __thiscall sub_403F10(void *this)
{
  HMODULE v1; // eax@1
  HMODULE v2; // edi@1
  void *v3; // esi@1
  FARPROC v4; // ebx@2
  FARPROC v5; // ebp@2
  int result; // eax@3
  int v7; // ecx@5
  int v8; // [sp-Ch] [bp-30h]@5
  int v9; // [sp-8h] [bp-2Ch]@5
  signed int v10; // [sp-4h] [bp-28h]@5
  char v11; // [sp+10h] [bp-14h]@5
  int *v12; // [sp+14h] [bp-10h]@5
  int v13; // [sp+20h] [bp-4h]@5

  v3 = this;
  v1 = LoadLibraryA("scutil.dll");
  v2 = v1;
  if ( v1 )
  {
    v5 = GetProcAddress(v1, "CompleteExecution");
    v4 = GetProcAddress(v2, "GetpFuncRemNumOfExecutionsainingExecutions");
    if ( ((int (__cdecl *)(char *, _DWORD, _DWORD, wchar_t *, signed int))v5)(
           (char *)v3 + 525,
           *((_DWORD *)v3 + 128),
           *((_DWORD *)v3 + 129),
           L"m",
           1) == 255 )
    {
      result = ((int (__cdecl *)(char *, _DWORD, _DWORD, wchar_t[2]))v4)(
                 (char *)v3 + 525,
                 *((_DWORD *)v3 + 128),
                 *((_DWORD *)v3 + 129),
                 L"m");
      *((_DWORD *)v3 + 130) = result;
    }
    else
    {
      result = sub_4012B7(v3);
    }
  }
  else
  {
    CString__CString(&v11, "CCpFixDlg::DecpFuncRemNumOfExecutionsentExecutionCounter( ): Cannot load scutil.dll");
    v10 = 1;
    v9 = 0;
    v8 = v7;
    v12 = &v8;
    v13 = 0;
    CString__CString(&v8, &v11);
    sub_401023(v8, v9, v10);
    sub_4012B7(v3);
    v13 = -1;
    result = CString___CString(&v11);
  }
  return result;
}
// 401023: using guessed type _DWORD __stdcall sub_401023(char, _DWORD, _DWORD);
// 4012B7: using guessed type int __thiscall sub_4012B7(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 4149C4: using guessed type wchar_t aM[2];

//----- (00404080) --------------------------------------------------------
int __thiscall sub_404080(void *this)
{
  return CWnd__EnableWindow((char *)this + 288, 0);
}
// 40B832: using guessed type int __thiscall CWnd__EnableWindow(_DWORD, _DWORD);

//----- (004040A0) --------------------------------------------------------
int __thiscall sub_4040A0(int this)
{
  int v2; // esi@1
  LRESULT v3; // eax@1

  v2 = this;
  v3 = SendMessageA(*(HWND *)(this + 128), 0x147u, 0, 0);
  return CComboBox__GetLBText(v2 + 96, v3, v2 + 496);
}
// 40B838: using guessed type int __thiscall CComboBox__GetLBText(_DWORD, _DWORD, _DWORD);

//----- (004040E0) --------------------------------------------------------
signed int __thiscall sub_4040E0(void *this)
{
  int v1; // ecx@1
  signed int v2; // ebp@1
  signed int v3; // edi@1
  int v4; // esi@1
  int v5; // eax@2
  int v6; // eax@4
  int v7; // ecx@4
  int v8; // ecx@5
  int v10; // [sp-10h] [bp-A8h]@4
  int v11; // [sp-Ch] [bp-A4h]@4
  int v12; // [sp-8h] [bp-A0h]@4
  int v13; // [sp-4h] [bp-9Ch]@4
  int *v14; // [sp+Ch] [bp-8Ch]@4
  char v15; // [sp+10h] [bp-88h]@1
  char v16; // [sp+14h] [bp-84h]@1
  int *v17; // [sp+18h] [bp-80h]@4
  char v18; // [sp+1Ch] [bp-7Ch]@4
  char v19; // [sp+7Ch] [bp-1Ch]@8
  char v20; // [sp+80h] [bp-18h]@8
  char v21; // [sp+88h] [bp-10h]@8
  int v22; // [sp+94h] [bp-4h]@1

  v4 = (int)((char *)this + 420);
  v2 = 1;
  sub_40123F(&v16);
  v22 = 0;
  v3 = sub_401122(v4);
  sub_401140(&v15);
  LOBYTE(v22) = 1;
  if ( v3 >= 8 )
    v5 = v3 / 8;
  else
    v5 = 1;
  v13 = 0;
  v12 = 2 * v5;
  v11 = v1;
  v14 = &v11;
  CString__CString(&v11, &v16);
  v10 = v7;
  v17 = &v10;
  LOBYTE(v22) = 2;
  CString__CString(&v10, &v15);
  LOBYTE(v22) = 1;
  sub_4012B2(v10, v11, v12, v13);
  LOBYTE(v22) = 3;
  v6 = CDialog__DoModal(&v18);
  if ( v6 == 1 )
  {
    sub_40116D(&v14);
    v13 = v8;
    v17 = &v13;
    LOBYTE(v22) = 4;
    CString__CString(&v13, &v14);
    v2 = sub_401186(v13);
    LOBYTE(v22) = 3;
    CString___CString(&v14);
  }
  else
  {
    if ( v6 == 2 )
      v2 = 0;
  }
  LOBYTE(v22) = 7;
  CString___CString(&v21);
  LOBYTE(v22) = 6;
  CString___CString(&v20);
  LOBYTE(v22) = 5;
  CString___CString(&v19);
  LOBYTE(v22) = 1;
  CDialog___CDialog(&v18);
  LOBYTE(v22) = 0;
  CString___CString(&v15);
  v22 = -1;
  CString___CString(&v16);
  return v2;
}
// 401122: using guessed type int __thiscall sub_401122(_DWORD);
// 401140: using guessed type _DWORD __stdcall sub_401140(_DWORD);
// 40116D: using guessed type _DWORD __stdcall sub_40116D(_DWORD);
// 401186: using guessed type _DWORD __stdcall sub_401186(char);
// 40123F: using guessed type _DWORD __stdcall sub_40123F(_DWORD);
// 4012B2: using guessed type _DWORD __stdcall sub_4012B2(char, char, _DWORD, _DWORD);
// 40B5B0: using guessed type int __thiscall CDialog__DoModal(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (004042F0) --------------------------------------------------------
int __thiscall sub_4042F0(void *this)
{
  void *v2; // esi@1

  v2 = this;
  CString___CString((char *)this + 108);
  CString___CString((char *)v2 + 100);
  CString___CString((char *)v2 + 96);
  return CDialog___CDialog(v2);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (00404380) --------------------------------------------------------
void *__thiscall sub_404380(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  CButton___CButton(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);

//----- (004043D0) --------------------------------------------------------
void *__thiscall sub_4043D0(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  CComboBox___CComboBox(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40B70C: using guessed type int __thiscall CComboBox___CComboBox(_DWORD);

//----- (00404400) --------------------------------------------------------
void *__thiscall sub_404400(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  CEdit___CEdit(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40B700: using guessed type int __thiscall CEdit___CEdit(_DWORD);

//----- (00404450) --------------------------------------------------------
void *__thiscall sub_404450(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  CProgressCtrl___CProgressCtrl(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40B706: using guessed type int __thiscall CProgressCtrl___CProgressCtrl(_DWORD);

//----- (00404480) --------------------------------------------------------
void *__thiscall sub_404480(void *this)
{
  void *v2; // esi@1
  int v3; // edi@1

  v2 = this;
  v3 = (int)((char *)this + 4);
  CPtrList__CPtrList((char *)this + 4, 10);
  *(_DWORD *)v3 = off_411894;
  CString__CString((char *)v2 + 36);
  CString__CString((char *)v2 + 40);
  CString__CString((char *)v2 + 44);
  CString__CString((char *)v2 + 48);
  *(_DWORD *)v2 = off_411890;
  *((_DWORD *)v2 + 8) = 0;
  CString__operator_((char *)v2 + 36, &unk_4159AC);
  CString__operator_((char *)v2 + 40, &unk_4159AC);
  CString__operator_((char *)v2 + 44, &unk_4159AC);
  CString__operator_((char *)v2 + 48, "UNDEFINED");
  return v2;
}
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B844: using guessed type int __thiscall CPtrList__CPtrList(_DWORD, _DWORD);
// 411890: using guessed type int (__stdcall *off_411890[6])();
// 411894: using guessed type int (*off_411894[5])();

//----- (004046C0) --------------------------------------------------------
int __thiscall sub_4046C0(void *this, int a2, int a3, int a4)
{
  int v4; // ebx@1
  int v5; // edi@1
  int v6; // eax@1
  BSTR v7; // eax@1
  int v8; // eax@1
  BSTR v9; // eax@1
  BSTR v10; // eax@1
  int v11; // ecx@1
  void *v12; // ecx@3
  int v13; // edi@4
  int v14; // eax@6
  BSTR v15; // eax@6
  int v16; // ebx@7
  int v17; // eax@7
  BSTR v18; // eax@7
  int v19; // eax@7
  int v20; // eax@9
  BSTR v21; // eax@9
  int v22; // eax@9
  int v23; // eax@9
  BSTR v24; // eax@9
  int v25; // eax@9
  BSTR v26; // eax@9
  int v27; // eax@9
  signed int v28; // eax@10
  int v29; // eax@10
  BSTR v30; // eax@10
  int v31; // eax@15
  OLECHAR *v32; // ebx@15
  void *v33; // eax@15
  void *v34; // eax@16
  int v35; // eax@17
  OLECHAR *v36; // ebx@17
  void *v37; // eax@17
  void *v38; // eax@18
  int v39; // eax@19
  BSTR v40; // eax@19
  BSTR v41; // eax@19
  int v43; // ST04_4@21
  char v44; // [sp+0h] [bp-54h]@1
  char v45; // [sp+Ch] [bp-48h]@1
  OLECHAR *psz; // [sp+14h] [bp-40h]@1
  char v47; // [sp+1Ch] [bp-38h]@1
  OLECHAR *v48; // [sp+20h] [bp-34h]@17
  int v49; // [sp+24h] [bp-30h]@1
  int v50; // [sp+28h] [bp-2Ch]@1
  BSTR bstrString; // [sp+2Ch] [bp-28h]@1
  int v52; // [sp+30h] [bp-24h]@1
  int v53; // [sp+34h] [bp-20h]@1
  int v54; // [sp+38h] [bp-1Ch]@1
  int v55; // [sp+3Ch] [bp-18h]@1
  int v56; // [sp+40h] [bp-14h]@1
  char *v57; // [sp+44h] [bp-10h]@1
  int v58; // [sp+50h] [bp-4h]@1
  int v59; // [sp+60h] [bp+Ch]@11

  v4 = a2;
  v5 = (int)this;
  v57 = &v44;
  v54 = (int)this;
  v52 = 0;
  sub_40A6B0(a2, (int)&v47);
  v58 = 0;
  sub_40AD90(a2, a3);
  v6 = (int)SysAllocString(L"CpFixItemModelNum");
  sub_40A5B0(a2, v6, (signed int)&v45);
  v7 = SysAllocString(psz);
  CString__operator_(v5 + 36, v7);
  v8 = (int)SysAllocString(L"CpFixItemSerialNum");
  sub_40A5B0(a2, v8, (signed int)&v45);
  v9 = SysAllocString(psz);
  CString__operator_(v5 + 40, v9);
  bstrString = SysAllocString(L"CpFixItemComments");
  sub_40A5B0(a2, (int)bstrString, (signed int)&v45);
  v10 = SysAllocString(psz);
  CString__operator_(v5 + 44, v10);
  v11 = *(_DWORD *)a3;
  v53 = 0;
  (*(void (__stdcall **)(int, int *))(v11 + 52))(a3, &v53);
  v49 = 0;
  CString__CString(&v56);
  LOBYTE(v58) = 1;
  v50 = 0;
  CString__CString(&v55);
  LOBYTE(v58) = 2;
  while ( v53 )
  {
    ++v50;
    sub_40AD90(v4, v53);
    v12 = operator new(0x2Cu);
    LOBYTE(v58) = 3;
    if ( v12 )
      v13 = sub_401208(v12);
    else
      v13 = 0;
    LOBYTE(v58) = 2;
    v49 = v13;
    v14 = (int)SysAllocString(L"ActionType");
    sub_40A5B0(v4, v14, (signed int)&v45);
    v15 = SysAllocString(psz);
    CString__operator_(v13 + 4, v15);
    CString__operator_(&v55, v13 + 4);
    CString__MakeUpper(&v55);
    if ( mbscmp(v55, "NAVIGATE") )
    {
      v17 = (int)SysAllocString(L"Partition");
      sub_40A5B0(a2, v17, (signed int)&v45);
      v18 = SysAllocString(psz);
      CString__operator_(&v56, v18);
      v19 = CString__GetBuffer(&v56, *(_DWORD *)(v56 - 8));
      v16 = v54;
      *(_DWORD *)(v13 + 8) = sub_40111D(v19);
      CString__ReleaseBuffer(&v56, -1);
    }
    else
    {
      v16 = v54;
    }
    v20 = (int)SysAllocString(L"BlockType");
    sub_40A5B0(a2, v20, (signed int)&v45);
    v21 = SysAllocString(psz);
    CString__operator_(&v56, v21);
    v22 = CString__GetBuffer(&v56, *(_DWORD *)(v56 - 8));
    *(_DWORD *)(v13 + 12) = sub_40111D(v22);
    CString__ReleaseBuffer(&v56, -1);
    v23 = (int)SysAllocString(L"BlockID");
    sub_40A5B0(a2, v23, (signed int)&v45);
    v24 = SysAllocString(psz);
    CString__operator_(&v56, v24);
    v25 = CString__GetBuffer(&v56, *(_DWORD *)(v56 - 8));
    *(_DWORD *)(v13 + 16) = sub_40111D(v25);
    CString__ReleaseBuffer(&v56, -1);
    bstrString = SysAllocString(L"OffsetInBits");
    sub_40A5B0(a2, (int)bstrString, (signed int)&v45);
    v26 = SysAllocString(psz);
    CString__operator_(&v56, v26);
    v27 = CString__GetBuffer(&v56, *(_DWORD *)(v56 - 8));
    *(_DWORD *)(v13 + 20) = sub_40111D(v27);
    CString__ReleaseBuffer(&v56, -1);
    if ( mbscmp(v55, "NAVIGATE") )
    {
      v29 = (int)SysAllocString(L"NumOfBits");
      sub_40A5B0(a2, v29, (signed int)&v45);
      v30 = SysAllocString(psz);
      CString__operator_(&v56, v30);
      v28 = StrToIntA(v56);
      *(_DWORD *)(v13 + 24) = v28;
      if ( v28 >= 8 )
        v59 = v28 / 8;
      else
        v59 = 1;
      if ( !mbscmp(v55, "CONDITION") || !mbscmp(v55, "BRANCH") )
      {
        v31 = (int)SysAllocString(L"ExpectedValue");
        sub_40A5B0(a2, v31, (signed int)&v45);
        v32 = SysAllocString(psz);
        v33 = operator new(v59);
        *(_DWORD *)(v13 + 28) = v33;
        if ( !sub_40100A(v32, v33) )
        {
          v34 = *(void **)(v13 + 28);
          v52 = 16;
          operator delete(v34);
          *(_DWORD *)(v13 + 28) = 0;
        }
      }
      v35 = (int)SysAllocString(L"NewValue");
      sub_40A5B0(a2, v35, (signed int)&v45);
      v36 = SysAllocString(psz);
      v48 = v36;
      v37 = operator new(v59);
      *(_DWORD *)(v13 + 32) = v37;
      if ( !sub_40100A(v36, v37) )
      {
        v38 = *(void **)(v13 + 32);
        v52 = 16;
        operator delete(v38);
        *(_DWORD *)(v13 + 32) = 0;
      }
      v39 = (int)SysAllocString(L"FieldName");
      sub_40A5B0(a2, v39, (signed int)&v45);
      v40 = SysAllocString(psz);
      CString__operator_(v13 + 36, v40);
      bstrString = SysAllocString(L"FieldDataType");
      sub_40A5B0(a2, (int)bstrString, (signed int)&v45);
      v41 = SysAllocString(psz);
      CString__operator_(v13 + 40, v41);
      v16 = v54;
    }
    CPtrList__AddTail(v16 + 4, v13);
    (*(void (__stdcall **)(int, int *))(*(_DWORD *)v53 + 64))(v53, &v53);
    v4 = a2;
    v5 = v54;
  }
  SysFreeString(bstrString);
  SysFreeString(v48);
  v43 = v49 + 4;
  *(_DWORD *)(v5 + 32) = v50;
  CString__operator_(v5 + 48, v43);
  CString__operator_(a4, v5 + 48);
  LOBYTE(v58) = 1;
  CString___CString(&v55);
  LOBYTE(v58) = 0;
  CString___CString(&v56);
  return v52;
}
// 40100A: using guessed type _DWORD __stdcall sub_40100A(BSTR lpWideCharStr, _DWORD);
// 40111D: using guessed type _DWORD __stdcall sub_40111D(_DWORD);
// 401208: using guessed type int __thiscall sub_401208(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B73C: using guessed type int __thiscall CString__MakeUpper(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B856: using guessed type int __thiscall CPtrList__AddTail(_DWORD, _DWORD);
// 40B85C: using guessed type int __thiscall CString__ReleaseBuffer(_DWORD, _DWORD);
// 40B862: using guessed type int __thiscall CString__GetBuffer(_DWORD, _DWORD);
// 40B86E: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);
// 416CEC: using guessed type int __stdcall StrToIntA(_DWORD);

//----- (00404B6A) --------------------------------------------------------
int (__stdcall *__usercall sub_404B6A<eax>(int a1<ebp>))(int, unsigned int, int)
{
  *(_DWORD *)(a1 - 36) = 4;
  return loc_404B54;
}
// 404B54: using guessed type int __stdcall loc_404B54(int, unsigned int, int);

//----- (00404CB0) --------------------------------------------------------
signed int __stdcall sub_404CB0(int a1, int a2, int a3)
{
  signed int v3; // esi@1
  int v4; // ebp@2
  int v5; // edi@2
  int v6; // esi@2
  int v7; // edx@2
  int v8; // eax@2
  int v9; // ecx@8
  __int64 v11; // [sp-4h] [bp-40h]@2
  unsigned __int64 v12; // [sp+4h] [bp-38h]@2
  int v13; // [sp+1Ch] [bp-20h]@1
  VARIANTARG pvarg; // [sp+20h] [bp-1Ch]@2
  int v15; // [sp+38h] [bp-4h]@1

  v3 = 0;
  v15 = 0;
  v13 = 0;
  if ( a3 )
  {
    v4 = a2;
    CString__CString(&a2, a2);
    LOBYTE(v15) = 1;
    v6 = 10 - (mbsicmp(a2, "USB") != 0);
    AfxVariantInit(&pvarg);
    v5 = a1;
    v11 = *(_QWORD *)&pvarg;
    LODWORD(pvarg.llVal) = 7;
    v7 = *(_DWORD *)a1;
    LOBYTE(v15) = 2;
    v12 = __PAIR__(HIDWORD(pvarg.llVal), 7);
    v8 = (*(int (__stdcall **)(int, int, int, _DWORD, _DWORD, signed int, _DWORD))(v7 + 60))(
           a1,
           v6,
           v4,
           *(_DWORD *)&pvarg,
           *(_DWORD *)&pvarg.wReserved2,
           7,
           HIDWORD(pvarg.llVal));
    v3 = 18;
    if ( v8 >= 0 )
      v3 = v13;
    VariantClear(&pvarg);
    LOBYTE(v15) = 0;
    CString___CString(&a2);
  }
  else
  {
    v5 = a1;
    if ( (*(int (__stdcall **)(int, _DWORD, int))(*(_DWORD *)a1 + 28))(a1, 0, a2) < 0 )
      v3 = 19;
  }
  v15 = -1;
  if ( v5 )
  {
    v9 = *(_DWORD *)v5;
    HIDWORD(v12) = v5;
    (*(void (__stdcall **)(int))(v9 + 8))(v5);
  }
  return v3;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B87A: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 416BE4: using guessed type int __cdecl mbsicmp(_DWORD, _DWORD);

//----- (00404E10) --------------------------------------------------------
signed int __thiscall sub_404E10(int this, BSTR *a2, BSTR bstrString)
{
  BSTR v3; // edi@1
  int v4; // esi@1
  signed int result; // eax@5
  signed int v6; // edi@6
  BSTR *v7; // ecx@7
  OLECHAR *v8; // ecx@7
  BSTR v9; // edx@11
  int v10; // [sp-Ch] [bp-2Ch]@6
  BSTR v11; // [sp-8h] [bp-28h]@6
  BSTR *v12; // [sp-4h] [bp-24h]@6
  int *v13; // [sp+8h] [bp-18h]@6
  BSTR **v14; // [sp+Ch] [bp-14h]@7
  BSTR *v15; // [sp+10h] [bp-10h]@7
  int v16; // [sp+1Ch] [bp-4h]@1

  v4 = this;
  v3 = bstrString;
  v16 = 0;
  if ( bstrString
    && (*(int (__stdcall **)(BSTR *, _DWORD))((int (__stdcall **)(_DWORD, _DWORD))*a2 + 18))(
         a2,
         *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(this + 12) + 8) + 8)) < 0 )
  {
    v16 = -1;
    if ( a2 )
      (*(void (__stdcall **)(BSTR *))((void (__stdcall **)(_DWORD))*a2 + 2))(a2);
    result = 20;
  }
  else
  {
    v12 = &bstrString;
    v11 = v3;
    v10 = this;
    bstrString = 0;
    v13 = &v10;
    sub_4010E6(&a2);
    v6 = sub_4010C8(v10, v11, v12);
    if ( !v6 )
    {
      CString__CString(&v13, bstrString);
      v12 = v7;
      v14 = &v12;
      LOBYTE(v16) = 1;
      CString__CString(&v12, &v13);
      v11 = v8;
      v15 = &v11;
      LOBYTE(v16) = 2;
      CString__CString(&v11, v4 + 36);
      LOBYTE(v16) = 1;
      if ( !sub_4010AA((char)v11, v12) )
        v6 = 12;
      LOBYTE(v16) = 0;
      CString___CString(&v13);
    }
    SysFreeString(bstrString);
    v16 = -1;
    if ( a2 )
    {
      v9 = *a2;
      v12 = a2;
      (*(void (__stdcall **)(BSTR *))((void (__stdcall **)(_DWORD))v9 + 2))(a2);
    }
    result = v6;
  }
  return result;
}
// 4010AA: using guessed type _DWORD __stdcall sub_4010AA(char, _DWORD);
// 4010C8: using guessed type _DWORD __stdcall sub_4010C8(_DWORD, _DWORD, _DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (00404F90) --------------------------------------------------------
int __thiscall sub_404F90(void *this, void *a2, int a3)
{
  void *v3; // esi@2
  int v4; // eax@4
  int v5; // edi@8
  int v6; // edx@9
  void *v8; // [sp-4h] [bp-18h]@1
  int v9; // [sp+10h] [bp-4h]@1

  v9 = 0;
  v8 = this;
  if ( a3 )
  {
    v3 = a2;
    v8 = a2;
    if ( a2 )
      (*(void (__stdcall **)(void *))(*(_DWORD *)a2 + 4))(a2);
    v4 = sub_401203(v8);
  }
  else
  {
    v3 = a2;
    v8 = a2;
    if ( a2 )
      (*(void (__stdcall **)(void *))(*(_DWORD *)a2 + 4))(a2);
    v4 = sub_401055(v8);
  }
  v5 = v4;
  v9 = -1;
  if ( v3 )
  {
    v6 = *(_DWORD *)v3;
    v8 = v3;
    (*(void (__stdcall **)(void *))(v6 + 8))(v3);
  }
  return v5;
}
// 401055: using guessed type _DWORD __stdcall sub_401055(_DWORD);
// 401203: using guessed type _DWORD __stdcall sub_401203(_DWORD);

//----- (00405050) --------------------------------------------------------
signed int __stdcall sub_405050(int a1, int a2)
{
  signed int v2; // edi@1

  v2 = 0;
  if ( a2 )
  {
    if ( (*(int (__stdcall **)(int))(*(_DWORD *)a1 + 56))(a1) < 0 )
      v2 = 22;
  }
  else
  {
    if ( (*(int (__stdcall **)(int))(*(_DWORD *)a1 + 52))(a1) < 0 )
      v2 = 21;
  }
  if ( a1 )
    (*(void (__stdcall **)(int))(*(_DWORD *)a1 + 8))(a1);
  return v2;
}

//----- (004050F0) --------------------------------------------------------
int __thiscall sub_4050F0(int this, int a2)
{
  int v3; // eax@1
  char v4; // [sp+4h] [bp-14h]@1
  int v5; // [sp+8h] [bp-10h]@1
  int v6; // [sp+14h] [bp-4h]@1

  v3 = *(_DWORD *)(this + 12);
  v5 = 0;
  CString__CString(&v4, *(_DWORD *)(v3 + 8) + 36);
  v6 = 1;
  CString__CString(a2, &v4);
  v5 = 1;
  LOBYTE(v6) = 0;
  CString___CString(&v4);
  return a2;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (004051B0) --------------------------------------------------------
int __thiscall sub_4051B0(int this, int a2)
{
  int v3; // eax@1
  char v4; // [sp+4h] [bp-14h]@1
  int v5; // [sp+8h] [bp-10h]@1
  int v6; // [sp+14h] [bp-4h]@1

  v3 = *(_DWORD *)(this + 12);
  v5 = 0;
  CString__CString(&v4, *(_DWORD *)(v3 + 8) + 40);
  v6 = 1;
  CString__CString(a2, &v4);
  v5 = 1;
  LOBYTE(v6) = 0;
  CString___CString(&v4);
  return a2;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (00405250) --------------------------------------------------------
signed int __thiscall sub_405250(int this, char a2)
{
  signed int v2; // ebx@1
  int v3; // esi@1
  OLECHAR *v4; // ebp@3

  v2 = 0;
  v3 = *(_DWORD *)(*(_DWORD *)(this + 12) + 8);
  if ( !v3 )
    v2 = 4;
  v4 = (OLECHAR *)CString__AllocSysString(&a2);
  if ( !sub_40100A(v4, *(_DWORD *)(v3 + 32)) )
  {
    operator delete(*(void **)(v3 + 32));
    *(_DWORD *)(v3 + 32) = 0;
    v2 = 16;
  }
  SysFreeString(v4);
  CString___CString(&a2);
  return v2;
}
// 40100A: using guessed type _DWORD __stdcall sub_40100A(BSTR lpWideCharStr, _DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B796: using guessed type int __thiscall CString__AllocSysString(_DWORD);

//----- (00405320) --------------------------------------------------------
signed int __stdcall sub_405320(int a1, int a2, int a3)
{
  signed int v3; // edi@1

  v3 = 0;
  if ( a2 )
  {
    if ( (*(int (__stdcall **)(int, int))(*(_DWORD *)a1 + 64))(a1, a3) < 0 )
      v3 = 8;
  }
  else
  {
    if ( (*(int (__stdcall **)(int, int))(*(_DWORD *)a1 + 44))(a1, a3) < 0 )
      v3 = 9;
  }
  if ( a1 )
    (*(void (__stdcall **)(int))(*(_DWORD *)a1 + 8))(a1);
  return v3;
}

//----- (004053C0) --------------------------------------------------------
signed int __stdcall sub_4053C0(int a1, int a2, int a3)
{
  signed int v3; // edi@1

  v3 = 0;
  if ( a2 )
  {
    if ( (*(int (__stdcall **)(int, int))(*(_DWORD *)a1 + 68))(a1, a3) < 0 )
      v3 = 10;
  }
  else
  {
    if ( (*(int (__stdcall **)(int, int))(*(_DWORD *)a1 + 48))(a1, a3) < 0 )
      v3 = 11;
  }
  if ( a1 )
    (*(void (__stdcall **)(int))(*(_DWORD *)a1 + 8))(a1);
  return v3;
}

//----- (00405460) --------------------------------------------------------
signed int __thiscall sub_405460(void *this, int a2)
{
  int v2; // ebx@1
  int v3; // edi@1
  void *v4; // edi@1
  int v5; // eax@1
  int v6; // edx@1
  int v7; // ebx@2
  int v8; // ebp@2
  int v9; // edi@2
  int v10; // esi@2
  unsigned int v11; // eax@4
  void *v12; // edx@4
  unsigned int v13; // ebp@4
  void *v14; // eax@4
  void *v15; // esi@4
  signed int v16; // ecx@6
  int v17; // ebp@7
  int v18; // edi@7
  int v19; // esi@7
  int v20; // ebx@16
  ULONG v21; // edi@17
  signed int k; // eax@19
  SAFEARRAY *v23; // esi@19
  int v24; // ebp@23
  int v25; // edi@23
  int v26; // esi@23
  int (__cdecl *v27)(_DWORD, _DWORD); // esi@25
  int v28; // eax@27
  int v29; // esi@35
  char *v30; // edx@36
  signed int j; // eax@43
  SAFEARRAY *v32; // esi@43
  int v33; // edx@47
  int v34; // eax@49
  int v35; // eax@51
  int v37; // eax@57
  int v38; // eax@59
  int v39; // eax@64
  int v40; // eax@66
  int v41; // eax@71
  int v42; // eax@73
  int v43; // eax@78
  int v44; // eax@80
  int v45; // eax@85
  int v46; // eax@87
  int v47; // eax@89
  int v48; // eax@91
  int v49; // eax@93
  int v50; // eax@95
  int v51; // eax@100
  int v52; // eax@102
  int v53; // eax@107
  int v54; // eax@114
  int v55; // [sp+48h] [bp-90h]@1
  void *i; // [sp+4Ch] [bp-8Ch]@4
  char v57; // [sp+53h] [bp-85h]@35
  int v58; // [sp+54h] [bp-84h]@6
  int v59; // [sp+58h] [bp-80h]@1
  int v60; // [sp+5Ch] [bp-7Ch]@21
  SAFEARRAY *psa; // [sp+60h] [bp-78h]@1
  int v62; // [sp+64h] [bp-74h]@21
  char v63; // [sp+68h] [bp-70h]@4
  int v64; // [sp+6Ch] [bp-6Ch]@5
  ULONG cElements; // [sp+70h] [bp-68h]@17
  VARIANTARG pvarg; // [sp+7Ch] [bp-5Ch]@1
  void *v67; // [sp+8Ch] [bp-4Ch]@1
  char v68; // [sp+90h] [bp-48h]@6
  int v69; // [sp+94h] [bp-44h]@8
  int v70; // [sp+A4h] [bp-34h]@2
  int v71; // [sp+A8h] [bp-30h]@1
  void *ppvData; // [sp+ACh] [bp-2Ch]@4
  int v73; // [sp+B0h] [bp-28h]@1
  int v74; // [sp+B4h] [bp-24h]@2
  int v75; // [sp+B8h] [bp-20h]@1
  int v76; // [sp+BCh] [bp-1Ch]@2
  ULONG v77; // [sp+C0h] [bp-18h]@35
  char *v78; // [sp+C4h] [bp-14h]@36
  int v79; // [sp+C8h] [bp-10h]@8
  int v80; // [sp+D4h] [bp-4h]@1

  v4 = this;
  v67 = this;
  v2 = 0;
  v80 = 0;
  v73 = 0;
  VariantInit(&pvarg);
  pvarg.vt = 8209;
  LODWORD(pvarg.llVal) = 0;
  VariantInit((VARIANTARG *)&v59);
  LOBYTE(v80) = 2;
  LOWORD(v59) = 8209;
  psa = 0;
  CString__CString(&v55);
  v5 = *((_DWORD *)v4 + 8);
  v6 = *((_DWORD *)v4 + 2);
  v3 = a2;
  LOBYTE(v80) = 3;
  v75 = v6;
  v71 = 0;
  if ( v5 <= 0 )
    goto LABEL_49;
  while ( 1 )
  {
    v7 = *(_DWORD *)(v75 + 8);
    v75 = *(_DWORD *)v75;
    v10 = *(_DWORD *)(v7 + 8);
    v9 = *(_DWORD *)(v7 + 12);
    v8 = *(_DWORD *)(v7 + 16);
    v74 = *(_DWORD *)(v7 + 8);
    v70 = v9;
    v76 = v8;
    CString__operator_(&v55, v7 + 4);
    CString__MakeUpper(&v55);
    if ( !mbscmp(v55, "NAVIGATE") )
      break;
    if ( (*(int (__stdcall **)(int, int, int, int, VARIANTARG *))(*(_DWORD *)a2 + 76))(a2, v9, v8, v10, &pvarg) < 0 )
    {
      LOBYTE(v80) = 2;
      CString___CString(&v55);
      LOBYTE(v80) = 1;
      v39 = VariantClear((VARIANTARG *)&v59);
      if ( v39 < 0 )
        sub_40BE24(v39);
      LOBYTE(v80) = 0;
      v40 = VariantClear(&pvarg);
      if ( v40 < 0 )
        sub_40BE24(v40);
      v80 = -1;
      if ( a2 )
        (*(void (__stdcall **)(int))(*(_DWORD *)a2 + 8))(a2);
      return 23;
    }
    ppvData = 0;
    SafeArrayAccessData(LODWORD(pvarg.llVal), &ppvData);
    v13 = *(_DWORD *)(LODWORD(pvarg.llVal) + 16);
    v14 = operator new(*(_DWORD *)(LODWORD(pvarg.llVal) + 16));
    v15 = ppvData;
    i = v14;
    memcpy(v14, ppvData, 4 * (v13 >> 2));
    memcpy((char *)v14 + 4 * (v13 >> 2), (char *)v15 + 4 * (v13 >> 2), v13 & 3);
    CByteArray__CByteArray(&v63);
    LOBYTE(v80) = 4;
    CByteArray__SetSize(&v63, v13, -1);
    v12 = i;
    v11 = 0;
    if ( v13 )
    {
      do
      {
        *(_BYTE *)(v64 + v11) = *((_BYTE *)v12 + v11);
        ++v11;
      }
      while ( v11 < v13 );
    }
    operator delete(v12);
    SafeArrayUnaccessData(LODWORD(pvarg.llVal));
    v58 = 0;
    CByteArray__CByteArray(&v68);
    v16 = *(_DWORD *)(v7 + 24);
    LOBYTE(v80) = 5;
    if ( v16 >= 8 )
    {
      v25 = v16 / 8;
      v24 = *(_DWORD *)(v7 + 20) / 8;
      v26 = 0;
      for ( i = operator new(v16 / 8); v26 < v25; *((_BYTE *)i + v26 - 1) = *(_BYTE *)v69 )
        sub_4011D6(1, v26++ + v24, &v63, &v68);
      v27 = mbscmp;
      if ( !mbscmp(v55, "CONDITION") || !mbscmp(v55, "BRANCH") )
      {
        v28 = 0;
        if ( v25 > 0 )
        {
          while ( *((_BYTE *)i + v28) == *(_BYTE *)(*(_DWORD *)(v7 + 28) + v28) )
          {
            ++v28;
            if ( v28 >= v25 )
            {
              v27 = mbscmp;
              goto LABEL_31;
            }
          }
          if ( !mbscmp(v55, "CONDITION") )
          {
            operator delete(i);
            LOBYTE(v80) = 4;
            CByteArray___CByteArray(&v68);
            LOBYTE(v80) = 3;
            CByteArray___CByteArray(&v63);
            LOBYTE(v80) = 2;
            CString___CString(&v55);
            LOBYTE(v80) = 1;
            v51 = VariantClear((VARIANTARG *)&v59);
            if ( v51 < 0 )
              sub_40BE24(v51);
            LOBYTE(v80) = 0;
            v52 = VariantClear(&pvarg);
            if ( v52 < 0 )
              sub_40BE24(v52);
            v80 = -1;
            if ( a2 )
              (*(void (__stdcall **)(int))(*(_DWORD *)a2 + 8))(a2);
            return 28;
          }
          if ( !mbscmp(v55, "BRANCH") )
          {
            operator delete(i);
            LOBYTE(v80) = 4;
            CByteArray___CByteArray(&v68);
            LOBYTE(v80) = 3;
            CByteArray___CByteArray(&v63);
            LOBYTE(v80) = 2;
            CString___CString(&v55);
            LOBYTE(v80) = 1;
            v53 = VariantClear((VARIANTARG *)&v59);
            if ( v53 < 0 )
              sub_40BE24(v53);
            LOBYTE(v80) = 0;
            v46 = VariantClear(&pvarg);
            if ( v46 < 0 )
LABEL_110:
              sub_40BE24(v46);
LABEL_111:
            v80 = -1;
            if ( a2 )
              (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
            return 34;
          }
LABEL_35:
          v57 = 0;
          CByteArray__RemoveAt(&v63, 0, 6);
          v77 = cElements;
          CByteArray__RemoveAt(&v63, cElements - 2, 2);
          v29 = 0;
          if ( v25 > 0 )
          {
            v30 = (char *)i - v24;
            v78 = (char *)i - v24;
            do
            {
              if ( *(&v30[v29] + v24) != *(_BYTE *)(*(_DWORD *)(v7 + 32) + v29) )
              {
                CByteArray__SetAtGrow(&v63, v29 + v24, *(_BYTE *)(*(_DWORD *)(v7 + 32) + v29));
                v30 = v78;
                v57 = 1;
              }
              ++v29;
            }
            while ( v29 < v25 );
          }
          operator delete(i);
          if ( !v57 )
          {
            LOBYTE(v80) = 4;
            CByteArray___CByteArray(&v68);
            LOBYTE(v80) = 3;
            CByteArray___CByteArray(&v63);
            LOBYTE(v80) = 2;
            CString___CString(&v55);
            LOBYTE(v80) = 1;
            v54 = VariantClear((VARIANTARG *)&v59);
            if ( v54 < 0 )
              sub_40BE24(v54);
            LOBYTE(v80) = 0;
            v48 = VariantClear(&pvarg);
            if ( v48 < 0 )
LABEL_117:
              sub_40BE24(v48);
LABEL_118:
            v80 = -1;
            if ( a2 )
              (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
            return 29;
          }
          if ( psa )
          {
            SafeArrayDestroy(psa);
            psa = 0;
          }
          v32 = SafeArrayCreateVector(0x11u, 1, cElements);
          SafeArrayAccessData(v32, (void **)&v58);
          for ( j = 0; j < (signed int)cElements; ++v58 )
            *(_BYTE *)v58 = *(_BYTE *)(v64 + j++);
          SafeArrayUnaccessData(v32);
          psa = v32;
          if ( (*(int (__stdcall **)(int, int, int, int, int, int, SAFEARRAY *, int, ULONG))(*(_DWORD *)a2 + 80))(
                 a2,
                 v70,
                 v76,
                 v74,
                 v59,
                 v60,
                 v32,
                 v62,
                 v77) < 0 )
            v73 = 32;
          goto LABEL_47;
        }
      }
LABEL_31:
      if ( v27(v55, "BRANCH") )
        goto LABEL_35;
      operator delete(i);
    }
    else
    {
      v17 = *(_DWORD *)(v7 + 20) / 8;
      v18 = *(_DWORD *)(v7 + 20) % 8;
      v19 = ((1 << v16) - 1) << v18;
      if ( !sub_4011D6(1, v17, &v63, &v68) )
      {
        LOBYTE(v80) = 4;
        CByteArray___CByteArray(&v68);
        LOBYTE(v80) = 3;
        CByteArray___CByteArray(&v63);
        LOBYTE(v80) = 2;
        CString___CString(&v55);
        LOBYTE(v80) = 1;
        v41 = VariantClear((VARIANTARG *)&v59);
        if ( v41 < 0 )
          sub_40BE24(v41);
        LOBYTE(v80) = 0;
        v42 = VariantClear(&pvarg);
        if ( v42 < 0 )
          sub_40BE24(v42);
        v80 = -1;
        if ( a2 )
          (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
        return 24;
      }
      LOBYTE(v79) = *(_BYTE *)v69;
      i = (void *)(unsigned __int8)v79;
      if ( (!mbscmp(v55, "CONDITION") || !mbscmp(v55, "BRANCH"))
        && (v19 & (unsigned int)i) != (v19 & (**(_BYTE **)(v7 + 28) << v18)) )
      {
        if ( !mbscmp(v55, "CONDITION") )
        {
          LOBYTE(v80) = 4;
          CByteArray___CByteArray(&v68);
          LOBYTE(v80) = 3;
          CByteArray___CByteArray(&v63);
          LOBYTE(v80) = 2;
          CString___CString(&v55);
          LOBYTE(v80) = 1;
          v43 = VariantClear((VARIANTARG *)&v59);
          if ( v43 < 0 )
            sub_40BE24(v43);
          LOBYTE(v80) = 0;
          v44 = VariantClear(&pvarg);
          if ( v44 < 0 )
            sub_40BE24(v44);
          v80 = -1;
          if ( a2 )
            (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
          return 28;
        }
        if ( !mbscmp(v55, "BRANCH") )
        {
          LOBYTE(v80) = 4;
          CByteArray___CByteArray(&v68);
          LOBYTE(v80) = 3;
          CByteArray___CByteArray(&v63);
          LOBYTE(v80) = 2;
          CString___CString(&v55);
          LOBYTE(v80) = 1;
          v45 = VariantClear((VARIANTARG *)&v59);
          if ( v45 < 0 )
            sub_40BE24(v45);
          LOBYTE(v80) = 0;
          v46 = VariantClear(&pvarg);
          if ( v46 < 0 )
            goto LABEL_110;
          goto LABEL_111;
        }
LABEL_16:
        v20 = v19 & (**(_BYTE **)(v7 + 32) << v18);
        if ( (v19 & (unsigned int)i) == v20 )
        {
          LOBYTE(v80) = 4;
          CByteArray___CByteArray(&v68);
          LOBYTE(v80) = 3;
          CByteArray___CByteArray(&v63);
          LOBYTE(v80) = 2;
          CString___CString(&v55);
          LOBYTE(v80) = 1;
          v47 = VariantClear((VARIANTARG *)&v59);
          if ( v47 < 0 )
            sub_40BE24(v47);
          LOBYTE(v80) = 0;
          v48 = VariantClear(&pvarg);
          if ( v48 < 0 )
            goto LABEL_117;
          goto LABEL_118;
        }
        CByteArray__RemoveAt(&v63, 0, 6);
        v21 = cElements;
        CByteArray__RemoveAt(&v63, cElements - 2, 2);
        CByteArray__SetAtGrow(&v63, v17, v20 | (unsigned int)i & ~v19);
        if ( psa )
        {
          SafeArrayDestroy(psa);
          psa = 0;
        }
        v23 = SafeArrayCreateVector(0x11u, 1, cElements);
        SafeArrayAccessData(v23, (void **)&v58);
        for ( k = 0; k < (signed int)cElements; ++k )
          *(_BYTE *)(k + v58) = *(_BYTE *)(v64 + k);
        SafeArrayUnaccessData(v23);
        psa = v23;
        if ( (*(int (__stdcall **)(int, int, int, int, int, int, SAFEARRAY *, int, ULONG))(*(_DWORD *)a2 + 80))(
               a2,
               v70,
               v76,
               v74,
               v59,
               v60,
               v23,
               v62,
               v21) < 0 )
        {
          LOBYTE(v80) = 4;
          CByteArray___CByteArray(&v68);
          LOBYTE(v80) = 3;
          CByteArray___CByteArray(&v63);
          LOBYTE(v80) = 2;
          CString___CString(&v55);
          LOBYTE(v80) = 1;
          v49 = VariantClear((VARIANTARG *)&v59);
          if ( v49 < 0 )
            sub_40BE24(v49);
          LOBYTE(v80) = 0;
          v50 = VariantClear(&pvarg);
          if ( v50 < 0 )
            sub_40BE24(v50);
          v80 = -1;
          if ( a2 )
            (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
          return 32;
        }
        goto LABEL_47;
      }
      if ( !mbscmp(v55, "CONDITION") || mbscmp(v55, "BRANCH") )
        goto LABEL_16;
    }
LABEL_47:
    LOBYTE(v80) = 4;
    CByteArray___CByteArray(&v68);
    LOBYTE(v80) = 3;
    CByteArray___CByteArray(&v63);
    v33 = *((_DWORD *)v67 + 8);
    ++v71;
    if ( v71 >= v33 )
    {
      v3 = a2;
      v2 = 0;
LABEL_49:
      LOBYTE(v80) = 2;
      CString___CString(&v55);
      LOBYTE(v80) = 1;
      v34 = VariantClear((VARIANTARG *)&v59);
      if ( v34 < v2 )
        sub_40BE24(v34);
      LOBYTE(v80) = 0;
      v35 = VariantClear(&pvarg);
      if ( v35 < v2 )
        sub_40BE24(v35);
      v80 = -1;
      if ( v3 != v2 )
        (*(void (__stdcall **)(int))(*(_DWORD *)v3 + 8))(v3);
      return v73;
    }
  }
  LOBYTE(v80) = 2;
  CString___CString(&v55);
  LOBYTE(v80) = 1;
  v37 = VariantClear((VARIANTARG *)&v59);
  if ( v37 < 0 )
    sub_40BE24(v37);
  LOBYTE(v80) = 0;
  v38 = VariantClear(&pvarg);
  if ( v38 < 0 )
    sub_40BE24(v38);
  v80 = -1;
  if ( a2 )
    (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
  return 33;
}
// 4011D6: using guessed type _DWORD __stdcall sub_4011D6(_DWORD, _DWORD, _DWORD, _DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B73C: using guessed type int __thiscall CString__MakeUpper(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B880: using guessed type int __thiscall CByteArray___CByteArray(_DWORD);
// 40B886: using guessed type int __thiscall CByteArray__SetAtGrow(_DWORD, _DWORD, _DWORD);
// 40B88C: using guessed type int __thiscall CByteArray__RemoveAt(_DWORD, _DWORD, _DWORD);
// 40B892: using guessed type int __thiscall CByteArray__SetSize(_DWORD, _DWORD, _DWORD);
// 40B898: using guessed type int __thiscall CByteArray__CByteArray(_DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (004063B0) --------------------------------------------------------
signed int __stdcall sub_4063B0(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4)
{
  signed int result; // eax@4
  int v5; // eax@5
  int v6; // ecx@5
  int v7; // esi@5
  int v8; // edi@6

  if ( *(_DWORD *)(a4 + 8) )
    CByteArray__SetSize(a4, 0, -1);
  if ( *(_DWORD *)(a3 + 8) >= a2 + a1 )
  {
    CByteArray__SetSize(a4, a1, -1);
    v5 = a2 + 6;
    v7 = a2 + a1 + 6;
    v6 = 0;
    if ( a2 + 6 >= v7 )
    {
      result = 1;
    }
    else
    {
      do
      {
        v8 = v6++;
        ++v5;
        *(_BYTE *)(*(_DWORD *)(a4 + 4) + v8) = *(_BYTE *)(*(_DWORD *)(a3 + 4) + v5 - 1);
      }
      while ( v5 < v7 );
      result = 1;
    }
  }
  else
  {
    result = 0;
  }
  return result;
}
// 40B892: using guessed type int __thiscall CByteArray__SetSize(_DWORD, _DWORD, _DWORD);

//----- (00406470) --------------------------------------------------------
signed int __thiscall sub_406470(void *this, int *a2)
{
  int v2; // eax@1
  int v3; // esi@1
  void *v4; // edi@1
  int v5; // ecx@1
  int v6; // ebx@4
  int v7; // ebp@4
  int v8; // edi@4
  int v9; // ecx@5
  char v10; // zf@5
  int v11; // eax@6
  int v12; // edx@8
  int v13; // ecx@11
  signed int v14; // eax@17
  int v15; // ebx@18
  int v16; // esi@18
  int v17; // ecx@21
  int v18; // edi@22
  int v19; // esi@22
  int v20; // ebp@23
  int v21; // ecx@24
  int v22; // eax@26
  void *v23; // ecx@28
  int v24; // esi@32
  int v25; // eax@33
  int v26; // edx@34
  int v27; // edx@41
  int v28; // ecx@44
  int v30; // edx@48
  int v31; // ecx@51
  int v32; // edx@54
  int v33; // ecx@57
  int v34; // ecx@60
  int v35; // edx@64
  int v36; // ecx@67
  int v37; // edx@70
  int v38; // [sp+12h] [bp-60h]@5
  int v39; // [sp+16h] [bp-5Ch]@5
  int *v40; // [sp+1Ah] [bp-58h]@5
  char i; // [sp+31h] [bp-41h]@32
  int v42; // [sp+32h] [bp-40h]@1
  int *v43; // [sp+36h] [bp-3Ch]@1
  int v44; // [sp+3Ah] [bp-38h]@1
  int v45; // [sp+3Eh] [bp-34h]@1
  void *v46; // [sp+42h] [bp-30h]@22
  int v47; // [sp+46h] [bp-2Ch]@1
  int v48; // [sp+4Ah] [bp-28h]@1
  int *v49; // [sp+4Eh] [bp-24h]@4
  int v50; // [sp+52h] [bp-20h]@1
  void *v51; // [sp+56h] [bp-1Ch]@1
  int v52; // [sp+5Ah] [bp-18h]@1
  int v53; // [sp+5Eh] [bp-14h]@3
  int v54; // [sp+62h] [bp-10h]@18
  int v55; // [sp+6Eh] [bp-4h]@1

  v4 = this;
  v51 = this;
  v3 = 0;
  v55 = 0;
  v52 = 0;
  v44 = 0;
  v47 = 0;
  v43 = 0;
  v48 = 0;
  v45 = 0;
  CString__CString(&v42);
  v5 = *((_DWORD *)v4 + 8);
  v2 = *((_DWORD *)v4 + 2);
  LOBYTE(v55) = 1;
  v50 = 0;
  if ( v5 <= 0 )
    goto LABEL_43;
  while ( 1 )
  {
    v7 = *(_DWORD *)(v2 + 8);
    v53 = *(_DWORD *)v2;
    v49 = (int *)v7;
    CString__operator_(&v42, v7 + 4);
    CString__MakeUpper(&v42);
    v6 = *(_DWORD *)(v7 + 20) / 8;
    v8 = *(_DWORD *)(v7 + 20) % 8;
    if ( !mbscmp(v42, "BRANCH") )
      break;
    v10 = *(_DWORD *)(v7 + 12) == 65535;
    v40 = (int *)&v43;
    v39 = v3;
    v9 = *a2;
    v38 = (int)a2;
    if ( v10 )
    {
      (*(void (__fastcall **)(int, int **, int, int, int *))(v9 + 36))(v9, &v43, v38, v39, v40);
      v11 = v3 + 2;
      v43 = (int *)((char *)v43 + 2);
    }
    else
    {
      (*(void (__fastcall **)(int, int **, int, int, int *))(v9 + 32))(v9, &v43, v38, v39, v40);
      v11 = v3 + 1;
      v43 = (int *)((char *)v43 + 1);
    }
    v12 = *a2;
    v40 = &v47;
    v39 = v11;
    v38 = (int)a2;
    (*(void (__stdcall **)(int *, int, int *))(v12 + 32))(a2, v11, &v47);
    if ( (_BYTE)v47 != *(_BYTE *)(v7 + 16) )
    {
      LOBYTE(v55) = 0;
      CString___CString(&v42);
      v55 = -1;
      if ( a2 )
      {
        v31 = *a2;
        v40 = a2;
        (*(void (__stdcall **)(int *))(v31 + 8))(a2);
      }
      return 25;
    }
    if ( v6 > (signed int)((char *)v43 - 1) )
    {
      LOBYTE(v55) = 0;
      CString___CString(&v42);
      v55 = -1;
      if ( a2 )
      {
        v32 = *a2;
        v40 = a2;
        (*(void (__stdcall **)(int *))(v32 + 8))(a2);
      }
      return 26;
    }
    if ( !mbscmp(v42, "NAVIGATE") )
    {
      v40 = &v48;
      v13 = *a2;
      v39 = v3 + v6;
      v38 = (int)a2;
      if ( (*(int (__stdcall **)(int *, int, int *))(v13 + 36))(a2, v3 + v6, &v48) < 0 || !v48 )
      {
        LOBYTE(v55) = 0;
        CString___CString(&v42);
        v55 = -1;
        if ( a2 )
        {
          v33 = *a2;
          v40 = a2;
          (*(void (__stdcall **)(int *))(v33 + 8))(a2);
        }
        return 27;
      }
      v44 = v48;
LABEL_40:
      v3 = v44;
      goto LABEL_41;
    }
    if ( !mbscmp(v42, "UNCONDITION") || !mbscmp(v42, "CONDITION") || !mbscmp(v42, "USERSELECT") )
    {
      v14 = *(_DWORD *)(v7 + 24);
      if ( v14 >= 8 )
      {
        v18 = v14 / 8;
        v19 = 0;
        v46 = operator new(v14 / 8);
        if ( v18 > 0 )
        {
          v20 = v6 + v44;
          do
          {
            v40 = &v45;
            v39 = v20;
            v21 = *a2;
            v38 = (int)a2;
            (*(void (__stdcall **)(int *, int, int *))(v21 + 32))(a2, v20, &v45);
            *((_BYTE *)v46 + v19++) = v45;
            ++v20;
          }
          while ( v19 < v18 );
          v7 = (int)v49;
        }
        v22 = mbscmp(v42, "CONDITION");
        if ( !v22 && v18 > 0 )
        {
          while ( 1 )
          {
            v23 = v46;
            if ( *((_BYTE *)v46 + v22) != *(_BYTE *)(*(_DWORD *)(v7 + 28) + v22) )
              break;
            ++v22;
            if ( v22 >= v18 )
              goto LABEL_32;
          }
          operator delete(v46);
LABEL_63:
          LOBYTE(v55) = 0;
          CString___CString(&v42);
          v55 = -1;
          if ( a2 )
          {
            v35 = *a2;
            v40 = a2;
            (*(void (__stdcall **)(int *))(v35 + 8))(a2);
          }
          return 28;
        }
        v23 = v46;
LABEL_32:
        v24 = 0;
        for ( i = 0; v24 < v18; ++v24 )
        {
          v25 = *(_BYTE *)(v24 + *(_DWORD *)(v7 + 32));
          v45 = v25;
          if ( *((_BYTE *)v23 + v24) != (_BYTE)v25 )
          {
            v26 = *a2;
            v40 = (int *)(v44 + v24 + v6);
            v39 = v25;
            v38 = (int)a2;
            if ( (*(int (__stdcall **)(int *, int, int *))(v26 + 40))(a2, v25, v40) < 0 )
            {
              operator delete(v46);
              LOBYTE(v55) = 0;
              CString___CString(&v42);
              v55 = -1;
              if ( a2 )
              {
                v36 = *a2;
                v40 = a2;
                (*(void (__stdcall **)(int *))(v36 + 8))(a2);
              }
              return 31;
            }
            v7 = (int)v49;
            v23 = v46;
            i = 1;
          }
        }
        operator delete(v23);
        if ( !i )
        {
          LOBYTE(v55) = 0;
          CString___CString(&v42);
          v55 = -1;
          if ( a2 )
          {
            v37 = *a2;
            v40 = a2;
            (*(void (__stdcall **)(int *))(v37 + 8))(a2);
          }
          return 29;
        }
      }
      else
      {
        v15 = v44 + v6;
        v40 = &v54;
        v39 = v15;
        v38 = (int)a2;
        v16 = ((1 << v14) - 1) << v8;
        (*(void (__stdcall **)(int *, int, int *))(*a2 + 32))(a2, v15, &v54);
        if ( !mbscmp(v42, "CONDITION") )
        {
          v45 = **(_BYTE **)(v7 + 28);
          if ( (v16 & v54) != (v16 & (v45 << v8)) )
            goto LABEL_63;
        }
        v45 = **(_BYTE **)(v7 + 32) << v8;
        if ( (v16 & v54) == (v45 & v16) )
        {
          LOBYTE(v55) = 0;
          CString___CString(&v42);
          v55 = -1;
          if ( a2 )
          {
            v34 = *a2;
            v40 = a2;
            (*(void (__stdcall **)(int *))(v34 + 8))(a2);
          }
          return 29;
        }
        v40 = (int *)v15;
        v17 = *a2;
        v39 = v45 & v16 | v54 & ~v16;
        v38 = (int)a2;
        (*(void (__stdcall **)(int *, int, int))(v17 + 40))(a2, v39, v15);
      }
      v40 = v43;
      v39 = v44;
      v38 = v44;
      v49 = &v38;
      sub_4010E6(&a2);
      if ( !sub_401159(v38, v39, v40) )
        v52 = 30;
      goto LABEL_40;
    }
LABEL_41:
    v27 = *((_DWORD *)v51 + 8);
    ++v50;
    if ( v50 >= v27 )
    {
      v3 = 0;
LABEL_43:
      LOBYTE(v55) = 0;
      CString___CString(&v42);
      v55 = -1;
      if ( a2 != (int *)v3 )
      {
        v28 = *a2;
        v40 = a2;
        (*(void (__stdcall **)(int *))(v28 + 8))(a2);
      }
      return v52;
    }
    v2 = v53;
  }
  LOBYTE(v55) = 0;
  CString___CString(&v42);
  v55 = -1;
  if ( a2 )
  {
    v30 = *a2;
    v40 = a2;
    (*(void (__stdcall **)(int *))(v30 + 8))(a2);
  }
  return 33;
}
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 401159: using guessed type _DWORD __stdcall sub_401159(_DWORD, _DWORD, _DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B73C: using guessed type int __thiscall CString__MakeUpper(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (00406B20) --------------------------------------------------------
signed int __stdcall sub_406B20(int a1, int a2, int a3)
{
  int v3; // ebx@1
  int v4; // ebp@1
  int v5; // edi@1
  signed int v6; // edi@3
  int v7; // eax@3
  int v9; // [sp+14h] [bp-14h]@1
  int v10; // [sp+18h] [bp-10h]@1
  int v11; // [sp+24h] [bp-4h]@1

  v4 = a3;
  v3 = a2;
  v5 = 0;
  v11 = 0;
  v10 = 0;
  v9 = 0;
  if ( a3 > 0 )
  {
    do
    {
      (*(void (__stdcall **)(int, int, int *))(*(_DWORD *)a1 + 32))(a1, v3, &v9);
      v5 += v9;
      ++v3;
      --v4;
    }
    while ( v4 );
  }
  v7 = (*(int (__stdcall **)(int, int, int))(*(_DWORD *)a1 + 40))(a1, v5 + 171, v3);
  v6 = 1;
  if ( v7 < 0 )
    v6 = v10;
  v11 = -1;
  if ( a1 )
    (*(void (__stdcall **)(int))(*(_DWORD *)a1 + 8))(a1);
  return v6;
}

//----- (00406BF0) --------------------------------------------------------
signed int __stdcall sub_406BF0(const WCHAR *lpWideCharStr, int a2)
{
  int v2; // edi@1
  const WCHAR *v3; // esi@1
  int v4; // ebx@2
  int v5; // esi@2
  const char *v6; // edi@3
  int v7; // eax@4
  signed int v9; // [sp+10h] [bp-8h]@1
  CHAR *v10; // [sp+14h] [bp-4h]@1

  v3 = lpWideCharStr;
  v9 = 1;
  v2 = SysStringLen((BSTR)lpWideCharStr);
  v10 = (CHAR *)operator new(v2 + 1);
  if ( !WideCharToMultiByte(0, 0, v3, v2, v10, v2, 0, 0) )
  {
LABEL_7:
    v9 = 0;
    goto LABEL_8;
  }
  LOWORD(lpWideCharStr) = 0;
  v5 = 0;
  v4 = v2 / 2;
  BYTE2(lpWideCharStr) = 0;
  if ( v2 / 2 > 0 )
  {
    v6 = v10;
    do
    {
      strncpy((char *)&lpWideCharStr, v6, 2u);
      v7 = sub_40111D(&lpWideCharStr);
      if ( v7 == -1 )
        goto LABEL_7;
      ++v5;
      v6 += 2;
      *(_BYTE *)(v5 + a2 - 1) = v7;
    }
    while ( v5 < v4 );
  }
LABEL_8:
  operator delete(v10);
  return v9;
}
// 40111D: using guessed type _DWORD __stdcall sub_40111D(_DWORD);

//----- (00406CE0) --------------------------------------------------------
signed int __stdcall sub_406CE0(const char *a1)
{
  const char *v1; // ebx@1
  signed int v2; // ebp@1
  int v3; // esi@1
  unsigned int v4; // kr00_4@1
  int v5; // eax@3
  int v6; // edi@3
  int v7; // eax@5
  int v9; // [sp+10h] [bp-4h]@1
  int v10; // [sp+18h] [bp+4h]@1

  v1 = a1;
  v4 = strlen(a1);
  v9 = 0;
  v3 = v4 - 2;
  v2 = 1;
  v10 = v4 - 2;
  if ( (signed int)(v4 - 2) < 0 )
    return v9;
  while ( !isalnum(v1[v3]) )
  {
LABEL_11:
    --v3;
    if ( v3 < 0 )
      return v9;
  }
  v5 = toupper(v1[v3]);
  v6 = v5;
  if ( v5 >= 65 && v5 <= 70 )
  {
    v7 = v5 - 55;
    goto LABEL_8;
  }
  if ( isdigit(v1[v3]) )
  {
    v7 = v6 - 48;
LABEL_8:
    if ( v3 == v10 )
    {
      v9 = v7;
    }
    else
    {
      v2 *= 16;
      v9 += v2 * v7;
    }
    goto LABEL_11;
  }
  return -1;
}

//----- (00406DC0) --------------------------------------------------------
char __stdcall sub_406DC0(const char *a1, void *a2)
{
  char result; // al@1
  void *v3; // esi@2
  int v4; // edx@3
  int i; // ecx@3
  int v6; // edi@3
  unsigned int v7; // kr00_4@3
  unsigned int v8; // ecx@3
  int j; // eax@6
  const char v10; // cl@7

  result = 0;
  if ( a1 )
  {
    v3 = a2;
    if ( a2 )
    {
      v7 = strlen(a1);
      v4 = v7 - 1;
      v8 = 2 * (v7 - 1) >> 2;
      memset(a2, 0, 4 * v8);
      v6 = (int)((char *)a2 + 4 * v8);
      for ( i = 2 * ((_BYTE)v7 - 1) & 3; i; --i )
        *(_BYTE *)v6++ = 0;
      for ( j = 0; j < v4; v3 = (char *)v3 + 2 )
      {
        v10 = a1[j++];
        *(_BYTE *)v3 = v10;
      }
      result = 1;
    }
  }
  return result;
}

//----- (00406F80) --------------------------------------------------------
signed int __stdcall sub_406F80(int a1, int a2)
{
  int v2; // eax@1
  int v3; // esi@1
  int v5; // edi@3

  v2 = a1;
  v3 = *(_DWORD *)(a1 - 8);
  if ( *(_DWORD *)(a2 - 8) != v3 )
  {
LABEL_2:
    CString___CString(&a1);
    CString___CString(&a2);
    return 0;
  }
  v5 = 0;
  if ( v3 > 0 )
  {
    while ( *(_BYTE *)v2 == 42 || *(_BYTE *)v2 == *(_BYTE *)(a2 - a1 + v2) )
    {
      ++v5;
      ++v2;
      if ( v5 >= v3 )
        goto LABEL_7;
    }
    goto LABEL_2;
  }
LABEL_7:
  CString___CString(&a1);
  CString___CString(&a2);
  return 1;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (00407070) --------------------------------------------------------
signed int __thiscall sub_407070(void *this, char a2, int a3)
{
  int v3; // ebx@1
  int v4; // ecx@1
  int v5; // ecx@2
  int v6; // edx@3
  int v7; // ebp@3
  int v8; // edi@3
  int v9; // esi@3
  int v11; // [sp-8h] [bp-44h]@4
  int v12; // [sp-4h] [bp-40h]@1
  void *v13; // [sp+10h] [bp-2Ch]@1
  int *v14; // [sp+14h] [bp-28h]@1
  int *v15; // [sp+18h] [bp-24h]@4
  char v16; // [sp+1Ch] [bp-20h]@1
  int v17; // [sp+20h] [bp-1Ch]@3
  int v18; // [sp+24h] [bp-18h]@3
  int v19; // [sp+38h] [bp-4h]@1

  v13 = this;
  v19 = 1;
  sub_4011CC(&v16);
  v12 = v4;
  v14 = &v12;
  LOBYTE(v19) = 2;
  CString__CString(&v12, &a2);
  sub_401136(v12);
  v3 = 0;
  if ( *(_DWORD *)(a3 - 8) > 0 )
  {
    while ( sub_4011E5(&v16) != 3 )
    {
      v6 = v17;
      v9 = 0;
      v8 = 0;
      v7 = *(_DWORD *)(*(_DWORD *)v17 - 8);
      if ( v18 <= 0 )
        goto LABEL_12;
      do
      {
        v12 = v5;
        v14 = &v12;
        CString__Mid(&a3, v6, &v12, v3, v7);
        v11 = v5;
        v15 = &v11;
        LOBYTE(v19) = 3;
        CString__CString(&v11, v17 + 4 * v9);
        LOBYTE(v19) = 2;
        v8 |= sub_401195(v11, v12);
        ++v9;
      }
      while ( v9 < v18 );
      if ( !v8 )
      {
LABEL_12:
        LOBYTE(v19) = 1;
        sub_4011C7(&v16);
        LOBYTE(v19) = 0;
        CString___CString(&a2);
        v19 = -1;
        CString___CString(&a3);
        return 0;
      }
      v3 += v7;
      if ( v3 >= *(_DWORD *)(a3 - 8) )
        break;
    }
  }
  LOBYTE(v19) = 1;
  sub_4011C7(&v16);
  LOBYTE(v19) = 0;
  CString___CString(&a2);
  v19 = -1;
  CString___CString(&a3);
  return 1;
}
// 401136: using guessed type _DWORD __stdcall sub_401136(char);
// 401195: using guessed type _DWORD __stdcall sub_401195(_DWORD, _DWORD);
// 4011C7: using guessed type int __thiscall sub_4011C7(_DWORD);
// 4011CC: using guessed type int __thiscall sub_4011CC(_DWORD);
// 4011E5: using guessed type int __thiscall sub_4011E5(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B89E: using guessed type int __fastcall CString__Mid(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);

//----- (00407220) --------------------------------------------------------
void *__thiscall sub_407220(void *this, int a2)
{
  int v2; // eax@1
  void *v3; // esi@1
  char v4; // zf@1

  v3 = this;
  v2 = *(_DWORD *)a2;
  v4 = *(_DWORD *)a2 == 0;
  *(_DWORD *)this = *(_DWORD *)a2;
  if ( !v4 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v2 + 4))(v2);
  return v3;
}

//----- (00407270) --------------------------------------------------------
void *__thiscall sub_407270(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  j_j___1CPtrList(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 4012A8: using guessed type int __thiscall j_j_??1CPtrList(_DWORD);

//----- (004073E0) --------------------------------------------------------
int __thiscall sub_4073E0(int this)
{
  int v1; // ecx@1
  int v2; // esi@1
  int v3; // eax@3
  int v4; // eax@6
  int v5; // eax@9

  v2 = this;
  v1 = *(_DWORD *)(this + 40);
  if ( v1 )
  {
    (**(void (__stdcall ***)(_DWORD))v1)(1);
    *(_DWORD *)(v2 + 40) = 0;
  }
  v3 = *(_DWORD *)(v2 + 36);
  if ( v3 )
  {
    if ( v3 )
    {
      *(_DWORD *)(v2 + 36) = 0;
      (*(void (__stdcall **)(int))(*(_DWORD *)v3 + 8))(v3);
    }
    v4 = *(_DWORD *)(v2 + 36);
    if ( v4 )
      (*(void (__stdcall **)(_DWORD))(*(_DWORD *)v4 + 8))(*(_DWORD *)(v2 + 36));
    *(_DWORD *)(v2 + 36) = 0;
  }
  CString___CString(v2 + 52);
  CString___CString(v2 + 48);
  v5 = *(_DWORD *)(v2 + 36);
  if ( v5 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v5 + 8))(v5);
  CString___CString(v2 + 32);
  CString___CString(v2 + 28);
  return sub_40A270(v2);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (004074F0) --------------------------------------------------------
bool __thiscall sub_4074F0(int this)
{
  return *(_DWORD *)(this + 36) || CoCreateInstance(&stru_414CD0, 0, 7u, &stru_414CE8, (LPVOID *)(this + 36)) >= 0;
}

//----- (00407530) --------------------------------------------------------
int __thiscall sub_407530(int this)
{
  int v1; // esi@1
  int result; // eax@4

  v1 = this;
  if ( mbscmp(*(_DWORD *)(this + 52), "XTS2500")
    && mbscmp(*(_DWORD *)(v1 + 52), "XTS5000")
    && mbscmp(*(_DWORD *)(v1 + 52), "ASTROSPECTRAPLUS") )
  {
    *(_DWORD *)(v1 + 56) = 0;
    result = *(_DWORD *)(v1 + 56);
  }
  else
  {
    *(_DWORD *)(v1 + 56) = 1;
    result = *(_DWORD *)(v1 + 56);
  }
  return result;
}
// 416BDC: using guessed type int __cdecl mbscmp(_DWORD, _DWORD);

//----- (004075B0) --------------------------------------------------------
int __thiscall sub_4075B0(void *this, int a2)
{
  void *v2; // edi@1
  int v3; // esi@1
  int result; // eax@2

  v2 = this;
  v3 = (int)((char *)this + 28);
  CString__Empty((char *)this + 28);
  switch ( a2 )
  {
    case 0:
      result = CString__operator_(v3, "Success : ");
      break;
    case 1:
      result = CString__operator_(v3, "Empty Package File Signature:");
      break;
    case 2:
      result = CString__operator_(v3, "Empty Package File Path:");
      break;
    case 3:
      result = CString__operator_(v3, "CpFix package File does not exist or is empty: ");
      break;
    case 4:
      CString__operator_(v3, "XML Handler Exception error: ");
      goto LABEL_7;
    case 5:
LABEL_7:
      result = CString__operator_(v3, "Failed to load the Digital Signer Server:");
      break;
    case 6:
      result = CString__operator_(v3, "DigitalSigner failed to verify the key :");
      break;
    case 7:
      result = CString__operator_(v3, "CpFix Package File Not Open:");
      break;
    case 8:
      result = CString__operator_(v3, "Failed to read ISH Model Number:");
      break;
    case 9:
      result = CString__operator_(v3, "Failed to read RIDE Model Number:");
      break;
    case 10:
      result = CString__operator_(v3, "Failed to read ISH Serial Number:");
      break;
    case 11:
      result = CString__operator_(v3, "Failed to read RIDE Serial Number:");
      break;
    case 12:
      result = CString__operator_(v3, "This CpFix Item cannot be applied on this target radio ");
      break;
    case 13:
      result = CString__operator_(v3, "Failed to Initialize current CpFixItem:");
      break;
    case 14:
      result = CString__operator_(v3, "CpFixItem Not Initialized yet:");
      break;
    case 15:
      result = CString__operator_(v3, "The communication is not open yet:");
      break;
    case 16:
      result = CString__operator_(v3, "CpFix Item Data error:");
      break;
    case 17:
      result = CString__operator_(v3, "Failed to load NextGenCpFix Server:");
      break;
    case 18:
      result = CString__operator_(v3, "Failed to open Ish Radio:");
      break;
    case 19:
      result = CString__operator_(v3, "Failed to open Ride Radio:");
      break;
    case 20:
      result = CString__operator_(v3, "Failed to unlock the radio:");
      break;
    case 21:
      result = CString__operator_(v3, "Failed to close Ride Radio:");
      break;
    case 22:
      result = CString__operator_(v3, "Failed to close Ish Radio:");
      break;
    case 23:
      result = CString__operator_(v3, "Failed to Read ISH Radio Component:");
      break;
    case 24:
      result = CString__operator_(v3, "Failed to Get ISH Byte:");
      break;
    case 25:
      result = CString__operator_(v3, "Invalid Ride Codeplug Block ID:");
      break;
    case 26:
      result = CString__operator_(v3, "Invalid Ride Codeplug Offset:");
      break;
    case 27:
      result = CString__operator_(v3, "Invalid Ride Codeplug Vector:");
      break;
    case 28:
      result = CString__operator_(
                 v3,
                 "Conditional update (current cp value different from Expected Value in Package File) : ");
      break;
    case 29:
      result = CString__operator_(v3, "Value already set(current cp value is the same as new value in package file) : ");
      break;
    case 30:
      result = CString__operator_(v3, "Failed to update Ride radio Check Sum");
      break;
    case 32:
      result = CString__operator_(v3, "Failed in ISH WriteISHList ");
      break;
    case 31:
      result = CString__operator_(v3, "Failed in Ride PutByte ");
      break;
    case 33:
      result = CString__operator_(v3, "Navigate action only applies to Ride Radio: ");
      break;
    case 34:
      result = CString__operator_(v3, (char *)v2 + 32);
      break;
    default:
      result = CString__operator_(v3, "Unexpected CpFix Error: ");
      break;
  }
  return result;
}
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B7D8: using guessed type int __thiscall CString__Empty(_DWORD);

//----- (00407990) --------------------------------------------------------
int __thiscall sub_407990(void *this, int a2)
{
  CString__CString(a2, (char *)this + 28);
  return a2;
}
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (004079C0) --------------------------------------------------------
int __thiscall sub_4079C0(void *this, int a2)
{
  const WCHAR *v2; // ebx@1
  int v3; // esi@1
  int result; // eax@7
  int v5; // eax@8
  SAFEARRAY *v6; // ebx@9
  int v7; // eax@10
  int v8; // eax@15
  void *v9; // eax@17
  int v10; // edi@17
  int v11; // eax@17
  BSTR v12; // eax@17
  int v13; // eax@17
  BSTR v14; // eax@17
  OLECHAR *v15; // ebx@17
  BSTR v16; // eax@17
  BSTR v17; // eax@18
  signed int v18; // eax@25
  char v19; // [sp+0h] [bp-6Ch]@1
  char v20; // [sp+Ch] [bp-60h]@8
  OLECHAR *psz; // [sp+14h] [bp-58h]@9
  VARIANTARG pvarg; // [sp+1Ch] [bp-50h]@9
  char v23; // [sp+2Ch] [bp-40h]@1
  void *v24; // [sp+34h] [bp-38h]@1
  void *v25; // [sp+38h] [bp-34h]@1
  LPCWSTR lpWideCharStr; // [sp+3Ch] [bp-30h]@8
  int cbMultiByte; // [sp+40h] [bp-2Ch]@9
  BSTR ppvData; // [sp+44h] [bp-28h]@1
  int v29; // [sp+48h] [bp-24h]@8
  int v30; // [sp+4Ch] [bp-20h]@8
  int v31; // [sp+50h] [bp-1Ch]@1
  int v32; // [sp+54h] [bp-18h]@1
  char v33; // [sp+58h] [bp-14h]@1
  char *v34; // [sp+5Ch] [bp-10h]@1
  int v35; // [sp+68h] [bp-4h]@1

  v3 = (int)this;
  v34 = &v19;
  v24 = this;
  v35 = 0;
  v31 = 1;
  CString__CString(&v33, "726A0A90-53AB-11D6-8C07-00C04F2E2FBE-6C00100F-E833B82C5D96169E493CE12F7D872311E9");
  LOBYTE(v35) = 1;
  v25 = (void *)CString__AllocSysString(&v33);
  v2 = SysAllocString(L"CpFixFilePackage.enc");
  sub_4092F0((int)&v23);
  LOBYTE(v35) = 2;
  ppvData = SysAllocString(L"{5F854CEA-4E57-4b6e-9EA6-8F0476B349E3}");
  v32 = 0;
  if ( sub_409890(&v23, v2, (int)&v32, ppvData) < 0 )
  {
    sub_401050(3);
LABEL_5:
    LOBYTE(v35) = 1;
    sub_409340((int)&v23);
    LOBYTE(v35) = 0;
    CString___CString(&v33);
    v35 = -1;
    if ( a2 )
      (*(void (__stdcall **)(int))(*(_DWORD *)a2 + 8))(a2);
    return 0;
  }
  if ( !sub_40AF30(v3, v32) )
  {
    CString__operator_(v3 + 28, "CCpFixPackage::ValidatePackageFile(): setXMLDOMString fails");
    goto LABEL_5;
  }
  SysFreeString((BSTR)v2);
  SysFreeString(ppvData);
  SysFreeString((BSTR)v32);
  sub_40AED0(v3);
  v30 = 0;
  sub_40A580(v3, (int)&v30);
  v29 = 0;
  (*(void (__stdcall **)(int, int *))(*(_DWORD *)v30 + 52))(v30, &v29);
  sub_40AD90(v3, v29);
  LOBYTE(v35) = 3;
  v5 = (int)SysAllocString(L"CpFixPKSignature");
  LOBYTE(lpWideCharStr) = sub_40A5B0(v3, v5, (signed int)&v20);
  lpWideCharStr = (LPCWSTR)(unsigned __int8)lpWideCharStr;
  lpWideCharStr = SysAllocString(psz);
  cbMultiByte = SysStringLen((BSTR)lpWideCharStr);
  v6 = SafeArrayCreateVector(0x11u, 1, cbMultiByte);
  ppvData = 0;
  SafeArrayAccessData(v6, (void **)&ppvData);
  WideCharToMultiByte(0, 0, lpWideCharStr, -1, (LPSTR)ppvData, cbMultiByte, 0, 0);
  VariantInit(&pvarg);
  LOBYTE(v35) = 4;
  pvarg.vt = 8209;
  LODWORD(pvarg.llVal) = v6;
  SafeArrayUnaccessData(v6);
  if ( (*(int (__stdcall **)(int, void *, _DWORD, _DWORD, _DWORD, _DWORD))(*(_DWORD *)a2 + 40))(
         a2,
         v25,
         *(_DWORD *)&pvarg,
         *(_DWORD *)&pvarg.wReserved2,
         LODWORD(pvarg.llVal),
         HIDWORD(pvarg.llVal)) >= 0 )
  {
    LOBYTE(v35) = 3;
    v8 = VariantClear(&pvarg);
    if ( v8 < 0 )
      sub_40BE24(v8);
    v11 = (int)SysAllocString(L"CpFixPKTargetType");
    sub_40A5B0(v3, v11, (signed int)&v20);
    v12 = SysAllocString(psz);
    CString__operator_(v3 + 48, v12);
    v13 = (int)SysAllocString(L"CpFixPKRadioType");
    sub_40A5B0(v3, v13, (signed int)&v20);
    v14 = SysAllocString(psz);
    CString__operator_(v3 + 52, v14);
    *(_DWORD *)(v3 + 56) = sub_4011EF(v3);
    v15 = SysAllocString(L"CpFixPKCustomErrMsg");
    sub_40A5B0(v3, (int)v15, (signed int)&v20);
    v16 = SysAllocString(psz);
    CString__operator_(v3 + 32, v16);
    SysFreeString(v15);
    v9 = operator new(0xCu);
    v10 = (int)v9;
    v25 = v9;
    LOBYTE(v35) = 5;
    if ( v9 )
    {
      *((_DWORD *)v9 + 1) = 0;
      *((_DWORD *)v9 + 2) = 1;
      v17 = sub_40C51A("/CpFixFilePackage/CpFixItem");
      *(_DWORD *)v10 = v17;
      if ( !v17 )
      {
        if ( "/CpFixFilePackage/CpFixItem" )
          sub_40BE24(-2147024882);
      }
    }
    else
    {
      v10 = 0;
    }
    LOBYTE(v35) = 3;
    v25 = (void *)v10;
    if ( !v10 )
      sub_40BE24(-2147024882);
    LOBYTE(v35) = 6;
    if ( v10 )
      v18 = *(_DWORD *)v10;
    else
      v18 = 0;
    *(_DWORD *)(v3 + 44) = sub_40AA30(v3, v18);
    LOBYTE(v35) = 3;
    if ( v10 )
    {
      if ( !InterlockedDecrement((volatile LONG *)(v10 + 8)) )
      {
        if ( *(_DWORD *)v10 )
          SysFreeString(*(BSTR *)v10);
        if ( *(_DWORD *)(v10 + 4) )
          operator delete(*(void **)(v10 + 4));
        operator delete((void *)v10);
      }
    }
    if ( *(_DWORD *)(v3 + 44) <= 0 )
    {
      sub_401050(3);
      v31 = 0;
    }
    else
    {
      *(_DWORD *)(v3 + 60) = 1;
    }
    v35 = 1;
    sub_409340((int)&v23);
    LOBYTE(v35) = 0;
    CString___CString(&v33);
    v35 = -1;
    if ( a2 )
      (*(void (__stdcall **)(int))(*(_DWORD *)a2 + 8))(a2);
    result = v31;
  }
  else
  {
    sub_401050(6);
    LOBYTE(v35) = 3;
    v7 = VariantClear(&pvarg);
    if ( v7 < 0 )
      sub_40BE24(v7);
    LOBYTE(v35) = 1;
    sub_409340((int)&v23);
    LOBYTE(v35) = 0;
    CString___CString(&v33);
    v35 = -1;
    if ( a2 )
      (*(void (__stdcall **)(_DWORD))(*(_DWORD *)a2 + 8))(a2);
    result = 0;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4011EF: using guessed type int __thiscall sub_4011EF(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B796: using guessed type int __thiscall CString__AllocSysString(_DWORD);
// 40B86E: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);

//----- (00407DC4) --------------------------------------------------------
int (__stdcall *__usercall sub_407DC4<eax>(int a1<ebp>))(int)
{
  sub_40A6B0(*(_DWORD *)(a1 - 56), a1 - 56);
  *(_DWORD *)(a1 - 28) = 0;
  return loc_407D6D;
}
// 407D6D: using guessed type int __stdcall loc_407D6D(int);

//----- (00407F60) --------------------------------------------------------
int __thiscall sub_407F60(int this)
{
  return *(_DWORD *)(this + 44);
}

//----- (00407F80) --------------------------------------------------------
int __stdcall sub_407F80(int a1)
{
  char v2; // [sp+4h] [bp-14h]@1
  int v3; // [sp+8h] [bp-10h]@1
  int v4; // [sp+14h] [bp-4h]@1

  v3 = 0;
  sub_40118B(&v2);
  v4 = 1;
  CString__CString(a1, &v2);
  v3 = 1;
  LOBYTE(v4) = 0;
  CString___CString(&v2);
  return a1;
}
// 40118B: using guessed type _DWORD __stdcall sub_40118B(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (00408010) --------------------------------------------------------
int __thiscall sub_408010(int this)
{
  return *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(*(_DWORD *)(this + 40) + 12) + 8) + 24);
}

//----- (00408030) --------------------------------------------------------
int __stdcall sub_408030(int a1)
{
  char v2; // [sp+4h] [bp-14h]@1
  int v3; // [sp+8h] [bp-10h]@1
  int v4; // [sp+14h] [bp-4h]@1

  v3 = 0;
  sub_4010B9(&v2);
  v4 = 1;
  CString__CString(a1, &v2);
  v3 = 1;
  LOBYTE(v4) = 0;
  CString___CString(&v2);
  return a1;
}
// 4010B9: using guessed type _DWORD __stdcall sub_4010B9(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (004080C0) --------------------------------------------------------
signed int __thiscall sub_4080C0(void *this, char a2)
{
  int v2; // eax@1
  signed int v3; // edi@1
  void *v5; // [sp-4h] [bp-1Ch]@1
  void **v6; // [sp+8h] [bp-10h]@1
  int v7; // [sp+14h] [bp-4h]@1

  v5 = this;
  v6 = &v5;
  v7 = 0;
  v3 = 1;
  CString__CString(&v5, &a2);
  v2 = sub_401091((char)v5);
  if ( v2 )
  {
    sub_401050(v2);
    v3 = 0;
  }
  v7 = -1;
  CString___CString(&a2);
  return v3;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 401091: using guessed type _DWORD __stdcall sub_401091(char);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (00408160) --------------------------------------------------------
int __thiscall sub_408160(int this, int a2, int a3)
{
  int v3; // edi@1
  int v4; // eax@1
  void *v6; // eax@3
  int v7; // esi@3
  BSTR v8; // eax@4
  signed int v9; // eax@11
  int v10; // ecx@21
  void *v11; // ecx@23
  int v12; // eax@24
  int v13; // ecx@27
  char v14; // [sp+0h] [bp-30h]@1
  void *v15; // [sp+Ch] [bp-24h]@3
  int v16; // [sp+10h] [bp-20h]@1
  int v17; // [sp+14h] [bp-1Ch]@3
  int v18; // [sp+18h] [bp-18h]@1
  unsigned int v19; // [sp+1Ch] [bp-14h]@3
  char *v20; // [sp+20h] [bp-10h]@1
  int v21; // [sp+2Ch] [bp-4h]@3

  v3 = this;
  v20 = &v14;
  v4 = *(_DWORD *)(this + 60);
  v16 = this;
  v18 = 1;
  if ( !v4 )
  {
    sub_401050(7);
    return 0;
  }
  v21 = 0;
  sub_40AED0(this);
  v17 = 0;
  sub_40A580(v3, (int)&v17);
  v19 = 0;
  (*(void (__stdcall **)(int, unsigned int *))(*(_DWORD *)v17 + 52))(v17, &v19);
  sub_40AD90(v3, v19);
  v6 = operator new(0xCu);
  v7 = (int)v6;
  v15 = v6;
  LOBYTE(v21) = 1;
  if ( v6 )
  {
    *((_DWORD *)v6 + 1) = 0;
    *((_DWORD *)v6 + 2) = 1;
    v8 = sub_40C51A("/CpFixFilePackage/CpFixItem");
    *(_DWORD *)v7 = v8;
    if ( !v8 )
    {
      if ( "/CpFixFilePackage/CpFixItem" )
        sub_40BE24(-2147024882);
    }
  }
  else
  {
    v7 = 0;
  }
  LOBYTE(v21) = 0;
  v15 = (void *)v7;
  if ( !v7 )
    sub_40BE24(-2147024882);
  LOBYTE(v21) = 2;
  if ( v7 )
    v9 = *(_DWORD *)v7;
  else
    v9 = 0;
  sub_40AA30(v3, v9);
  LOBYTE(v21) = 0;
  if ( v7 )
  {
    if ( !InterlockedDecrement((volatile LONG *)(v7 + 8)) )
    {
      if ( *(_DWORD *)v7 )
        SysFreeString(*(BSTR *)v7);
      if ( *(_DWORD *)(v7 + 4) )
        operator delete(*(void **)(v7 + 4));
      operator delete((void *)v7);
    }
  }
  if ( sub_40ACF0(v3, a2 - 1) )
  {
    v10 = *(_DWORD *)(v3 + 40);
    if ( v10 )
      (**(void (__stdcall ***)(_DWORD))v10)(1);
    v11 = operator new(0x34u);
    LOBYTE(v21) = 3;
    if ( v11 )
      v12 = sub_4011E0(v11);
    else
      v12 = 0;
    *(_DWORD *)(v3 + 40) = v12;
    LOBYTE(v21) = 0;
    sub_40A580(v3, (int)&v19);
    if ( !sub_4010DC(v3, v19, a3) )
      return v18;
    v13 = *(_DWORD *)(v3 + 40);
    if ( v13 )
      (**(void (__stdcall ***)(_DWORD))v13)(1);
    *(_DWORD *)(v3 + 40) = 0;
  }
  else
  {
    sub_401050(13);
  }
  return 0;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010DC: using guessed type _DWORD __stdcall sub_4010DC(_DWORD, unsigned int, _DWORD);
// 4011E0: using guessed type int __thiscall sub_4011E0(_DWORD);

//----- (00408329) --------------------------------------------------------
int (__stdcall *__usercall sub_408329<eax>(int a1<ebp>))(int, int)
{
  int v2; // esi@1

  v2 = *(_DWORD *)(a1 - 32);
  sub_401050(13);
  sub_40A6B0(v2, a1 + 8);
  *(_DWORD *)(a1 - 24) = 0;
  return loc_408308;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 408308: using guessed type int __stdcall loc_408308(int, int);

//----- (004083D0) --------------------------------------------------------
signed int __thiscall sub_4083D0(int this, char a2)
{
  signed int v2; // ebp@1
  int v3; // esi@1
  int v4; // eax@1
  signed int result; // eax@2
  int v6; // ebx@5
  OLECHAR *v7; // edi@5
  int v8; // ecx@5
  int v9; // [sp-Ch] [bp-2Ch]@5
  OLECHAR *v10; // [sp-8h] [bp-28h]@5
  int v11; // [sp-4h] [bp-24h]@5
  int *v12; // [sp+10h] [bp-10h]@5
  int v13; // [sp+1Ch] [bp-4h]@1

  v3 = this;
  v4 = *(_DWORD *)(this + 40);
  v13 = 0;
  v2 = 1;
  if ( v4 )
  {
    if ( !*(_DWORD *)(this + 36) )
      sub_401285();
    v7 = (OLECHAR *)CString__AllocSysString(&a2);
    v11 = *(_DWORD *)(v3 + 56);
    v10 = v7;
    v9 = v8;
    v12 = &v9;
    sub_4010E6(v3 + 36);
    v6 = sub_4010FA(v9, v10, v11);
    SysFreeString(v7);
    if ( v6 )
    {
      sub_401050(v6);
      v2 = 0;
    }
    else
    {
      *(_DWORD *)(v3 + 64) = 1;
    }
    v13 = -1;
    CString___CString(&a2);
    result = v2;
  }
  else
  {
    sub_401050(14);
    v13 = -1;
    CString___CString(&a2);
    result = -2147467259;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 4010FA: using guessed type _DWORD __stdcall sub_4010FA(_DWORD, _DWORD, _DWORD);
// 401285: using guessed type int sub_401285(void);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B796: using guessed type int __thiscall CString__AllocSysString(_DWORD);

//----- (004084F0) --------------------------------------------------------
signed int __thiscall sub_4084F0(int this)
{
  signed int v1; // edi@1
  signed int result; // eax@2
  int v3; // eax@3
  int v4; // [sp-10h] [bp-14h]@3
  OLECHAR *v5; // [sp-Ch] [bp-10h]@3
  int *v6; // [sp+0h] [bp-4h]@1

  v6 = (int *)this;
  v1 = 1;
  if ( *(_DWORD *)(this + 64) )
  {
    v5 = *(OLECHAR **)(this + 56);
    v4 = this;
    v6 = &v4;
    sub_4010E6(this + 36);
    v3 = sub_4010EB(v4, v5);
    if ( v3 )
    {
      sub_401050(v3);
      v1 = 0;
    }
    result = v1;
  }
  else
  {
    sub_401050(15);
    result = 0;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 4010EB: using guessed type _DWORD __stdcall sub_4010EB(_DWORD, BSTR bstrString);

//----- (00408560) --------------------------------------------------------
signed int __thiscall sub_408560(int this)
{
  signed int v1; // edi@1
  int v2; // esi@1
  signed int result; // eax@2
  int v4; // eax@3
  int v5; // ecx@3
  int v6; // [sp-10h] [bp-14h]@3
  int v7; // [sp-Ch] [bp-10h]@3
  int v8; // [sp+0h] [bp-4h]@1

  v8 = this;
  v2 = this;
  v1 = 1;
  if ( *(_DWORD *)(this + 64) )
  {
    v7 = sub_4011EF(this);
    v6 = v5;
    v8 = (int)&v6;
    sub_4010E6(v2 + 36);
    v4 = sub_401168(v6, v7);
    if ( v4 )
    {
      v1 = 0;
      sub_401050(v4);
    }
    result = v1;
  }
  else
  {
    sub_401050(15);
    result = 0;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 401168: using guessed type _DWORD __stdcall sub_401168(_DWORD, _DWORD);
// 4011EF: using guessed type int __thiscall sub_4011EF(_DWORD);

//----- (004085E0) --------------------------------------------------------
signed int __thiscall sub_4085E0(int this)
{
  int v1; // esi@1
  int v2; // eax@2
  int v3; // ecx@2
  signed int result; // eax@3
  int v5; // [sp-10h] [bp-14h]@2
  int v6; // [sp-Ch] [bp-10h]@2
  int v7; // [sp+0h] [bp-4h]@1

  v7 = this;
  v1 = this;
  if ( *(_DWORD *)(this + 64)
    && (v6 = sub_4011EF(this), v5 = v3, v7 = (int)&v5, sub_4010E6(v1 + 36), (v2 = sub_4010A0(v5, v6)) != 0) )
  {
    sub_401050(v2);
    result = 0;
  }
  else
  {
    result = 1;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010A0: using guessed type _DWORD __stdcall sub_4010A0(_DWORD, _DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 4011EF: using guessed type int __thiscall sub_4011EF(_DWORD);

//----- (004086D0) --------------------------------------------------------
signed int __thiscall sub_4086D0(int this, int a2)
{
  signed int v2; // edi@1
  int v3; // esi@1
  signed int result; // eax@2
  int v5; // eax@3
  int v6; // ecx@3
  int v7; // [sp-Ch] [bp-14h]@3
  int v8; // [sp-8h] [bp-10h]@3
  int v9; // [sp-4h] [bp-Ch]@3

  v3 = this;
  v2 = 1;
  if ( *(_DWORD *)(this + 64) )
  {
    v6 = *(_DWORD *)(this + 56);
    v9 = a2;
    v8 = v6;
    v7 = v6;
    sub_4010E6(v3 + 36);
    v5 = sub_4011FE(v7, v8, v9);
    if ( v5 )
    {
      sub_401050(v5);
      v2 = 0;
    }
    result = v2;
  }
  else
  {
    sub_401050(15);
    result = 0;
  }
  return result;
}
// 401050: using guessed type _DWORD __stdcall sub_401050(_DWORD);
// 4010E6: using guessed type _DWORD __stdcall sub_4010E6(_DWORD);
// 4011FE: using guessed type _DWORD __stdcall sub_4011FE(_DWORD, _DWORD, _DWORD);

//----- (00408750) --------------------------------------------------------
void *__thiscall sub_408750(void *this)
{
  void *v2; // esi@1
  int v3; // edi@1

  v2 = this;
  v3 = (int)((char *)this + 16);
  CString__CString((char *)this + 16);
  *(_DWORD *)v2 = off_4118AC;
  *((_DWORD *)v2 + 3) = 0;
  CString__operator_(v3, &unk_4159AC);
  *((_DWORD *)v2 + 1) = 0;
  return v2;
}
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 4118AC: using guessed type int (__stdcall *off_4118AC[2])();

//----- (004087E0) --------------------------------------------------------
void *__thiscall sub_4087E0(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_4011C7(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 4011C7: using guessed type int __thiscall sub_4011C7(_DWORD);

//----- (00408810) --------------------------------------------------------
int __thiscall sub_408810(void *this)
{
  void *v2; // esi@1

  v2 = this;
  *(_DWORD *)this = off_4118AC;
  sub_4010F5();
  return CString___CString((char *)v2 + 16);
}
// 4010F5: using guessed type int sub_4010F5(void);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 4118AC: using guessed type int (__stdcall *off_4118AC[2])();

//----- (00408880) --------------------------------------------------------
char __thiscall sub_408880(int this)
{
  return *(_DWORD *)(this + 12) >= *(_DWORD *)(*(_DWORD *)(this + 16) - 8);
}

//----- (004088B0) --------------------------------------------------------
signed int __thiscall sub_4088B0(void *this)
{
  void *v1; // esi@1
  int v3; // ebp@3
  int v4; // ebx@4
  void *v5; // eax@6
  int v6; // eax@7
  int v7; // edi@7
  int v8; // edi@11
  int v9; // ecx@11
  int v10; // eax@12
  int v11; // ST10_4@13
  int v12; // eax@13
  int v13; // ecx@13
  void *v14; // eax@15
  int v15; // eax@16
  int v16; // eax@20
  int v17; // edx@20
  int v18; // edi@22
  int v19; // [sp+10h] [bp-14h]@4
  void *v20; // [sp+14h] [bp-10h]@6
  int v21; // [sp+20h] [bp-4h]@6

  v1 = this;
  sub_4010F5();
  if ( (unsigned __int8)sub_401226(v1) )
    return 3;
  v3 = (int)((char *)v1 + 16);
  if ( *(_BYTE *)(*((_DWORD *)v1 + 3) + *((_DWORD *)v1 + 4)) == 91 )
  {
    v4 = sub_401249(&v19);
    if ( v4 == -1 )
      return 2;
    v5 = operator new(4 * v4 + 4);
    v20 = v5;
    v21 = 0;
    if ( v5 )
    {
      v7 = (int)((char *)v5 + 4);
      *(_DWORD *)v5 = v4;
      _eh_vector_constructor_iterator_((char *)v5 + 4, 4, v4, CString__CString, CString___CString);
      v6 = v7;
    }
    else
    {
      v6 = 0;
    }
    v21 = -1;
    *((_DWORD *)v1 + 1) = v6;
    if ( !v6 )
      return 1;
    v8 = 0;
    v9 = *((_DWORD *)v1 + 3) + 1;
    *((_DWORD *)v1 + 2) = v4;
    *((_DWORD *)v1 + 3) = v9;
    if ( v4 > 0 )
    {
      v10 = v19;
      do
      {
        v11 = CString__Mid((char *)v1 + 16, &v20, &v20, *((_DWORD *)v1 + 3), v10);
        v12 = *((_DWORD *)v1 + 1);
        v21 = 1;
        CString__operator_(v12 + 4 * v8, v11);
        v21 = -1;
        CString___CString(&v20);
        v10 = v19;
        ++v8;
        v13 = *((_DWORD *)v1 + 2);
        *((_DWORD *)v1 + 3) += v19 + 1;
      }
      while ( v8 < v13 );
    }
  }
  else
  {
    v14 = operator new(4u);
    v20 = v14;
    v21 = 2;
    if ( v14 )
      v15 = CString__CString(v14, &unk_4159AC);
    else
      v15 = 0;
    v21 = -1;
    *((_DWORD *)v1 + 1) = v15;
    if ( !v15 )
      return 1;
    v16 = *(_DWORD *)v3;
    v17 = *((_DWORD *)v1 + 3);
    *((_DWORD *)v1 + 2) = 1;
    if ( v17 < *(_DWORD *)(v16 - 8) )
    {
      do
      {
        LOBYTE(v16) = *(_BYTE *)(*((_DWORD *)v1 + 3) + v16);
        if ( (_BYTE)v16 == 91 )
          break;
        CString__operator__(*((_DWORD *)v1 + 1), v17, v16);
        v16 = *(_DWORD *)v3;
        v18 = *((_DWORD *)v1 + 3) + 1;
        *((_DWORD *)v1 + 3) = v18;
        v17 = *(_DWORD *)(v16 - 8);
      }
      while ( v18 < v17 );
    }
  }
  return 0;
}
// 4010F5: using guessed type int sub_4010F5(void);
// 401226: using guessed type int __thiscall sub_401226(_DWORD);
// 401249: using guessed type _DWORD __stdcall sub_401249(_DWORD);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B77E: using guessed type int __fastcall CString__operator__(_DWORD, _DWORD, _DWORD);
// 40B89E: using guessed type int __fastcall CString__Mid(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40B964: using guessed type _DWORD __stdcall _eh vector constructor iterator_(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);

//----- (00408BB0) --------------------------------------------------------
int __thiscall sub_408BB0(void *this, char a2)
{
  void *v3; // esi@1

  v3 = this;
  sub_4010F5();
  CString__operator_((char *)v3 + 16, &a2);
  *((_DWORD *)v3 + 3) = 0;
  return CString___CString(&a2);
}
// 4010F5: using guessed type int sub_4010F5(void);
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);

//----- (00408C30) --------------------------------------------------------
void __thiscall sub_408C30(int this)
{
  int v1; // edi@1
  void *v2; // esi@1

  v1 = this;
  v2 = *(void **)(this + 4);
  if ( v2 )
  {
    if ( *(_DWORD *)(this + 8) <= 1 )
    {
      if ( v2 )
      {
        CString___CString(*(_DWORD *)(this + 4));
        operator delete(v2);
      }
    }
    else
    {
      if ( v2 )
      {
        _eh_vector_destructor_iterator_(v2, 4, *((_DWORD *)v2 - 1), CString___CString);
        operator delete((char *)v2 - 4);
        *(_DWORD *)(v1 + 4) = 0;
        *(_DWORD *)(v1 + 8) = 0;
        return;
      }
    }
  }
  *(_DWORD *)(v1 + 4) = 0;
  *(_DWORD *)(v1 + 8) = 0;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B9E6: using guessed type _DWORD __stdcall _eh vector destructor iterator_(_DWORD, _DWORD, _DWORD, _DWORD);

//----- (00408CC0) --------------------------------------------------------
signed int __thiscall sub_408CC0(int this, int a2)
{
  int v2; // edx@1
  int v3; // ebx@1
  int v4; // ebp@1
  int v5; // esi@1
  char v6; // al@2
  signed int result; // eax@8
  int v8; // edi@9
  char v9; // cl@11
  char v10; // cl@15

  v5 = *(_DWORD *)(this + 16);
  v2 = *(_DWORD *)(this + 12) + 1;
  v3 = 0;
  v4 = *(_DWORD *)(v5 - 8);
  if ( v2 >= v4 )
    goto LABEL_18;
  do
  {
    v6 = *(_BYTE *)(v5 + v2);
    if ( v6 == 124 )
      break;
    if ( v6 == 93 )
      break;
    ++v3;
    ++v2;
  }
  while ( v2 < v4 );
  if ( v2 < v4 && *(_BYTE *)(v5 + v2) != 93 && v3 )
  {
    result = 1;
    do
    {
      ++result;
      ++v2;
      v8 = 0;
      if ( v3 > 0 )
      {
        while ( v2 < v4 )
        {
          v9 = *(_BYTE *)(v5 + v2);
          if ( v9 == 124 )
            break;
          if ( v9 == 93 )
            break;
          ++v8;
          ++v2;
          if ( v8 >= v3 )
            goto LABEL_14;
        }
        goto LABEL_18;
      }
LABEL_14:
      if ( v2 >= v4 )
        goto LABEL_18;
      v10 = *(_BYTE *)(v5 + v2);
    }
    while ( v10 == 124 );
    if ( v10 != 93 )
      goto LABEL_18;
    *(_DWORD *)a2 = v3;
  }
  else
  {
LABEL_18:
    result = -1;
  }
  return result;
}

//----- (00408E60) --------------------------------------------------------
void *__thiscall sub_408E60(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_401253(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 401253: using guessed type int __thiscall sub_401253(_DWORD);

//----- (00408E90) --------------------------------------------------------
void *__thiscall sub_408E90(void *this, char a2, char a3, int a4, int a5)
{
  void *v6; // esi@1

  v6 = this;
  CDialog__CDialog(129, a5);
  CString__CString((char *)v6 + 96);
  CString__CString((char *)v6 + 100);
  CString__CString((char *)v6 + 108);
  *(_DWORD *)v6 = off_4118D8;
  CString__operator_((char *)v6 + 100, &a3);
  CString__operator_((char *)v6 + 108, &a2);
  *((_DWORD *)v6 + 26) = a4;
  CString__operator_((char *)v6 + 96, &unk_4159AC);
  CString___CString(&a2);
  CString___CString(&a3);
  return v6;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5C8: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B694: using guessed type int __stdcall CDialog__CDialog(_DWORD, _DWORD);
// 40B742: using guessed type int __thiscall CString__operator_(_DWORD, _DWORD);
// 4118D8: using guessed type int (*off_4118D8[5])();

//----- (00408FA0) --------------------------------------------------------
int __thiscall sub_408FA0(void *this, int a2)
{
  return DDX_Text(a2, 1003, (char *)this + 96);
}
// 40B8A4: using guessed type int __stdcall DDX_Text(_DWORD, _DWORD, _DWORD);

//----- (00408FD0) --------------------------------------------------------
void *__cdecl sub_408FD0()
{
  return CDialog__messageMap;
}
// 4168F8: using guessed type void *CDialog__messageMap;

//----- (00408FF0) --------------------------------------------------------
int (**__cdecl sub_408FF0())()
{
  return &off_4118B0;
}
// 4118B0: using guessed type int (*off_4118B0)();

//----- (00409010) --------------------------------------------------------
int __thiscall sub_409010(void *this)
{
  int v1; // edi@1
  void *v2; // esi@1
  int v3; // ecx@1
  char *v5; // [sp+Ch] [bp-10h]@1
  int v6; // [sp+18h] [bp-4h]@1

  v2 = this;
  CWnd__UpdateData(this, 1);
  CString__CString(&v5, &unk_4159AC);
  v1 = 0;
  v3 = *(_DWORD *)(*((_DWORD *)v2 + 24) - 8);
  v6 = 0;
  if ( v3 && CString__FindOneOf((char *)v2 + 96, L" ") == -1 )
  {
    if ( mbsicmp(*((_DWORD *)v2 + 27), "digital") )
    {
      CDialog__OnOK(v2);
    }
    else
    {
      if ( *((_DWORD *)v2 + 26) > 0 )
      {
        do
        {
          if ( isdigit(*(_BYTE *)(v1 + *((_DWORD *)v2 + 24))) )
          {
            CDialog__OnOK(v2);
          }
          else
          {
            CString__Format(&v5, "Invalid input type, must enter a numeric value");
            AfxMessageBox(v5, 0, 0);
          }
          ++v1;
        }
        while ( v1 < *((_DWORD *)v2 + 26) );
      }
    }
  }
  else
  {
    CString__Format(&v5, "The new value cannot be empty, must enter a value!");
    AfxMessageBox(v5, 0, 0);
  }
  v6 = -1;
  return CString___CString(&v5);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5E6: using guessed type int __thiscall CDialog__OnOK(_DWORD);
// 40B72A: using guessed type int __thiscall CWnd__UpdateData(_DWORD, _DWORD);
// 40B736: using guessed type int CString__Format(_DWORD, const char *, ...);
// 40B748: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);
// 40B8B0: using guessed type int __thiscall CString__FindOneOf(_DWORD, _DWORD);
// 4155A0: using guessed type wchar_t asc_4155A0[2];
// 416BE4: using guessed type int __cdecl mbsicmp(_DWORD, _DWORD);

//----- (00409170) --------------------------------------------------------
signed int __thiscall sub_409170(void *this)
{
  int v1; // eax@1
  void *v2; // esi@1
  int v3; // edi@3
  int v4; // ST08_4@4
  int *v6; // [sp-Ch] [bp-24h]@5
  const char *v7; // [sp-8h] [bp-20h]@5
  int v8; // [sp-4h] [bp-1Ch]@5
  int v9; // [sp+8h] [bp-10h]@4
  int v10; // [sp+14h] [bp-4h]@4

  v2 = this;
  CDialog__OnInitDialog();
  v1 = CWnd__GetDlgItem(v2, 1003);
  if ( v1 )
    SendMessageA(*(HWND *)(v1 + 32), 0xC5u, *((_DWORD *)v2 + 26), 0);
  v3 = CWnd__GetDlgItem(v2, 1013);
  if ( v3 )
  {
    CString__CString(&v9);
    v4 = *((_DWORD *)v2 + 27);
    v10 = 0;
    if ( mbsicmp(v4, "digital") )
    {
      v8 = *((_DWORD *)v2 + 25);
      v7 = "New value for Field: \" %s \" in Hex String";
      v6 = &v9;
    }
    else
    {
      v8 = *((_DWORD *)v2 + 25);
      v7 = "New Value for Field:\" %s \" ";
      v6 = &v9;
    }
    CString__Format(v6, v7, v8);
    CWnd__SetWindowTextA(v3, v9);
    v10 = -1;
    CString___CString(&v9);
  }
  return 1;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);
// 40B5CE: using guessed type int __thiscall CString__CString(_DWORD);
// 40B5F2: using guessed type int CDialog__OnInitDialog(void);
// 40B736: using guessed type int CString__Format(_DWORD, const char *, ...);
// 40B75A: using guessed type int __thiscall CWnd__GetDlgItem(_DWORD, _DWORD);
// 40B7BA: using guessed type int __thiscall CWnd__SetWindowTextA(_DWORD, _DWORD);
// 416BE4: using guessed type int __cdecl mbsicmp(_DWORD, _DWORD);

//----- (004092B0) --------------------------------------------------------
int __thiscall sub_4092B0(void *this, int a2)
{
  CString__CString(a2, (char *)this + 96);
  return a2;
}
// 40B730: using guessed type int __thiscall CString__CString(_DWORD, _DWORD);

//----- (004092F0) --------------------------------------------------------
int __thiscall sub_4092F0(int this)
{
  int v1; // esi@1

  v1 = this;
  *(_DWORD *)this = off_4119F0;
  *(_DWORD *)(this + 4) = 0;
  if ( sub_409A40(this) < 0 )
    *(_DWORD *)(v1 + 4) = 0;
  return v1;
}
// 4119F0: using guessed type int (__thiscall *off_4119F0[5])(void *, char);

//----- (00409320) --------------------------------------------------------
void *__thiscall sub_409320(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_409340((int)this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (00409340) --------------------------------------------------------
signed int __thiscall sub_409340(int this)
{
  HCRYPTPROV v1; // eax@1
  signed int result; // eax@2
  char v3; // zf@2

  *(_DWORD *)this = off_4119F0;
  v1 = *(_DWORD *)(this + 4);
  if ( !v1 || (v3 = CryptReleaseContext(v1, 0) == 1, result = -400002, v3) )
    result = 0;
  return result;
}
// 4119F0: using guessed type int (__thiscall *off_4119F0[5])(void *, char);

//----- (004093D0) --------------------------------------------------------
int __thiscall sub_4093D0(void *this, const void *a2, unsigned int a3, void *a4, int a5, const BYTE *pbData)
{
  HCRYPTHASH v6; // ebx@1
  signed int v7; // edi@1
  void *v8; // esi@1
  unsigned int v9; // ST14_4@1
  void *v10; // eax@1
  int v11; // eax@7
  signed int v12; // eax@10
  void *v13; // ebx@12
  signed int v14; // ecx@16
  void *v15; // eax@20
  char v17; // [sp+0h] [bp-44h]@1
  int v18; // [sp+10h] [bp-34h]@19
  int v19; // [sp+14h] [bp-30h]@13
  int v20; // [sp+18h] [bp-2Ch]@11
  int v21; // [sp+1Ch] [bp-28h]@8
  int v22; // [sp+20h] [bp-24h]@4
  int v23; // [sp+24h] [bp-20h]@2
  void *v24; // [sp+28h] [bp-1Ch]@1
  HCRYPTKEY hKey; // [sp+2Ch] [bp-18h]@1
  DWORD pdwDataLen; // [sp+30h] [bp-14h]@1
  char *v27; // [sp+34h] [bp-10h]@1
  int v28; // [sp+40h] [bp-4h]@1

  v8 = a4;
  v7 = 0;
  v27 = &v17;
  v6 = (HCRYPTHASH)this;
  v9 = a3 + 1;
  hKey = 0;
  v24 = 0;
  pdwDataLen = 0;
  v28 = 0;
  *(_DWORD *)a4 = 0;
  v10 = operator new(v9);
  *(_DWORD *)v8 = v10;
  a4 = v10;
  if ( !v10 )
  {
    v23 = -400000;
    CxxThrowException(&v23, &unk_412C28);
  }
  if ( !*(_DWORD *)(v6 + 4) )
  {
    v22 = -400001;
    CxxThrowException(&v22, &unk_412C28);
  }
  if ( pbData )
  {
    if ( strlen((const char *)pbData) != 1 )
    {
      v11 = sub_409E00(v6, pbData, &hKey);
      if ( v11 < 0 )
      {
        v21 = v11;
        CxxThrowException(&v21, &unk_412C28);
      }
      goto LABEL_12;
    }
    v7 = 0;
  }
  v12 = sub_409EA0((void *)v6, &a2, (int)&a3, &hKey);
  if ( v12 < v7 )
  {
    v20 = v12;
    CxxThrowException(&v20, &unk_412C28);
  }
LABEL_12:
  v13 = operator new(0x3E8u);
  v24 = v13;
  if ( !v13 )
  {
    v19 = -400000;
    CxxThrowException(&v19, &unk_412C28);
  }
  *(_DWORD *)a5 = 0;
  while ( a3 )
  {
    v14 = 1000;
    if ( a3 <= 0x3E8 )
      v14 = a3;
    pdwDataLen = v14;
    memcpy(v13, a2, v14);
    a3 -= pdwDataLen;
    a2 = (char *)a2 + pdwDataLen;
    if ( !CryptDecrypt(hKey, 0, a3 <= 0, 0, (BYTE *)v13, &pdwDataLen) )
    {
      v18 = -400012;
      CxxThrowException(&v18, &unk_412C28);
    }
    v15 = a4;
    memcpy(a4, v13, pdwDataLen);
    a4 = (char *)v15 + pdwDataLen;
    *(_DWORD *)a5 += pdwDataLen;
  }
  *(_BYTE *)a4 = byte_4159B0;
  v28 = -1;
  if ( v13 )
    operator delete(v13);
  if ( hKey )
    CryptDestroyKey(hKey);
  return 0;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);
// 4159B0: using guessed type char byte_4159B0;

//----- (00409660) --------------------------------------------------------
int __thiscall sub_409660(void *this, const char *a2, int a3, int a4, const BYTE *pbData)
{
  HCRYPTHASH v5; // ebx@1
  int v6; // esi@1
  const char *v7; // edx@1
  unsigned int v8; // kr04_4@1
  void *v9; // eax@1
  int v10; // edi@1
  int v11; // eax@7
  signed int v12; // eax@9
  void *v13; // ebx@11
  signed int v14; // ecx@14
  const char *v15; // edi@18
  char v16; // dl@18
  DWORD v17; // ecx@18
  int v18; // eax@18
  DWORD v19; // edx@18
  char v21; // [sp+0h] [bp-4Ch]@1
  int v22; // [sp+10h] [bp-3Ch]@17
  int v23; // [sp+14h] [bp-38h]@12
  int v24; // [sp+18h] [bp-34h]@10
  int v25; // [sp+1Ch] [bp-30h]@8
  int v26; // [sp+20h] [bp-2Ch]@4
  int v27; // [sp+24h] [bp-28h]@2
  void *v28; // [sp+28h] [bp-24h]@1
  int v29; // [sp+2Ch] [bp-20h]@1
  const void *v30; // [sp+30h] [bp-1Ch]@1
  HCRYPTKEY hKey; // [sp+34h] [bp-18h]@1
  DWORD pdwDataLen; // [sp+38h] [bp-14h]@1
  char *v33; // [sp+3Ch] [bp-10h]@1
  int v34; // [sp+48h] [bp-4h]@1

  v7 = a2;
  v5 = (HCRYPTHASH)this;
  v8 = strlen(a2);
  hKey = 0;
  v28 = 0;
  pdwDataLen = 0;
  *(_DWORD *)a4 = 0;
  v6 = v8 - 1;
  v33 = &v21;
  v30 = v7;
  v29 = v8 - 1;
  v34 = 0;
  *(_DWORD *)a3 = 0;
  v9 = operator new(strlen(v7) + 9999);
  *(_DWORD *)v10 = v9;
  a2 = (const char *)v9;
  if ( !v9 )
  {
    v27 = -400000;
    CxxThrowException(&v27, &unk_412C28);
  }
  if ( !*(_DWORD *)(v5 + 4) )
  {
    v26 = -400001;
    CxxThrowException(&v26, &unk_412C28);
  }
  if ( pbData && strlen((const char *)pbData) != 1 )
  {
    v11 = sub_409E00(v5, pbData, &hKey);
    if ( v11 < 0 )
    {
      v25 = v11;
      CxxThrowException(&v25, &unk_412C28);
    }
  }
  else
  {
    v12 = sub_409F60(v5, &hKey, (void **)&a2, a4);
    if ( v12 < 0 )
    {
      v24 = v12;
      CxxThrowException(&v24, &unk_412C28);
    }
  }
  v13 = operator new(0x3E8u);
  v28 = v13;
  if ( !v13 )
  {
    v23 = -400000;
    CxxThrowException(&v23, &unk_412C28);
  }
  while ( v6 )
  {
    v14 = 1000;
    if ( (unsigned int)v6 <= 0x3E8 )
      v14 = v6;
    pdwDataLen = v14;
    memcpy(v13, v30, v14);
    v29 -= pdwDataLen;
    v30 = (char *)v30 + pdwDataLen;
    if ( !CryptEncrypt(hKey, 0, (unsigned int)v29 <= 0, 0, (BYTE *)v13, &pdwDataLen, 0x3E8u) )
    {
      v22 = -400013;
      CxxThrowException(&v22, &unk_412C28);
    }
    v15 = a2;
    v16 = pdwDataLen;
    v17 = pdwDataLen >> 2;
    memcpy((void *)a2, v13, 4 * (pdwDataLen >> 2));
    v18 = a4;
    memcpy((void *)&v15[4 * v17], (char *)v13 + 4 * v17, v16 & 3);
    v19 = pdwDataLen + *(_DWORD *)v18;
    a2 += pdwDataLen;
    v6 = v29;
    *(_DWORD *)v18 = v19;
  }
  v34 = -1;
  if ( v13 )
    operator delete(v13);
  if ( hKey )
    CryptDestroyKey(hKey);
  return 0;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (00409890) --------------------------------------------------------
int __thiscall sub_409890(void *this, const WCHAR *Str, int a3, const WCHAR *a4)
{
  void *v4; // ebx@1
  void *v5; // edi@1
  int v6; // esi@1
  void *v7; // esi@1
  UINT cbMultiByte; // [sp+0h] [bp-4h]@1

  v7 = this;
  v5 = sub_40C58F(Str);
  v4 = sub_40C58F(a4);
  Str = 0;
  cbMultiByte = 0;
  v6 = sub_409920(v7, (signed int)v5, &Str, (int)&cbMultiByte, (const BYTE *)v4);
  if ( !v6 )
    v6 = sub_40A120((LPCSTR)Str, cbMultiByte, a3);
  operator delete(v5);
  operator delete((void *)Str);
  operator delete(v4);
  return v6;
}

//----- (00409920) --------------------------------------------------------
int __thiscall sub_409920(void *this, signed int lpFileName, void *a3, int a4, const BYTE *pbData)
{
  int v5; // esi@1
  unsigned int v6; // ebx@2
  unsigned int v7; // kr04_4@3
  char v9; // [sp+0h] [bp-28h]@1
  void *v10; // [sp+10h] [bp-18h]@1
  void *v11; // [sp+14h] [bp-14h]@1
  char *v12; // [sp+18h] [bp-10h]@1
  int v13; // [sp+24h] [bp-4h]@1
  DWORD v14; // [sp+30h] [bp+8h]@1

  v10 = this;
  v12 = &v9;
  v5 = 1;
  v11 = 0;
  v13 = 0;
  v14 = sub_40B1E0(lpFileName, (int)&v11);
  if ( v14 > 0 )
  {
    v6 = strlen((const char *)sub_40A1A0()) - 1;
    if ( strncmp((const char *)v6, (const char *)&dword_4119DC, 19) )
    {
      v5 = 400000;
    }
    else
    {
      v7 = strlen((const char *)sub_40A1A0());
      v5 = sub_4093D0(v10, (const void *)(v6 + 19), -19 - (v7 - 1) + v14, a3, a4, pbData);
    }
  }
  v13 = -1;
  operator delete(v11);
  return v5;
}
// 4119DC: using guessed type int dword_4119DC;

//----- (00409A40) --------------------------------------------------------
signed int __thiscall sub_409A40(int this)
{
  HCRYPTPROV *v1; // esi@1
  signed int result; // eax@2
  char v3; // zf@2

  v1 = (HCRYPTPROV *)(this + 4);
  if ( CryptAcquireContextA((HCRYPTPROV *)(this + 4), 0, "Microsoft Base Cryptographic Provider v1.0", 1u, 0)
    || (v3 = CryptAcquireContextA(v1, 0, "Microsoft Base Cryptographic Provider v1.0", 1u, 0xF0000000u) == 0,
        result = -400001,
        !v3) )
    result = 0;
  return result;
}

//----- (00409BFE) --------------------------------------------------------
int (*__usercall sub_409BFE<eax>(int a1<ebp>))()
{
  int (*result)(); // eax@1

  result = sub_409C0A;
  *(_DWORD *)(a1 - 24) = *(_DWORD *)(a1 - 52);
  return result;
}
// 409C0A: using guessed type int sub_409C0A();

//----- (00409CB0) --------------------------------------------------------
int __thiscall sub_409CB0(void *this, LPCSTR lpFileName, const char *a3, int a4, const BYTE *pbData)
{
  void *v5; // ebx@2
  unsigned int v6; // kr04_4@2
  unsigned int v7; // ecx@2
  int v8; // edi@2
  int v9; // esi@2
  int v10; // eax@2
  unsigned int v11; // kr0C_4@2
  DWORD v12; // eax@2
  char v14; // [sp+0h] [bp-28h]@1
  DWORD nNumberOfBytesToWrite; // [sp+Ch] [bp-1Ch]@2
  int v16; // [sp+10h] [bp-18h]@1
  unsigned int v17; // [sp+14h] [bp-14h]@2
  char *v18; // [sp+18h] [bp-10h]@1
  int v19; // [sp+24h] [bp-4h]@2
  int v20; // [sp+34h] [bp+Ch]@1

  v18 = &v14;
  v20 = sub_409660(this, a3, (int)&v16, (int)&pbData, pbData);
  if ( !v20 )
  {
    nNumberOfBytesToWrite = (DWORD)&pbData[strlen((const char *)sub_40A1A0()) + 18];
    v5 = operator new(nNumberOfBytesToWrite);
    v6 = strlen((const char *)sub_40A1A0());
    memcpy(v5, (const void *)sub_40A1A0(), v6 - 1);
    v7 = (unsigned int)((char *)v5 + strlen((const char *)sub_40A1A0()) - 1);
    *(_DWORD *)v7 = dword_4119DC;
    *(_DWORD *)(v7 + 4) = dword_4119E0;
    *(_DWORD *)(v7 + 8) = dword_4119E4;
    *(_DWORD *)(v7 + 12) = dword_4119E8;
    *(_WORD *)(v7 + 16) = word_4119EC;
    *(_BYTE *)(v7 + 18) = byte_4119EE;
    v8 = (int)pbData;
    v9 = v16;
    v10 = sub_40A1A0();
    v17 = v8;
    v11 = strlen((const char *)v10);
    v19 = 0;
    v12 = nNumberOfBytesToWrite;
    memcpy(v5 + v11 + 18, (const void *)v9, v17);
    sub_40B3E0(lpFileName, v5, v12, HANDLE_FLAG_INHERIT, 0);
  }
  return v20;
}
// 4119DC: using guessed type int dword_4119DC;
// 4119E0: using guessed type int dword_4119E0;
// 4119E4: using guessed type int dword_4119E4;
// 4119E8: using guessed type int dword_4119E8;
// 4119EC: using guessed type __int16 word_4119EC;
// 4119EE: using guessed type char byte_4119EE;

//----- (00409DEA) --------------------------------------------------------
int (__stdcall *__usercall sub_409DEA<eax>(int a1<ebp>))(LPCSTR, int, int, int)
{
  int (__stdcall *result)(LPCSTR, int, int, int); // eax@1

  result = loc_409DD4;
  *(_DWORD *)(a1 + 12) = *(_DWORD *)(a1 - 20);
  return result;
}
// 409DD4: using guessed type int __stdcall loc_409DD4(LPCSTR lpFileName, int, int, int pbData);

//----- (00409E00) --------------------------------------------------------
int __thiscall sub_409E00(HCRYPTHASH this, const BYTE *pbData, HCRYPTKEY *phKey)
{
  HCRYPTHASH v3; // esi@1
  HCRYPTPROV v4; // ST00_4@1
  int v5; // esi@2
  int v6; // esi@5
  HCRYPTHASH hHash; // [sp+0h] [bp-4h]@1

  hHash = this;
  v3 = this;
  v4 = *(_DWORD *)(this + 4);
  hHash = 0;
  if ( CryptCreateHash(v4, 0x8003u, 0, 0, &hHash) )
  {
    if ( CryptHashData(hHash, pbData, strlen((const char *)pbData) - 1, 0) )
    {
      v6 = -(CryptDeriveKey(*(_DWORD *)(v3 + 4), 0x6801u, hHash, 0, phKey) != 0);
      v5 = (v6 & 0x61A85) - 400005;
    }
    else
    {
      v5 = -400004;
    }
  }
  else
  {
    v5 = -400003;
  }
  if ( hHash )
    CryptDestroyHash(hHash);
  return v5;
}

//----- (00409EA0) --------------------------------------------------------
signed int __thiscall sub_409EA0(void *this, const void **a2, int a3, HCRYPTKEY *phKey)
{
  DWORD v4; // ebx@1
  const void **v5; // ebp@1
  signed int result; // eax@2
  void *v7; // eax@3
  int v8; // esi@4
  BOOL v9; // esi@5
  int v10; // esi@5
  void *v11; // [sp+Ch] [bp-4h]@1
  void *v12; // [sp+14h] [bp+4h]@3

  v5 = a2;
  v11 = this;
  v4 = *(_DWORD *)*a2;
  *a2 = (char *)*a2 + 4;
  *(_DWORD *)a3 -= 4;
  if ( v4 )
  {
    v7 = operator new(v4);
    v12 = v7;
    if ( v7 )
    {
      memcpy(v7, *v5, v4);
      *v5 = (char *)*v5 + v4;
      *(_DWORD *)a3 -= v4;
      v9 = CryptImportKey(*((_DWORD *)v11 + 1), (const BYTE *)v7, v4, 0, 0, phKey);
      v7 = v12;
      v10 = -(v9 != 0);
      v8 = (v10 & 0x61A8B) - 400011;
    }
    else
    {
      v8 = -400000;
    }
    if ( v7 )
      operator delete(v7);
    result = v8;
  }
  else
  {
    result = -400010;
  }
  return result;
}

//----- (00409F60) --------------------------------------------------------
signed int __thiscall sub_409F60(int this, HCRYPTKEY *phKey, void **a3, int a4)
{
  int v4; // edi@1
  HCRYPTPROV v5; // eax@1
  signed int v6; // esi@2
  const void *v7; // ebx@7
  void **v8; // eax@11
  DWORD v9; // ecx@11
  DWORD pdwDataLen; // [sp+Ch] [bp-8h]@1
  HCRYPTKEY hKey; // [sp+10h] [bp-4h]@1

  v4 = this;
  v5 = *(_DWORD *)(this + 4);
  pdwDataLen = 0;
  hKey = 0;
  if ( CryptGenKey(v5, 0x6801u, 1u, phKey) )
  {
    if ( CryptGetUserKey(*(_DWORD *)(v4 + 4), 1u, &hKey) )
    {
      if ( CryptExportKey(*phKey, hKey, 1u, 0, 0, &pdwDataLen) )
      {
        v7 = operator new(pdwDataLen);
        if ( v7 )
        {
          if ( CryptExportKey(*phKey, hKey, 1u, 0, (BYTE *)v7, &pdwDataLen) )
          {
            v8 = a3;
            *(_DWORD *)*a3 = pdwDataLen;
            *v8 = (char *)*v8 + 4;
            *(_DWORD *)a4 += 4;
            memcpy(*a3, v7, pdwDataLen);
            v9 = pdwDataLen;
            *v8 = (char *)*v8 + pdwDataLen;
            v6 = 0;
            *(_DWORD *)a4 += v9;
          }
          else
          {
            v6 = -400009;
          }
        }
        else
        {
          v6 = -400000;
        }
        if ( v7 )
          operator delete((void *)v7);
      }
      else
      {
        v6 = -400008;
      }
    }
    else
    {
      v6 = -400007;
    }
  }
  else
  {
    v6 = -400006;
  }
  if ( hKey )
    CryptDestroyKey(hKey);
  return v6;
}

//----- (0040A0A0) --------------------------------------------------------
void *__thiscall sub_40A0A0(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_40A0C0(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (0040A0C0) --------------------------------------------------------
void __thiscall sub_40A0C0(void *this)
{
  *(_DWORD *)this = off_4119F4;
}
// 4119F4: using guessed type int (__thiscall *off_4119F4[4])(void *, char);

//----- (0040A0D0) --------------------------------------------------------
signed int __cdecl sub_40A0D0(BSTR lpWideCharStr, int a2, int *a3)
{
  signed int result; // eax@1
  unsigned int v4; // eax@1
  CHAR *v5; // eax@1
  char v6; // zf@1

  v4 = SysStringLen(lpWideCharStr) + 1;
  *a3 = v4;
  v5 = (CHAR *)operator new(v4);
  *(_DWORD *)a2 = v5;
  v6 = WideCharToMultiByte(0, 0, lpWideCharStr, *a3, v5, *a3, 0, 0) == *a3;
  result = -2147467259;
  if ( v6 )
    result = 0;
  return result;
}

//----- (0040A120) --------------------------------------------------------
signed int __cdecl sub_40A120(LPCSTR lpMultiByteStr, UINT cbMultiByte, int a3)
{
  signed int result; // eax@1
  WCHAR *v4; // eax@1
  char v5; // zf@1

  v4 = SysAllocStringLen(0, cbMultiByte);
  *(_DWORD *)a3 = v4;
  v5 = MultiByteToWideChar(0, 0, lpMultiByteStr, cbMultiByte, v4, cbMultiByte) == cbMultiByte;
  result = -2147467259;
  if ( v5 )
    result = 0;
  return result;
}

//----- (0040A170) --------------------------------------------------------
void *__thiscall sub_40A170(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_40A190(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (0040A190) --------------------------------------------------------
void __thiscall sub_40A190(void *this)
{
  *(_DWORD *)this = off_4119F8;
}
// 4119F8: using guessed type int (__thiscall *off_4119F8[3])(void *, char);

//----- (0040A1A0) --------------------------------------------------------
int __cdecl sub_40A1A0()
{
  struct tm *v1; // eax@1
  char Buf[12]; // [sp+0h] [bp-Ch]@1

  time((time_t *)Buf);
  v1 = localtime((const time_t *)Buf);
  strftime(&Buf[4], 5u, "%Y", v1);
  sprintf(Dest, "Copyright (c) %s Motorola, Inc. All rights reserved.", &Buf[4]);
  return (int)Dest;
}

//----- (0040A1F0) --------------------------------------------------------
int __thiscall sub_40A1F0(int this)
{
  int v2; // esi@1

  v2 = this;
  *(_DWORD *)(this + 4) = 0;
  *(_DWORD *)(this + 8) = 0;
  *(_DWORD *)(this + 12) = 0;
  *(_DWORD *)(this + 16) = 0;
  *(_DWORD *)(this + 20) = 0;
  *(_DWORD *)this = off_4119FC;
  sub_40A4C0((void *)this);
  *(_DWORD *)(v2 + 24) = 0;
  return v2;
}
// 4119FC: using guessed type int (__thiscall *off_4119FC[2])(void *, char);

//----- (0040A250) --------------------------------------------------------
void *__thiscall sub_40A250(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_40A270((int)this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (0040A270) --------------------------------------------------------
int __thiscall sub_40A270(int this)
{
  int v1; // eax@1
  int v2; // esi@1
  int v3; // eax@3
  int v4; // eax@5
  int result; // eax@7
  int v6; // esi@9

  v2 = this;
  *(_DWORD *)this = off_4119FC;
  v1 = *(_DWORD *)(this + 20);
  if ( v1 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v1 + 8))(v1);
  v3 = *(_DWORD *)(v2 + 16);
  if ( v3 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v3 + 8))(v3);
  v4 = *(_DWORD *)(v2 + 12);
  if ( v4 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v4 + 8))(v4);
  result = *(_DWORD *)(v2 + 8);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  v6 = *(_DWORD *)(v2 + 4);
  if ( v6 )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)v6 + 8))(v6);
  return result;
}
// 4119FC: using guessed type int (__thiscall *off_4119FC[2])(void *, char);

//----- (0040A390) --------------------------------------------------------
char __thiscall sub_40A390(int this, signed int a2, int a3)
{
  char v3; // bl@1
  int v4; // esi@1
  int v5; // ecx@2
  int v6; // ST04_4@2
  int v8; // [sp+18h] [bp-10h]@2
  int v9; // [sp+24h] [bp-4h]@2

  v4 = this;
  v3 = 0;
  if ( sub_40A530(this) )
  {
    v8 = 0;
    v5 = **(_DWORD **)(v4 + 4);
    v6 = *(_DWORD *)(v4 + 4);
    v9 = 0;
    if ( (*(int (__stdcall **)(int, signed int, int *))(v5 + 188))(v6, a2, &v8) < 0 )
    {
      a2 = -100000;
      CxxThrowException(&a2, &unk_412C28);
    }
    if ( (*(int (__stdcall **)(_DWORD, int, int))(**(_DWORD **)(v4 + 8) + 84))(*(_DWORD *)(v4 + 8), v8, a3) < 0 )
    {
      a2 = -100001;
      CxxThrowException(&a2, &unk_412C28);
    }
    v3 = 1;
    v9 = -1;
    if ( v8 )
      (*(void (__stdcall **)(int))(*(_DWORD *)v8 + 8))(v8);
  }
  return v3;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040A4C0) --------------------------------------------------------
char __thiscall sub_40A4C0(void *this)
{
  HRESULT v1; // eax@1
  void *v2; // esi@1
  HRESULT v3; // eax@3
  LPVOID *v4; // esi@3
  int v6; // [sp-Ch] [bp-10h]@3
  __int32 v7; // [sp+0h] [bp-4h]@1

  v7 = (__int32)this;
  v2 = this;
  v1 = CoInitialize(0);
  if ( v1 < 0 )
  {
    v7 = v1;
    CxxThrowException(&v7, &unk_412C28);
  }
  v4 = (LPVOID *)((char *)v2 + 4);
  v3 = CoCreateInstance(&rclsid, 0, 7u, &riid, v4);
  if ( v3 < 0 )
  {
    v7 = v3;
    CxxThrowException(&v7, &unk_412C28);
  }
  (*(void (__stdcall **)(int, signed int))(*(_DWORD *)*v4 + 288))(v6, 1);
  return 1;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040A530) --------------------------------------------------------
char __thiscall sub_40A530(int this)
{
  char result; // al@1

  result = 0;
  if ( *(_DWORD *)(this + 8) )
    result = 1;
  return result;
}

//----- (0040A540) --------------------------------------------------------
char __thiscall sub_40A540(int this)
{
  char result; // al@1

  result = 0;
  if ( *(_DWORD *)(this + 20) )
    result = 1;
  return result;
}

//----- (0040A550) --------------------------------------------------------
char __thiscall sub_40A550(int this)
{
  char result; // al@1

  result = 0;
  if ( *(_DWORD *)(this + 4) )
    result = 1;
  return result;
}

//----- (0040A580) --------------------------------------------------------
char __thiscall sub_40A580(int this, int a2)
{
  int v2; // esi@1
  char result; // al@2

  v2 = this;
  if ( sub_40A530(this) )
  {
    *(_DWORD *)a2 = *(_DWORD *)(v2 + 8);
    result = 1;
  }
  else
  {
    result = 0;
  }
  return result;
}

//----- (0040A5B0) --------------------------------------------------------
char __thiscall sub_40A5B0(int this, int a2, signed int a3)
{
  char v3; // bl@1
  int v4; // esi@1
  int v5; // eax@2
  int v7; // [sp+18h] [bp-10h]@2
  int v8; // [sp+24h] [bp-4h]@2

  v4 = this;
  v3 = 0;
  if ( sub_40A530(this) )
  {
    v5 = *(_DWORD *)(v4 + 8);
    v8 = 0;
    v7 = 0;
    if ( !v5 || ((**(void (__stdcall ***)(int, _UNKNOWN *, int *))v5)(v5, &unk_415698, &v7), !v7) )
    {
      a3 = -100003;
      CxxThrowException(&a3, &unk_412C28);
    }
    if ( (*(int (__stdcall **)(int, int, signed int))(*(_DWORD *)v7 + 176))(v7, a2, a3) )
    {
      a3 = 100030;
      CxxThrowException(&a3, &unk_412C28);
    }
    v3 = 1;
    v8 = -1;
    if ( v7 )
      (*(void (__stdcall **)(int))(*(_DWORD *)v7 + 8))(v7);
  }
  return v3;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040A6B0) --------------------------------------------------------
char __thiscall sub_40A6B0(int this, int a2)
{
  int v2; // esi@1
  char result; // al@2
  char v4; // sf@2

  v2 = this;
  if ( !sub_40A530(this)
    || (v4 = (*(int (__stdcall **)(_DWORD, int))(**(_DWORD **)(v2 + 8) + 28))(*(_DWORD *)(v2 + 8), a2) < 0,
        result = 1,
        v4) )
    result = 0;
  return result;
}

//----- (0040AA30) --------------------------------------------------------
int __thiscall sub_40AA30(int this, signed int a2)
{
  int v2; // edi@1
  int v3; // eax@2
  int v4; // esi@2
  int result; // eax@7
  int v6; // [sp+0h] [bp-14h]@4
  int v7; // [sp+10h] [bp-4h]@1

  v2 = this;
  v7 = -1;
  if ( sub_40A550(this) )
  {
    v3 = *(_DWORD *)(v2 + 20);
    v4 = v2 + 20;
    if ( v3 )
    {
      *(_DWORD *)v4 = 0;
      (*(void (__stdcall **)(int))(*(_DWORD *)v3 + 8))(v3);
    }
    if ( (*(int (__stdcall **)(_DWORD, signed int, int))(**(_DWORD **)(v2 + 4) + 144))(*(_DWORD *)(v2 + 4), a2, v2 + 20) >= 0 )
    {
      if ( (*(int (__stdcall **)(int, int *))(**(_DWORD **)v4 + 32))(v6, &v7) < 0 )
      {
        a2 = -100007;
        CxxThrowException(&a2, &unk_412C28);
      }
    }
  }
  result = v7;
  *(_DWORD *)(v2 + 24) = v7;
  return result;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040ACF0) --------------------------------------------------------
char __thiscall sub_40ACF0(int this, int a2)
{
  int v2; // esi@1
  int v3; // ecx@2
  int v4; // ST00_4@2
  int v5; // eax@4
  char v7; // [sp+15h] [bp-11h]@1
  int v8; // [sp+16h] [bp-10h]@2
  int v9; // [sp+22h] [bp-4h]@2

  v2 = this;
  v7 = 0;
  if ( sub_40A540(this) )
  {
    v8 = 0;
    v3 = **(_DWORD **)(v2 + 20);
    v4 = *(_DWORD *)(v2 + 20);
    v9 = 0;
    if ( (*(int (__stdcall **)(int, int, int *))(v3 + 28))(v4, a2, &v8) )
    {
      v5 = *(_DWORD *)(v2 + 8);
      if ( v5 )
      {
        *(_DWORD *)(v2 + 8) = 0;
        (*(void (__stdcall **)(int))(*(_DWORD *)v5 + 8))(v5);
      }
    }
    else
    {
      v7 = sub_40AD90(v2, v8);
    }
    v9 = -1;
    if ( v8 )
      (*(void (__stdcall **)(int))(*(_DWORD *)v8 + 8))(v8);
  }
  return v7;
}

//----- (0040AD90) --------------------------------------------------------
char __thiscall sub_40AD90(int this, int a2)
{
  int v2; // esi@1
  int v3; // eax@2
  int v4; // edi@4
  int v5; // eax@6
  int v6; // eax@8
  char result; // al@10
  char v8; // zf@10

  v2 = this;
  if ( !a2 )
    goto LABEL_14;
  v3 = *(_DWORD *)(this + 12);
  if ( v3 )
  {
    *(_DWORD *)(this + 12) = 0;
    (*(void (__stdcall **)(int))(*(_DWORD *)v3 + 8))(v3);
  }
  v4 = *(_DWORD *)(v2 + 8);
  if ( v4 )
    (*(void (__stdcall **)(_DWORD))(*(_DWORD *)v4 + 4))(*(_DWORD *)(v2 + 8));
  v5 = *(_DWORD *)(v2 + 12);
  if ( v5 )
    (*(void (__stdcall **)(_DWORD))(*(_DWORD *)v5 + 8))(*(_DWORD *)(v2 + 12));
  *(_DWORD *)(v2 + 12) = v4;
  (*(void (__stdcall **)(int))(*(_DWORD *)a2 + 4))(a2);
  v6 = *(_DWORD *)(v2 + 8);
  if ( v6 )
    (*(void (__stdcall **)(_DWORD))(*(_DWORD *)v6 + 8))(*(_DWORD *)(v2 + 8));
  *(_DWORD *)(v2 + 8) = a2;
  v8 = sub_40A530(v2) == 0;
  result = 1;
  if ( v8 )
LABEL_14:
    result = 0;
  return result;
}

//----- (0040AED0) --------------------------------------------------------
char __thiscall sub_40AED0(int this)
{
  return sub_40AD90(this, *(_DWORD *)(this + 4));
}

//----- (0040AF30) --------------------------------------------------------
char __thiscall sub_40AF30(int this, int a2)
{
  char v2; // bl@1
  int v3; // esi@1
  int v5; // [sp+Ch] [bp-4h]@1

  v5 = this;
  v3 = this;
  v2 = 0;
  if ( sub_40A550(this) )
  {
    if ( (*(int (__stdcall **)(_DWORD, int, int *))(**(_DWORD **)(v3 + 4) + 260))(*(_DWORD *)(v3 + 4), a2, &a2) < 0 )
    {
      v5 = -100008;
      CxxThrowException(&v5, &unk_412C28);
    }
    v2 = 1;
  }
  return v2;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040B100) --------------------------------------------------------
void *__thiscall sub_40B100(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_40B120(this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (0040B120) --------------------------------------------------------
void __thiscall sub_40B120(void *this)
{
  *(_DWORD *)this = &off_411A00;
}
// 411A00: using guessed type int (__thiscall *off_411A00)(void *, char);

//----- (0040B1E0) --------------------------------------------------------
DWORD __cdecl sub_40B1E0(signed int lpFileName, int a2)
{
  HANDLE v2; // eax@1
  void *v3; // edi@1
  DWORD v4; // esi@3
  void *v5; // eax@5
  int v6; // ebx@5
  DWORD result; // eax@7
  DWORD NumberOfBytesRead; // [sp+0h] [bp-4h]@1

  NumberOfBytesRead = 0;
  v2 = CreateFileA((LPCSTR)lpFileName, 0x80000000u, 1u, 0, 3u, 0x80u, 0);
  v3 = v2;
  if ( v2 == (HANDLE)-1 )
  {
    lpFileName = -300000;
    CxxThrowException(&lpFileName, &unk_412C28);
  }
  v4 = GetFileSize(v2, 0);
  if ( (signed int)v4 < 0 )
  {
    lpFileName = -300002;
    CxxThrowException(&lpFileName, &unk_412C28);
  }
  v6 = a2;
  *(_DWORD *)a2 = 0;
  v5 = operator new(v4 + 1);
  *(_DWORD *)v6 = v5;
  if ( !v5 )
  {
    lpFileName = -300005;
    CxxThrowException(&lpFileName, &unk_412C28);
  }
  ReadFile(v3, v5, v4, &NumberOfBytesRead, 0);
  CloseHandle(v3);
  *(_BYTE *)(*(_DWORD *)v6 + v4) = 0;
  result = NumberOfBytesRead;
  if ( v4 != NumberOfBytesRead )
  {
    lpFileName = -300003;
    CxxThrowException(&lpFileName, &unk_412C28);
  }
  return result;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040B3B5) --------------------------------------------------------
void __usercall sub_40B3B5(int a1<ebp>)
{
  operator delete(*(void **)(a1 - 20));
  *(_DWORD *)(a1 - 28) = *(_DWORD *)(a1 - 32);
  CxxThrowException(a1 - 28, &unk_412C28);
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040B3E0) --------------------------------------------------------
DWORD __cdecl sub_40B3E0(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, HANDLE hObject, DWORD dwCreationDisposition)
{
  DWORD v5; // eax@1
  HANDLE v6; // esi@3
  char v8; // [sp+0h] [bp-30h]@1
  int v9; // [sp+14h] [bp-1Ch]@6
  int v10; // [sp+18h] [bp-18h]@4
  DWORD NumberOfBytesWritten; // [sp+1Ch] [bp-14h]@1
  char *v12; // [sp+20h] [bp-10h]@1
  int v13; // [sp+2Ch] [bp-4h]@1

  v5 = dwCreationDisposition;
  v12 = &v8;
  NumberOfBytesWritten = 0;
  v13 = 0;
  if ( !dwCreationDisposition )
    v5 = ((_BYTE)hObject != 0) + 1;
  v6 = CreateFileA(lpFileName, 0x40000000u, 0, 0, v5, 0x80u, 0);
  if ( v6 == (HANDLE)-1 )
  {
    v10 = -300001;
    CxxThrowException(&v10, &unk_412C28);
  }
  WriteFile(v6, lpBuffer, nNumberOfBytesToWrite, &NumberOfBytesWritten, 0);
  if ( nNumberOfBytesToWrite != NumberOfBytesWritten )
  {
    v9 = -300004;
    CxxThrowException(&v9, &unk_412C28);
  }
  CloseHandle(v6);
  return NumberOfBytesWritten;
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040BC18) --------------------------------------------------------
int __usercall sub_40BC18<eax>(int a1<ebp>)
{
  int v1; // eax@1
  int v3; // ecx@1

  v1 = *(_DWORD *)(a1 - 20);
  v3 = **(_DWORD **)v1;
  *(_DWORD *)(a1 - 120) = v3;
  return XcptFilter(v3, v1);
}
// 40BC9A: using guessed type int __cdecl XcptFilter(_DWORD, _DWORD);

//----- (0040BC2C) --------------------------------------------------------
void __usercall sub_40BC2C(int a1<ebp>)
{
  exit(*(_DWORD *)(a1 - 120));
}

//----- (0040BC43) --------------------------------------------------------
void *__thiscall sub_40BC43(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  type_info___type_info();
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}
// 40BCE0: using guessed type int type_info___type_info(void);

//----- (0040BE24) --------------------------------------------------------
void __stdcall sub_40BE24(int a1)
{
  sub_40C65F(a1, 0);
}

//----- (0040BE93) --------------------------------------------------------
int __cdecl sub_40BE93(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7)
{
  int v7; // esi@1

  v7 = sub_40BECF(a1, a2, a3, vt, pperrinfo, lpString, (int)&a7, (void **)&pperrinfo);
  if ( v7 < 0 )
    SetErrorInfo(0, (IErrorInfo *)pperrinfo);
  return v7;
}

//----- (0040BECF) --------------------------------------------------------
int __cdecl sub_40BECF(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7, void **a8)
{
  int result; // eax@2
  int v9; // ebx@3
  int v10; // eax@4
  int v11; // eax@10
  int v12; // edx@10
  int v13; // ecx@10
  char *v14; // edi@10
  unsigned int v15; // esi@10
  void *v16; // esp@10
  int v17; // esi@13
  char v18; // zf@13
  int v19; // eax@14
  int v20; // edx@14
  int v21; // ecx@14
  signed int v22; // ebx@14
  unsigned __int16 v23; // di@16
  int v24; // esi@19
  int v25; // esi@22
  int v26; // esi@22
  int v27; // esi@23
  __int16 v28; // si@25
  int v29; // esi@26
  int v30; // edi@26
  int v31; // esi@27
  int v32; // edi@27
  int v33; // esi@31
  int v34; // eax@34
  int v35; // edx@34
  int v36; // ecx@34
  int v37; // esi@37
  unsigned int v38; // ecx@44
  int v39; // eax@45
  int v40; // ebx@45
  int v41; // esi@46
  HRESULT v42; // ebx@48
  void **v43; // esi@59
  ICreateErrorInfo *v44; // eax@78
  ICreateErrorInfo *v45; // edi@80
  char v46; // [sp+0h] [bp-60h]@10
  unsigned __int16 v47; // [sp+Ch] [bp-54h]@48
  BSTR bstrString; // [sp+10h] [bp-50h]@53
  OLECHAR *v49; // [sp+14h] [bp-4Ch]@55
  OLECHAR *v50; // [sp+18h] [bp-48h]@57
  DWORD v51; // [sp+1Ch] [bp-44h]@59
  void (__stdcall *v52)(unsigned __int16 *); // [sp+24h] [bp-3Ch]@50
  int v53; // [sp+28h] [bp-38h]@72
  char *v54; // [sp+2Ch] [bp-34h]@3
  int *v55; // [sp+30h] [bp-30h]@3
  int v56; // [sp+34h] [bp-2Ch]@3
  unsigned int v57; // [sp+38h] [bp-28h]@3
  VARIANTARG pvarg; // [sp+3Ch] [bp-24h]@48
  int v59; // [sp+4Ch] [bp-14h]@48
  int v60; // [sp+50h] [bp-10h]@6
  int v61; // [sp+54h] [bp-Ch]@10
  int v62; // [sp+58h] [bp-8h]@10
  int v63; // [sp+5Ch] [bp-4h]@13

  *a8 = 0;
  if ( !a1 )
    return -2147467261;
  v54 = 0;
  v9 = lpString;
  v55 = 0;
  v56 = 0;
  v57 = 0;
  if ( lpString )
  {
    v10 = lstrlenW((LPCWSTR)lpString);
    v56 = v10;
  }
  else
  {
    v10 = v56;
  }
  v60 = -3;
  if ( a3 & 0xC )
  {
    if ( !v10 )
      return -2147024809;
    v57 = 1;
    v55 = &v60;
  }
  if ( v10 )
  {
    v11 = 16 * v10;
    v15 = v11;
    v11 += 3;
    LOBYTE(v11) = v11 & 0xFC;
    v16 = alloca(v11);
    v12 = (int)&v46;
    memset(&v46, 0, 4 * (v15 >> 2));
    v14 = &v46 + 4 * (v15 >> 2);
    v61 = (int)&v46;
    v13 = v15 & 3;
    v62 = v9;
    while ( v13 )
    {
      *v14++ = 0;
      --v13;
    }
    v54 = &v46;
    v18 = *(_WORD *)v9 == 0;
    v17 = (int)(&v46 + 16 * v56 - 16);
    v63 = (int)(&v46 + 16 * v56 - 16);
    if ( !v18 )
    {
      v21 = v17 + 8;
      v22 = 4;
      v19 = a7 - 4;
      v20 = a7 - 8;
      while ( 1 )
      {
        v23 = *(_WORD *)v62 & 0xF7FF;
        *(_WORD *)v17 = v23;
        if ( (signed int)v23 > 16386 )
        {
          switch ( v23 )
          {
            default:
LABEL_30:
              if ( v23 & 0x2000 )
                break;
              return -2147024809;
            case 0x4003u:
            case 0x4004u:
            case 0x4005u:
            case 0x4006u:
            case 0x4007u:
            case 0x4008u:
            case 0x4009u:
            case 0x400Au:
            case 0x400Bu:
            case 0x400Cu:
            case 0x400Du:
            case 0x400Eu:
            case 0x4011u:
              break;
          }
        }
        else
        {
          if ( v23 != 16386 )
          {
            switch ( v23 )
            {
              case 2u:
                LOWORD(v24) = *(_WORD *)(v19 + v22);
                v20 += v22;
                v19 += v22;
                goto LABEL_20;
              case 4u:
                *(_WORD *)v63 = 5;
                goto LABEL_22;
              case 5u:
              case 7u:
LABEL_22:
                v26 = *(_DWORD *)(v20 + 8);
                v20 += 8;
                *(_DWORD *)v21 = v26;
                v19 += 8;
                v25 = *(_DWORD *)(v20 + 4);
                goto LABEL_24;
              case 6u:
                v27 = *(_DWORD *)(v19 + v22);
                v20 += v22;
                v19 += v22;
                *(_DWORD *)v21 = *(_DWORD *)v27;
                v25 = *(_DWORD *)(v27 + 4);
LABEL_24:
                *(_DWORD *)(v21 + 4) = v25;
                goto LABEL_32;
              case 0xBu:
                v28 = *(_WORD *)(v19 + v22);
                v19 += v22;
                v20 += v22;
                v24 = -(v28 != 0);
LABEL_20:
                *(_WORD *)v21 = v24;
                goto LABEL_32;
              case 0xCu:
                v29 = *(_DWORD *)(v19 + v22);
                v30 = v63;
                v20 += v22;
                v19 += v22;
                *(_DWORD *)v63 = *(_DWORD *)v29;
                v29 += 4;
                v30 += 4;
                *(_DWORD *)v30 = *(_DWORD *)v29;
                v29 += 4;
                v30 += 4;
                *(_DWORD *)v30 = *(_DWORD *)v29;
                *(_DWORD *)(v30 + 4) = *(_DWORD *)(v29 + 4);
                goto LABEL_32;
              case 0xEu:
                v31 = *(_DWORD *)(v19 + v22);
                v32 = v63;
                v20 += v22;
                v19 += v22;
                *(_DWORD *)v63 = *(_DWORD *)v31;
                v31 += 4;
                v32 += 4;
                *(_DWORD *)v32 = *(_DWORD *)v31;
                v31 += 4;
                v32 += 4;
                *(_DWORD *)v32 = *(_DWORD *)v31;
                *(_DWORD *)(v32 + 4) = *(_DWORD *)(v31 + 4);
                *(_WORD *)v63 = 14;
                goto LABEL_32;
              case 0x11u:
                v20 += v22;
                v19 += v22;
                *(_BYTE *)v21 = *(_BYTE *)v19;
                v22 = 4;
                goto LABEL_32;
              default:
                goto LABEL_30;
              case 3u:
              case 8u:
              case 9u:
              case 0xAu:
              case 0xDu:
                break;
            }
          }
        }
        v33 = *(_DWORD *)(v19 + v22);
        v20 += v22;
        v19 += v22;
        *(_DWORD *)v21 = v33;
LABEL_32:
        v62 += 2;
        v63 -= 16;
        v21 -= 16;
        if ( !*(_WORD *)v62 )
          break;
        v17 = v63;
      }
      v12 = v61;
      v9 = lpString;
    }
    v34 = v12 + 16 * v57;
    v35 = 0;
    v36 = v9 + 2 * (v56 - v57) - 2;
    if ( v36 >= (unsigned int)v9 )
    {
      do
      {
        if ( (unsigned __int16)(*(_WORD *)v36 & 0xBFFF) != 2060 )
          break;
        v37 = *(_WORD *)v36 & 0x4000 ? *(_DWORD *)(v34 + 8) : v34;
        if ( *(_WORD *)v37 != 10 )
          break;
        if ( *(_DWORD *)(v37 + 8) != -2147352572 )
          break;
        ++v35;
        v34 += 16;
        v36 -= 2;
      }
      while ( v36 >= (unsigned int)v9 );
      if ( v35 )
      {
        v38 = 0;
        if ( v57 )
        {
          v40 = v61;
          v39 = v61 + 16 * v35;
          do
          {
            *(_DWORD *)v39 = *(_DWORD *)v40;
            *(_DWORD *)(v39 + 4) = *(_DWORD *)(v40 + 4);
            *(_DWORD *)(v39 + 8) = *(_DWORD *)(v40 + 8);
            v41 = v40 + 12;
            ++v38;
            v40 += 16;
            *(_DWORD *)(v39 + 12) = *(_DWORD *)v41;
            v39 += 16;
          }
          while ( v38 < v57 );
        }
        v56 -= v35;
        v54 += 16 * v35;
      }
    }
  }
  VariantInit(&pvarg);
  v59 = -1;
  memset(&v47, 0, 0x20u);
  v42 = (*(int (__stdcall **)(int, int, _UNKNOWN *, _DWORD, int, char **, int, unsigned __int16 *, int *))(*(_DWORD *)a1 + 24))(
          a1,
          a2,
          &unk_415AD0,
          0,
          a3,
          &v54,
          vt != 0 ? (int)&pvarg : 0,
          &v47,
          &v59);
  if ( v42 >= 0 )
  {
    if ( vt )
    {
      if ( vt != 12 && vt != (_WORD)pvarg.vt && (v42 = VariantChangeType(&pvarg, &pvarg, 0, vt), v42 < 0) )
      {
LABEL_85:
        VariantClear(&pvarg);
      }
      else
      {
        switch ( vt )
        {
          case 5u:
          case 6u:
          case 7u:
            v44 = pperrinfo;
            pperrinfo->lpVtbl = (struct ICreateErrorInfoVtbl *)LODWORD(pvarg.llVal);
            v44[1].lpVtbl = (struct ICreateErrorInfoVtbl *)HIDWORD(pvarg.llVal);
            break;
          case 2u:
          case 0xBu:
            LOWORD(pperrinfo->lpVtbl) = LOWORD(pvarg.llVal);
            break;
          case 0xCu:
          case 0xEu:
            v45 = pperrinfo;
            pperrinfo->lpVtbl = *(struct ICreateErrorInfoVtbl **)&pvarg;
            ++v45;
            v45->lpVtbl = *(struct ICreateErrorInfoVtbl **)&pvarg.wReserved2;
            *(_QWORD *)&v45[1].lpVtbl = pvarg.llVal;
            break;
          case 0x11u:
            LOBYTE(pperrinfo->lpVtbl) = LOBYTE(pvarg.llVal);
            break;
          default:
            if ( (vt & 0x6000) == 8192 )
              goto LABEL_83;
            v42 = -2147024809;
            goto LABEL_85;
          case 3u:
          case 4u:
          case 8u:
          case 9u:
          case 0xAu:
          case 0xDu:
LABEL_83:
            pperrinfo->lpVtbl = (struct ICreateErrorInfoVtbl *)LODWORD(pvarg.llVal);
            break;
        }
      }
    }
    return v42;
  }
  VariantClear(&pvarg);
  if ( v42 != -2147352567 )
    return v42;
  if ( v52 )
    v52(&v47);
  pperrinfo = 0;
  if ( CreateErrorInfo(&pperrinfo) >= 0 )
  {
    pperrinfo->lpVtbl->SetGUID(pperrinfo, (const GUID *const )&unk_4156F0);
    if ( bstrString )
      pperrinfo->lpVtbl->SetSource(pperrinfo, bstrString);
    if ( v49 )
      pperrinfo->lpVtbl->SetDescription(pperrinfo, v49);
    if ( v50 )
      pperrinfo->lpVtbl->SetHelpFile(pperrinfo, v50);
    pperrinfo->lpVtbl->SetHelpContext(pperrinfo, v51);
    v43 = a8;
    if ( pperrinfo->lpVtbl->QueryInterface(pperrinfo, (const IID *const )&unk_4156E0, a8) < 0 )
      *v43 = 0;
    pperrinfo->lpVtbl->Release(pperrinfo);
  }
  if ( bstrString )
    SysFreeString(bstrString);
  if ( v49 )
    SysFreeString(v49);
  if ( v50 )
    SysFreeString(v50);
  if ( v47 )
  {
    if ( v47 < 0xFE00u )
      result = v47 - 2147220992;
    else
      result = -2147155969;
  }
  else
  {
    result = v53;
  }
  return result;
}

//----- (0040C3B4) --------------------------------------------------------
int __cdecl sub_40C3B4(int a1, int a2, int a3, VARTYPE vt, ICreateErrorInfo *pperrinfo, int lpString, int a7)
{
  int result; // eax@1

  result = sub_40BECF(a1, a2, a3, vt, pperrinfo, lpString, (int)&a7, (void **)&pperrinfo);
  if ( result < 0 )
    sub_40C65F(result, (int)pperrinfo);
  return result;
}

//----- (0040C4DC) --------------------------------------------------------
int __cdecl sub_40C4DC()
{
  sub_40C4E6();
  return atexit(sub_40C504);
}

//----- (0040C4E6) --------------------------------------------------------
int __cdecl sub_40C4E6()
{
  return sub_40C603((int)&pvarg, -2147352572, 10);
}

//----- (0040C504) --------------------------------------------------------
int __cdecl sub_40C504()
{
  int result; // eax@1

  result = VariantClear(&pvarg);
  if ( result < 0 )
    sub_40BE24(result);
  return result;
}

//----- (0040C51A) --------------------------------------------------------
BSTR __stdcall sub_40C51A(LPCSTR lpMultiByteStr)
{
  BSTR result; // eax@2
  int v2; // eax@3
  int v3; // esi@3
  int v4; // eax@3
  void *v5; // esp@3
  int v6; // eax@5
  __int16 v7; // [sp+0h] [bp-8h]@3

  if ( lpMultiByteStr )
  {
    v2 = lstrlenA(lpMultiByteStr);
    v3 = v2 + 1;
    v4 = 2 * (v2 + 1) + 3;
    LOBYTE(v4) = v4 & 0xFC;
    v5 = alloca(v4);
    v7 = 0;
    if ( !MultiByteToWideChar(0, 0, lpMultiByteStr, -1, (LPWSTR)&v7, v3) )
    {
      if ( ((int (__cdecl *)(_DWORD))GetLastError)(*(_DWORD *)&v7) )
        v6 = (unsigned __int16)GetLastError() | 0x80070000;
      else
        v6 = 0;
      sub_40BE24(v6);
    }
    result = SysAllocString((const OLECHAR *)&v7);
  }
  else
  {
    result = 0;
  }
  return result;
}

//----- (0040C58F) --------------------------------------------------------
void *__stdcall sub_40C58F(LPCWSTR Str)
{
  void *result; // eax@2
  void *v2; // eax@3
  int v3; // edi@3
  void *v4; // esi@3
  size_t v5; // eax@3
  int v6; // eax@7

  if ( Str )
  {
    v5 = wcslen(Str);
    v3 = 2 * v5 + 2;
    v2 = operator new(2 * v5 + 2);
    v4 = v2;
    if ( !v2 )
      sub_40BE24(-2147024882);
    *(_BYTE *)v2 = 0;
    if ( !WideCharToMultiByte(0, 0, Str, -1, (LPSTR)v2, v3, 0, 0) )
    {
      if ( GetLastError() )
        v6 = (unsigned __int16)GetLastError() | 0x80070000;
      else
        v6 = 0;
      sub_40BE24(v6);
    }
    result = v4;
  }
  else
  {
    result = 0;
  }
  return result;
}

//----- (0040C603) --------------------------------------------------------
int __thiscall sub_40C603(int this, int a2, __int16 a3)
{
  if ( a3 != 3 )
  {
    if ( a3 == 10 )
    {
LABEL_6:
      *(_WORD *)this = 10;
LABEL_10:
      *(_DWORD *)(this + 8) = a2;
      return this;
    }
    if ( a3 != 11 )
      sub_40BE24(-2147024809);
  }
  if ( a3 == 10 )
    goto LABEL_6;
  if ( a3 != 11 )
  {
    *(_WORD *)this = 3;
    goto LABEL_10;
  }
  *(_WORD *)this = 11;
  *(_WORD *)(this + 8) = -(a2 != 0);
  return this;
}

//----- (0040C65F) --------------------------------------------------------
void __cdecl sub_40C65F(int a1, int a2)
{
  char v2; // [sp+0h] [bp-10h]@1

  sub_40C683((int)&v2, a1, a2, 0);
  CxxThrowException(&v2, &unk_413158);
}
// 40BC64: using guessed type int __stdcall CxxThrowException(_DWORD, _DWORD);

//----- (0040C683) --------------------------------------------------------
int __thiscall sub_40C683(int this, int a2, int a3, char a4)
{
  int v4; // esi@1

  v4 = this;
  *(_DWORD *)(this + 12) = 0;
  *(_DWORD *)(this + 4) = a2;
  *(_DWORD *)this = &off_411A50;
  *(_DWORD *)(this + 8) = a3;
  if ( a3 )
  {
    if ( a4 )
      (*(void (__stdcall **)(int))(*(_DWORD *)a3 + 4))(a3);
  }
  return v4;
}
// 411A50: using guessed type int (__thiscall *off_411A50)(void *, char);

//----- (0040C6B5) --------------------------------------------------------
void *__thiscall sub_40C6B5(void *this, char a2)
{
  void *v2; // esi@1

  v2 = this;
  sub_40C6FE((int)this);
  if ( a2 & 1 )
    operator delete(v2);
  return v2;
}

//----- (0040C6D1) --------------------------------------------------------
int __thiscall sub_40C6D1(int this, int a2)
{
  int v2; // eax@1
  int v3; // esi@1

  v3 = this;
  *(_DWORD *)(this + 4) = *(_DWORD *)(a2 + 4);
  v2 = *(_DWORD *)(a2 + 8);
  *(_DWORD *)(this + 12) = 0;
  *(_DWORD *)(this + 8) = v2;
  *(_DWORD *)this = &off_411A50;
  if ( v2 )
    (*(void (__stdcall **)(int))(*(_DWORD *)v2 + 4))(v2);
  return v3;
}
// 411A50: using guessed type int (__thiscall *off_411A50)(void *, char);

//----- (0040C6FE) --------------------------------------------------------
HLOCAL __thiscall sub_40C6FE(int this)
{
  HLOCAL result; // eax@1
  int v2; // esi@1
  void *v3; // esi@3

  v2 = this;
  result = *(HLOCAL *)(this + 8);
  *(_DWORD *)this = &off_411A50;
  if ( result )
    result = (HLOCAL)(*(int (__stdcall **)(HLOCAL))(*(_DWORD *)result + 8))(result);
  v3 = *(void **)(v2 + 12);
  if ( v3 )
    result = LocalFree(v3);
  return result;
}
// 411A50: using guessed type int (__thiscall *off_411A50)(void *, char);

//----- (0040C793) --------------------------------------------------------
int __cdecl sub_40C793()
{
  int result; // eax@1

  result = AfxInitialize(0, 0x600u);
  byte_415AF0 = result;
  return result;
}
// 415AF0: using guessed type char byte_415AF0;

//----- (0040E420) --------------------------------------------------------
int __usercall sub_40E420<eax>(int a1<ebp>)
{
  return sub_4010AF(a1 - 1068);
}
// 4010AF: using guessed type int __thiscall sub_4010AF(_DWORD);

//----- (0040E42B) --------------------------------------------------------
int __cdecl SEH_401740()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E440) --------------------------------------------------------
int __usercall sub_40E440<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E44B) --------------------------------------------------------
int __usercall sub_40E44B<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 36);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E456) --------------------------------------------------------
int __usercall sub_40E456<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 40);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E461) --------------------------------------------------------
int __cdecl SEH_401800()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E480) --------------------------------------------------------
int __usercall sub_40E480<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E48B) --------------------------------------------------------
int __usercall sub_40E48B<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 36);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E496) --------------------------------------------------------
int __usercall sub_40E496<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 40);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E4A1) --------------------------------------------------------
int __cdecl SEH_401910()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E4C0) --------------------------------------------------------
int __usercall sub_40E4C0<eax>(int a1<ebp>)
{
  return CDialog___CDialog(*(_DWORD *)(a1 - 16));
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040E4C8) --------------------------------------------------------
int __usercall sub_40E4C8<eax>(int a1<ebp>)
{
  return CComboBox___CComboBox(*(_DWORD *)(a1 - 16) + 96);
}
// 40B70C: using guessed type int __thiscall CComboBox___CComboBox(_DWORD);

//----- (0040E4D3) --------------------------------------------------------
int __usercall sub_40E4D3<eax>(int a1<ebp>)
{
  return CProgressCtrl___CProgressCtrl(*(_DWORD *)(a1 - 16) + 160);
}
// 40B706: using guessed type int __thiscall CProgressCtrl___CProgressCtrl(_DWORD);

//----- (0040E4E1) --------------------------------------------------------
int __usercall sub_40E4E1<eax>(int a1<ebp>)
{
  return CEdit___CEdit(*(_DWORD *)(a1 - 16) + 224);
}
// 40B700: using guessed type int __thiscall CEdit___CEdit(_DWORD);

//----- (0040E4EF) --------------------------------------------------------
int __usercall sub_40E4EF<eax>(int a1<ebp>)
{
  return CButton___CButton(*(_DWORD *)(a1 - 16) + 288);
}
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);

//----- (0040E4FD) --------------------------------------------------------
int __usercall sub_40E4FD<eax>(int a1<ebp>)
{
  return CButton___CButton(*(_DWORD *)(a1 - 16) + 352);
}
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);

//----- (0040E50B) --------------------------------------------------------
int __usercall sub_40E50B<eax>(int a1<ebp>)
{
  return sub_4011A4(*(_DWORD *)(a1 - 16) + 420);
}
// 4011A4: using guessed type int __thiscall sub_4011A4(_DWORD);

//----- (0040E519) --------------------------------------------------------
int __usercall sub_40E519<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(*(_DWORD *)(a1 - 16) + 488);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040E527) --------------------------------------------------------
int __usercall sub_40E527<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 492);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E535) --------------------------------------------------------
int __usercall sub_40E535<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 496);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E543) --------------------------------------------------------
int __usercall sub_40E543<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 512);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E551) --------------------------------------------------------
int __usercall sub_40E551<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 516);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E55F) --------------------------------------------------------
int __usercall sub_40E55F<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1040);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E56D) --------------------------------------------------------
int __usercall sub_40E56D<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1044);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E57B) --------------------------------------------------------
int __usercall sub_40E57B<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1048);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E589) --------------------------------------------------------
int __usercall sub_40E589<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1052);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E597) --------------------------------------------------------
int __cdecl SEH_401AC0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E5E0) --------------------------------------------------------
int __usercall sub_40E5E0<eax>(int a1<ebp>)
{
  return CDialog___CDialog(*(_DWORD *)(a1 - 16));
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040E5E8) --------------------------------------------------------
int __usercall sub_40E5E8<eax>(int a1<ebp>)
{
  return CComboBox___CComboBox(*(_DWORD *)(a1 - 16) + 96);
}
// 40B70C: using guessed type int __thiscall CComboBox___CComboBox(_DWORD);

//----- (0040E5F3) --------------------------------------------------------
int __usercall sub_40E5F3<eax>(int a1<ebp>)
{
  return CProgressCtrl___CProgressCtrl(*(_DWORD *)(a1 - 16) + 160);
}
// 40B706: using guessed type int __thiscall CProgressCtrl___CProgressCtrl(_DWORD);

//----- (0040E601) --------------------------------------------------------
int __usercall sub_40E601<eax>(int a1<ebp>)
{
  return CEdit___CEdit(*(_DWORD *)(a1 - 16) + 224);
}
// 40B700: using guessed type int __thiscall CEdit___CEdit(_DWORD);

//----- (0040E60F) --------------------------------------------------------
int __usercall sub_40E60F<eax>(int a1<ebp>)
{
  return CButton___CButton(*(_DWORD *)(a1 - 16) + 288);
}
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);

//----- (0040E61D) --------------------------------------------------------
int __usercall sub_40E61D<eax>(int a1<ebp>)
{
  return CButton___CButton(*(_DWORD *)(a1 - 16) + 352);
}
// 40B6FA: using guessed type int __thiscall CButton___CButton(_DWORD);

//----- (0040E62B) --------------------------------------------------------
int __usercall sub_40E62B<eax>(int a1<ebp>)
{
  return sub_4011A4(*(_DWORD *)(a1 - 16) + 420);
}
// 4011A4: using guessed type int __thiscall sub_4011A4(_DWORD);

//----- (0040E639) --------------------------------------------------------
void __cdecl sub_40E639()
{
  JUMPOUT(*(unsigned int *)loc_401037);
}
// 401037: using guessed type int loc_401037();

//----- (0040E647) --------------------------------------------------------
int __usercall sub_40E647<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 492);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E655) --------------------------------------------------------
int __usercall sub_40E655<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 496);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E663) --------------------------------------------------------
int __usercall sub_40E663<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 512);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E671) --------------------------------------------------------
int __usercall sub_40E671<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 516);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E67F) --------------------------------------------------------
int __usercall sub_40E67F<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1040);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E68D) --------------------------------------------------------
int __usercall sub_40E68D<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1044);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E69B) --------------------------------------------------------
int __usercall sub_40E69B<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1048);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E6A9) --------------------------------------------------------
int __usercall sub_40E6A9<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 1052);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E6B7) --------------------------------------------------------
int __cdecl SEH_401D50()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E700) --------------------------------------------------------
int __usercall sub_40E700<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E708) --------------------------------------------------------
int __usercall sub_40E708<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E710) --------------------------------------------------------
int __usercall sub_40E710<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E718) --------------------------------------------------------
int __cdecl SEH_401FF0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E730) --------------------------------------------------------
int __usercall sub_40E730<eax>(int a1<ebp>)
{
  return CPortManager___CPortManager(a1 - 26908);
}
// 416CBC: using guessed type int __thiscall CPortManager___CPortManager(_DWORD);

//----- (0040E73C) --------------------------------------------------------
int __usercall sub_40E73C<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 26916);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E747) --------------------------------------------------------
int __usercall sub_40E747<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 26916);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E770) --------------------------------------------------------
int __usercall sub_40E770<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E77B) --------------------------------------------------------
int __usercall sub_40E77B<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E786) --------------------------------------------------------
int __usercall sub_40E786<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E791) --------------------------------------------------------
int __usercall sub_40E791<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E7C0) --------------------------------------------------------
int __usercall sub_40E7C0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 76);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E7C8) --------------------------------------------------------
HRESULT __usercall sub_40E7C8<eax>(int a1<ebp>)
{
  return VariantClear((VARIANTARG *)(a1 - 36));
}

//----- (0040E7D0) --------------------------------------------------------
int __usercall sub_40E7D0<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 72) & 1;
  if ( result )
    result = CString___CString(*(_DWORD *)(a1 + 4));
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E7E7) --------------------------------------------------------
int __cdecl SEH_402840()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E800) --------------------------------------------------------
int __usercall sub_40E800<eax>(int a1<ebp>)
{
  return j_j___1CDialog(a1 - 108);
}
// 40119A: using guessed type int __thiscall j_j_??1CDialog(_DWORD);

//----- (0040E808) --------------------------------------------------------
int __cdecl SEH_402A00()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E820) --------------------------------------------------------
int __usercall sub_40E820<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E828) --------------------------------------------------------
int __usercall sub_40E828<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E830) --------------------------------------------------------
int __cdecl SEH_402CC0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E840) --------------------------------------------------------
int __usercall sub_40E840<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E848) --------------------------------------------------------
int __usercall sub_40E848<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 28);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E850) --------------------------------------------------------
int __usercall sub_40E850<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E858) --------------------------------------------------------
int __usercall sub_40E858<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E860) --------------------------------------------------------
int __usercall sub_40E860<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E868) --------------------------------------------------------
int __usercall sub_40E868<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 8);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E870) --------------------------------------------------------
int __cdecl SEH_402DA0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E890) --------------------------------------------------------
int __usercall sub_40E890<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 64);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E898) --------------------------------------------------------
int __usercall sub_40E898<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 56);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8A0) --------------------------------------------------------
int __usercall sub_40E8A0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 36);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8A8) --------------------------------------------------------
int __usercall sub_40E8A8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 32);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8B0) --------------------------------------------------------
int __usercall sub_40E8B0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 40);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8B8) --------------------------------------------------------
int __usercall sub_40E8B8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 28);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8C0) --------------------------------------------------------
int __usercall sub_40E8C0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8C8) --------------------------------------------------------
int __usercall sub_40E8C8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8D0) --------------------------------------------------------
int __usercall sub_40E8D0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E8D8) --------------------------------------------------------
int __cdecl SEH_402F20()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E900) --------------------------------------------------------
int __usercall sub_40E900<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 184);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E90B) --------------------------------------------------------
int __usercall sub_40E90B<eax>(int a1<ebp>)
{
  return CFile___CFile(a1 - 128);
}
// 40B7FC: using guessed type int __thiscall CFile___CFile(_DWORD);

//----- (0040E913) --------------------------------------------------------
void __usercall sub_40E913(int a1<ebp>)
{
  *(_DWORD *)(a1 - 152) = &off_411854;
}
// 411854: using guessed type int (*off_411854)();

//----- (0040E91E) --------------------------------------------------------
int __usercall sub_40E91E<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 136);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E929) --------------------------------------------------------
int __usercall sub_40E929<eax>(int a1<ebp>)
{
  return sub_401235(a1 - 152);
}
// 401235: using guessed type int __thiscall sub_401235(_DWORD);

//----- (0040E934) --------------------------------------------------------
int __usercall sub_40E934<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 180);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E93F) --------------------------------------------------------
int __usercall sub_40E93F<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 196);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E94A) --------------------------------------------------------
int __usercall sub_40E94A<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E955) --------------------------------------------------------
int __usercall sub_40E955<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 188);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E960) --------------------------------------------------------
int __usercall sub_40E960<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 156);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E96B) --------------------------------------------------------
int __usercall sub_40E96B<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 188);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E976) --------------------------------------------------------
int __usercall sub_40E976<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 192);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E981) --------------------------------------------------------
void __cdecl sub_40E981()
{
  JUMPOUT(*(unsigned int *)loc_40102D);
}
// 40102D: using guessed type int loc_40102D();

//----- (0040E9C0) --------------------------------------------------------
void __cdecl sub_40E9C0()
{
  JUMPOUT(*(unsigned int *)loc_40102D);
}
// 40102D: using guessed type int loc_40102D();

//----- (0040E9C8) --------------------------------------------------------
int __cdecl SEH_403C40()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040E9E0) --------------------------------------------------------
int __usercall sub_40E9E0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E9E8) --------------------------------------------------------
int __usercall sub_40E9E8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040E9F0) --------------------------------------------------------
int __cdecl SEH_403CB0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EA00) --------------------------------------------------------
int __usercall sub_40EA00<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA08) --------------------------------------------------------
int __cdecl SEH_403F10()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EA20) --------------------------------------------------------
int __usercall sub_40EA20<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 132);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA2B) --------------------------------------------------------
int __usercall sub_40EA2B<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 136);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA36) --------------------------------------------------------
int __usercall sub_40EA36<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 140));
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA41) --------------------------------------------------------
int __usercall sub_40EA41<eax>(int a1<ebp>)
{
  return sub_401253(a1 - 124);
}
// 401253: using guessed type int __thiscall sub_401253(_DWORD);

//----- (0040EA49) --------------------------------------------------------
int __usercall sub_40EA49<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 140);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA54) --------------------------------------------------------
int __usercall sub_40EA54<eax>(int a1<ebp>)
{
  return CDialog___CDialog(a1 - 124);
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040EA5C) --------------------------------------------------------
int __usercall sub_40EA5C<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 28);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA64) --------------------------------------------------------
int __usercall sub_40EA64<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EA6C) --------------------------------------------------------
int __cdecl SEH_4040E0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EA90) --------------------------------------------------------
int __usercall sub_40EA90<eax>(int a1<ebp>)
{
  return CDialog___CDialog(*(_DWORD *)(a1 - 16));
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040EA98) --------------------------------------------------------
int __usercall sub_40EA98<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 96);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EAA3) --------------------------------------------------------
int __usercall sub_40EAA3<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 100);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EAAE) --------------------------------------------------------
int __cdecl SEH_4042F0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EAD0) --------------------------------------------------------
int __usercall sub_40EAD0<eax>(int a1<ebp>)
{
  return j_j___1CPtrList(*(_DWORD *)(a1 - 16) + 4);
}
// 4012A8: using guessed type int __thiscall j_j_??1CPtrList(_DWORD);

//----- (0040EADB) --------------------------------------------------------
int __usercall sub_40EADB<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 36);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EAE6) --------------------------------------------------------
int __usercall sub_40EAE6<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 40);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EAF1) --------------------------------------------------------
int __usercall sub_40EAF1<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 44);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EAFC) --------------------------------------------------------
int __usercall sub_40EAFC<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 48);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB07) --------------------------------------------------------
int __cdecl SEH_404480()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EB30) --------------------------------------------------------
int __usercall sub_40EB30<eax>(int a1<ebp>)
{
  return j_j___1CPtrList(*(_DWORD *)(a1 - 16) + 4);
}
// 4012A8: using guessed type int __thiscall j_j_??1CPtrList(_DWORD);

//----- (0040EB3B) --------------------------------------------------------
int __usercall sub_40EB3B<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 36);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB46) --------------------------------------------------------
int __usercall sub_40EB46<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 40);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB51) --------------------------------------------------------
int __usercall sub_40EB51<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 44);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB5C) --------------------------------------------------------
int __usercall sub_40EB5C<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 48);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB67) --------------------------------------------------------
int __cdecl SEH_4045E0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EB90) --------------------------------------------------------
int __usercall sub_40EB90<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EB98) --------------------------------------------------------
int __usercall sub_40EB98<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EBA0) --------------------------------------------------------
void __usercall sub_40EBA0(int a1<ebp>)
{
  operator delete(*(void **)(a1 + 12));
}

//----- (0040EBAB) --------------------------------------------------------
int __cdecl SEH_4046C0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EBC0) --------------------------------------------------------
int __usercall sub_40EBC0<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 + 4);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040EBC8) --------------------------------------------------------
int __usercall sub_40EBC8<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 8);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EBD0) --------------------------------------------------------
HRESULT __usercall sub_40EBD0<eax>(int a1<ebp>)
{
  return VariantClear((VARIANTARG *)(a1 - 28));
}

//----- (0040EBD8) --------------------------------------------------------
int __cdecl SEH_404CB0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EBF0) --------------------------------------------------------
void __cdecl sub_40EBF0()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EBF8) --------------------------------------------------------
int __usercall sub_40EBF8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 24);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EC00) --------------------------------------------------------
int __usercall sub_40EC00<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 20));
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EC08) --------------------------------------------------------
int __cdecl SEH_404E10()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EC20) --------------------------------------------------------
void __cdecl sub_40EC20()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EC28) --------------------------------------------------------
int __cdecl SEH_404F90()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EC40) --------------------------------------------------------
void __cdecl sub_40EC40()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EC48) --------------------------------------------------------
int __cdecl SEH_405050()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EC60) --------------------------------------------------------
int __usercall sub_40EC60<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EC68) --------------------------------------------------------
int __usercall sub_40EC68<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16) & 1;
  if ( result )
    result = CString___CString(*(_DWORD *)(a1 + 4));
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EC7F) --------------------------------------------------------
int __cdecl SEH_4050F0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ECA0) --------------------------------------------------------
int __usercall sub_40ECA0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040ECA8) --------------------------------------------------------
int __usercall sub_40ECA8<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16) & 1;
  if ( result )
    result = CString___CString(*(_DWORD *)(a1 + 4));
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040ECBF) --------------------------------------------------------
int __cdecl SEH_4051B0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ECE0) --------------------------------------------------------
int __usercall sub_40ECE0<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040ECE8) --------------------------------------------------------
int __cdecl SEH_405250()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ED00) --------------------------------------------------------
void __cdecl sub_40ED00()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040ED08) --------------------------------------------------------
int __cdecl SEH_405320()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ED20) --------------------------------------------------------
void __cdecl sub_40ED20()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040ED28) --------------------------------------------------------
int __cdecl SEH_4053C0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ED40) --------------------------------------------------------
void __cdecl sub_40ED40()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040ED48) --------------------------------------------------------
int __usercall sub_40ED48<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = VariantClear((VARIANTARG *)(a1 - 92));
  if ( result < 0 )
    sub_40BE24(result);
  return result;
}

//----- (0040ED50) --------------------------------------------------------
void __cdecl sub_40ED50()
{
  JUMPOUT(*(unsigned int *)loc_401172);
}
// 401172: using guessed type int loc_401172();

//----- (0040ED58) --------------------------------------------------------
int __usercall sub_40ED58<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 144);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040ED63) --------------------------------------------------------
int __usercall sub_40ED63<eax>(int a1<ebp>)
{
  return CByteArray___CByteArray(a1 - 112);
}
// 40B880: using guessed type int __thiscall CByteArray___CByteArray(_DWORD);

//----- (0040ED6B) --------------------------------------------------------
int __usercall sub_40ED6B<eax>(int a1<ebp>)
{
  return CByteArray___CByteArray(a1 - 72);
}
// 40B880: using guessed type int __thiscall CByteArray___CByteArray(_DWORD);

//----- (0040ED73) --------------------------------------------------------
int __cdecl SEH_405460()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040ED90) --------------------------------------------------------
void __cdecl sub_40ED90()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040ED98) --------------------------------------------------------
int __usercall sub_40ED98<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 64);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EDA0) --------------------------------------------------------
int __cdecl SEH_406470()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EDB0) --------------------------------------------------------
void __cdecl sub_40EDB0()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EDB8) --------------------------------------------------------
int __cdecl SEH_406B20()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EDD0) --------------------------------------------------------
int __usercall sub_40EDD0<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 8);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EDD8) --------------------------------------------------------
int __usercall sub_40EDD8<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EDE0) --------------------------------------------------------
int __cdecl SEH_406F80()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EDF0) --------------------------------------------------------
int __usercall sub_40EDF0<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 8);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EDF8) --------------------------------------------------------
int __usercall sub_40EDF8<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE00) --------------------------------------------------------
int __usercall sub_40EE00<eax>(int a1<ebp>)
{
  return sub_4011C7(a1 - 32);
}
// 4011C7: using guessed type int __thiscall sub_4011C7(_DWORD);

//----- (0040EE08) --------------------------------------------------------
int __usercall sub_40EE08<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 40));
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE10) --------------------------------------------------------
int __cdecl SEH_407070()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EE30) --------------------------------------------------------
int __usercall sub_40EE30<eax>(int this<ecx>, int a2<ebp>)
{
  return sub_40A270(*(_DWORD *)(a2 - 16));
}

//----- (0040EE38) --------------------------------------------------------
int __usercall sub_40EE38<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 28);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE43) --------------------------------------------------------
int __usercall sub_40EE43<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 32);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE4E) --------------------------------------------------------
void __cdecl sub_40EE4E()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EE59) --------------------------------------------------------
int __usercall sub_40EE59<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 48);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE64) --------------------------------------------------------
int __usercall sub_40EE64<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 52);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EE6F) --------------------------------------------------------
int __cdecl strstreambuf__strstreambuf()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EE90) --------------------------------------------------------
int __usercall sub_40EE90<eax>(int this<ecx>, int a2<ebp>)
{
  return sub_40A270(*(_DWORD *)(a2 - 16));
}

//----- (0040EE98) --------------------------------------------------------
int __usercall sub_40EE98<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 28);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EEA3) --------------------------------------------------------
int __usercall sub_40EEA3<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 32);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EEAE) --------------------------------------------------------
void __cdecl sub_40EEAE()
{
  JUMPOUT(*(unsigned int *)loc_4011B8);
}
// 4011B8: using guessed type int loc_4011B8();

//----- (0040EEB9) --------------------------------------------------------
int __usercall sub_40EEB9<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 48);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EEC4) --------------------------------------------------------
int __usercall sub_40EEC4<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 52);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EECF) --------------------------------------------------------
int __cdecl SEH_4073E0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EEF0) --------------------------------------------------------
void __cdecl sub_40EEF0()
{
  JUMPOUT(*(unsigned int *)loc_401037);
}
// 401037: using guessed type int loc_401037();

//----- (0040EEF8) --------------------------------------------------------
int __usercall sub_40EEF8<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EF00) --------------------------------------------------------
signed int __usercall sub_40EF00<eax>(int this<ecx>, int a2<ebp>)
{
  return sub_409340(a2 - 64);
}

//----- (0040EF08) --------------------------------------------------------
void __cdecl sub_40EF08()
{
  JUMPOUT(*(unsigned int *)loc_401172);
}
// 401172: using guessed type int loc_401172();

//----- (0040EF10) --------------------------------------------------------
void __usercall sub_40EF10(int a1<ebp>)
{
  operator delete(*(void **)(a1 - 52));
}

//----- (0040EF1B) --------------------------------------------------------
void __usercall sub_40EF1B(int a1<ebp>)
{
  int v1; // esi@1

  v1 = *(_DWORD *)(a1 - 52);
  if ( v1 )
  {
    if ( !InterlockedDecrement((volatile LONG *)(v1 + 8)) )
    {
      if ( v1 )
      {
        if ( *(_DWORD *)v1 )
          SysFreeString(*(BSTR *)v1);
        if ( *(_DWORD *)(v1 + 4) )
          operator delete(*(void **)(v1 + 4));
        operator delete((void *)v1);
      }
    }
    *(_DWORD *)(a1 - 52) = 0;
  }
}

//----- (0040EF23) --------------------------------------------------------
int __cdecl SEH_4079C0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EF40) --------------------------------------------------------
int __usercall sub_40EF40<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EF48) --------------------------------------------------------
int __usercall sub_40EF48<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16) & 1;
  if ( result )
    result = CString___CString(*(_DWORD *)(a1 + 4));
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EF5F) --------------------------------------------------------
int __cdecl SEH_407F80()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EF80) --------------------------------------------------------
int __usercall sub_40EF80<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 20);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EF88) --------------------------------------------------------
int __usercall sub_40EF88<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16) & 1;
  if ( result )
    result = CString___CString(*(_DWORD *)(a1 + 4));
  return result;
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EF9F) --------------------------------------------------------
int __cdecl SEH_408030()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EFC0) --------------------------------------------------------
int __usercall sub_40EFC0<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040EFC8) --------------------------------------------------------
int __cdecl SEH_4080C0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040EFE0) --------------------------------------------------------
void __usercall sub_40EFE0(int a1<ebp>)
{
  operator delete(*(void **)(a1 - 36));
}

//----- (0040EFEB) --------------------------------------------------------
void __cdecl sub_40EFEB()
{
  JUMPOUT(*(unsigned int *)loc_401244);
}
// 401244: using guessed type int loc_401244();

//----- (0040EFF3) --------------------------------------------------------
void __usercall sub_40EFF3(int a1<ebp>)
{
  operator delete(*(void **)(a1 + 8));
}

//----- (0040EFFE) --------------------------------------------------------
int __cdecl SEH_408160()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F020) --------------------------------------------------------
int __usercall sub_40F020<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F028) --------------------------------------------------------
int __cdecl SEH_4083D0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F040) --------------------------------------------------------
int __usercall sub_40F040<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F04B) --------------------------------------------------------
int __cdecl SEH_408750()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F060) --------------------------------------------------------
int __usercall sub_40F060<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F06B) --------------------------------------------------------
int __cdecl SEH_408810()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F080) --------------------------------------------------------
void __usercall sub_40F080(int a1<ebp>)
{
  operator delete(*(void **)(a1 - 16));
}

//----- (0040F08B) --------------------------------------------------------
int __usercall sub_40F08B<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F09E) --------------------------------------------------------
int __cdecl SEH_4088B0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F0C0) --------------------------------------------------------
int __usercall sub_40F0C0<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F0C8) --------------------------------------------------------
int __cdecl SEH_408BB0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F0E0) --------------------------------------------------------
int __usercall sub_40F0E0<eax>(int a1<ebp>)
{
  return CDialog___CDialog(*(_DWORD *)(a1 - 16));
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040F0E8) --------------------------------------------------------
int __usercall sub_40F0E8<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 96);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F0F3) --------------------------------------------------------
int __usercall sub_40F0F3<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 100);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F0FE) --------------------------------------------------------
int __usercall sub_40F0FE<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 108);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F120) --------------------------------------------------------
int __usercall sub_40F120<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 8);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F128) --------------------------------------------------------
int __usercall sub_40F128<eax>(int a1<ebp>)
{
  return CString___CString(a1 + 4);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F130) --------------------------------------------------------
int __usercall sub_40F130<eax>(int a1<ebp>)
{
  return CDialog___CDialog(*(_DWORD *)(a1 - 16));
}
// 40B69A: using guessed type int __thiscall CDialog___CDialog(_DWORD);

//----- (0040F138) --------------------------------------------------------
int __usercall sub_40F138<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 96);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F143) --------------------------------------------------------
int __usercall sub_40F143<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 100);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F14E) --------------------------------------------------------
int __usercall sub_40F14E<eax>(int a1<ebp>)
{
  return CString___CString(*(_DWORD *)(a1 - 16) + 108);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F159) --------------------------------------------------------
int __cdecl SEH_408E90()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F180) --------------------------------------------------------
int __usercall sub_40F180<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F188) --------------------------------------------------------
int __cdecl SEH_409010()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F1A0) --------------------------------------------------------
int __usercall sub_40F1A0<eax>(int a1<ebp>)
{
  return CString___CString(a1 - 16);
}
// 40B5C2: using guessed type int __thiscall CString___CString(_DWORD);

//----- (0040F1A8) --------------------------------------------------------
int __cdecl SEH_409170()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F1C0) --------------------------------------------------------
int __cdecl SEH_4093D0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F1D0) --------------------------------------------------------
int __cdecl SEH_409660()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F1E0) --------------------------------------------------------
int __cdecl SEH_409920()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F200) --------------------------------------------------------
int __cdecl SEH_409CB0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F21B) --------------------------------------------------------
int __usercall sub_40F21B<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(*(_DWORD *)(a1 - 16) + 8);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040F226) --------------------------------------------------------
void __cdecl sub_40F226()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F231) --------------------------------------------------------
void __cdecl sub_40F231()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F23C) --------------------------------------------------------
int __usercall sub_40F23C<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(*(_DWORD *)(a1 - 16) + 20);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040F247) --------------------------------------------------------
int __cdecl SEH_40A1F0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F26B) --------------------------------------------------------
void __cdecl sub_40F26B()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F276) --------------------------------------------------------
void __cdecl sub_40F276()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F281) --------------------------------------------------------
void __cdecl sub_40F281()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F28C) --------------------------------------------------------
int __cdecl SEH_40A270()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F2A0) --------------------------------------------------------
int __usercall sub_40F2A0<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040F2C0) --------------------------------------------------------
int __usercall sub_40F2C0<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040F2C8) --------------------------------------------------------
int __cdecl SEH_40A390()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F2E0) --------------------------------------------------------
int __usercall sub_40F2E0<eax>(int a1<ebp>)
{
  int result; // eax@1

  result = *(_DWORD *)(a1 - 16);
  if ( result )
    result = (*(int (__stdcall **)(int))(*(_DWORD *)result + 8))(result);
  return result;
}

//----- (0040F2E8) --------------------------------------------------------
int __cdecl SEH_40A5B0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F300) --------------------------------------------------------
void __cdecl sub_40F300()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F320) --------------------------------------------------------
void __cdecl sub_40F320()
{
  JUMPOUT(*(unsigned int *)unknown_libname_12);
}
// 40B0E0: using guessed type int unknown_libname_12();

//----- (0040F340) --------------------------------------------------------
void __cdecl sub_40F340()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F360) --------------------------------------------------------
void __cdecl sub_40F360()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F380) --------------------------------------------------------
void __cdecl sub_40F380()
{
  JUMPOUT(*(unsigned int *)unknown_libname_9);
}
// 40B0B0: using guessed type int unknown_libname_9();

//----- (0040F3A0) --------------------------------------------------------
void __cdecl sub_40F3A0()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F3C0) --------------------------------------------------------
void __cdecl sub_40F3C0()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F3E0) --------------------------------------------------------
void __cdecl sub_40F3E0()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F3E8) --------------------------------------------------------
int __cdecl SEH_40ACF0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

//----- (0040F400) --------------------------------------------------------
void __cdecl sub_40F400()
{
  JUMPOUT(*(unsigned int *)unknown_libname_8);
}
// 40B0A0: using guessed type int unknown_libname_8();

//----- (0040F420) --------------------------------------------------------
void __cdecl sub_40F420()
{
  JUMPOUT(*(unsigned int *)unknown_libname_10);
}
// 40B0C0: using guessed type int unknown_libname_10();

//----- (0040F450) --------------------------------------------------------
int __cdecl SEH_40B3E0()
{
  return _CxxFrameHandler();
}
// 40B8F4: using guessed type int _CxxFrameHandler(void);

// ALL OK, 427 function(s) have been successfully decompiled
