Function at 0x406b40
Capabilities:
Get keyboard layout
Log keystrokes via polling
Resolve function by parsing pe exports

Disassembly:
mov dl, byte [esp + 8]
mov ecx, dword [0x4c8f74]
sub esp, 0x18c
push ebx
push ebp
mov ebp, dword [0x4c96d8]
push edi
mov di, word [esp + 0x1a4]
cmp ebp, 1
jne 0x406b83
cmp byte [0x4c9708], 0
jne 0x406b83
movzx eax, dl
lea eax, [eax + eax*4]
cmp dword [ecx + eax*4], 0
jne 0x406b83
xor bl, bl
mov byte [esp + 0xf], bl
jmp 0x406b8c
mov byte [esp + 0xf], 1
mov bl, byte [esp + 0xf]
cmp byte [esp + 0x1a8], 0
je 0x406bb5
movzx eax, dl
lea edx, [eax + eax*4]
cmp byte [ecx + edx*4 + 8], 0
mov al, 1
jne 0x407649
pop edi
pop ebp
mov al, bl
pop ebx
add esp, 0x18c
ret
cmp dword [0x4c8fa4], 0
je 0x406bd1
cmp byte [esp + 0x1ac], 0
jne 0x406bd1
mov byte [esp + 0x10], 1
test bl, bl
jne 0x406bd6
mov byte [esp + 0x10], 0
mov bl, byte [0x4c8535]
push esi
cmp ebp, 1
jne 0x406cc4
cmp byte [0x4c9706], 0
je 0x406bfd
cmp byte [esp + 0x1b0], 0
jne 0x406cc4
mov byte [esp + 0x15], 1
cmp dl, 0xe7
je 0x406ca5
mov ecx, dword [0x4c96dc]
mov esi, dword [0x4c96e0]
movzx eax, dl
mov al, byte [eax + ecx]
test al, al
jne 0x406c2b
movzx eax, di
mov al, byte [eax + esi]
test al, al
je 0x406ca5
mov cl, al
shr al, 2
shr cl, 1
and al, 1
and cl, 1
je 0x406ccb
test al, al
jne 0x406c4f
test bl, 0x30
jne 0x406c4f
test al, al
je 0x406ca5
test bl, 0x30
jne 0x406ca5
movzx eax, di
mov ebp, 4
mov dword [0x4c96d8], ebp
cmp byte [eax + esi], 0
mov byte [0x4c96e8], dl
setne al
mov byte [0x4c96ee], al
xor eax, eax
mov word [0x4c96ea], di
mov word [0x4c96ec], ax
test cl, cl
je 0x406c8e
mov byte [0x4c96ef], 1
test bl, 0x30
jne 0x406c93
mov byte [0x4c96ef], al
cmp byte [esp + 0x14], al
jne 0x406ca5
cmp byte [0x4ca3fc], al
je 0x40765d
movzx eax, dl
mov dword [esp + 0x20], eax
add eax, 0xffffffdf
cmp eax, 0x84
ja case.0x406cbd.41
movzx ecx, byte [eax + 0x4076b4]
jmp dword [ecx*4 + 0x4076a8]
mov byte [esp + 0x15], 0
jmp 0x406ca5
test al, al
je 0x406c4f
jmp 0x406c4a
pop esi
pop edi
pop ebp
mov al, 1
pop ebx
add esp, 0x18c
ret
cmp byte [esp + 0x14], 0
je case.0x406cbd.41
mov ecx, dword [0x4c7284]
test ecx, ecx
je 0x406d0a
xor eax, eax
xor ecx, ecx
mov word [0x4c7288], ax
mov dword [0x4c7284], ecx
jmp 0x406d0a
mov ecx, dword [0x4c7284]
test bl, bl
je 0x406d3d
cmp ebp, 1
jne 0x406d1c
cmp byte [0x4c9707], 0
jne 0x406d3d
cmp bl, 0x10
je 0x406d3d
cmp bl, 0x20
je 0x406d3d
cmp bl, 0x30
je 0x406d3d
test bl, 0xc
je 0x40765d
test bl, 3
je 0x40765d
cmp dl, 8
jne 0x406daf
test bl, bl
jne 0x406daf
cmp byte [esp + 0x15], bl
je 0x406d74
cmp ebp, 1
jne 0x406d74
cmp byte [0x4c9704], bl
je 0x406d74
mov eax, dword [0x4c9710]
test eax, eax
je 0x406d74
mov esi, dword [0x4c970c]
dec eax
xor edx, edx
mov dword [0x4c9710], eax
mov word [esi + eax*2], dx
cmp byte [esp + 0x14], 0
je 0x406d90
test ecx, ecx
je 0x406d90
dec ecx
xor eax, eax
mov dword [0x4c7284], ecx
mov word [ecx*2 + 0x4c7288], ax
cmp byte [0x4ca3fc], 0
je 0x406da0
mov byte [0x4ca3fc], 0
mov al, byte [esp + 0x13]
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18c
ret
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov edi, eax
xor esi, esi
mov dword [esp + 0x28], edi
test edi, edi
je 0x406df4
mov ebx, dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push esi
push edi
call ebx
lea ecx, [esp + 0x34]
mov esi, eax
push ecx
push esi
mov dword [esp + 0x3c], 0x30
call dword [sym.imp.USER32.dll_GetGUIThreadInfo]
test eax, eax
je 0x406df4
mov eax, dword [esp + 0x40]
test eax, eax
je 0x406df4
push 0
push eax
call ebx
mov esi, eax
push esi
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov ebp, eax
mov dword [esp + 0x30], ebp
cmp dword [0x4ca408], edi
je 0x406e3e
push 0x1c
lea edx, [esp + 0x168]
push edx
push edi
mov dword [0x4ca408], edi
call dword [sym.imp.USER32.dll_GetClassNameW]
lea eax, [esp + 0x164]
push str.ApplicationFrameWindow
push eax
call fcn.0048deb9
add esp, 8
test eax, eax
sete byte [0x4ca404]
mov bl, byte [0x4ca3fc]
mov ecx, 0x40
mov esi, 0x4c8558
lea edi, [esp + 0x64]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [sym.imp.USER32.dll_ToUnicodeEx]
test bl, bl
je 0x406edb
cmp byte [0x4ca404], 0
je 0x406edb
cmp byte [esp + 0x1a4], 0xe7
je 0x406edb
mov al, byte [0x4ca402]
mov cl, byte [0x4ca403]
neg al
sbb al, al
and al, 0x20
neg cl
sbb cl, cl
and cl, 9
or al, cl
lea ecx, [esp + 0x64]
call fcn.00412200
push ebp
push 0
push 2
lea edx, [esp + 0x24]
push edx
mov eax, ecx
movzx ecx, word [0x4ca400]
push eax
movzx edx, bl
push ecx
push edx
call esi
test eax, eax
jle 0x406ed4
movzx edx, word [0x4ca400]
push ebp
push 0
push 2
lea eax, [esp + 0x24]
push eax
movzx eax, byte [0x4ca3fc]
lea ecx, [esp + 0x74]
push ecx
push edx
push eax
call esi
mov byte [0x4ca3fc], 0
mov al, byte [0x4c8535]
lea ecx, [esp + 0x64]
call fcn.00412200
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x406efc
or byte [esp + 0x78], 1
jmp 0x406f01
and byte [esp + 0x78], 0xfe
cmp byte [esp + 0x1a4], 0xe7
jne 0x406f23
mov cx, word [esp + 0x1a8]
mov eax, 1
mov dword [esp + 0x2c], eax
mov word [esp + 0x18], cx
jmp 0x406f5a
xor edx, edx
cmp dword [0x4c86c8], edx
push ebp
setne dl
lea eax, [esp + 0x1c]
lea ecx, [esp + 0x68]
push edx
mov edx, dword [esp + 0x1a8]
push 2
push eax
mov eax, dword [edx + 4]
push ecx
mov ecx, dword [esp + 0x34]
push eax
push ecx
call esi
mov dword [esp + 0x2c], eax
test eax, eax
je 0x40765d
cmp byte [0x4ca3fc], 0
setne byte [esp + 0x27]
test eax, eax
jns 0x406ff3
mov bl, byte [esp + 0x13]
test bl, bl
je 0x407646
mov ax, word [esp + 0x1a8]
mov dl, byte [esp + 0x1a4]
mov word [0x4ca400], ax
mov al, byte [0x4c8535]
test al, 0x30
setne cl
mov byte [0x4ca3fc], dl
mov byte [0x4ca402], cl
test al, 3
je 0x406fb4
mov byte [0x4ca403], 1
test al, 0xc
jne 0x406fbb
mov byte [0x4ca403], 0
xor edx, edx
cmp dword [0x4c86c8], edx
push ebp
setne dl
lea eax, [esp + 0x1c]
lea ecx, [esp + 0x68]
push edx
mov edx, dword [esp + 0x1a8]
push 2
push eax
mov eax, dword [edx + 4]
push ecx
mov ecx, dword [esp + 0x34]
push eax
push ecx
call esi
pop esi
pop edi
pop ebp
mov al, bl
pop ebx
add esp, 0x18c
ret
test byte [0x4c8535], 3
jne 0x407023
mov eax, 0xd
cmp word [esp + 0x18], ax
jne 0x407012
mov edx, 0xa
mov word [esp + 0x18], dx
cmp word [esp + 0x1a], ax
jne 0x407023
mov eax, 0xa
mov word [esp + 0x1a], ax
cmp byte [esp + 0x14], 0
mov byte [esp + 0x17], 0
je 0x4073f3
mov eax, dword [esp + 0x28]
cmp eax, dword [0x4c7280]
je 0x40704f
xor ecx, ecx
mov dword [0x4c7280], eax
mov word [0x4c7288], cx
jmp 0x4070a1
mov ecx, dword [0x4c7284]
mov edx, 0x5a
sub edx, ecx
cmp edx, 3
jge 0x4070a1
mov eax, 0x4c72e2
lea edx, [eax + 2]
lea esp, [esp]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x407070
sub eax, edx
sar eax, 1
mov dword [0x4c7284], eax
lea eax, [eax + eax + 2]
push eax
push 0x4c72e2
push 0x4c7288
call fcn.0048e930
mov ecx, dword [0x4c7284]
add esp, 0xc
mov dx, word [esp + 0x18]
mov word [ecx*2 + 0x4c7288], dx
inc ecx
cmp dword [esp + 0x2c], 1
mov dword [0x4c7284], ecx
jle 0x4070d0
mov ax, word [esp + 0x1a]
mov word [ecx*2 + 0x4c7288], ax
inc ecx
mov dword [0x4c7284], ecx
xor edx, edx
mov word [ecx*2 + 0x4c7288], dx
test ecx, ecx
je 0x4073f3
mov dword [esp + 0x28], edx
cmp dword [0x4c8fa8], edx
jbe 0x4073f3
mov ebx, dword [sym.imp.USER32.dll_CharLowerW]
jmp 0x407100
mov eax, dword [0x4c8fa4]
mov edx, dword [esp + 0x28]
mov ebp, dword [eax + edx*4]
cmp byte [ebp + 0x23], 0
jne 0x407212
cmp byte [ebp + 0x2a], 0
je 0x407155
movzx eax, byte [ebp + 0x22]
cmp ecx, eax
jle 0x407212
movzx eax, word [ecx*2 + 0x4c7286]
push eax
push str._____:____.___n__t
call fcn.0048eccb
add esp, 8
test eax, eax
je 0x40720c
mov ecx, dword [0x4c7284]
lea edi, [ecx*2 + 0x4c7284]
jmp 0x407168
movzx edx, byte [ebp + 0x22]
cmp ecx, edx
jl 0x407212
lea edi, [ecx*2 + 0x4c7286]
cmp byte [ebp + 0x26], 0
movzx edx, byte [ebp + 0x22]
mov eax, dword [ebp + 8]
lea esi, [eax + edx*2 - 2]
je 0x407194
cmp esi, eax
jb 0x4071d6
lea ecx, [ecx]
mov dx, word [edi]
cmp dx, word [esi]
jne 0x4071d6
sub esi, 2
sub edi, 2
cmp esi, eax
jae 0x407180
jmp 0x4071d6
cmp esi, eax
jb 0x4071d6
jmp 0x4071a6
mov ebx, dword [sym.imp.USER32.dll_CharLowerW]
movzx eax, word [esi]
push eax
call ebx
movzx ecx, word [edi]
push ecx
mov dword [esp + 0x24], eax
call ebx
mov ecx, dword [esp + 0x20]
cmp ax, cx
jne 0x4071ca
sub esi, 2
sub edi, 2
cmp esi, dword [ebp + 8]
jae 0x4071a0
mov ecx, dword [0x4c7284]
mov ebx, dword [sym.imp.USER32.dll_CharLowerW]
cmp esi, dword [ebp + 8]
jae 0x407212
cmp byte [ebp + 0x2b], 0
jne 0x4071f9
cmp edi, 0x4c7288
jb 0x4071f9
movzx edx, word [edi]
push edx
call fcn.00407740
add esp, 4
test al, al
jne 0x40720c
mov eax, dword [ebp + 4]
mov esi, dword [ebp + 0x10]
push eax
call fcn.004098f0
add esp, 4
test eax, eax
jne 0x40722c
mov ecx, dword [0x4c7284]
mov eax, dword [esp + 0x28]
inc eax
mov dword [esp + 0x28], eax
cmp eax, dword [0x4c8fa8]
jb 0x407100
jmp 0x4073f3
movzx edx, byte [ebp + 0x21]
mov ecx, dword [esp + 0x1b4]
mov eax, dword [esp + 0x1a0]
mov eax, dword [eax + 0x10]
add ecx, 4
push edx
call fcn.0040a510
add esp, 4
test al, al
je 0x4073f3
cmp byte [ebp + 0x27], 0
jne 0x407262
xor edi, edi
jmp 0x40733d
cmp byte [ebp + 0x2a], 0
mov ebx, dword [0x4c7284]
lea ebx, [ebx*2 + 0x4c7288]
je 0x407278
sub ebx, 2
movzx ecx, byte [ebp + 0x22]
add ecx, ecx
mov esi, ebx
sub esi, ecx
mov dword [esp + 0x20], 0
mov byte [esp + 0x16], 0
mov byte [esp + 0x14], 0
cmp esi, ebx
jae 0x4072e6
mov edi, dword [sym.imp.USER32.dll_IsCharUpperW]
mov edi, edi
movzx edx, word [esi]
push edx
call dword [sym.imp.USER32.dll_IsCharLowerW]
test eax, eax
jne 0x4072b8
movzx eax, word [esi]
push eax
call edi
test eax, eax
je 0x4072d7
cmp byte [esp + 0x16], 0
jne 0x4072d3
movzx ecx, word [esi]
push ecx
mov byte [esp + 0x1a], 1
call edi
test eax, eax
je 0x4072d3
mov byte [esp + 0x14], 1
inc dword [esp + 0x20]
add esi, 2
cmp esi, ebx
jb 0x4072a0
mov eax, dword [esp + 0x20]
test eax, eax
jne 0x4072ea
xor edi, edi
jmp 0x40733d
cmp eax, 1
jne 0x4072fd
movzx edi, byte [esp + 0x14]
neg edi
sbb edi, edi
and edi, 2
jmp 0x40733d
cmp byte [esp + 0x14], 0
jne 0x407308
xor edi, edi
jmp 0x40733d
movzx edx, byte [ebp + 0x22]
add edx, edx
mov esi, ebx
sub esi, edx
mov edi, 2
cmp esi, ebx
jae 0x407336
jmp 0x407320
movzx eax, word [esi]
push eax
call dword [sym.imp.USER32.dll_IsCharLowerW]
test eax, eax
jne 0x407334
add esi, edi
cmp esi, ebx
jb 0x407320
cmp esi, ebx
jne 0x40733d
mov edi, 1
mov dl, byte [ebp + 0x28]
test dl, dl
jne 0x407349
cmp byte [ebp + 0x29], dl
je 0x407353
mov byte [esp + 0x13], 0
mov byte [esp + 0x17], 1
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x1b8]
mov dword [ecx], eax
mov al, byte [ebp + 0x2a]
test al, al
je 0x407377
mov ecx, dword [0x4c7284]
movzx ecx, word [ecx*2 + 0x4c7286]
jmp 0x407379
xor ecx, ecx
movzx esi, di
movzx ecx, cx
shl esi, 0x10
or esi, ecx
mov ecx, dword [esp + 0x1bc]
mov dword [ecx], esi
xor ecx, ecx
cmp dword [ebp + 0xc], ecx
je 0x4073c0
test al, al
je 0x4073b8
mov edx, dword [0x4c7284]
mov ax, word [edx*2 + 0x4c7286]
mov word [0x4c7288], ax
mov dword [0x4c7284], 1
jmp 0x4073d8
mov dword [0x4c7284], ecx
jmp 0x4073d8
test dl, dl
je 0x4073d8
movzx edx, byte [ebp + 0x22]
sub dword [0x4c7284], edx
test al, al
je 0x4073d8
dec dword [0x4c7284]
cmp byte [ebp + 0x2c], cl
je 0x4073e3
mov dword [0x4c7284], ecx
mov ecx, dword [0x4c7284]
xor eax, eax
mov word [ecx*2 + 0x4c7288], ax
cmp byte [esp + 0x27], 0
mov bl, byte [esp + 0x13]
je 0x407465
test bl, bl
je 0x407465
push 0x100
lea edx, [esp + 0x68]
push 0
push edx
call fcn.00496d90
mov al, byte [0x4ca402]
mov cl, byte [0x4ca403]
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 + 0x64]
call fcn.00412200
mov edx, dword [esp + 0x30]
push edx
movzx edx, word [0x4ca400]
push 0
push 2
lea eax, [esp + 0x3c]
push eax
movzx eax, byte [0x4ca3fc]
push ecx
push edx
push eax
call dword [sym.imp.USER32.dll_ToUnicodeEx]
mov byte [0x4ca3fc], 0
cmp byte [esp + 0x15], 0
je 0x407646
cmp dword [0x4c96d8], 1
jne 0x407646
cmp byte [esp + 0x17], 0
jne 0x407646
mov edi, dword [esp + 0x2c]
xor esi, esi
test edi, edi
jle 0x40750a
jmp 0x4074a0
cmp byte [0x4c9705], 0
mov ecx, dword [0x4c96e4]
je 0x4074c0
movzx eax, word [esp + esi*2 + 0x18]
push eax
push ecx
call fcn.0048eccb
add esp, 8
jmp 0x4074ca
mov ax, word [esp + esi*2 + 0x18]
call fcn.00474f50
test eax, eax
jne 0x40755a
mov eax, dword [0x4c9710]
cmp eax, dword [0x4c9714]
je 0x40750a
mov dx, word [esp + esi*2 + 0x18]
mov ecx, dword [0x4c970c]
mov word [ecx + eax*2], dx
mov eax, dword [0x4c9710]
mov ecx, dword [0x4c970c]
inc eax
xor edx, edx
inc esi
mov dword [0x4c9710], eax
mov word [ecx + eax*2], dx
cmp esi, edi
jl 0x4074a0
xor esi, esi
cmp byte [0x4c9709], 0
je 0x4075c6
cmp byte [0x4c9705], 0
je 0x407594
cmp dword [0x4c96f4], esi
jbe 0x40762e
mov edi, edi
mov eax, dword [0x4c96f0]
mov eax, dword [eax + esi*4]
mov ecx, dword [0x4c970c]
push eax
push ecx
call fcn.0048ecf2
add esp, 8
test eax, eax
jne 0x40757d
inc esi
cmp esi, dword [0x4c96f4]
jb 0x407530
jmp 0x40762e
mov dx, word [esp + esi*2 + 0x18]
pop esi
pop edi
pop ebp
mov al, bl
mov dword [0x4c96d8], 4
mov word [0x4c96ec], dx
pop ebx
add esp, 0x18c
ret
pop esi
pop edi
pop ebp
mov al, bl
mov dword [0x4c96d8], 3
pop ebx
add esp, 0x18c
ret
cmp dword [0x4c96f4], esi
jbe 0x40762e
mov edx, dword [0x4c970c]
mov eax, dword [0x4c96f0]
mov eax, dword [eax + esi*4]
push edx
call fcn.00474fa0
add esp, 4
test eax, eax
jne 0x40757d
inc esi
cmp esi, dword [0x4c96f4]
jb 0x4075a0
jmp 0x40762e
cmp byte [0x4c9705], 0
je 0x40766c
mov ebx, dword [0x4c96f4]
test ebx, ebx
je 0x40762a
mov edi, dword [0x4c970c]
mov ebp, dword [0x4c96f0]
lea esp, [esp]
mov ecx, dword [ebp + esi*4]
mov eax, edi
mov dx, word [eax]
cmp dx, word [ecx]
jne 0x40761c
test dx, dx
je 0x407618
mov dx, word [eax + 2]
cmp dx, word [ecx + 2]
jne 0x40761c
add eax, 4
add ecx, 4
test dx, dx
jne 0x4075f6
xor eax, eax
jmp 0x407621
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x407653
inc esi
cmp esi, ebx
jb 0x4075f0
mov bl, byte [esp + 0x13]
mov ecx, dword [0x4c9714]
cmp dword [0x4c9710], ecx
jl 0x407646
mov dword [0x4c96d8], 5
mov al, bl
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18c
ret
mov dword [0x4c96d8], 3
mov al, byte [esp + 0x13]
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18c
ret
cmp dword [0x4c96f4], esi
jbe 0x40762e
mov edi, dword [sym.imp.KERNEL32.dll_lstrcmpiW]
lea ebx, [ebx]
mov ecx, dword [0x4c96f0]
mov edx, dword [ecx + esi*4]
mov eax, dword [0x4c970c]
push edx
push eax
call edi
test eax, eax
je 0x40757d
inc esi
cmp esi, dword [0x4c96f4]
jb 0x407680
jmp 0x40762e