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

Disassembly:
mov dl, byte [esp + 8]
mov ecx, dword [0x4f1510]
sub esp, 0x144
push ebx
push ebp
mov ebp, dword [0x4f1c98]
push esi
push edi
mov di, word [esp + 0x160]
cmp ebp, 1
jne 0x407064
cmp byte [0x4f1cc8], 0
jne 0x407064
movzx eax, dl
lea eax, [eax + eax*4]
cmp dword [ecx + eax*4], 0
jne 0x407064
xor bl, bl
mov byte [esp + 0x16], bl
jmp 0x40706d
mov byte [esp + 0x16], 1
mov bl, byte [esp + 0x16]
cmp byte [esp + 0x164], 0
je 0x407097
movzx eax, dl
lea edx, [eax + eax*4]
cmp byte [ecx + edx*4 + 8], 0
mov al, 1
jne 0x407aac
mov al, bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
cmp dword [0x4f1540], 0
je 0x4070b3
cmp byte [esp + 0x168], 0
jne 0x4070b3
mov byte [esp + 0x17], 1
test bl, bl
jne 0x4070b8
mov byte [esp + 0x17], 0
mov bl, byte [0x4f0bd5]
cmp ebp, 1
jne 0x4071a8
cmp byte [0x4f1cc6], 0
je 0x4070de
cmp byte [esp + 0x168], 0
jne 0x4071a8
mov byte [esp + 0x1d], 1
cmp dl, 0xe7
je 0x407189
mov ecx, dword [0x4f1c9c]
mov esi, dword [0x4f1ca0]
movzx eax, dl
mov al, byte [eax + ecx]
test al, al
jne 0x40710c
movzx eax, di
mov al, byte [eax + esi]
test al, al
je 0x407189
mov cl, al
shr al, 2
shr cl, 1
and al, 1
and cl, 1
je 0x4071af
test al, al
jne 0x407130
test bl, 0x30
jne 0x407130
test al, al
je 0x407189
test bl, 0x30
jne 0x407189
movzx eax, di
mov ebp, 4
mov dword [0x4f1c98], ebp
cmp byte [eax + esi], 0
mov byte [0x4f1ca8], dl
setne al
mov byte [0x4f1cad], al
mov word [0x4f1caa], di
mov byte [0x4f1cac], 0
test cl, cl
je 0x40716e
mov byte [0x4f1cae], 1
test bl, 0x30
jne 0x407175
mov byte [0x4f1cae], 0
cmp byte [esp + 0x17], 0
jne 0x407189
cmp byte [0x4f3e68], 0
je 0x407279
movzx eax, dl
mov dword [esp + 0x20], eax
add eax, 0xffffffdf
cmp eax, 0x84
ja case.0x4071a1.41
movzx ecx, byte [eax + 0x407ac4]
jmp dword [ecx*4 + 0x407ab8]
mov byte [esp + 0x1d], 0
jmp 0x407189
test al, al
je 0x407130
jmp 0x40712b
mov al, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
cmp byte [esp + 0x17], 0
je case.0x4071a1.41
mov ecx, dword [0x4ef964]
test ecx, ecx
je 0x4071f1
xor ecx, ecx
mov byte [0x4ef968], 0
mov dword [0x4ef964], ecx
jmp 0x4071f1
mov ecx, dword [0x4ef964]
test bl, bl
je 0x40721c
cmp ebp, 1
jne 0x407203
cmp byte [0x4f1cc7], 0
jne 0x40721c
cmp bl, 0x10
je 0x40721c
cmp bl, 0x20
je 0x40721c
cmp bl, 0x30
je 0x40721c
test bl, 0xc
je 0x407279
test bl, 3
je 0x407279
cmp dl, 8
jne 0x407288
test bl, bl
jne 0x407288
cmp byte [esp + 0x1d], bl
je 0x407250
cmp ebp, 1
jne 0x407250
cmp byte [0x4f1cc4], bl
je 0x407250
mov eax, dword [0x4f1cd0]
test eax, eax
je 0x407250
mov edx, dword [0x4f1ccc]
dec eax
mov dword [0x4f1cd0], eax
mov byte [edx + eax], bl
cmp byte [esp + 0x17], 0
je 0x407269
test ecx, ecx
je 0x407269
dec ecx
mov dword [0x4ef964], ecx
mov byte [ecx + 0x4ef968], 0
cmp byte [0x4f3e68], 0
je 0x407279
mov byte [0x4f3e68], 0
mov al, byte [esp + 0x16]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov esi, eax
mov ecx, esi
mov dword [esp + 0x24], esi
call fcn.004127d0
push eax
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov ebp, eax
mov dword [esp + 0x30], ebp
cmp dword [0x4f3e74], esi
je 0x4072e8
push 0x1c
lea eax, [esp + 0x38]
push eax
push esi
mov dword [0x4f3e74], esi
call dword [sym.imp.USER32.dll_GetClassNameA]
push 0x4d8d5c
call fcn.0049be50
add esp, 4
push eax
lea ecx, [esp + 0x38]
push ecx
call fcn.004ba135
add esp, 8
test eax, eax
sete byte [0x4f3e70]
mov bl, byte [0x4f3e68]
mov ecx, 0x40
mov esi, 0x4f0bf8
lea edi, [esp + 0x50]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [sym.imp.USER32.dll_ToAsciiEx]
test bl, bl
je 0x40737f
cmp byte [0x4f3e70], 0
je 0x40737f
cmp byte [esp + 0x15c], 0xe7
je 0x40737f
mov al, byte [0x4f3e6e]
mov dl, byte [0x4f3e6f]
neg al
sbb al, al
and al, 0x20
neg dl
sbb dl, dl
and dl, 9
or al, dl
lea ecx, [esp + 0x50]
call fcn.00412300
movzx edx, word [0x4f3e6c]
push ebp
push 0
lea eax, [esp + 0x20]
push eax
push ecx
movzx eax, bl
push edx
push eax
call esi
test eax, eax
jle 0x407378
movzx eax, word [0x4f3e6c]
push ebp
push 0
lea ecx, [esp + 0x20]
push ecx
movzx ecx, byte [0x4f3e68]
lea edx, [esp + 0x5c]
push edx
push eax
push ecx
call esi
mov byte [0x4f3e68], 0
mov al, byte [0x4f0bd5]
lea ecx, [esp + 0x50]
call fcn.00412300
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x4073a0
or byte [esp + 0x64], 1
jmp 0x4073a5
and byte [esp + 0x64], 0xfe
cmp byte [esp + 0x15c], 0xe7
lea edx, [esp + 0x18]
jne 0x4073d3
push 0
push 0
push 3
push edx
push 1
lea eax, [esp + 0x174]
push eax
push 0x400
push 0
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
jmp 0x4073f8
xor ecx, ecx
cmp dword [0x4f0d68], ecx
push ebp
setne cl
lea eax, [esp + 0x54]
push ecx
mov ecx, dword [esp + 0x160]
push edx
mov edx, dword [ecx + 4]
push eax
mov eax, dword [esp + 0x30]
push edx
push eax
call esi
mov dword [esp + 0x2c], eax
test eax, eax
je 0x407279
cmp byte [0x4f3e68], 0
setne byte [esp + 0x28]
test eax, eax
jns 0x40749c
mov bl, byte [esp + 0x16]
test bl, bl
je 0x407aaa
mov al, byte [0x4f0bd5]
mov cl, byte [esp + 0x15c]
mov dx, word [esp + 0x160]
test al, 0x30
mov byte [0x4f3e68], cl
setne cl
mov word [0x4f3e6c], dx
mov byte [0x4f3e6e], cl
test al, 3
je 0x40745f
mov byte [0x4f3e6f], 1
test al, 0xc
jne 0x407466
mov byte [0x4f3e6f], 0
xor edx, edx
cmp dword [0x4f0d68], edx
push ebp
setne dl
lea eax, [esp + 0x1c]
lea ecx, [esp + 0x54]
push edx
mov edx, dword [esp + 0x160]
push eax
mov eax, dword [edx + 4]
push ecx
mov ecx, dword [esp + 0x30]
push eax
push ecx
call esi
mov al, bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
test byte [0x4f0bd5], 3
jne 0x4074bd
mov cl, 0xd
mov al, 0xa
cmp byte [esp + 0x18], cl
jne 0x4074b3
mov byte [esp + 0x18], al
cmp byte [esp + 0x19], cl
jne 0x4074bd
mov byte [esp + 0x19], al
cmp byte [esp + 0x17], 0
mov byte [esp + 0x1e], 0
je 0x407849
mov eax, dword [esp + 0x24]
cmp eax, dword [0x4ef960]
je 0x4074e9
mov dword [0x4ef960], eax
mov byte [0x4ef968], 0
xor ecx, ecx
jmp 0x40752b
mov ecx, dword [0x4ef964]
mov edx, 0x5a
sub edx, ecx
cmp edx, 3
jge 0x40752b
mov eax, 0x4ef995
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x407503
sub eax, edx
mov dword [0x4ef964], eax
inc eax
push eax
push 0x4ef995
push 0x4ef968
call fcn.004bad10
mov ecx, dword [0x4ef964]
add esp, 0xc
mov al, byte [esp + 0x18]
mov byte [ecx + 0x4ef968], al
inc ecx
cmp dword [esp + 0x2c], 1
mov dword [0x4ef964], ecx
jle 0x407554
mov dl, byte [esp + 0x19]
mov byte [ecx + 0x4ef968], dl
inc ecx
mov dword [0x4ef964], ecx
mov byte [ecx + 0x4ef968], 0
test ecx, ecx
je 0x407849
cmp dword [0x4f1544], 0
mov dword [esp + 0x24], 0
jbe 0x407849
jmp 0x407580
mov eax, dword [0x4f1540]
mov edx, dword [esp + 0x24]
mov ebp, dword [eax + edx*4]
cmp byte [ebp + 0x23], 0
jne 0x407679
cmp byte [ebp + 0x2a], 0
je 0x4075d3
movzx eax, byte [ebp + 0x22]
cmp ecx, eax
jle 0x407679
movsx eax, byte [ecx + 0x4ef967]
push eax
push str._____:____.___n__t
call fcn.004bb121
add esp, 8
test eax, eax
je 0x407673
mov ecx, dword [0x4ef964]
lea edi, [ecx + 0x4ef966]
jmp 0x4075e5
movzx edx, byte [ebp + 0x22]
cmp ecx, edx
jl 0x407679
lea edi, [ecx + 0x4ef967]
cmp byte [ebp + 0x26], 0
movzx edx, byte [ebp + 0x22]
mov eax, dword [ebp + 8]
lea esi, [edx + eax - 1]
je 0x40760e
cmp esi, eax
jb 0x40763d
lea ebx, [ebx]
mov dl, byte [edi]
cmp dl, byte [esi]
jne 0x40763d
dec esi
dec edi
cmp esi, eax
jae 0x407600
jmp 0x40763d
cmp esi, eax
jb 0x40763d
movzx eax, byte [esi]
mov ebx, dword [sym.imp.USER32.dll_CharLowerA]
push eax
call ebx
movzx ecx, byte [edi]
push ecx
mov dword [esp + 0x24], eax
call ebx
mov ecx, dword [esp + 0x20]
cmp al, cl
jne 0x407637
dec esi
dec edi
cmp esi, dword [ebp + 8]
jae 0x407612
mov ecx, dword [0x4ef964]
cmp esi, dword [ebp + 8]
jae 0x407679
cmp byte [ebp + 0x2b], 0
jne 0x407660
cmp edi, 0x4ef968
jb 0x407660
movzx edx, byte [edi]
push edx
call fcn.00407b50
add esp, 4
test al, al
jne 0x407673
mov eax, dword [ebp + 4]
mov esi, dword [ebp + 0x10]
push eax
call fcn.00409d50
add esp, 4
test eax, eax
jne 0x407693
mov ecx, dword [0x4ef964]
mov eax, dword [esp + 0x24]
inc eax
mov dword [esp + 0x24], eax
cmp eax, dword [0x4f1544]
jb 0x407580
jmp 0x407849
movzx edx, byte [ebp + 0x21]
mov ecx, dword [esp + 0x16c]
mov eax, dword [esp + 0x158]
mov eax, dword [eax + 0x10]
add ecx, 4
push edx
call fcn.0040a8c0
add esp, 4
test al, al
je 0x407849
cmp byte [ebp + 0x27], 0
jne 0x4076c9
xor edi, edi
jmp 0x40779c
cmp byte [ebp + 0x2a], 0
mov ebx, dword [0x4ef964]
lea ebx, [ebx + 0x4ef968]
je 0x4076dc
dec ebx
movzx ecx, byte [ebp + 0x22]
mov esi, ebx
sub esi, ecx
mov dword [esp + 0x20], 0
mov byte [esp + 0x1f], 0
mov byte [esp + 0x17], 0
cmp esi, ebx
jae 0x407744
mov edi, dword [sym.imp.USER32.dll_IsCharUpperA]
movzx edx, byte [esi]
push edx
call dword [sym.imp.USER32.dll_IsCharLowerA]
test eax, eax
jne 0x407718
movzx eax, byte [esi]
push eax
call edi
test eax, eax
je 0x407737
cmp byte [esp + 0x1f], 0
jne 0x407733
movzx ecx, byte [esi]
push ecx
mov byte [esp + 0x23], 1
call edi
test eax, eax
je 0x407733
mov byte [esp + 0x17], 1
inc dword [esp + 0x20]
inc esi
cmp esi, ebx
jb 0x407700
mov eax, dword [esp + 0x20]
test eax, eax
jne 0x407748
xor edi, edi
jmp 0x40779c
cmp eax, 1
jne 0x40775b
movzx edi, byte [esp + 0x17]
neg edi
sbb edi, edi
and edi, 2
jmp 0x40779c
cmp byte [esp + 0x17], 0
jne 0x407766
xor edi, edi
jmp 0x40779c
movzx edx, byte [ebp + 0x22]
mov esi, ebx
sub esi, edx
mov edi, 2
cmp esi, ebx
jae 0x407795
jmp 0x407780
movzx eax, byte [esi]
push eax
call dword [sym.imp.USER32.dll_IsCharLowerA]
test eax, eax
jne 0x407793
inc esi
cmp esi, ebx
jb 0x407780
cmp esi, ebx
jne 0x40779c
mov edi, 1
mov dl, byte [ebp + 0x28]
test dl, dl
jne 0x4077a8
cmp byte [ebp + 0x29], dl
je 0x4077b2
mov byte [esp + 0x16], 0
mov byte [esp + 0x1e], 1
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x170]
mov dword [ecx], eax
mov al, byte [ebp + 0x2a]
test al, al
je 0x4077d5
mov ecx, dword [0x4ef964]
movsx ecx, byte [ecx + 0x4ef967]
jmp 0x4077d7
xor ecx, ecx
movzx esi, di
movzx ecx, cx
shl esi, 0x10
or esi, ecx
mov ecx, dword [esp + 0x174]
mov dword [ecx], esi
xor ecx, ecx
cmp dword [ebp + 0xc], ecx
je 0x40781b
test al, al
je 0x407813
mov edx, dword [0x4ef964]
mov al, byte [edx + 0x4ef967]
mov byte [0x4ef968], al
mov dword [0x4ef964], 1
jmp 0x407833
mov dword [0x4ef964], ecx
jmp 0x407833
test dl, dl
je 0x407833
movzx edx, byte [ebp + 0x22]
sub dword [0x4ef964], edx
test al, al
je 0x407833
dec dword [0x4ef964]
cmp byte [ebp + 0x2c], cl
je 0x40783e
mov dword [0x4ef964], ecx
mov eax, dword [0x4ef964]
mov byte [eax + 0x4ef968], cl
cmp byte [esp + 0x28], 0
mov bl, byte [esp + 0x16]
je 0x4078bd
test bl, bl
je 0x4078bd
push 0x100
lea ecx, [esp + 0x54]
push 0
push ecx
call fcn.004c16a0
mov al, byte [0x4f3e6e]
mov dl, byte [0x4f3e6f]
add esp, 0xc
neg al
sbb al, al
and al, 0x20
neg dl
sbb dl, dl
and dl, 9
or al, dl
lea ecx, [esp + 0x50]
call fcn.00412300
mov eax, dword [esp + 0x30]
push eax
movzx eax, word [0x4f3e6c]
push 0
lea ecx, [esp + 0x30]
push ecx
movzx ecx, byte [0x4f3e68]
lea edx, [esp + 0x5c]
push edx
push eax
push ecx
call dword [sym.imp.USER32.dll_ToAsciiEx]
mov byte [0x4f3e68], 0
cmp byte [esp + 0x1d], 0
je 0x407aaa
cmp dword [0x4f1c98], 1
jne 0x407aaa
cmp byte [esp + 0x1e], 0
jne 0x407aaa
mov edi, dword [esp + 0x2c]
xor esi, esi
test edi, edi
jle 0x40795b
lea ebx, [ebx]
cmp byte [0x4f1cc5], 0
je 0x407910
movzx eax, byte [esp + esi + 0x18]
mov edx, dword [0x4f1ca4]
push eax
push edx
call fcn.004bb121
add esp, 8
jmp 0x40791f
mov al, byte [esp + esi + 0x18]
mov ecx, dword [0x4f1ca4]
call fcn.004a3510
test eax, eax
jne 0x4079aa
mov eax, dword [0x4f1cd0]
cmp eax, dword [0x4f1cd4]
je 0x40795b
mov cl, byte [esp + esi + 0x18]
mov edx, dword [0x4f1ccc]
mov byte [edx + eax], cl
mov eax, dword [0x4f1cd0]
mov ecx, dword [0x4f1ccc]
inc eax
inc esi
mov dword [0x4f1cd0], eax
mov byte [ecx + eax], 0
cmp esi, edi
jl 0x4078f0
xor esi, esi
cmp byte [0x4f1cc9], 0
je 0x407a19
cmp byte [0x4f1cc5], 0
je 0x4079e2
cmp dword [0x4f1cb4], esi
jbe 0x407a93
nop
mov eax, dword [0x4f1cb0]
mov eax, dword [eax + esi*4]
mov ecx, dword [0x4f1ccc]
push eax
push ecx
call fcn.004bb262
add esp, 8
test eax, eax
jne 0x4079cb
inc esi
cmp esi, dword [0x4f1cb4]
jb 0x407980
jmp 0x407a93
mov dl, byte [esp + esi + 0x18]
mov dword [0x4f1c98], 4
mov byte [0x4f1cac], dl
mov al, bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
mov dword [0x4f1c98], 3
mov al, bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
cmp dword [0x4f1cb4], esi
jbe 0x407a93
mov edi, edi
mov edx, dword [0x4f1cb0]
mov eax, dword [edx + esi*4]
push eax
mov eax, dword [0x4f1ccc]
call fcn.004a3560
add esp, 4
test eax, eax
jne 0x4079cb
inc esi
cmp esi, dword [0x4f1cb4]
jb 0x4079f0
jmp 0x407a93
cmp byte [0x4f1cc5], 0
je 0x407a5c
cmp dword [0x4f1cb4], esi
jbe 0x407a93
lea ebx, [ebx]
mov ecx, dword [0x4f1cb0]
mov eax, dword [ecx + esi*4]
mov edx, dword [0x4f1ccc]
push eax
push edx
call fcn.004ba285
add esp, 8
test eax, eax
je 0x4079cb
inc esi
cmp esi, dword [0x4f1cb4]
jb 0x407a30
jmp 0x407a93
cmp dword [0x4f1cb4], esi
jbe 0x407a93
mov edi, dword [sym.imp.KERNEL32.dll_lstrcmpiA]
lea ebx, [ebx]
mov eax, dword [0x4f1cb0]
mov ecx, dword [eax + esi*4]
mov edx, dword [0x4f1ccc]
push ecx
push edx
call edi
test eax, eax
je 0x4079cb
inc esi
cmp esi, dword [0x4f1cb4]
jb 0x407a70
mov eax, dword [0x4f1cd4]
cmp dword [0x4f1cd0], eax
jl 0x407aaa
mov dword [0x4f1c98], 5
mov al, bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret