[HD Mini ROM Development] _Madmatt:
Checked that for you, and indeed it is decompiled C++. This is what it contains, but I don't know what we should do with this code? Maybe someone who knows C++ can make HSPL with this as a basis? :)

/* 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 char aGetprocesswind[]; // idb
extern char aGetuserobjecti[]; // idb
extern char aGetlastactivep[19]; // weak
extern char aGetactivewindo[16]; // weak
extern char aMessageboxa[]; // idb
extern char LibFileName[]; // idb
extern char aRomupdateutili[21]; // weak
extern char Caption[]; // idb
extern _UNKNOWN unk_409300; // weak
extern char Text[]; // idb
extern char aErrorDuringExt[]; // idb
extern _UNKNOWN unk_409400; // weak
extern _UNKNOWN unk_409408; // weak
extern int dword_40AA58; // weak
extern int dword_40ACA0; // weak
extern char off_40ACA4[92]; // idb
extern int dword_40AD10; // weak
extern int dword_40AD1C; // weak
extern int dword_40B2E0; // weak
extern int dword_40B2F0; // weak
extern int dword_40B308; // weak
extern int dword_40B30C; // weak
extern int dword_40B310; // weak
extern int dword_40B314; // weak
extern int dword_40B318; // weak
extern int dword_40B31C; // weak
extern int dword_40B320; // weak
extern int dword_40B324; // weak
extern CHAR Filename; // idb
extern char FileName[]; // idb
extern int dword_40BB68; // weak

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

#define __thiscall __cdecl // Test compile in C mode

// signed int __usercall sub_401000<eax>(int a1<eax>, int a2<edx>, int a3<ecx>);
LPVOID __cdecl sub_401050(DWORD NumberOfBytesWritten);
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
// char *__cdecl strrchr(const char *, int);
signed int __cdecl sub_4017D5(int a1);
signed int __cdecl sub_40180C(int a1);
int (*__cdecl sub_40247B())(void);
int (*__cdecl sub_40249F())(void);
// _DWORD __cdecl _encode_pointer(_DWORD); weak
// int _encoded_null(void); weak
// _DWORD __cdecl _decode_pointer(_DWORD); weak
int __cdecl sub_402EE1(int a1);
// int __cdecl _invoke_watson(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int *__cdecl _errno();
int __cdecl sub_403325();
int __cdecl sub_4034EC(int a1);
int __cdecl sub_4034F6(int a1);
int __cdecl sub_4035D5(int a1);
int __cdecl sub_403601(int a1, int a2, int a3);
int __thiscall sub_40544A(void *this, char a2);
void __cdecl sub_4055AF();
// void *__cdecl memset(void *, int, size_t);
// _DWORD __thiscall __report_gsfailure(_DWORD ecx0, _BYTE _4); weak
// int __cdecl _unwind_handler(int, int, int, int, int); weak
// int __cdecl _abnormal_termination();
// HANDLE __stdcall CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
// HRSRC __stdcall FindResourceA(HMODULE hModule, LPCSTR lpName, LPCSTR lpType);
// HGLOBAL __stdcall LoadResource(HMODULE hModule, HRSRC hResInfo);
// DWORD __stdcall WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
// BOOL __stdcall WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
// DWORD __stdcall SizeofResource(HMODULE hModule, HRSRC hResInfo);
// BOOL __stdcall CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
// BOOL __stdcall SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes);
// LPVOID __stdcall LockResource(HGLOBAL hResData);
// DWORD __stdcall GetModuleFileNameA(HMODULE hModule, LPCH lpFilename, DWORD nSize);
// BOOL __stdcall CloseHandle(HANDLE hObject);
// BOOL __stdcall DeleteFileA(LPCSTR lpFileName);
// FARPROC __stdcall GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
// HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName);
// int __stdcall MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);

//----- (00401000) --------------------------------------------------------
signed int __usercall sub_401000<eax>(int a1<eax>, int a2<edx>, int a3<ecx>)
{
signed int result; // eax@1
int v4; // edi@1
int v5; // esi@1

v5 = a1;
v4 = a3;
result = 0;
if ( a3 )
{
while ( *(_BYTE *)v5 )
{
*(_BYTE *)a2++ = *(_BYTE *)v5++;
--v4;
if ( !v4 )
{
result = -2147024774;
*(_BYTE *)(a2 - 1) = 0;
return result;
}
}
if ( !v4 )
{
--a2;
result = -2147024774;
}
*(_BYTE *)a2 = 0;
}
else
{
result = -2147024809;
}
return result;
}

//----- (00401050) --------------------------------------------------------
LPVOID __cdecl sub_401050(DWORD NumberOfBytesWritten)
{
HRSRC v1; // eax@1
HRSRC v2; // esi@1
LPVOID result; // eax@2
HGLOBAL v4; // eax@3
const void *v5; // ebx@4
HANDLE v6; // eax@6
DWORD v7; // edi@6
void *v8; // esi@6

v1 = FindResourceA(0, (LPCSTR)(unsigned __int16)NumberOfBytesWritten, (LPCSTR)0xA);
v2 = v1;
if ( v1 && (v4 = LoadResource(0, v1)) != 0 )
{
result = LockResource(v4);
v5 = result;
if ( result )
{
v7 = SizeofResource(0, v2);
v6 = CreateFileA(FileName, 0x40000000u, 1u, 0, 2u, 2u, 0);
v8 = v6;
if ( v6 == (HANDLE)-1 )
{
result = 0;
}
else
{
WriteFile(v6, v5, v7, &NumberOfBytesWritten, 0);
CloseHandle(v8);
SetFileAttributesA(FileName, 2u);
result = (LPVOID)1;
}
}
}
else
{
result = 0;
}
return result;
}

//----- (004010F0) --------------------------------------------------------
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
char *v4; // eax@1
unsigned int v5; // ebx@3
unsigned int v6; // edi@3
int v7; // eax@4
signed int v8; // edx@4
char v9; // cl@5
int v10; // eax@10
signed int v11; // ecx@10
char *v12; // eax@15
int v13; // edx@15
char *v14; // esi@16
char v15; // cl@17
int v16; // ecx@23
signed int v17; // esi@23
int v18; // eax@31
signed int v19; // edx@31
char v20; // cl@32
int v22; // eax@38
signed int v23; // ecx@38
char *v24; // eax@43
int v25; // edx@43
char *v26; // esi@44
char v27; // cl@45
int v28; // eax@51
signed int v29; // ecx@51
char *v30; // eax@56
int v31; // edx@56
char *v32; // esi@57
char v33; // cl@58
unsigned int v34; // edi@68
int v35; // eax@69
signed int v36; // edx@69
char v37; // cl@70
int v38; // eax@75
signed int v39; // ecx@75
char *v40; // eax@80
int v41; // edx@80
char *v42; // esi@81
char v43; // cl@82
int v44; // eax@88
signed int v45; // ecx@88
char *v46; // eax@93
int v47; // edx@93
char *v48; // esi@94
char v49; // cl@95
struct _PROCESS_INFORMATION ProcessInformation; // [sp+4h] [bp-54h]@64
struct _STARTUPINFOA StartupInfo; // [sp+14h] [bp-44h]@64

Filename = 0;
GetModuleFileNameA(0, &Filename, 0x1FFu);
v4 = strrchr(&Filename, 92);
if ( v4 )
*v4 = 0;
v5 = &Filename - FileName;
v6 = 0;
do
{
v8 = 512;
v7 = (int)FileName;
while ( 1 )
{
v9 = *(_BYTE *)(v5 + v7);
if ( !v9 )
break;
*(_BYTE *)v7++ = v9;
--v8;
if ( !v8 )
goto LABEL_9;
}
if ( v8 )
goto LABEL_10;
LABEL_9:
--v7;
LABEL_10:
*(_BYTE *)v7 = 0;
v11 = 512;
v10 = (int)FileName;
while ( *(_BYTE *)v10 )
{
++v10;
--v11;
if ( !v11 )
goto LABEL_23;
}
if ( v11 )
{
v13 = 512 - (512 - v11);
v12 = &FileName[512 - v11];
if ( 0 != v11 )
{
v14 = (char *)(&unk_409300 - (_UNKNOWN *)v12);
while ( 1 )
{
v15 = *(_BYTE *)((_DWORD)v14 + (_DWORD)v12);
if ( !v15 )
break;
*v12++ = v15;
--v13;
if ( !v13 )
goto LABEL_21;
}
if ( v13 )
goto LABEL_22;
LABEL_21:
--v12;
LABEL_22:
*v12 = 0;
}
}
LABEL_23:
v17 = 512;
v16 = (int)FileName;
while ( *(_BYTE *)v16 )
{
++v16;
--v17;
if ( !v17 )
goto LABEL_29;
}
if ( v17 )
sub_401000(*(_DWORD *)&off_40ACA4[v6], (int)&FileName[512 - v17], 512 - (512 - v17));
LABEL_29:
if ( !sub_401050(*(int *)((char *)&dword_40ACA0 + v6)) )
{
MessageBoxA(0, "Error during application start! Possible file corrupted!", Caption, 0x40010u);
return -1;
}
v6 += 8;
}
while ( v6 < 0x50 );
v19 = 512;
v18 = (int)FileName;
while ( 1 )
{
v20 = *(_BYTE *)(v5 + v18);
if ( !v20 )
break;
*(_BYTE *)v18++ = v20;
--v19;
if ( !v19 )
goto LABEL_37;
}
if ( v19 )
goto LABEL_38;
LABEL_37:
--v18;
LABEL_38:
*(_BYTE *)v18 = 0;
v23 = 512;
v22 = (int)FileName;
while ( *(_BYTE *)v22 )
{
++v22;
--v23;
if ( !v23 )
goto LABEL_51;
}
if ( v23 )
{
v25 = 512 - (512 - v23);
v24 = &FileName[512 - v23];
if ( 0 != v23 )
{
v26 = (char *)(&unk_409300 - (_UNKNOWN *)v24);
while ( 1 )
{
v27 = *(_BYTE *)((_DWORD)v26 + (_DWORD)v24);
if ( !v27 )
break;
*v24++ = v27;
--v25;
if ( !v25 )
goto LABEL_49;
}
if ( v25 )
goto LABEL_50;
LABEL_49:
--v24;
LABEL_50:
*v24 = 0;
}
}
LABEL_51:
v29 = 512;
v28 = (int)FileName;
while ( *(_BYTE *)v28 )
{
++v28;
--v29;
if ( !v29 )
goto LABEL_64;
}
if ( v29 )
{
v31 = 512 - (512 - v29);
v30 = &FileName[512 - v29];
if ( 0 != v29 )
{
v32 = (char *)("ROMUpdateUtility.exe" - v30);
while ( 1 )
{
v33 = *(_BYTE *)((_DWORD)v30 + (_DWORD)v32);
if ( !v33 )
break;
*v30++ = v33;
--v31;
if ( !v31 )
goto LABEL_62;
}
if ( v31 )
goto LABEL_63;
LABEL_62:
--v30;
LABEL_63:
*v30 = 0;
}
}
LABEL_64:
memset(&StartupInfo, 0, 0x44u);
if ( CreateProcessA(FileName, 0, 0, 0, 0, 0, 0, 0, &StartupInfo, &ProcessInformation)
&& (_DWORD)ProcessInformation.hProcess )
{
WaitForSingleObject(ProcessInformation.hProcess, 0xFFFFFFFFu);
CloseHandle(ProcessInformation.hProcess);
}
else
{
MessageBoxA(0, "Error during extraction! Possible file corrupted!", Caption, 0x40010u);
}
v34 = 0;
do
{
v36 = 512;
v35 = (int)FileName;
while ( 1 )
{
v37 = *(_BYTE *)(&Filename - FileName + v35);
if ( !v37 )
break;
*(_BYTE *)v35++ = v37;
--v36;
if ( !v36 )
goto LABEL_74;
}
if ( v36 )
goto LABEL_75;
LABEL_74:
--v35;
LABEL_75:
*(_BYTE *)v35 = 0;
v39 = 512;
v38 = (int)FileName;
while ( *(_BYTE *)v38 )
{
++v38;
--v39;
if ( !v39 )
goto LABEL_88;
}
if ( v39 )
{
v41 = 512 - (512 - v39);
v40 = &FileName[512 - v39];
if ( 0 != v39 )
{
v42 = (char *)(&unk_409300 - (_UNKNOWN *)v40);
while ( 1 )
{
v43 = *(_BYTE *)((_DWORD)v42 + (_DWORD)v40);
if ( !v43 )
break;
*v40++ = v43;
--v41;
if ( !v41 )
goto LABEL_86;
}
if ( v41 )
goto LABEL_87;
LABEL_86:
--v40;
LABEL_87:
*v40 = 0;
}
}
LABEL_88:
v45 = 512;
v44 = (int)FileName;
while ( *(_BYTE *)v44 )
{
++v44;
--v45;
if ( !v45 )
goto LABEL_101;
}
if ( v45 )
{
v47 = 512 - (512 - v45);
v46 = &FileName[512 - v45];
if ( 0 != v45 )
{
v48 = (char *)(*(_DWORD *)&off_40ACA4[v34] - (_DWORD)v46);
while ( 1 )
{
v49 = *(_BYTE *)((_DWORD)v46 + (_DWORD)v48);
if ( !v49 )
break;
*v46++ = v49;
--v47;
if ( !v47 )
goto LABEL_99;
}
if ( v47 )
goto LABEL_100;
LABEL_99:
--v46;
LABEL_100:
*v46 = 0;
}
}
LABEL_101:
SetFileAttributesA(FileName, 0x80u);
DeleteFileA(FileName);
v34 += 8;
}
while ( v34 < 0x50 );
return 0;
}
// 40ACA0: using guessed type int dword_40ACA0;

//----- (004017D5) --------------------------------------------------------
signed int __cdecl sub_4017D5(int a1)
{
signed int result; // eax@2

if ( a1 && dword_40AD10 )
{
*(_DWORD *)a1 = dword_40AD10;
result = 0;
}
else
{
*_errno() = 22;
_invalid_parameter(0, 0, 0, 0, 0);
result = 22;
}
return result;
}
// 402FE7: using guessed type int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40AD10: using guessed type int dword_40AD10;

//----- (0040180C) --------------------------------------------------------
signed int __cdecl sub_40180C(int a1)
{
signed int result; // eax@2

if ( a1 && dword_40AD10 )
{
*(_DWORD *)a1 = dword_40AD1C;
result = 0;
}
else
{
*_errno() = 22;
_invalid_parameter(0, 0, 0, 0, 0);
result = 22;
}
return result;
}
// 402FE7: using guessed type int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40AD10: using guessed type int dword_40AD10;
// 40AD1C: using guessed type int dword_40AD1C;

//----- (0040247B) --------------------------------------------------------
int (*__cdecl sub_40247B())(void)
{
int (*result)(void); // eax@1
unsigned int v1; // esi@1

result = (int (*)(void))&unk_409400;
v1 = (unsigned int)&unk_409400;
if ( &unk_409400 < &unk_409400 )
{
do
{
result = *(int (**)(void))v1;
if ( *(_DWORD *)v1 )
result = (int (*)(void))result();
v1 += 4;
}
while ( v1 < (unsigned int)&unk_409400 );
}
return result;
}

//----- (0040249F) --------------------------------------------------------
int (*__cdecl sub_40249F())(void)
{
int (*result)(void); // eax@1
unsigned int v1; // esi@1

result = (int (*)(void))&unk_409408;
v1 = (unsigned int)&unk_409408;
if ( &unk_409408 < &unk_409408 )
{
do
{
result = *(int (**)(void))v1;
if ( *(_DWORD *)v1 )
result = (int (*)(void))result();
v1 += 4;
}
while ( v1 < (unsigned int)&unk_409408 );
}
return result;
}

//----- (00402EE1) --------------------------------------------------------
int __cdecl sub_402EE1(int a1)
{
int result; // eax@1

result = a1;
dword_40B2E0 = a1;
return result;
}
// 40B2E0: using guessed type int dword_40B2E0;

//----- (00403325) --------------------------------------------------------
int __cdecl sub_403325()
{
return _decode_pointer(dword_40B2F0);
}
// 40252F: using guessed type _DWORD __cdecl _decode_pointer(_DWORD);
// 40B2F0: using guessed type int dword_40B2F0;

//----- (004034EC) --------------------------------------------------------
int __cdecl sub_4034EC(int a1)
{
int result; // eax@1

result = a1;
dword_40B308 = a1;
return result;
}
// 40B308: using guessed type int dword_40B308;

//----- (004034F6) --------------------------------------------------------
int __cdecl sub_4034F6(int a1)
{
int result; // eax@1

result = a1;
dword_40B30C = a1;
return result;
}
// 40B30C: using guessed type int dword_40B30C;

//----- (004035D5) --------------------------------------------------------
int __cdecl sub_4035D5(int a1)
{
int result; // eax@1

result = a1;
dword_40B310 = a1;
return result;
}
// 40B310: using guessed type int dword_40B310;

//----- (00403601) --------------------------------------------------------
int __cdecl sub_403601(int a1, int a2, int a3)
{
HMODULE v3; // eax@2
HMODULE v4; // edi@2
FARPROC v6; // eax@4
FARPROC v7; // eax@5
FARPROC v8; // eax@5
FARPROC v9; // eax@8
FARPROC v10; // eax@9
int v11; // esi@10
int v12; // eax@12
int (__thiscall *v13)(_DWORD); // eax@12
int v14; // ST14_4@12
int v15; // ST04_4@13
int (__thiscall *v16)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // eax@13
int v17; // ST00_4@13
int (__thiscall *v18)(_DWORD); // eax@21
int v19; // ST14_4@21
int v20; // ST14_4@23
int (__thiscall *v21)(_DWORD, _DWORD); // eax@23
int v22; // ST10_4@23
int v23; // ST08_4@24
int (__thiscall *v24)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // eax@24
int v25; // ST04_4@24
char v26; // [sp+10h] [bp-20h]@13
char v27; // [sp+18h] [bp-18h]@14
char v28; // [sp+1Ch] [bp-14h]@13
int v29; // [sp+20h] [bp-10h]@1
unsigned int v30; // [sp+24h] [bp-Ch]@1
int v31; // [sp+28h] [bp-8h]@1
int v32; // [sp+2Ch] [bp-4h]@1

v29 = _encoded_null();
v32 = 0;
v31 = 0;
v30 = 0;
if ( !dword_40B314 )
{
v3 = LoadLibraryA("USER32.DLL");
v4 = v3;
if ( !v3 || (v6 = GetProcAddress(v3, "MessageBoxA"), !v6) )
return 0;
dword_40B314 = _encode_pointer(v6);
v7 = GetProcAddress(v4, "GetActiveWindow");
dword_40B318 = _encode_pointer(v7);
v8 = GetProcAddress(v4, "GetLastActivePopup");
dword_40B31C = _encode_pointer(v8);
if ( sub_4017D5((int)&v31) )
_invoke_watson(0, 0, 0, 0, 0);
if ( v31 == 2 )
{
v9 = GetProcAddress(v4, "GetUserObjectInformationA");
dword_40B324 = _encode_pointer(v9);
if ( dword_40B324 )
{
v10 = GetProcAddress(v4, "GetProcessWindowStation");
dword_40B320 = _encode_pointer(v10);
}
}
}
v11 = v29;
if ( dword_40B320 == v29
|| dword_40B324 == v29
|| (v13 = (int (__thiscall *)(_DWORD))_decode_pointer(dword_40B320), (v12 = v13(v14)) != 0)
&& (v15 = v12,
v16 = (int (__thiscall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))_decode_pointer(dword_40B324),
v16(v17, v15, 1, &v26, 12, &v28))
&& v27 & 1 )
{
if ( dword_40B318 != v11 )
{
v18 = (int (__thiscall *)(_DWORD))_decode_pointer(dword_40B318);
v32 = v18(v19);
if ( v32 )
{
if ( dword_40B31C != v11 )
{
v20 = v32;
v21 = (int (__thiscall *)(_DWORD, _DWORD))_decode_pointer(dword_40B31C);
v32 = v21(v22, v20);
}
}
}
}
else
{
if ( sub_40180C((int)&v30) )
_invoke_watson(0, 0, 0, 0, 0);
if ( v30 < 4 )
a3 |= 0x40000u;
else
a3 |= 0x200000u;
}
v23 = v32;
v24 = (int (__thiscall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))_decode_pointer(dword_40B314);
return v24(v25, v23, a1, a2, a3);
}
// 4024C3: using guessed type _DWORD __cdecl _encode_pointer(_DWORD);
// 402526: using guessed type int _encoded_null(void);
// 40252F: using guessed type _DWORD __cdecl _decode_pointer(_DWORD);
// 402EEB: using guessed type int __cdecl _invoke_watson(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40B314: using guessed type int dword_40B314;
// 40B318: using guessed type int dword_40B318;
// 40B31C: using guessed type int dword_40B31C;
// 40B320: using guessed type int dword_40B320;
// 40B324: using guessed type int dword_40B324;

//----- (0040544A) --------------------------------------------------------
int __thiscall sub_40544A(void *this, char a2)
{
if ( this == (void *)dword_40AA58 )
__asm { rep retn }
return __report_gsfailure(this, a2);
}
// 406A85: using guessed type _DWORD __thiscall __report_gsfailure(_DWORD ecx0, _BYTE _4);
// 40AA58: using guessed type int dword_40AA58;

//----- (004055AF) --------------------------------------------------------
void __cdecl sub_4055AF()
{
dword_40BB68 = 0;
}
// 40BB68: using guessed type int dword_40BB68;

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