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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x12c
push ebx
mov bl, dl
mov dword [esp + 0x14], edx
push esi
mov esi, dword [ebp + 8]
movzx eax, bl
or ax, si
push edi
mov edi, ecx
je 0x40feaf
mov eax, dword [ebp + 0x14]
mov ecx, 0xffc3d44d
test eax, eax
cmovne ecx, eax
mov dword [esp + 0x18], ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x4d2130]
sete bh
cmp dword [0x4d4c54], 0
je 0x40f968
mov byte [esp + 0x12], 1
test bh, bh
je 0x40f96d
mov byte [esp + 0x12], 0
cmp dword [0x4d4c54], 1
je 0x40f97a
test bh, bh
je 0x40f97e
mov byte [ebp + 0x10], 0
test bl, bl
jne 0x40f994
mov ecx, esi
call fcn.00412e40
mov edx, dword [ebp + 8]
mov bl, al
mov byte [esp + 0x1c], bl
jmp 0x40f9ab
mov edx, dword [ebp + 8]
test dx, dx
jne 0x40f9ab
xor dl, dl
mov cl, bl
call fcn.00412ab0
movzx edx, ax
mov dword [ebp + 8], edx
mov eax, edx
mov byte [esp + 0x28], dl
xor ecx, ecx
shr eax, 8
test al, al
setne cl
cmp dword [0x4d4c54], 2
mov dword [esp + 0x2c], ecx
jne case.default.0x40f9d5
movzx eax, bl
add eax, 0xffffff60
cmp eax, 5
ja case.default.0x40f9d5
jmp dword [eax*4 + 0x40feb8]
mov bl, 0x11
jmp 0x40f9e6
mov bl, 0x10
jmp 0x40f9e6
mov bl, 0x12
mov byte [esp + 0x1c], bl
cmp dword [ebp + 0xc], 0
je 0x40fb18
push 0
mov cl, bl
call fcn.00411ed0
add esp, 4
test al, al
je 0x40fab4
lea eax, [esp + 0x38]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardState]
test edi, edi
jne 0x40fa21
movzx eax, bl
or byte [esp + eax + 0x38], 0x80
jmp 0x40fa2e
cmp edi, 1
jne 0x40fa2e
movzx eax, bl
and byte [esp + eax + 0x38], 0x7f
movzx eax, bl
add eax, 0xffffff60
cmp eax, 5
ja case.default.0x40fa3b
jmp dword [eax*4 + 0x40fed0]
test byte [esp + 0xda], 0x80
jne 0x40fa5d
test byte [esp + 0xdb], 0x80
jne 0x40fa5d
and byte [esp + 0x49], 0x7f
jmp case.default.0x40fa3b
or byte [esp + 0x49], 0x80
jmp case.default.0x40fa3b
test byte [esp + 0xd8], 0x80
jne 0x40fa7f
test byte [esp + 0xd9], 0x80
jne 0x40fa7f
and byte [esp + 0x48], 0x7f
jmp case.default.0x40fa3b
or byte [esp + 0x48], 0x80
jmp case.default.0x40fa3b
test byte [esp + 0xdc], 0x80
jne 0x40faa1
test byte [esp + 0xdd], 0x80
jne 0x40faa1
and byte [esp + 0x4a], 0x7f
jmp case.default.0x40fa3b
or byte [esp + 0x4a], 0x80
lea eax, [esp + 0x38]
push eax
call dword [sym.imp.USER32.dll_SetKeyboardState]
mov edx, dword [ebp + 8]
movzx esi, dx
shl esi, 0x10
cmp edi, 1
je 0x40fad7
mov eax, esi
or eax, 1
push eax
movzx eax, bl
push eax
push pe_nt_image_headers32
push dword [ebp + 0xc]
call dword [sym.imp.USER32.dll_PostMessageW]
cmp byte [ebp + 0x10], 0
je 0x40faf2
cmp edi, 2
jne 0x40faf2
mov ecx, dword [0x4ce8c8]
mov ecx, dword [ecx + 0x64]
call fcn.00411350
jmp 0x40fafa
test edi, edi
je 0x40fe84
or esi, 0xc0000001
movzx eax, bl
push esi
push eax
push 0x101
push dword [ebp + 0xc]
call dword [sym.imp.USER32.dll_PostMessageW]
jmp 0x40fe84
cmp byte [0x4d169b], 0
mov dword [0x4d4be0], edi
mov byte [0x4d4bc6], bl
je 0x40fb51
cmp bl, 0x12
je 0x40fb3c
cmp bl, 0xa4
je 0x40fb3c
cmp bl, 0xa5
jne 0x40fb51
test bh, bh
jne 0x40fb51
xor cl, cl
mov byte [esp + 0x17], 1
call fcn.0042cd00
mov edx, dword [ebp + 8]
jmp 0x40fb56
mov byte [esp + 0x17], 0
test bh, bh
lea esi, [esp + 0x34]
mov eax, 0x4d4c38
cmove esi, eax
mov al, byte [esp + 0x12]
mov dword [esp + 0x30], esi
cmp bl, 0xa5
jne 0x40fc0b
test al, al
jne 0x40fc0b
cmp dword [0x4d16a0], 0
je 0x40fc0b
mov byte [esp + 0x16], 1
mov byte [esp + 0x13], 1
test bh, bh
jne 0x40fba3
mov eax, dword [0x4d4be4]
mov dword [esp + 0x20], eax
jmp 0x40fbd0
call dword [sym.imp.USER32.dll_GetForegroundWindow]
test eax, eax
je 0x40fbb8
push 0
push eax
call dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
jmp 0x40fbba
xor eax, eax
push eax
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
xor edx, edx
mov dword [esp + 0x20], eax
mov ecx, eax
call fcn.004122c0
mov dword [esi], eax
cmp dword [esi], 0
je 0x40fbe4
mov cl, byte [esp + 0x11]
mov byte [esp + 0x13], 0
mov byte [esp + 0x14], cl
jmp 0x40fc57
push 0xa2
mov byte [esp + 0x18], 0xa2
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
shr eax, 0xf
and eax, 0xffffff01
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x18]
mov dword [0x4d2010], eax
jmp 0x40fc5f
mov byte [esp + 0x16], 0
mov byte [esp + 0x13], 0
test al, al
je 0x40fc47
push 0
mov cl, bl
call fcn.00411ed0
mov ecx, dword [esp + 0x2c]
add esp, 4
mov dword [esp + 0x20], ecx
mov cl, byte [esp + 0x11]
mov byte [esp + 0x15], al
mov al, byte [esp + 0x11]
mov byte [esp + 0x14], cl
mov cl, byte [esp + 0x15]
mov dword [esp + 0x24], eax
jmp 0x40fc68
mov eax, dword [esp + 0x28]
mov dword [esp + 0x20], eax
mov al, byte [esp + 0x11]
mov byte [esp + 0x14], al
mov al, byte [esp + 0x11]
mov dword [esp + 0x24], eax
mov edx, dword [ebp + 8]
xor cl, cl
mov byte [esp + 0x15], cl
test bh, bh
jne 0x40fc8b
mov eax, dword [0x4d4c54]
cmp eax, 2
je 0x40fc8b
cmp dword [0x4d16a0], 0
je 0x40fc84
cmp eax, 1
jne 0x40fc8b
mov byte [esp + 0x11], 1
jmp 0x40fc90
mov byte [esp + 0x11], 0
mov bh, byte [esp + 0x12]
cmp edi, 1
je 0x40fd61
test bh, bh
je 0x40fcb9
push dword [esp + 0x18]
push dword [esp + 0x30]
push edx
mov dl, bl
call fcn.00410e10
add esp, 0xc
jmp 0x40fd48
cmp byte [esp + 0x16], 0
je 0x40fcd2
mov eax, dword [0x4d200c]
cmp dword [esi], 3
cmove eax, dword [esp + 0x18]
mov dword [0x4d200c], eax
push dword [esp + 0x18]
push dword [esp + 0x30]
push dword [esp + 0x30]
push dword [esp + 0x28]
call dword [sym.imp.USER32.dll_keybd_event]
cmp byte [esp + 0x13], 0
mov dword [0x4d200c], 0
je 0x40fd48
cmp dword [0x4d2010], 0
mov byte [esp + 0x13], 0
je 0x40fd18
mov dword [0x4d2010], 0
mov edx, 4
jmp 0x40fd3d
cmp byte [esp + 0x24], 0
jne 0x40fd48
movzx eax, byte [esp + 0x14]
push eax
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
mov ecx, 0x8000
and ax, cx
movzx edx, ax
neg edx
sbb edx, edx
add edx, 4
mov ecx, dword [esp + 0x20]
call fcn.004122c0
mov dword [esi], eax
cmp byte [esp + 0x11], 0
mov esi, dword [ebp + 8]
je 0x40fd64
push esi
mov dl, bl
xor cl, cl
call fcn.00411420
add esp, 4
jmp 0x40fd64
mov esi, dword [ebp + 8]
cmp byte [ebp + 0x10], 0
je 0x40fd90
cmp edi, 2
jne 0x40fd90
mov eax, dword [0x4ce8c8]
cmp dword [0x4d4c54], edi
jne 0x40fd86
mov ecx, dword [eax + 0x68]
call fcn.00411350
jmp 0x40fd98
mov ecx, dword [eax + 0x64]
call fcn.00411350
jmp 0x40fd98
test edi, edi
je 0x40fe76
mov ecx, dword [esp + 0x2c]
or ecx, 2
test bh, bh
je 0x40fdc0
push dword [esp + 0x18]
mov dl, bl
push ecx
mov cl, byte [esp + 0x1d]
push esi
call fcn.00410e10
mov edi, dword [esp + 0x3c]
add esp, 0xc
jmp 0x40fe4c
cmp byte [esp + 0x16], 0
mov edi, dword [esp + 0x30]
je 0x40fddd
mov eax, dword [0x4d2008]
cmp dword [edi], 3
cmove eax, dword [esp + 0x18]
mov dword [0x4d2008], eax
push dword [esp + 0x18]
push ecx
push dword [esp + 0x30]
push dword [esp + 0x28]
call dword [sym.imp.USER32.dll_keybd_event]
cmp byte [esp + 0x13], 0
mov dword [0x4d2008], 0
je 0x40fe4c
cmp dword [0x4d2010], 0
je 0x40fe1b
mov dword [0x4d2010], 0
mov edx, 4
jmp 0x40fe41
cmp byte [esp + 0x24], 0
je 0x40fe4c
movzx eax, byte [esp + 0x14]
push eax
call dword [sym.imp.USER32.dll_GetAsyncKeyState]
mov ecx, 0x8000
mov edx, 0
test cx, ax
setne dl
add edx, 3
mov ecx, dword [esp + 0x20]
call fcn.004122c0
mov dword [edi], eax
cmp dword [edi], 0
je 0x40fe62
mov eax, 0x138
cmp si, ax
jne 0x40fe62
and byte [0x4d4bdf], 0xfe
cmp byte [esp + 0x11], 0
je 0x40fe76
push esi
mov dl, bl
mov cl, 1
call fcn.00411420
add esp, 4
cmp byte [esp + 0x17], 0
je 0x40fe84
mov cl, 1
call fcn.0042cd00
cmp byte [ebp + 0x10], 0
je 0x40feaf
cmp dword [0x4d4c54], 2
mov eax, dword [0x4ce8c8]
jne 0x40fea7
mov ecx, dword [eax + 0x60]
call fcn.00411350
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [eax + 0x5c]
call fcn.00411350
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret