Function at 0x413020
Capabilities:
Get keyboard layout
Log keystrokes via polling

Disassembly:
sub esp, 0x15c
push ebx
push ebp
mov bl, dl
mov dword [esp + 0x18], edx
push esi
mov esi, dword [esp + 0x16c]
mov ebp, ecx
movzx eax, bl
or ax, si
mov dword [esp + 0x20], ebp
push edi
je 0x4136e2
mov eax, dword [esp + 0x17c]
mov ecx, 0xffc3d44d
test eax, eax
cmovne ecx, eax
mov dword [esp + 0x1c], ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x4ea340]
sete bh
cmp dword [0x4ec738], 0
je 0x41307f
mov byte [esp + 0x16], 1
test bh, bh
je 0x413084
mov byte [esp + 0x16], 0
cmp dword [0x4ec738], 1
je 0x413091
test bh, bh
je 0x413099
mov byte [esp + 0x178], 0
test bl, bl
jne 0x4130b3
mov ecx, esi
call fcn.00416bf0
mov edx, dword [esp + 0x170]
mov bl, al
mov byte [esp + 0x20], bl
jmp 0x4130d2
mov edx, dword [esp + 0x170]
test dx, dx
jne 0x4130d2
xor dl, dl
mov cl, bl
call fcn.004167d0
movzx edx, ax
mov dword [esp + 0x170], edx
mov eax, edx
mov byte [esp + 0x2c], dl
xor ecx, ecx
shr eax, 8
test al, al
setne cl
cmp dword [0x4ec738], 2
mov dword [esp + 0x30], ecx
jne case.default.0x4130fc
movzx eax, bl
add eax, 0xffffff60
cmp eax, 5
ja case.default.0x4130fc
jmp dword [eax*4 + 0x4136f0]
mov bl, 0x11
jmp 0x41310d
mov bl, 0x10
jmp 0x41310d
mov bl, 0x12
mov byte [esp + 0x20], bl
mov edi, dword [esp + 0x174]
test edi, edi
je 0x41324a
push 0
mov cl, bl
call fcn.00415ac0
add esp, 4
test al, al
je 0x4131e4
lea eax, [esp + 0x38]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardState]
test ebp, ebp
jne 0x41314d
movzx eax, bl
or byte [esp + eax + 0x38], 0x80
jmp 0x41315a
cmp ebp, 1
jne 0x41315a
movzx eax, bl
and byte [esp + eax + 0x38], 0x7f
movzx eax, bl
add eax, 0xffffff60
cmp eax, 5
ja case.default.0x413167
jmp dword [eax*4 + 0x413708]
test byte [esp + 0xda], 0x80
jne 0x413189
test byte [esp + 0xdb], 0x80
jne 0x413189
and byte [esp + 0x49], 0x7f
jmp case.default.0x413167
or byte [esp + 0x49], 0x80
jmp case.default.0x413167
test byte [esp + 0xd8], 0x80
jne 0x4131ab
test byte [esp + 0xd9], 0x80
jne 0x4131ab
and byte [esp + 0x48], 0x7f
jmp case.default.0x413167
or byte [esp + 0x48], 0x80
jmp case.default.0x413167
test byte [esp + 0xdc], 0x80
jne 0x4131cd
test byte [esp + 0xdd], 0x80
jne 0x4131cd
and byte [esp + 0x4a], 0x7f
jmp case.default.0x413167
or byte [esp + 0x4a], 0x80
lea eax, [esp + 0x38]
push eax
call dword [sym.imp.USER32.dll_SetKeyboardState]
mov edx, dword [esp + 0x170]
movzx esi, dx
shl esi, 0x10
cmp ebp, 1
mov ebp, dword [sym.imp.USER32.dll_PostMessageW]
je 0x413207
mov eax, esi
or eax, 1
push eax
movzx eax, bl
push eax
push 0x100
push edi
call ebp
cmp byte [esp + 0x178], 0
mov eax, dword [esp + 0x24]
je 0x41322a
cmp eax, 2
jne 0x41322a
mov ecx, dword [0x4e7024]
mov ecx, dword [ecx + 0x64]
call fcn.00414d60
jmp 0x413232
test eax, eax
je 0x4136a6
or esi, 0xc0000001
movzx eax, bl
push esi
push eax
push 0x101
push edi
call ebp
jmp 0x4136a6
cmp byte [0x4e98a2], 0
mov dword [0x4ec6c0], ebp
mov byte [0x4ec6c4], bl
je 0x41328e
cmp bl, 0x12
je 0x41326e
cmp bl, 0xa4
je 0x41326e
cmp bl, 0xa5
jne 0x41328e
test bh, bh
jne 0x41328e
push 0
mov byte [esp + 0x1f], 1
call dword [sym.imp.USER32.dll_BlockInput]
mov edx, dword [esp + 0x170]
mov byte [0x4e98a2], bh
jmp 0x413293
mov byte [esp + 0x1b], 0
test bh, bh
lea esi, [esp + 0x34]
mov eax, 0x4ec71c
cmove esi, eax
mov al, byte [esp + 0x16]
mov dword [esp + 0x24], esi
cmp bl, 0xa5
jne 0x413378
test al, al
jne 0x413378
cmp dword [0x4e9834], 0
je 0x413378
mov byte [esp + 0x19], 1
mov byte [esp + 0x17], 1
test bh, bh
jne 0x4132dd
mov edi, dword [0x4ec718]
jmp 0x41333d
call dword [sym.imp.USER32.dll_GetForegroundWindow]
xor esi, esi
test eax, eax
je 0x413325
mov edi, dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push esi
push eax
call edi
mov esi, eax
mov dword [esp + 0x138], 0x30
lea eax, [esp + 0x138]
push eax
push esi
call dword [sym.imp.USER32.dll_GetGUIThreadInfo]
test eax, eax
je 0x413325
mov eax, dword [esp + 0x144]
test eax, eax
je 0x413325
push 0
push eax
call edi
mov esi, eax
push esi
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov edi, eax
xor edx, edx
mov ecx, edi
call fcn.00415df0
mov esi, dword [esp + 0x24]
mov dword [esi], eax
cmp dword [esi], 0
je 0x413351
mov cl, byte [esp + 0x15]
mov byte [esp + 0x17], 0
mov byte [esp + 0x18], cl
jmp 0x4133ba
push 0xa2
mov byte [esp + 0x1c], 0xa2
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
shr eax, 0xf
and eax, 0xffffff01
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x1c]
mov dword [0x4ea220], eax
jmp 0x4133c2
mov byte [esp + 0x19], 0
mov byte [esp + 0x17], 0
test al, al
je 0x4133ae
push 0
mov cl, bl
call fcn.00415ac0
mov cl, byte [esp + 0x19]
mov ch, al
mov edi, dword [esp + 0x30]
add esp, 4
mov byte [esp + 0x1a], al
mov al, byte [esp + 0x15]
mov byte [esp + 0x18], cl
mov dword [esp + 0x28], eax
jmp 0x4133cf
mov al, byte [esp + 0x15]
mov edi, dword [esp + 0x2c]
mov byte [esp + 0x18], al
mov al, byte [esp + 0x15]
mov dword [esp + 0x28], eax
mov edx, dword [esp + 0x170]
xor ch, ch
mov byte [esp + 0x1a], ch
test bh, bh
jne 0x4133f2
mov eax, dword [0x4ec738]
cmp eax, 2
je 0x4133f2
cmp dword [0x4e9834], 0
je 0x4133eb
cmp eax, 1
jne 0x4133f2
mov byte [esp + 0x15], 1
jmp 0x4133f7
mov byte [esp + 0x15], 0
mov bh, byte [esp + 0x16]
cmp ebp, 1
je 0x41351d
test bh, bh
je 0x413422
push dword [esp + 0x1c]
mov cl, ch
push dword [esp + 0x34]
push edx
mov dl, bl
call fcn.00414770
add esp, 0xc
jmp 0x413500
cmp byte [esp + 0x19], 0
je 0x41343b
mov eax, dword [0x4ea21c]
cmp dword [esi], 3
cmove eax, dword [esp + 0x1c]
mov dword [0x4ea21c], eax
push dword [esp + 0x1c]
push dword [esp + 0x34]
push dword [esp + 0x34]
push dword [esp + 0x2c]
call dword [sym.imp.USER32.dll_keybd_event]
cmp byte [esp + 0x17], 0
mov dword [0x4ea21c], 0
je 0x413500
cmp dword [0x4ea220], 0
mov byte [esp + 0x17], 0
je 0x4134d2
mov dword [0x4ea220], 0
xor ecx, ecx
mov eax, dword [ecx*8 + 0x4ec6c8]
test eax, eax
je 0x413495
cmp eax, edi
je 0x4134b9
inc ecx
cmp ecx, 0xa
jl 0x413480
cmp ecx, 0xa
mov eax, 9
cmovl eax, ecx
mov dword [eax*8 + 0x4ec6c8], edi
mov dword [eax*8 + 0x4ec6cc], 4
mov eax, 4
jmp 0x4134fe
mov eax, dword [ecx*8 + 0x4ec6cc]
test eax, eax
jne 0x4134fe
mov eax, 4
mov dword [ecx*8 + 0x4ec6cc], eax
jmp 0x4134fe
cmp byte [esp + 0x28], 0
jne 0x413500
movzx eax, byte [esp + 0x18]
push eax
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
mov ecx, 0x8000
and ax, cx
mov ecx, edi
movzx edx, ax
neg edx
sbb edx, edx
add edx, 4
call fcn.00415df0
mov dword [esi], eax
cmp byte [esp + 0x15], 0
mov esi, dword [esp + 0x170]
je 0x413524
push esi
mov dl, bl
xor cl, cl
call fcn.00414f60
add esp, 4
jmp 0x413524
mov esi, dword [esp + 0x170]
cmp byte [esp + 0x178], 0
je 0x413554
cmp ebp, 2
jne 0x413554
mov eax, dword [0x4e7024]
cmp dword [0x4ec738], ebp
jne 0x41354a
mov ecx, dword [eax + 0x68]
call fcn.00414d60
jmp 0x41355c
mov ecx, dword [eax + 0x64]
call fcn.00414d60
jmp 0x41355c
test ebp, ebp
je 0x413690
mov ecx, dword [esp + 0x30]
or ecx, 2
test bh, bh
je 0x413584
push dword [esp + 0x1c]
mov dl, bl
push ecx
mov cl, byte [esp + 0x22]
push esi
call fcn.00414770
mov ebp, dword [esp + 0x30]
add esp, 0xc
jmp 0x413665
cmp byte [esp + 0x19], 0
mov ebp, dword [esp + 0x24]
je 0x4135a2
mov eax, dword [0x4ea218]
cmp dword [ebp], 3
cmove eax, dword [esp + 0x1c]
mov dword [0x4ea218], eax
push dword [esp + 0x1c]
push ecx
push dword [esp + 0x34]
push dword [esp + 0x2c]
call dword [sym.imp.USER32.dll_keybd_event]
cmp byte [esp + 0x17], 0
mov dword [0x4ea218], 0
je 0x413665
cmp dword [0x4ea220], 0
je 0x413638
mov dword [0x4ea220], 0
xor eax, eax
nop
mov ecx, dword [eax*8 + 0x4ec6c8]
test ecx, ecx
je 0x4135f5
cmp ecx, edi
je 0x41361c
inc eax
cmp eax, 0xa
jl 0x4135e0
cmp eax, 0xa
mov ecx, 9
cmovl ecx, eax
mov dword [ecx*8 + 0x4ec6c8], edi
mov dword [ecx*8 + 0x4ec6cc], 4
mov ecx, 4
mov dword [ebp], ecx
jmp 0x413665
mov ecx, dword [eax*8 + 0x4ec6cc]
test ecx, ecx
jne 0x413617
mov ecx, 4
mov dword [eax*8 + 0x4ec6cc], ecx
mov dword [ebp], ecx
jmp 0x413665
cmp byte [esp + 0x28], 0
je 0x413665
movzx eax, byte [esp + 0x18]
push eax
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
bt ax, 0xf
mov edx, 0
mov ecx, edi
setb dl
add edx, 3
call fcn.00415df0
mov dword [ebp], eax
cmp dword [ebp], 0
je 0x41367c
mov eax, 0x138
cmp si, ax
jne 0x41367c
and byte [0x4ec72c], 0xfe
cmp byte [esp + 0x15], 0
je 0x413690
push esi
mov dl, bl
mov cl, 1
call fcn.00414f60
add esp, 4
cmp byte [esp + 0x1b], 0
je 0x4136a6
push 1
call dword [sym.imp.USER32.dll_BlockInput]
mov byte [0x4e98a2], 1
cmp byte [esp + 0x178], 0
je 0x4136e2
cmp dword [0x4ec738], 2
mov eax, dword [0x4e7024]
jne 0x4136d0
mov ecx, dword [eax + 0x60]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x15c
jmp fcn.00414d60
mov ecx, dword [eax + 0x5c]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x15c
jmp fcn.00414d60
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x15c
ret