Function at 0x40cfe0
Capabilities:
Get keyboard layout

Disassembly:
sub esp, 0x410
push ebx
push ebp
mov ebp, dword [esp + 0x420]
xor al, al
mov byte [esp + 0xd], al
mov byte [esp + 0xe], al
mov dword [esp + 0x14], edx
lea eax, [ebp + 0x14]
push esi
push edi
mov edi, ecx
test ebp, ebp
jne 0x40d00c
lea eax, [esp + 0x17]
cmp byte [esp + 0x424], 0
mov dword [esp + 0x18], eax
jne 0x40d061
mov edx, 0x4bfc0c
call fcn.0040ab90
mov esi, eax
test esi, esi
je 0x40d061
mov ecx, esi
nop dword [eax]
movzx edx, word [ecx]
cmp edx, 0x20
je 0x40d03d
cmp edx, 9
jne 0x40d042
add ecx, 2
jmp 0x40d030
push 0x4bee74
push ecx
call fcn.0048f253
add esp, 8
test eax, eax
jne 0x40d061
test ebp, ebp
je 0x40d05c
mov byte [ebp + 0x18], 1
xor eax, eax
mov word [esi], ax
push 0
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
movzx ecx, word [edi]
test cx, cx
je 0x40d0ea
cmp word [edi + 2], 0
jne 0x40d094
push eax
lea edx, [esp + 0x1a]
call fcn.00412730
mov bl, al
add esp, 4
mov al, byte [esp + 0x16]
mov byte [esp + 0x15], al
jmp 0x40d152
call fcn.0040ab40
cmp ax, 0x56
jne 0x40d0c5
mov cx, word [edi + 2]
call fcn.0040ab40
cmp ax, 0x4b
jne 0x40d0c5
push 0x10
lea eax, [edi + 4]
push 0
push eax
call fcn.00492e76
add esp, 0xc
mov bl, al
jmp 0x40d152
xor esi, esi
nop word [eax + eax]
push edi
push dword [esi*8 + 0x4ce940]
call fcn.0048f253
add esp, 8
test eax, eax
je 0x40d14b
inc esi
cmp esi, 0x6d
jl 0x40d0d0
xor bl, bl
mov ecx, edi
call fcn.004125c0
movzx eax, ax
test ax, ax
jne 0x40d2b3
push 1
lea edx, [esp + 0x20]
mov ecx, edi
call fcn.0044eb40
movzx eax, ax
add esp, 4
test ax, ax
jne 0x40d29b
cmp byte [esp + 0x42c], al
je 0x40d23c
mov ecx, dword [0x4d166c]
push 1
push 0
push 0xffffffffffffffff
push 0x4bfc6c
call fcn.00475930
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov bl, byte [esi*8 + 0x4ce944]
test bl, bl
je 0x40d0ec
cmp byte [esp + 0x424], 0
je 0x40d1da
mov al, bl
add al, 0x64
cmp al, 3
ja 0x40d1f6
cmp byte [esp + 0x42c], 0
je 0x40d199
mov ecx, dword [0x4d166c]
push 1
push 0
push 0xffffffffffffffff
push 0x4bfc14
call fcn.00475930
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
push edi
push 0x4bfc18
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.00472ce0
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4d3ee0
push dword [esp + 0x1c]
push eax
call fcn.0042d580
test ebp, ebp
jne 0x40d28e
lea eax, [ebp + 4]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test ebp, ebp
je 0x40d1f6
push 2
push 0x4bfc64
push edi
call fcn.00491336
add esp, 0xc
test eax, eax
sete al
mov byte [ebp + 0x19], al
mov al, bl
dec al
cmp al, 5
ja 0x40d203
cmp bl, 3
jne 0x40d20b
mov al, bl
add al, 0x66
cmp al, 5
ja 0x40d20f
mov cl, 1
jmp 0x40d211
xor cl, cl
mov dl, byte [esp + 0x15]
test dl, 0x30
je 0x40d229
mov al, bl
sub al, 0x41
cmp al, 0x19
ja 0x40d229
and dl, 0xcf
mov byte [esp + 0x15], dl
xor eax, eax
test cl, cl
je 0x40d2b7
mov ecx, dword [esp + 0x18]
mov byte [ecx], 2
jmp 0x40d2b7
cmp word [edi + 2], 0
jne 0x40d25e
cmp byte [0x4d49ac], 0
jne 0x40d25e
test ebp, ebp
jne 0x40d28e
lea eax, [ebp + 3]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test ebp, ebp
je 0x40d28e
push edi
push 0x4bfc70
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.00472ce0
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4d3ee0
push 0x4ac22c
push eax
call fcn.0042d580
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov ecx, dword [esp + 0x18]
mov ebx, dword [esp + 0x1c]
inc dword [0x4d214c]
mov byte [ecx], 4
mov byte [ebx + 0x4d2134], 1
mov dl, byte [esp + 0x15]
test ebp, ebp
je 0x40d325
cmp byte [esp + 0x424], 0
je 0x40d2dc
mov word [ebp + 0xa], ax
mov eax, 1
mov byte [ebp + 0x13], bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov word [ebp + 8], ax
mov byte [ebp + 0x12], bl
mov bl, dl
and bl, 0xd5
mov al, bl
and al, 0xc0
movzx ecx, al
mov al, bl
neg ecx
sbb ecx, ecx
and ecx, 8
mov edx, ecx
or edx, 1
and al, 0xc
mov al, bl
cmove edx, ecx
mov ecx, edx
or ecx, 4
and al, 0x30
cmove ecx, edx
mov eax, ecx
or eax, 2
and bl, 3
cmove eax, ecx
or dword [ebp + 0xc], eax
mov al, byte [esp + 0x15]
and al, 0x2a
or byte [ebp + 0x10], al
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x410
ret