Function at 0x401559
Capabilities:
Create thread

Disassembly:
sub esp, 0x5c
push ebx
push ebp
push esi
push edi
xor esi, esi
lea eax, [esp + 0x40]
mov edi, esi
mov dword [0x528608], esi
push eax
mov ebx, 0x528608
mov dword [esp + 0x18], edi
call dword [sym.imp.HID.DLL_HidD_GetHidGuid]
push 0x12
push esi
push esi
lea eax, [esp + 0x4c]
push eax
call dword [sym.imp.SETUPAPI.dll_SetupDiGetClassDevsW]
mov ebp, eax
mov dword [esp + 0x10], ebp
cmp ebp, 0xffffffff
je 0x401832
mov eax, esi
mov dword [esp + 0x2c], esi
lea ecx, [esp + 0x50]
mov dword [esp + 0x50], 0x1c
push ecx
push eax
lea eax, [esp + 0x48]
push eax
push esi
push ebp
call dword [sym.imp.SETUPAPI.dll_SetupDiEnumDeviceInterfaces]
mov dword [esp + 0x30], eax
test eax, eax
je 0x401815
push esi
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], esi
push eax
push esi
push esi
lea eax, [esp + 0x60]
push eax
push ebp
call dword [sym.imp.SETUPAPI.dll_SetupDiGetDeviceInterfaceDetailW]
test eax, eax
jne 0x401815
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x401815
push dword [esp + 0x18]
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
mov dword [esp + 0x1c], esi
test esi, esi
je 0x401813
push 0
lea eax, [esp + 0x1c]
mov dword [esi], 6
push eax
push dword [esp + 0x20]
lea eax, [esp + 0x5c]
push esi
push eax
push ebp
call dword [sym.imp.SETUPAPI.dll_SetupDiGetDeviceInterfaceDetailW]
test eax, eax
je 0x40180c
xor ecx, ecx
lea eax, [esi + 4]
push ecx
push ecx
push 3
push ecx
push 3
push ecx
push eax
mov dword [esp + 0x40], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [esp + 0x28], eax
cmp eax, 0xffffffff
je 0x40180c
lea ecx, [esp + 0x34]
mov dword [esp + 0x34], 0xc
push ecx
push eax
call dword [sym.imp.HID.DLL_HidD_GetAttributes]
test al, al
je 0x401802
mov dx, word [esp + 0x3a]
xor ecx, ecx
mov di, word [esp + 0x38]
xor eax, eax
cmp word [eax + 0x4c7b50], di
jne 0x40169d
cmp word [eax + 0x4c7b52], dx
je 0x40179c
add eax, 0xc
inc ecx
cmp eax, 0x48
jb 0x401687
xor ebp, ebp
test ebp, ebp
je 0x4017fa
test byte [ebp + 4], 2
je 0x4017fa
push 0x74
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov dword [ebx], eax
test eax, eax
je 0x4017fa
lea eax, [esp + 0x20]
push eax
push dword [esp + 0x2c]
call dword [sym.imp.HID.DLL_HidD_GetPreparsedData]
test al, al
je 0x40170c
mov eax, dword [ebx]
add eax, 0x18
push eax
push dword [esp + 0x24]
call dword [sym.imp.HID.DLL_HidP_GetCaps]
test eax, eax
jns 0x401702
push eax
push str.ERROR_kull_m_busylight_devices_get___HidP_GetCaps___08x__n
call fcn.00409cda
pop ecx
pop ecx
push dword [esp + 0x20]
call dword [sym.imp.HID.DLL_HidD_FreePreparsedData]
push dword [esp + 0x24]
call fcn.004a6476
pop ecx
mov ecx, dword [ebx]
lea esi, [esp + 0x34]
mov dword [ecx + 8], eax
mov edi, dword [ebx]
add edi, 0xc
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
mov eax, dword [ebx]
mov edi, dword [esp + 0x14]
mov dword [eax + 0x58], ebp
xor ebp, ebp
mov eax, dword [ebx]
push ebp
push ebp
push 3
mov byte [eax + 0x5c], 4
mov eax, dword [ebx]
push ebp
push 3
push 3
push dword [esp + 0x3c]
mov byte [eax + 0x5d], 4
mov eax, dword [ebx]
mov byte [eax + 0x5e], 0x55
mov eax, dword [ebx]
mov dword [eax + 4], edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, dword [ebx]
mov dword [ecx + 0x60], eax
mov eax, dword [ebx]
cmp dword [eax + 0x60], ebp
je 0x4017e5
cmp dword [eax + 0x60], 0xffffffff
je 0x4017e5
push ebp
push ebp
mov dword [eax + 0x64], 0x1388
push dword [ebx]
push 0x401af2
push ebp
push ebp
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov ecx, dword [ebx]
mov dword [ecx + 0x68], eax
test eax, eax
je 0x4017aa
mov ebx, dword [ebx]
inc edi
mov dword [esp + 0x14], edi
mov esi, dword [esp + 0x1c]
jmp 0x4017fe
imul ebp, ecx, 0xc
add ebp, 0x4c7b50
jmp 0x4016a8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_busylight_devices_get___CreateThread__hKeepAliveThread___0x_08x__n
call fcn.00409cda
mov eax, dword [ebx]
pop ecx
pop ecx
push dword [eax + 0x60]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebx]
mov ecx, dword [eax + 8]
test ecx, ecx
je 0x4017da
push ecx
call fcn.004a64d5
mov eax, dword [ebx]
pop ecx
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov dword [ebx], eax
jmp 0x401796
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_busylight_devices_get___CreateFile__hBusy___0x_08x__n
call fcn.00409cda
pop ecx
pop ecx
jmp 0x4017c8
mov edi, dword [esp + 0x14]
mov ebp, dword [esp + 0x10]
push dword [esp + 0x28]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
xor esi, esi
mov eax, dword [esp + 0x2c]
inc eax
cmp dword [esp + 0x30], 0
mov dword [esp + 0x2c], eax
jne 0x4015a2
push ebp
call dword [sym.imp.SETUPAPI.dll_SetupDiDestroyDeviceInfoList]
jmp 0x401845
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_busylight_devices_get___SetupDiGetClassDevs__0x_08x__n
call fcn.00409cda
pop ecx
pop ecx
xor eax, eax
cmp eax, edi
pop edi
pop esi
sbb eax, eax
pop ebp
neg eax
pop ebx
add esp, 0x5c
ret