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

Disassembly:
sub esp, 0x178
push ebx
push ebp
push esi
mov esi, dword [0x4d8eac]
push edi
mov byte [esp + 0x13], 0
test esi, esi
je 0x40c0ec
lea ecx, [ecx]
cmp dword [esi], 1
jne 0x40c0e1
mov al, byte [esi + 0x3c]
test al, al
je 0x40c040
mov ecx, dword [esp + 0x18c]
mov ecx, dword [ecx + 0x10]
lea edx, [ecx + 0x3c2c17]
dec al
cmp edx, 0x66
ja 0x40c030
mov edx, 0xffc3d44d
sub edx, ecx
jmp 0x40c035
mov edx, 0x65
movzx eax, al
cmp edx, eax
jle 0x40c0e1
cmp byte [esp + 0x198], 0
je 0x40c0d6
mov eax, dword [esi + 8]
test eax, eax
je 0x40c0a9
cmp dword [eax + 0x368], 0
je 0x40c0a9
mov ebp, dword [esp + 0x194]
mov bl, byte [esp + 0x190]
movzx eax, bp
mov dl, byte [eax + esi + 0x154]
movzx edi, bl
mov cl, byte [edi + esi + 0x54]
or dl, cl
test dl, 0x20
jne 0x40c08f
cmp byte [esi + 0x42], 0
je 0x40c0b7
test cl, 0x40
jne 0x40c0b7
shl eax, 0x10
or eax, edi
push eax
mov eax, dword [0x4d86a0]
push esi
push 0x41e
push eax
call dword [sym.imp.USER32.dll_PostMessageW]
jmp 0x40c0b7
mov bl, byte [esp + 0x190]
mov ebp, dword [esp + 0x194]
movzx ecx, bp
test byte [ecx + esi + 0x154], 0x80
jne 0x40c273
movzx edx, bl
test byte [edx + esi + 0x54], 0x80
jne 0x40c292
cmp byte [esi + 0x3f], 0
je 0x40c0e1
mov byte [esp + 0x13], 1
mov esi, dword [esi + 4]
test esi, esi
jne 0x40c000
cmp byte [esp + 0x198], 0
jne 0x40c515
mov al, byte [0x4d869d]
mov byte [esp + 0x12], 1
test al, 0xcf
je 0x40c11c
cmp byte [esp + 0x13], 0
jne 0x40c11c
test al, 0xc
je 0x40c117
test al, 3
jne 0x40c11c
mov byte [esp + 0x12], 0
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov ebx, eax
xor esi, esi
mov dword [esp + 0x1c], ebx
test ebx, ebx
je 0x40c161
mov edi, dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push esi
push ebx
call edi
lea edx, [esp + 0x20]
mov esi, eax
push edx
push esi
mov dword [esp + 0x28], 0x30
call dword [sym.imp.USER32.dll_GetGUIThreadInfo]
test eax, eax
je 0x40c161
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x40c161
push 0
push eax
call edi
mov esi, eax
push esi
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov ebp, eax
cmp dword [0x4da3b8], ebx
je 0x40c1a7
push 0x1c
lea eax, [esp + 0x154]
push eax
push ebx
mov dword [0x4da3b8], ebx
call dword [sym.imp.USER32.dll_GetClassNameW]
lea ecx, [esp + 0x150]
push str.ApplicationFrameWindow
push ecx
call fcn.00498d39
add esp, 8
test eax, eax
sete byte [0x4da3b4]
mov bl, byte [0x4da3ac]
xor edx, edx
mov ecx, 0x40
mov esi, 0x4d86c8
lea edi, [esp + 0x50]
rep movsd dword es:[edi], dword [esi]
mov edi, dword [sym.imp.USER32.dll_ToUnicodeEx]
mov word [esp + 0x14], dx
mov dword [esp + 0x16], edx
test bl, bl
je 0x40c252
cmp byte [0x4da3b4], dl
je 0x40c252
cmp byte [esp + 0x190], 0xe7
je 0x40c252
mov al, byte [0x4da3b2]
mov cl, byte [0x4da3b3]
neg al
sbb al, al
and al, 0x20
neg cl
sbb cl, cl
and cl, 9
or al, cl
lea ecx, [esp + 0x50]
call fcn.00418740
push ebp
push 0
push 2
lea edx, [esp + 0x20]
push edx
mov eax, ecx
movzx ecx, word [0x4da3b0]
push eax
movzx edx, bl
push ecx
push edx
call edi
test eax, eax
jle 0x40c24b
movzx edx, word [0x4da3b0]
push ebp
push 0
push 2
lea eax, [esp + 0x20]
push eax
movzx eax, byte [0x4da3ac]
lea ecx, [esp + 0x60]
push ecx
push edx
push eax
call edi
mov byte [0x4da3ac], 0
mov al, byte [0x4d869d]
lea ecx, [esp + 0x50]
call fcn.00418740
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x40c2ab
or byte [esp + 0x64], 1
jmp 0x40c2b0
movzx eax, bp
and byte [eax + esi + 0x154], 0x7f
lea eax, [eax + esi + 0x154]
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x178
ret
movzx ecx, bl
and byte [ecx + esi + 0x54], 0x7f
lea esi, [ecx + esi + 0x54]
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x178
ret
and byte [esp + 0x64], 0xfe
mov ebx, dword [esp + 0x190]
cmp bl, 0xe7
jne 0x40c2d6
mov ecx, dword [esp + 0x18c]
mov dx, word [ecx + 4]
mov esi, 1
mov word [esp + 0x14], dx
jmp 0x40c35b
cmp byte [esp + 0x12], 0
je 0x40c33b
xor eax, eax
cmp dword [0x4d8838], eax
push ebp
setne al
lea ecx, [esp + 0x18]
lea edx, [esp + 0x54]
push eax
mov eax, dword [esp + 0x194]
push 2
push ecx
mov ecx, dword [eax + 4]
push edx
movzx edx, bl
push ecx
push edx
call edi
test byte [0x4d869d], 3
mov esi, eax
jne 0x40c33d
mov eax, 0xd
cmp word [esp + 0x14], ax
jne 0x40c328
mov ecx, 0xa
mov word [esp + 0x14], cx
cmp word [esp + 0x16], ax
jne 0x40c33d
mov edx, 0xa
mov word [esp + 0x16], dx
jmp 0x40c33d
xor esi, esi
cmp bl, 8
jne 0x40c35b
test esi, esi
je 0x40c35b
cmp byte [0x4da3b4], 0
je 0x40c35a
xor esi, esi
mov byte [0x4da3ac], 0
jmp 0x40c35b
dec esi
mov ecx, dword [esp + 0x194]
mov edx, dword [esp + 0x18c]
push esi
lea eax, [esp + 0x18]
push eax
push ecx
push ebx
push edx
call fcn.0040c940
add esp, 0x14
test al, al
je 0x40c285
cmp byte [0x4da3ac], 0
je 0x40c394
mov byte [esp + 0x12], 1
test esi, esi
jg 0x40c39b
mov byte [esp + 0x12], 0
test esi, esi
jns 0x40c40e
mov ax, word [esp + 0x194]
mov word [0x4da3b0], ax
mov al, byte [0x4d869d]
test al, 0x30
setne cl
mov byte [0x4da3ac], bl
mov byte [0x4da3b2], cl
test al, 3
je 0x40c3d0
mov byte [0x4da3b3], 1
test al, 0xc
jne 0x40c3d7
mov byte [0x4da3b3], 0
xor edx, edx
cmp dword [0x4d8838], edx
push ebp
setne dl
lea eax, [esp + 0x18]
lea ecx, [esp + 0x54]
push edx
mov edx, dword [esp + 0x194]
push 2
push eax
mov eax, dword [edx + 4]
push ecx
movzx ecx, bl
push eax
push ecx
call edi
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x178
ret
cmp dword [0x4d8f1c], 0
je 0x40c4b1
cmp byte [esp + 0x19c], 0
jne 0x40c4b1
cmp bl, 8
je 0x40c452
cmp bl, 0x20
jbe 0x40c474
cmp bl, 0x28
ja 0x40c474
cmp dword [0x4d73f4], 0
je 0x40c474
xor edx, edx
mov word [0x4d73f8], dx
mov dword [0x4d73f4], edx
jmp 0x40c474
cmp byte [0x4d869d], 0
jne 0x40c474
mov eax, dword [0x4d73f4]
test eax, eax
je 0x40c474
dec eax
xor ecx, ecx
mov dword [0x4d73f4], eax
mov word [eax*2 + 0x4d73f8], cx
test esi, esi
jle 0x40c4b1
mov edx, dword [esp + 0x1a8]
mov eax, dword [esp + 0x1a4]
mov ecx, dword [esp + 0x1a0]
push edx
mov edx, dword [esp + 0x190]
push eax
mov eax, dword [esp + 0x24]
push ecx
push esi
push edx
lea ecx, [esp + 0x28]
call fcn.0040c530
add esp, 0x14
test al, al
je 0x40c285
cmp byte [esp + 0x12], 0
je 0x40c515
push pe_nt_image_headers32
lea eax, [esp + 0x54]
push 0
push eax
call fcn.004a3c50
mov al, byte [0x4da3b2]
mov cl, byte [0x4da3b3]
add esp, 0xc
neg al
sbb al, al
and al, 0x20
neg cl
sbb cl, cl
and cl, 9
or al, cl
lea ecx, [esp + 0x50]
call fcn.00418740
push ebp
push 0
push 2
lea edx, [esp + 0x28]
push edx
movzx edx, byte [0x4da3ac]
mov eax, ecx
movzx ecx, word [0x4da3b0]
push eax
push ecx
push edx
call edi
mov byte [0x4da3ac], 0
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x178
ret