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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x118
mov eax, dword [0x467400]
push esi
mov esi, dword [0x466ca0]
cmp esi, 1
jne 0x40cd8e
cmp byte [0x466ccc], 0
jne 0x40cd8e
movzx ecx, byte [ebp + 0xc]
lea ecx, [ecx + ecx*8]
shl ecx, 5
cmp dword [ecx + eax], 0
mov byte [ebp - 1], 0
je 0x40cd92
mov byte [ebp - 1], 1
cmp byte [ebp + 0x14], 0
je 0x40cdb7
movzx ecx, byte [ebp + 0xc]
lea ecx, [ecx + ecx*8]
shl ecx, 5
cmp byte [ecx + eax + 4], 0
mov al, 1
jne 0x40d5a7
mov al, byte [ebp - 1]
jmp 0x40d5a7
cmp dword [0x4683e0], 0
je 0x40cdd0
cmp byte [ebp + 0x18], 0
jne 0x40cdd0
cmp byte [ebp - 1], 0
mov byte [ebp + 0x17], 1
jne 0x40cdd4
mov byte [ebp + 0x17], 0
cmp esi, 1
push ebx
mov bl, byte [0x466270]
push edi
mov di, word [ebp + 0x10]
jne 0x40ce2f
cmp byte [0x466cca], 0
je 0x40cdf4
cmp byte [ebp + 0x18], 0
jne 0x40ce2f
movzx eax, byte [ebp + 0xc]
mov ecx, dword [0x466ca4]
mov al, byte [eax + ecx]
test al, al
mov edx, dword [0x466ca8]
mov byte [ebp - 3], 1
jne 0x40ce19
movzx eax, di
mov al, byte [eax + edx]
test al, al
je 0x40ce33
mov cl, al
shr cl, 1
shr al, 2
and cl, 1
and al, 1
test cl, cl
je 0x40ce69
test al, al
je 0x40ce6d
jmp 0x40ce7f
mov byte [ebp - 3], 0
mov al, byte [ebp + 0xc]
cmp al, 0x21
jb 0x40cee9
cmp al, 0x28
jbe 0x40cecc
cmp al, 0x5a
jbe 0x40cee9
cmp al, 0x5c
jbe 0x40ce62
cmp al, 0x9f
jbe 0x40cee9
cmp al, 0xa5
ja 0x40cee9
mov al, 1
jmp 0x40d5a5
test al, al
je 0x40ce7f
test cl, cl
je 0x40ce76
test bl, 0x30
jne 0x40ce7f
test al, al
je 0x40ce33
test bl, 0x30
jne 0x40ce33
push 4
movzx eax, di
pop esi
mov dword [0x466ca0], esi
cmp byte [eax + edx], 0
mov word [0x466cae], di
setne al
test cl, cl
mov byte [0x466cb0], al
mov al, byte [ebp + 0xc]
mov byte [0x466cac], al
je 0x40ceb6
test bl, 0x30
mov byte [0x466cb1], 1
jne 0x40cebd
mov byte [0x466cb1], 0
cmp byte [ebp + 0x17], 0
jne 0x40ce36
jmp 0x40d5a2
cmp byte [ebp + 0x17], 0
je 0x40cee9
cmp dword [0x466110], 0
je 0x40cee9
and dword [0x466110], 0
mov byte [0x466118], 0
test bl, bl
je 0x40cf17
cmp esi, 1
jne 0x40cefb
cmp byte [0x466ccb], 0
jne 0x40cf17
cmp bl, 0x10
je 0x40cf17
cmp bl, 0x20
je 0x40cf17
test bl, 0xc
je 0x40d5a2
test bl, 3
je 0x40d5a2
cmp al, 8
jne 0x40cf7e
test bl, bl
jne 0x40cf7e
cmp byte [ebp - 3], bl
je 0x40cf49
cmp esi, 1
jne 0x40cf49
cmp byte [0x466cc8], bl
je 0x40cf49
mov eax, dword [0x466cd4]
test eax, eax
je 0x40cf49
mov ecx, dword [0x466cd0]
dec eax
mov dword [0x466cd4], eax
mov byte [ecx + eax], bl
cmp byte [ebp + 0x17], 0
je 0x40cf65
mov eax, dword [0x466110]
test eax, eax
je 0x40cf65
dec eax
mov dword [0x466110], eax
mov byte [eax + 0x466118], 0
cmp byte [0x46740e], 0
je 0x40d5a2
mov byte [0x46740e], 0
jmp 0x40d5a2
push pe_nt_image_headers32
lea eax, [ebp - 0x118]
push 0x466278
push eax
call fcn.00456f20
xor eax, eax
mov al, byte [0x466270]
push eax
lea eax, [ebp - 0x118]
push eax
call fcn.00411e9d
add esp, 0x14
push 0x14
call dword [sym.imp.USER32.dll_GetKeyState]
test al, 1
je 0x40cfc0
or byte [ebp - 0x104], 1
jmp 0x40cfc7
and byte [ebp - 0x104], 0xfe
call dword [sym.imp.USER32.dll_GetForegroundWindow]
mov esi, eax
xor eax, eax
cmp esi, eax
je 0x40cfdd
push eax
push esi
call dword [sym.imp.USER32.dll_GetWindowThreadProcessId]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
push eax
mov bl, byte [ebp + 0xc]
xor eax, eax
cmp dword [0x4663cc], eax
setne al
push eax
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x118]
push eax
mov eax, dword [ebp + 8]
push dword [eax + 4]
movzx eax, bl
push eax
call dword [sym.imp.USER32.dll_ToAsciiEx]
test eax, eax
mov dword [ebp - 0x18], eax
je 0x40d5a2
cmp byte [0x46740e], 0
je 0x40d031
cmp bl, 9
je 0x40d031
cmp bl, 0x1b
mov byte [ebp - 2], 1
jne 0x40d035
mov byte [ebp - 2], 0
xor eax, eax
cmp dword [ebp - 0x18], eax
jge 0x40d080
cmp byte [ebp - 2], al
jne 0x40d080
cmp byte [ebp - 1], al
je 0x40d079
mov al, byte [0x466270]
test al, 0x30
setne cl
test al, 3
mov byte [0x46740e], bl
mov word [0x46740c], di
mov byte [0x467409], cl
je 0x40d072
test al, 0xc
mov byte [0x467408], 1
jne 0x40d079
mov byte [0x467408], 0
xor al, al
jmp 0x40d5a5
cmp byte [ebp - 8], 0xd
jne 0x40d08a
mov byte [ebp - 8], 0xa
cmp byte [ebp - 7], 0xd
jne 0x40d094
mov byte [ebp - 7], 0xa
cmp byte [ebp + 0x17], 0
mov byte [ebp - 4], 0
je 0x40d3c3
cmp esi, dword [0x46610c]
je 0x40d0b9
mov dword [0x46610c], esi
mov byte [0x466118], 0
jmp 0x40d0ed
mov eax, dword [0x466110]
push 0x5a
pop ecx
sub ecx, eax
cmp ecx, 3
jge 0x40d0ed
mov esi, 0x466145
push esi
call fcn.00457520
mov dword [0x466110], eax
inc eax
push eax
push esi
push 0x466118
call fcn.00457710
mov eax, dword [0x466110]
add esp, 0x10
mov cl, byte [ebp - 8]
mov byte [eax + 0x466118], cl
inc eax
cmp dword [ebp - 0x18], 1
mov dword [0x466110], eax
jle 0x40d111
mov cl, byte [ebp - 7]
mov byte [eax + 0x466118], cl
inc eax
mov dword [0x466110], eax
test eax, eax
mov byte [eax + 0x466118], 0
je 0x40d3c3
and dword [ebp - 0x14], 0
cmp dword [0x4683e4], 0
jbe 0x40d3c3
mov ecx, dword [0x4683e0]
mov edx, dword [ebp - 0x14]
mov esi, dword [ecx + edx*4]
cmp byte [esi + 0x22], 0
jne 0x40d219
cmp byte [esi + 0x2a], 0
movzx ecx, byte [esi + 0x21]
je 0x40d182
cmp eax, ecx
jle 0x40d219
movsx eax, byte [eax + 0x466117]
push eax
push str._____:____.___n__t
call fcn.00457650
test eax, eax
pop ecx
pop ecx
je 0x40d214
mov eax, dword [0x466110]
lea edx, [eax + 0x466116]
jmp 0x40d190
cmp eax, ecx
jl 0x40d219
lea edx, [eax + 0x466117]
cmp byte [esi + 0x25], 0
movzx edi, byte [esi + 0x21]
mov ecx, dword [esi + 4]
mov dword [ebp + 0x14], edx
lea edi, [edi + ecx - 1]
jne 0x40d238
cmp edi, ecx
jb 0x40d1da
movzx eax, byte [edx]
mov ebx, dword [sym.imp.USER32.dll_CharLowerA]
push eax
call ebx
movzx ecx, byte [edi]
push ecx
mov dword [ebp - 0xc], eax
call ebx
mov ecx, dword [ebp - 0xc]
cmp ecx, eax
mov edx, dword [ebp + 0x14]
jne 0x40d1d5
dec edx
dec edi
cmp edi, dword [esi + 4]
mov dword [ebp + 0x14], edx
jae 0x40d1ac
mov eax, dword [0x466110]
cmp edi, dword [esi + 4]
jae 0x40d219
cmp byte [esi + 0x2b], 0
jne 0x40d1fc
cmp edx, 0x466118
jb 0x40d1fc
xor eax, eax
mov al, byte [edx]
push eax
call dword [sym.imp.USER32.dll_IsCharAlphaNumericA]
test eax, eax
jne 0x40d214
push dword [esi + 0x10]
xor eax, eax
mov al, byte [esi + 0x20]
push dword [esi + 0xc]
push eax
call fcn.0040fb9a
add esp, 0xc
test eax, eax
jne 0x40d23e
mov eax, dword [0x466110]
inc dword [ebp - 0x14]
mov ecx, dword [ebp - 0x14]
cmp ecx, dword [0x4683e4]
jb 0x40d131
jmp 0x40d3c3
mov bl, byte [edx]
cmp bl, byte [edi]
jne 0x40d1da
dec edx
dec edi
cmp edi, ecx
jae 0x40d230
jmp 0x40d1da
cmp byte [esi + 0x26], 0
jne 0x40d24b
xor ebx, ebx
jmp 0x40d302
cmp byte [esi + 0x2a], 0
mov eax, dword [0x466110]
lea eax, [eax + 0x466118]
mov dword [ebp - 0x10], eax
je 0x40d262
dec dword [ebp - 0x10]
movzx eax, byte [esi + 0x21]
mov edi, dword [ebp - 0x10]
and dword [ebp - 0xc], 0
sub edi, eax
xor bl, bl
cmp edi, dword [ebp - 0x10]
mov byte [ebp + 0x17], 0
jae 0x40d244
xor eax, eax
mov al, byte [edi]
push eax
call dword [sym.imp.USER32.dll_IsCharLowerA]
test eax, eax
jne 0x40d296
mov al, byte [edi]
push eax
call dword [sym.imp.USER32.dll_IsCharUpperA]
test eax, eax
je 0x40d2b4
cmp byte [ebp + 0x17], 0
jne 0x40d2b1
xor eax, eax
mov al, byte [edi]
mov byte [ebp + 0x17], 1
push eax
call dword [sym.imp.USER32.dll_IsCharUpperA]
test eax, eax
je 0x40d2b1
mov bl, 1
inc dword [ebp - 0xc]
inc edi
cmp edi, dword [ebp - 0x10]
jb 0x40d27a
cmp dword [ebp - 0xc], 0
je 0x40d244
cmp dword [ebp - 0xc], 1
jne 0x40d2cf
neg bl
sbb ebx, ebx
and ebx, 2
jmp 0x40d302
test bl, bl
je 0x40d244
movzx eax, byte [esi + 0x21]
mov edi, dword [ebp - 0x10]
push 2
pop ebx
sub edi, eax
jmp 0x40d2f5
xor eax, eax
mov al, byte [edi]
push eax
call dword [sym.imp.USER32.dll_IsCharLowerA]
test eax, eax
jne 0x40d2fa
inc edi
cmp edi, dword [ebp - 0x10]
jb 0x40d2e5
cmp edi, dword [ebp - 0x10]
jne 0x40d302
xor ebx, ebx
inc ebx
cmp byte [esi + 0x27], 0
jne 0x40d30e
cmp byte [esi + 0x28], 0
je 0x40d316
mov byte [ebp - 1], 0
mov byte [ebp - 4], 1
mov eax, dword [ebp + 0x1c]
mov ecx, dword [ebp - 0x14]
mov dword [eax], ecx
cmp byte [esi + 0x2a], 0
je 0x40d338
cmp byte [esi + 0x27], 0
je 0x40d338
mov eax, dword [0x466110]
movzx eax, byte [eax + 0x466117]
jmp 0x40d34b
cmp byte [ebp - 2], 0
je 0x40d349
cmp byte [ebp - 4], 0
je 0x40d349
xor eax, eax
inc eax
jmp 0x40d34b
xor eax, eax
movzx ecx, bx
movzx eax, ax
shl ecx, 0x10
or ecx, eax
mov eax, dword [ebp + 0x20]
mov dword [eax], ecx
mov eax, dword [esi + 8]
cmp byte [eax], 0
je 0x40d38e
cmp byte [esi + 0x2a], 0
je 0x40d385
mov eax, dword [0x466110]
mov al, byte [eax + 0x466117]
mov byte [0x466118], al
mov dword [0x466110], 1
jmp 0x40d3aa
and dword [0x466110], 0
jmp 0x40d3aa
cmp byte [esi + 0x27], 0
je 0x40d3aa
movzx eax, byte [esi + 0x21]
sub dword [0x466110], eax
cmp byte [esi + 0x2a], 0
je 0x40d3aa
dec dword [0x466110]
cmp byte [esi + 0x2c], 0
je 0x40d3b7
and dword [0x466110], 0
mov eax, dword [0x466110]
mov byte [eax + 0x466118], 0
cmp byte [ebp - 2], 0
je 0x40d4bd
cmp byte [ebp - 1], 0
mov al, byte [0x46740e]
mov byte [ebp - 0x14], al
mov byte [0x46740e], 0
je 0x40d4bd
mov cl, byte [0x466270]
mov byte [0x4673e4], al
xor al, al
test cl, 0x10
je 0x40d3fc
mov al, 0xa0
jmp 0x40d403
test cl, 0x20
je 0x40d408
mov al, 0xa1
mov byte [ebp - 0xc], al
jmp 0x40d40c
mov byte [ebp - 0xc], 0xa0
test al, al
mov al, byte [0x467409]
setne byte [ebp + 0x17]
cmp al, byte [ebp + 0x17]
mov esi, 0xffc3d44d
je 0x40d438
xor ecx, ecx
push esi
push ecx
push ecx
push ecx
push dword [ebp - 0xc]
test al, al
sete cl
push ecx
call fcn.00412b58
add esp, 0x18
cmp byte [0x467408], 0
je 0x40d5aa
test byte [0x466270], 8
jne 0x40d5aa
push esi
xor edi, edi
push edi
push edi
push edi
push 0xa5
push edi
mov bl, 1
call fcn.00412b58
add esp, 0x18
xor eax, eax
mov ax, word [0x46740c]
push 0xffc3d44e
push edi
push edi
push eax
push dword [ebp - 0x14]
push 2
call fcn.00412b58
add esp, 0x18
test bl, bl
je 0x40d49c
push esi
push edi
push edi
push edi
push 0xa5
push 1
call fcn.00412b58
add esp, 0x18
mov al, byte [0x467409]
cmp al, byte [ebp + 0x17]
je 0x40d4bd
push esi
xor ecx, ecx
push edi
test al, al
push edi
setne cl
push edi
push dword [ebp - 0xc]
push ecx
call fcn.00412b58
add esp, 0x18
cmp byte [ebp - 3], 0
je 0x40d5a2
cmp dword [0x466ca0], 1
jne 0x40d5a2
cmp byte [ebp - 4], 0
jne 0x40d5a2
mov eax, dword [0x466cd4]
cmp eax, dword [0x466cd8]
jge 0x40d50c
mov ecx, dword [0x466cd0]
mov dl, byte [ebp - 8]
mov byte [ecx + eax], dl
inc dword [0x466cd4]
mov eax, dword [0x466cd0]
mov ecx, dword [0x466cd4]
mov byte [eax + ecx], 0
cmp dword [ebp - 0x18], 1
jle 0x40d540
mov eax, dword [0x466cd4]
cmp eax, dword [0x466cd8]
jge 0x40d540
mov ecx, dword [0x466cd0]
mov dl, byte [ebp - 7]
mov byte [ecx + eax], dl
inc dword [0x466cd4]
mov eax, dword [0x466cd0]
mov ecx, dword [0x466cd4]
mov byte [eax + ecx], 0
mov eax, dword [0x466cb8]
test eax, eax
je 0x40d58b
xor esi, esi
cmp byte [0x466ccd], 0
je 0x40d5db
cmp byte [0x466cc9], 0
je 0x40d5b3
test eax, eax
jbe 0x40d58b
mov eax, dword [0x466cb4]
push dword [eax + esi*4]
push dword [0x466cd0]
call fcn.004575b0
test eax, eax
pop ecx
pop ecx
jne 0x40d63d
inc esi
cmp esi, dword [0x466cb8]
jb 0x40d565
mov eax, dword [0x466cd8]
cmp dword [0x466cd4], eax
jl 0x40d5a2
mov dword [0x466ca0], 5
mov al, byte [ebp - 1]
pop edi
pop ebx
pop esi
leave
ret
xor bl, bl
xor edi, edi
jmp 0x40d468
test eax, eax
jbe 0x40d58b
mov eax, dword [0x466cb4]
push dword [eax + esi*4]
push dword [0x466cd0]
call fcn.00439071
test eax, eax
pop ecx
pop ecx
jne 0x40d63d
inc esi
cmp esi, dword [0x466cb8]
jb 0x40d5b7
jmp 0x40d58b
cmp byte [0x466cc9], 0
je 0x40d60f
test eax, eax
jbe 0x40d58b
mov eax, dword [0x466cb4]
push dword [eax + esi*4]
push dword [0x466cd0]
call fcn.00457260
test eax, eax
pop ecx
pop ecx
je 0x40d63d
inc esi
cmp esi, dword [0x466cb8]
jb 0x40d5e8
jmp 0x40d58b
test eax, eax
jbe 0x40d58b
mov eax, dword [0x466cb4]
push dword [eax + esi*4]
push dword [0x466cd0]
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
je 0x40d63d
inc esi
cmp esi, dword [0x466cb8]
jb 0x40d617
jmp 0x40d58b
mov dword [0x466ca0], 3
jmp 0x40d5a2