//
// sub_18007BBC0 from 0x18007bbc0 to 0x18007bde4 (548 bytes)
//
// 4 xrefs:
// > StartAddress @ 0x180077ccc
// > ??> @ 0x180144d38
// > ??> @ 0x180144d48
// > ??> @ 0x1801bede8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:00 +0000
//
int __fastcall sub_18007BBC0(LONG_PTR dwNewLong)
{
HWND Window; // rax
HWND v3; // rsi
HANDLE CurrentThread; // rax
void *v5; // rcx
RAWINPUTDEVICE pRawInputDevices; // [rsp+60h] [rbp-A8h] BYREF
int v8; // [rsp+70h] [rbp-98h]
int v9; // [rsp+74h] [rbp-94h]
HWND v10; // [rsp+78h] [rbp-90h]
WNDCLASSA WndClass; // [rsp+80h] [rbp-88h] BYREF
struct tagMSG Msg; // [rsp+D0h] [rbp-38h] BYREF
*(_DWORD *)(dwNewLong + 240) = GetCurrentThreadId();
*(_QWORD *)&WndClass.cbClsExtra = 0;
*(_QWORD *)&WndClass.style = 0;
WndClass.lpfnWndProc = (WNDPROC)sub_1800787A0;
memset(&WndClass.hIcon, 0, 32);
WndClass.hInstance = GetModuleHandleA(nullptr);
WndClass.lpszClassName = "GD_RawInput";
if ( (RegisterClassA(&WndClass) || (LODWORD(Window) = GetLastError(), (_DWORD)Window == 1410))
&& (Window = CreateWindowExA(
0,
"GD_RawInput",
"GD Raw Input Window",
0,
0,
0,
0,
0,
HWND_MESSAGE,
nullptr,
WndClass.hInstance,
nullptr),
(v3 = Window) != nullptr) )
{
*(_QWORD *)(dwNewLong + 48) = Window;
SetWindowLongPtrA(Window, -21, dwNewLong);
*(_DWORD *)&pRawInputDevices.usUsagePage = 131073;
pRawInputDevices.dwFlags = 256;
pRawInputDevices.hwndTarget = v3;
v8 = 393217;
v9 = 256;
v10 = v3;
if ( RegisterRawInputDevices(&pRawInputDevices, 2u, 0x10u) )
{
CurrentThread = GetCurrentThread();
SetThreadPriority(CurrentThread, 2);
*(_QWORD *)(dwNewLong + 248) = RegisterPowerSettingNotification(v3, &PowerSettingGuid, 0);
if ( GetMessageA(&Msg, nullptr, 0, 0) > 0 )
{
do
DispatchMessageA(&Msg);
while ( *(_BYTE *)(dwNewLong + 8) && GetMessageA(&Msg, nullptr, 0, 0) > 0 );
}
v5 = *(void **)(dwNewLong + 248);
if ( v5 )
{
UnregisterPowerSettingNotification(v5);
*(_QWORD *)(dwNewLong + 248) = 0;
}
}
else
{
*(_BYTE *)(dwNewLong + 8) = 0;
}
LODWORD(Window) = DestroyWindow(v3);
*(_QWORD *)(dwNewLong + 48) = 0;
}
else
{
*(_BYTE *)(dwNewLong + 8) = 0;
}
return (int)Window;
}