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

Disassembly:
sub esp, 0x17c
push ebx
push ebp
push esi
mov esi, dword [0x4cacf8]
push edi
mov byte [esp + 0x13], 0
test esi, esi
je 0x40727c
lea ecx, [ecx]
cmp dword [esi], 1
jne 0x407271
mov al, byte [esi + 0x3c]
test al, al
je 0x4071d0
mov ecx, dword [esp + 0x190]
mov ecx, dword [ecx + 0x10]
lea edx, [ecx + 0x3c2c17]
dec al
cmp edx, 0x66
ja 0x4071c0
mov edx, 0xffc3d44d
sub edx, ecx
jmp 0x4071c5
mov edx, 0x65
movzx eax, al
cmp edx, eax
jle 0x407271
cmp byte [esp + 0x19c], 0
je 0x407266
mov eax, dword [esi + 8]
test eax, eax
je 0x407239
cmp dword [eax + 0x368], 0
je 0x407239
mov ebp, dword [esp + 0x198]
mov bl, byte [esp + 0x194]
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 0x40721f
cmp byte [esi + 0x42], 0
je 0x407247
test cl, 0x40
jne 0x407247
shl eax, 0x10
or eax, edi
push eax
mov eax, dword [0x4ca4ec]
push esi
push 0x41e
push eax
call dword [sym.imp.USER32.dll_PostMessageW]
jmp 0x407247
mov bl, byte [esp + 0x194]
mov ebp, dword [esp + 0x198]
movzx ecx, bp
test byte [ecx + esi + 0x154], 0x80
jne 0x4073f9
movzx edx, bl
test byte [edx + esi + 0x54], 0x80
jne 0x407418
cmp byte [esi + 0x3f], 0
je 0x407271
mov byte [esp + 0x13], 1
mov esi, dword [esi + 4]
test esi, esi
jne 0x407190
cmp byte [esp + 0x19c], 0
jne 0x407752
mov al, byte [0x4ca4e9]
mov byte [esp + 0x12], 1
test al, 0xcf
je 0x4072ac
cmp byte [esp + 0x13], 0
jne 0x4072ac
test al, 0xc
je 0x4072a7
test al, 3
jne 0x4072ac
mov byte [esp + 0x12], 0
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov edi, eax
xor esi, esi
mov dword [esp + 0x20], edi
test edi, edi
je 0x4072fa
mov ebx, dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push esi
push edi
call ebx
lea edx, [esp + 0x124]
mov esi, eax
push edx
push esi
mov dword [esp + 0x12c], 0x30
call dword [sym.imp.USER32.dll_GetGUIThreadInfo]
test eax, eax
je 0x4072fa
mov eax, dword [esp + 0x130]
test eax, eax
je 0x4072fa
push 0
push eax
call ebx
mov esi, eax
push esi
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov ebp, eax
mov dword [esp + 0x1c], ebp
cmp dword [0x4cc18c], edi
je 0x407344
push 0x1c
lea eax, [esp + 0x158]
push eax
push edi
mov dword [0x4cc18c], edi
call dword [sym.imp.USER32.dll_GetClassNameW]
lea ecx, [esp + 0x154]
push str.ApplicationFrameWindow
push ecx
call fcn.00490459
add esp, 8
test eax, eax
sete byte [0x4cc188]
mov bl, byte [0x4cc180]
xor edx, edx
mov ecx, 0x40
mov esi, 0x4ca510
lea edi, [esp + 0x24]
mov word [esp + 0x14], dx
mov dword [esp + 0x16], edx
rep movsd dword es:[edi], dword [esi]
test bl, bl
je 0x407431
cmp byte [0x4cc188], dl
je 0x407431
cmp byte [esp + 0x194], 0xe7
je 0x407431
mov al, byte [0x4cc186]
mov cl, byte [0x4cc187]
neg al
sbb al, al
and al, 0x20
neg cl
sbb cl, cl
and cl, 9
or al, cl
lea ecx, [esp + 0x24]
call fcn.00413ac0
mov edi, dword [sym.imp.USER32.dll_ToUnicodeEx]
push ebp
push 0
push 2
lea edx, [esp + 0x20]
push edx
mov eax, ecx
movzx ecx, word [0x4cc184]
push eax
movzx edx, bl
push ecx
push edx
call edi
test eax, eax
jle 0x4073f0
movzx edx, word [0x4cc184]
push ebp
push 0
push 2
lea eax, [esp + 0x20]
push eax
movzx eax, byte [0x4cc180]
lea ecx, [esp + 0x34]
push ecx
push edx
push eax
call edi
mov byte [0x4cc180], 0
jmp 0x407437
movzx eax, bp
and byte [eax + esi + 0x154], 0x7f
lea esi, [eax + esi + 0x154]
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x17c
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, 0x17c
ret
mov edi, dword [sym.imp.USER32.dll_ToUnicodeEx]
mov al, byte [0x4ca4e9]
lea ecx, [esp + 0x24]
call fcn.00413ac0
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x407458
or byte [esp + 0x38], 1
jmp 0x40745d
and byte [esp + 0x38], 0xfe
mov eax, dword [esp + 0x194]
cmp al, 0xe7
jne 0x407482
mov ebx, dword [esp + 0x190]
mov cx, word [ebx + 4]
mov ebp, 1
mov word [esp + 0x14], cx
jmp 0x407521
cmp byte [esp + 0x12], 0
je 0x407513
xor edx, edx
cmp dword [0x4ca688], edx
push ebp
setne dl
lea ecx, [esp + 0x18]
movzx eax, al
push edx
push 2
push ecx
mov ecx, dword [esp + 0x1a0]
lea edx, [esp + 0x34]
push edx
mov edx, dword [ecx + 4]
push edx
push eax
call edi
test byte [0x4ca4e9], 3
mov ebp, eax
jne 0x4074e9
mov eax, 0xd
cmp word [esp + 0x14], ax
jne 0x4074d8
mov ecx, 0xa
mov word [esp + 0x14], cx
cmp word [esp + 0x16], ax
jne 0x4074e9
mov edx, 0xa
mov word [esp + 0x16], dx
mov eax, dword [esp + 0x194]
cmp al, 8
jne 0x40751a
test ebp, ebp
je 0x40751a
cmp byte [0x4cc188], 0
mov ebx, dword [esp + 0x190]
je 0x407517
xor ebp, ebp
mov byte [0x4cc180], 0
jmp 0x407521
xor ebp, ebp
jmp 0x4074f0
dec ebp
jmp 0x407521
mov ebx, dword [esp + 0x190]
mov esi, dword [esp + 0x198]
push ebp
lea ecx, [esp + 0x18]
push ecx
push esi
push eax
push ebx
call fcn.00407b70
add esp, 0x14
test al, al
je 0x40740b
cmp byte [0x4cc180], 0
je 0x407553
mov byte [esp + 0x12], 1
test ebp, ebp
jg 0x40755a
mov byte [esp + 0x12], 0
test ebp, ebp
jns 0x4075ca
mov al, byte [0x4ca4e9]
mov cl, byte [esp + 0x194]
test al, 0x30
setne dl
mov byte [0x4cc180], cl
mov word [0x4cc184], si
mov byte [0x4cc186], dl
test al, 3
je 0x40758f
mov byte [0x4cc187], 1
test al, 0xc
jne 0x407596
mov byte [0x4cc187], 0
mov eax, dword [esp + 0x1c]
xor edx, edx
cmp dword [0x4ca688], edx
push eax
setne dl
lea eax, [esp + 0x18]
movzx ecx, cl
push edx
push 2
push eax
mov eax, dword [ebx + 4]
lea edx, [esp + 0x34]
push edx
push eax
push ecx
call edi
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x17c
ret
cmp dword [0x4cad6c], 0
je 0x407678
cmp byte [esp + 0x1a0], 0
jne 0x407678
mov al, byte [esp + 0x194]
cmp al, 8
je 0x407612
cmp al, 0x20
jbe 0x407636
cmp al, 0x28
ja 0x407636
cmp dword [0x4c9244], 0
je 0x407636
xor edx, edx
mov word [0x4c9248], dx
mov dword [0x4c9244], edx
jmp 0x407636
cmp byte [0x4ca4e9], 0
jne 0x407636
mov ecx, dword [0x4c9244]
test ecx, ecx
je 0x407636
dec ecx
xor edx, edx
mov dword [0x4c9244], ecx
mov word [ecx*2 + 0x4c9248], dx
test ebp, ebp
jle 0x40767f
mov eax, dword [esp + 0x1ac]
mov ecx, dword [esp + 0x1a8]
mov edx, dword [esp + 0x1a4]
push eax
mov eax, dword [esp + 0x24]
push ecx
push edx
push ebp
push ebx
lea ecx, [esp + 0x28]
call fcn.00407760
add esp, 0x14
test al, al
jne 0x407678
pop edi
pop esi
pop ebp
mov byte [0x4cc180], al
pop ebx
add esp, 0x17c
ret
mov al, byte [esp + 0x194]
cmp byte [esp + 0x12], 0
je 0x407752
xor ecx, ecx
cmp dword [0x4ca688], ecx
movzx esi, al
mov eax, dword [esp + 0x1c]
setne cl
push eax
lea edx, [esp + 0x24]
lea eax, [esp + 0x28]
push ecx
mov ecx, dword [ebx + 4]
push 2
push edx
push eax
push ecx
push esi
call edi
mov edi, eax
test edi, edi
jns 0x4076df
mov edx, dword [esp + 0x1c]
xor eax, eax
cmp dword [0x4ca688], eax
push edx
setne al
lea ecx, [esp + 0x24]
lea edx, [esp + 0x28]
push eax
mov eax, dword [ebx + 4]
push 2
push ecx
push edx
push eax
push esi
call dword [sym.imp.USER32.dll_ToUnicodeEx]
cmp edi, ebp
jne 0x4076ef
mov cx, word [esp + 0x14]
cmp cx, word [esp + 0x20]
je 0x407752
push 0x100
lea edx, [esp + 0x28]
push 0
push edx
call fcn.00498f80
mov al, byte [0x4cc186]
mov cl, byte [0x4cc187]
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 + 0x24]
call fcn.00413ac0
mov edx, dword [esp + 0x1c]
push edx
movzx edx, word [0x4cc184]
push 0
push 2
lea eax, [esp + 0x28]
push eax
movzx eax, byte [0x4cc180]
push ecx
push edx
push eax
call dword [sym.imp.USER32.dll_ToUnicodeEx]
mov byte [0x4cc180], 0
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x17c
ret