Function at 0x40e840
Capabilities:
Get keyboard layout

Disassembly:
sub esp, 0x410
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x428]
mov esi, edx
mov dword [esp + 0x14], esi
mov ebp, ecx
mov byte [esp + 0x13], 0
lea eax, [edi + 0x12]
test edi, edi
jne 0x40e869
lea eax, [esp + 0x1b]
cmp byte [esp + 0x424], 0
mov dword [esp + 0x1c], eax
jne 0x40e8fb
mov ebx, ebp
test ebp, ebp
je 0x40e8fb
movzx eax, word [ebp]
test ax, ax
je 0x40e8fb
mov esi, eax
nop dword [eax]
mov ecx, 0x4d5384
mov edx, 0x20
nop word [eax + eax]
cmp si, dx
je 0x40e8c3
movzx eax, word [ecx + 2]
add ecx, 2
mov edx, eax
test ax, ax
jne 0x40e8a0
movzx eax, word [ebx + 2]
add ebx, 2
mov esi, eax
test ax, ax
jne 0x40e890
jmp 0x40e8f7
mov eax, ebx
movzx ecx, word [eax]
cmp ecx, 0x20
je 0x40e8d2
cmp ecx, 9
jne 0x40e8d7
add eax, 2
jmp 0x40e8c5
push 0x4c1e8c
push eax
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__wcsicmp]
add esp, 8
test eax, eax
jne 0x40e8f7
test edi, edi
je 0x40e8f2
mov byte [edi + 0x16], 1
xor eax, eax
mov word [ebx], ax
mov esi, dword [esp + 0x14]
push 0
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
push eax
push ecx
push 1
lea edx, [esp + 0x1f]
mov ecx, ebp
call fcn.00416200
mov bl, al
add esp, 0xc
test bl, bl
je 0x40ea0a
cmp byte [esp + 0x424], 0
je 0x40e9a0
lea ecx, [ebx + 0x64]
cmp cl, 3
ja 0x40e9bd
cmp byte [esp + 0x42c], 0
je 0x40e962
mov ecx, dword [0x4e97f8]
push 1
push 0
push 0xffffffffffffffff
push 0x4d538c
call fcn.004a5f40
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
push ebp
push 0x4d5390
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.004a19b0
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4eb990
push esi
push eax
call fcn.0043eb10
test edi, edi
jne 0x40eab9
lea eax, [edi + 4]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test edi, edi
je 0x40e9bd
push 2
push 0x4d53dc
push ebp
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__wcsnicmp]
add esp, 0xc
test eax, eax
sete al
mov byte [edi + 0x17], al
mov al, bl
dec al
cmp al, 5
ja 0x40e9ca
cmp bl, 3
jne 0x40e9d2
mov al, bl
add al, 0x66
cmp al, 5
ja 0x40e9d6
mov dl, 1
jmp 0x40e9d8
xor dl, dl
mov cl, byte [esp + 0x13]
mov byte [esp + 0x13], cl
test cl, 0x30
je 0x40e9f4
mov al, bl
sub al, 0x41
cmp al, 0x19
ja 0x40e9f4
and cl, 0xcf
mov byte [esp + 0x13], cl
xor eax, eax
test dl, dl
je 0x40eae6
mov edx, dword [esp + 0x1c]
mov byte [edx], 2
jmp 0x40eae6
xor edx, edx
mov ecx, ebp
call fcn.00416110
movzx eax, ax
test ax, ax
jne 0x40eade
push 1
lea edx, [esp + 0x18]
mov ecx, ebp
call fcn.0046ba90
movzx eax, ax
add esp, 4
test ax, ax
jne 0x40eac6
cmp byte [esp + 0x42c], al
je 0x40ea67
mov ecx, dword [0x4e97f8]
push 1
push 0
push 0xffffffffffffffff
push 0x4d53e4
call fcn.004a5f40
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
cmp word [ebp + 2], 0
jne 0x40ea89
cmp byte [0x4ec488], 0
jne 0x40ea89
test edi, edi
jne 0x40eab9
lea eax, [edi + 3]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test edi, edi
je 0x40eab9
push ebp
push 0x4d53e8
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.004a19b0
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4eb990
push 0x4bfb90
push eax
call fcn.0043eb10
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov edx, dword [esp + 0x1c]
mov ebx, dword [esp + 0x14]
inc dword [0x4ea364]
mov byte [edx], 4
mov byte [ebx + 0x4ea34c], 1
mov cl, byte [esp + 0x13]
mov byte [esp + 0x13], cl
test edi, edi
je 0x40eb53
cmp byte [esp + 0x424], 0
je 0x40eb0b
mov word [edi + 0xa], ax
mov eax, 1
mov byte [edi + 0x11], bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov word [edi + 8], ax
mov byte [edi + 0x10], bl
mov bl, cl
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 [edi], eax
mov al, byte [esp + 0x13]
and al, 0x2a
or byte [edi + 0xe], al
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x410
ret