//
// CWin32InputBox::DlgProc from 0x18001e680 to 0x18001e804 (388 bytes)
//
// 4 xrefs:
// > CWin32InputBox::InputBoxEx @ 0x18001e0fc
// > CWin32InputBox::InputBox @ 0x18001e2aa
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004b10c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
INT_PTR __fastcall CWin32InputBox::DlgProc(HWND a1, int a2, unsigned __int16 a3, CWin32InputBox *a4)
{
HWND *WindowLongPtrW; // r14
int v9; // ebx
unsigned __int64 v10; // rcx
size_t v12; // r8
_BYTE *v13; // rdx
const char *v14; // rdx
char *v15; // rcx
__int128 v16; // [rsp+20h] [rbp-78h] BYREF
__int64 v17; // [rsp+30h] [rbp-68h]
__int64 v18; // [rsp+38h] [rbp-60h]
char *Source[3]; // [rsp+48h] [rbp-50h] BYREF
unsigned __int64 v20; // [rsp+60h] [rbp-38h]
WindowLongPtrW = (HWND *)GetWindowLongPtrW(a1, -21);
v9 = a2 - 272;
if ( v9 )
{
if ( v9 != 1 )
return 0;
v10 = 0;
while ( a3 != *(_QWORD *)((char *)&unk_1800234D8 + v10) )
{
v10 += 8LL;
if ( v10 >= 0x10 )
return 0;
}
GetWindowTextA(WindowLongPtrW[1], *((LPSTR *)*WindowLongPtrW + 8), *((_DWORD *)*WindowLongPtrW + 18));
v12 = -1;
v13 = *((_BYTE **)*WindowLongPtrW + 8);
v16 = 0;
v17 = 0;
v18 = 0;
do
++v12;
while ( v13[v12] );
sub_180003AB0(&v16, v13, v12);
CWin32InputBox::AnsiToUtf8(Source);
memset(*((void **)*WindowLongPtrW + 8), 0, *((unsigned int *)*WindowLongPtrW + 18));
v14 = (const char *)Source;
if ( v20 > 0xF )
v14 = Source[0];
strncpy(*((char **)*WindowLongPtrW + 8), v14, (unsigned int)(*((_DWORD *)*WindowLongPtrW + 18) - 1));
EndDialog(a1, a3);
if ( v20 > 0xF )
{
v15 = Source[0];
if ( v20 + 1 >= 0x1000 )
{
v15 = *((char **)Source[0] - 1);
if ( (unsigned __int64)(Source[0] - v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
}
else
{
SetWindowLongPtrW(a1, -21, (LONG_PTR)a4);
*(_QWORD *)(*(_QWORD *)a4 + 104LL) = a1;
CWin32InputBox::InitDialog(a4);
}
return 1;
}