Function at 0x417770
Capabilities:
Get keyboard layout

Disassembly:
sub esp, 0x410
push ebx
push ebp
mov ebp, dword [esp + 0x420]
mov byte [esp + 0xe], 0
push esi
mov esi, edx
mov dword [esp + 0x14], esi
lea eax, [ebp + 0x12]
push edi
mov edi, ecx
test ebp, ebp
jne 0x417799
lea eax, [esp + 0x17]
cmp byte [esp + 0x424], 0
mov dword [esp + 0x1c], eax
jne 0x41782b
mov ebx, edi
test edi, edi
je 0x41782b
movzx eax, word [edi]
test ax, ax
je 0x41782b
mov esi, eax
nop dword [eax + eax]
mov ecx, 0x4e6614
mov edx, 0x20
nop word [eax + eax]
cmp si, dx
je 0x4177f3
movzx eax, word [ecx + 2]
add ecx, 2
mov edx, eax
test ax, ax
jne 0x4177d0
movzx eax, word [ebx + 2]
add ebx, 2
mov esi, eax
test ax, ax
jne 0x4177c0
jmp 0x417827
mov eax, ebx
movzx ecx, word [eax]
cmp ecx, 0x20
je 0x417802
cmp ecx, 9
jne 0x417807
add eax, 2
jmp 0x4177f5
push 0x4e57b4
push eax
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__wcsicmp]
add esp, 8
test eax, eax
jne 0x417827
test ebp, ebp
je 0x417822
mov byte [ebp + 0x16], 1
xor eax, eax
mov word [ebx], ax
mov esi, dword [esp + 0x18]
push 0
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
push eax
push ecx
push 1
lea edx, [esp + 0x22]
mov ecx, edi
call fcn.0041f4d0
mov bl, al
add esp, 0xc
test bl, bl
je 0x41793a
cmp byte [esp + 0x424], 0
je 0x4178d0
lea ecx, [ebx + 0x64]
cmp cl, 3
ja 0x4178ed
cmp byte [esp + 0x42c], 0
je 0x417892
mov ecx, dword [0x4fb9cc]
push 1
push 0
push 0xffffffffffffffff
push 0x4e661c
call fcn.004b5b70
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
push edi
push 0x4e6620
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.004b1470
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4fdb78
push esi
push eax
call fcn.0044ec90
test ebp, ebp
jne 0x417a57
lea eax, [ebp + 4]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test ebp, ebp
je 0x4178ed
push 2
push 0x4e666c
push edi
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__wcsnicmp]
add esp, 0xc
test eax, eax
sete al
mov byte [ebp + 0x17], al
mov al, bl
dec al
cmp al, 5
ja 0x4178fa
cmp bl, 3
jne 0x417902
mov al, bl
add al, 0x66
cmp al, 5
ja 0x417906
mov dl, 1
jmp 0x417908
xor dl, dl
mov cl, byte [esp + 0x16]
mov byte [esp + 0x16], cl
test cl, 0x30
je 0x417924
mov al, bl
sub al, 0x41
cmp al, 0x19
ja 0x417924
and cl, 0xcf
mov byte [esp + 0x16], cl
xor eax, eax
test dl, dl
je 0x417a80
mov edx, dword [esp + 0x1c]
mov byte [edx], 2
jmp 0x417a80
xor edx, edx
mov ecx, edi
call fcn.0041f3e0
movzx eax, ax
test ax, ax
jne 0x417a78
xor ebx, ebx
mov esi, edi
test edi, edi
je 0x4179cb
movzx eax, word [edi]
test ax, ax
je 0x4179cb
cmp eax, 0x30
jb 0x41798d
mov ecx, eax
cmp cx, 0x39
ja 0x41797a
movzx eax, word [esi + 2]
add esi, 2
mov ecx, eax
cmp eax, 0x30
jae 0x417966
cmp esi, edi
jbe 0x41798d
mov ecx, edi
call fcn.0041a370
dec eax
cmp eax, 0xf
ja 0x4179cb
mov ebx, eax
push 3
push 0x4ef740
push esi
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__wcsnicmp]
add esp, 0xc
test eax, eax
jne 0x4179cb
push eax
push eax
push eax
xor edx, edx
lea ecx, [esi + 6]
call fcn.004b1280
add esp, 0xc
test eax, eax
je 0x4179cb
lea ecx, [esi + 6]
call fcn.0041a370
lea ecx, [eax - 1]
cmp ecx, 0x1f
ja 0x4179cb
add eax, 0xb
jmp 0x4179cd
xor eax, eax
movzx eax, ax
test ax, ax
jne 0x417a64
cmp byte [esp + 0x42c], al
je 0x417a05
mov ecx, dword [0x4fb9cc]
push 1
push 0
push 0xffffffffffffffff
push 0x4e6674
call fcn.004b5b70
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
cmp word [edi + 2], 0
jne 0x417a27
cmp byte [0x4fe670], 0
jne 0x417a27
test ebp, ebp
jne 0x417a57
lea eax, [ebp + 3]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
test ebp, ebp
je 0x417a57
push edi
push 0x4e6678
lea eax, [esp + 0x28]
push 0x200
push eax
call fcn.004b1470
add esp, 0x10
lea eax, [esp + 0x20]
mov ecx, 0x4fdb78
push 0x4cfc40
push eax
call fcn.0044ec90
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov edx, dword [esp + 0x1c]
inc dword [0x4fc548]
mov byte [ebx + 0x4fc530], 1
mov byte [edx], 4
mov cl, byte [esp + 0x16]
mov byte [esp + 0x16], cl
test ebp, ebp
je 0x417aec
cmp byte [esp + 0x424], 0
je 0x417aa5
mov word [ebp + 0xa], ax
mov eax, 1
mov byte [ebp + 0x11], bl
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x410
ret
mov word [ebp + 8], ax
mov byte [ebp + 0x10], bl
mov bl, cl
and bl, 0xd5
mov al, bl
and al, 0xc0
movzx ecx, al
neg ecx
sbb ecx, ecx
and ecx, 8
mov edx, ecx
or edx, 1
test bl, 0xc
cmove edx, ecx
mov ecx, edx
or ecx, 4
test bl, 0x30
cmove ecx, edx
mov eax, ecx
or eax, 2
test bl, 3
cmove eax, ecx
or dword [ebp], eax
mov al, byte [esp + 0x16]
and al, 0x2a
or byte [ebp + 0xe], al
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x410
ret