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

Disassembly:
sub esp, 0x17c
push ebx
mov bh, byte [esp + 0x188]
mov bl, dl
push ebp
push esi
mov esi, dword [0x4dc414]
xor al, al
mov dword [esp + 0x10], eax
mov edx, ecx
mov dword [esp + 0x1c], edx
push edi
test esi, esi
je 0x407bd1
mov ebp, dword [esp + 0x190]
mov edi, 1
nop dword [eax]
cmp dword [esi], 1
jne 0x407bc6
mov cl, byte [esi + 0x3c]
test cl, cl
je 0x407b3c
mov edx, dword [edx + 0x10]
lea eax, [edx + 0x3c2c17]
cmp eax, 0x66
ja 0x407b38
dec cl
mov eax, 0xffc3d44d
sub eax, edx
movzx ecx, cl
cmp eax, ecx
mov eax, dword [esp + 0x14]
jle 0x407bc2
jmp 0x407b3c
mov eax, dword [esp + 0x14]
test bh, bh
je 0x407bb4
mov eax, dword [esi + 8]
test eax, eax
je 0x407b8f
cmp dword [eax + 0x368], 0
je 0x407b8f
movzx ecx, bp
movzx edi, bl
mov al, byte [ecx + esi + 0x154]
mov dl, byte [edi + esi + 0x54]
or al, dl
test al, 0x20
jne 0x407b72
cmp byte [esi + 0x42], 0
je 0x407b8a
test dl, 0x40
jne 0x407b8a
shl ecx, 0x10
or ecx, edi
push ecx
push esi
push 0x41e
push dword [0x4dc424]
call dword [sym.imp.USER32.dll_PostMessageW]
mov edi, 1
movzx ecx, bp
mov al, byte [ecx + esi + 0x154]
test al, al
js 0x407c9d
movzx ecx, bl
mov al, byte [ecx + esi + 0x54]
test al, al
js 0x407c8a
mov eax, dword [esp + 0x14]
cmp byte [esi + 0x3f], 0
movzx eax, al
cmovne eax, edi
mov dword [esp + 0x14], eax
mov edx, dword [esp + 0x20]
mov esi, dword [esi + 4]
test esi, esi
jne 0x407b00
test bh, bh
jne 0x407fbf
mov dl, byte [0x4dcdc5]
mov bh, 1
test dl, 0xcf
je 0x407bfe
test al, al
jne 0x407bfe
test dl, 0xc
setne cl
test dl, 3
setne al
and cl, al
neg cl
sbb cl, cl
and bh, cl
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov ebp, eax
xor esi, esi
test ebp, ebp
je 0x407c3f
mov edi, dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push esi
push ebp
call edi
mov esi, eax
mov dword [esp + 0x24], 0x30
lea eax, [esp + 0x24]
push eax
push esi
call dword [sym.imp.USER32.dll_GetGUIThreadInfo]
test eax, eax
je 0x407c3f
mov eax, dword [esp + 0x30]
test eax, eax
je 0x407c3f
push 0
push eax
call edi
mov esi, eax
push esi
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov dword [esp + 0x14], eax
cmp dword [0x4df408], ebp
je 0x407cb3
push 0x1c
lea eax, [esp + 0x158]
mov dword [0x4df408], ebp
push eax
push ebp
call dword [sym.imp.USER32.dll_GetClassNameW]
lea eax, [esp + 0x154]
push str.ApplicationFrameWindow
push eax
call fcn.00499643
add esp, 8
test eax, eax
sete al
mov byte [0x4df405], al
jmp 0x407cb8
and al, 0x7f
pop edi
mov byte [ecx + esi + 0x54], al
xor al, al
pop esi
pop ebp
pop ebx
add esp, 0x17c
ret
and al, 0x7f
mov byte [ecx + esi + 0x154], al
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x17c
ret
mov al, byte [0x4df405]
xor ecx, ecx
lea edi, [esp + 0x54]
cmp byte [0x4df404], 0
mov esi, 0x4dcdc8
mov dword [esp + 0x18], ecx
mov word [esp + 0x1c], cx
mov ecx, 0x40
rep movsd dword es:[edi], dword [esi]
mov esi, dword [sym.imp.USER32.dll_ToUnicodeEx]
je 0x407d61
test al, al
je 0x407d61
cmp bl, 0xe7
je 0x407d61
mov dl, byte [0x4df402]
lea ecx, [esp + 0x54]
mov al, byte [0x4df403]
neg dl
sbb dl, dl
and dl, 0x20
neg al
sbb al, al
and al, 9
or dl, al
call fcn.00413980
mov edi, dword [esp + 0x14]
lea eax, [esp + 0x18]
push edi
push 0
push 2
push eax
lea eax, [esp + 0x64]
push eax
movzx eax, word [0x4df400]
push eax
movzx eax, byte [0x4df404]
push eax
call esi
test eax, eax
jle 0x407d58
push edi
push 0
push 2
lea eax, [esp + 0x24]
push eax
lea eax, [esp + 0x64]
push eax
movzx eax, word [0x4df400]
push eax
movzx eax, byte [0x4df404]
push eax
call esi
mov byte [0x4df404], 0
jmp 0x407d65
mov edi, dword [esp + 0x14]
mov dl, byte [0x4dcdc5]
lea ecx, [esp + 0x54]
call fcn.00413980
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x407d87
or byte [esp + 0x68], 1
jmp 0x407d8c
and byte [esp + 0x68], 0xfe
cmp bl, 0xe7
jne 0x407da5
mov eax, dword [esp + 0x20]
mov esi, 1
mov ax, word [eax + 4]
mov word [esp + 0x18], ax
jmp 0x407e1b
test bh, bh
je 0x407dfb
xor eax, eax
cmp dword [0x4dc2ec], eax
push edi
setne al
push eax
push 2
lea eax, [esp + 0x24]
push eax
lea eax, [esp + 0x64]
push eax
mov eax, dword [esp + 0x34]
push dword [eax + 4]
movzx eax, bl
push eax
call esi
test byte [0x4dcdc5], 3
mov esi, eax
jne 0x407dfd
cmp word [esp + 0x18], 0xd
mov eax, 0xa
jne 0x407dec
mov word [esp + 0x18], ax
cmp word [esp + 0x1a], 0xd
jne 0x407dfd
mov word [esp + 0x1a], ax
jmp 0x407dfd
xor esi, esi
cmp bl, 8
jne 0x407e1b
test esi, esi
je 0x407e1b
cmp byte [0x4df405], 0
je 0x407e1a
xor esi, esi
mov byte [0x4df404], 0
jmp 0x407e1b
dec esi
push ecx
mov ecx, dword [esp + 0x24]
lea eax, [esp + 0x1c]
push esi
push eax
push dword [esp + 0x19c]
mov dl, bl
call fcn.004083d0
add esp, 0x10
test al, al
je 0x407ca6
mov bh, byte [0x4df404]
test bh, bh
je 0x407e52
mov byte [esp + 0x13], 1
test esi, esi
jg 0x407e59
mov byte [esp + 0x13], 0
test esi, esi
jns 0x407ec6
mov eax, dword [esp + 0x190]
mov word [0x4df400], ax
mov al, byte [0x4dcdc5]
test al, 0x30
mov byte [0x4df404], bl
push edi
setne byte [0x4df402]
test al, 0xc
setne cl
test al, 3
setne al
and cl, al
xor eax, eax
cmp dword [0x4dc2ec], eax
mov byte [0x4df403], cl
setne al
push eax
push 2
lea eax, [esp + 0x24]
push eax
lea eax, [esp + 0x64]
push eax
mov eax, dword [esp + 0x34]
push dword [eax + 4]
movzx eax, bl
push eax
mov eax, dword [sym.imp.USER32.dll_ToUnicodeEx]
call eax
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x17c
ret
cmp dword [0x4dcf08], 0
je 0x407f58
cmp byte [esp + 0x198], 0
jne 0x407f58
cmp bl, 8
je 0x407efd
sub bl, 0x21
cmp bl, 7
ja 0x407f1f
cmp dword [0x4dc59c], 0
je 0x407f1f
xor eax, eax
mov word [0x4dc5a0], ax
jmp 0x407f1a
cmp byte [0x4dcdc5], 0
jne 0x407f1f
mov eax, dword [0x4dc59c]
test eax, eax
je 0x407f1f
dec eax
xor ecx, ecx
mov word [eax*2 + 0x4dc5a0], cx
mov dword [0x4dc59c], eax
test esi, esi
jle 0x407f58
push dword [esp + 0x1a4]
mov ecx, dword [esp + 0x24]
lea edx, [esp + 0x1c]
push dword [esp + 0x1a4]
push dword [esp + 0x1a4]
push ebp
push esi
call fcn.00407fd0
add esp, 0x14
test al, al
je 0x407ca6
mov bh, byte [0x4df404]
cmp byte [esp + 0x13], 0
je 0x407fbf
push pe_nt_image_headers32
lea eax, [esp + 0x58]
push 0
push eax
call fcn.004971b0
mov dl, byte [0x4df402]
lea ecx, [esp + 0x60]
mov al, byte [0x4df403]
add esp, 0xc
neg dl
sbb dl, dl
and dl, 0x20
neg al
sbb al, al
and al, 9
or dl, al
call fcn.00413980
push edi
push 0
push 2
lea eax, [esp + 0x20]
push eax
lea eax, [esp + 0x64]
push eax
movzx eax, word [0x4df400]
push eax
movzx eax, bh
push eax
mov eax, dword [sym.imp.USER32.dll_ToUnicodeEx]
call eax
mov byte [0x4df404], 0
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x17c
ret