Function at 0x5109be
Capabilities:
Get keyboard layout

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x274
mov eax, dword [0x816078]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0xaa
lea eax, [ebp - 0xf8]
mov bl, cl
push 0
push eax
call fcn.0064f890
and dword [ebp - 0x25c], 0
xor edi, edi
mov esi, dword [0x832098]
add esp, 0xc
inc edi
test esi, esi
jne 0x510a4a
push 0x20
lea edx, [ebp - 0x48]
mov dword [0x832098], edi
mov ecx, 0x6e3ba0
call fcn.00432132
test eax, eax
je 0x510a44
mov eax, dword [ebp - 0x48]
and eax, 0xffdf
cmp ax, 0x50
jne 0x510a32
push 3
pop esi
mov dword [0x832098], esi
jmp 0x510a4a
mov esi, dword [0x832098]
cmp ax, 0x4f
push 2
pop eax
cmove esi, eax
jmp 0x510a2a
mov esi, dword [0x832098]
lea ecx, [ebp - 0xf8]
call fcn.00520df2
cmp esi, edi
jne 0x510a7d
test bl, bl
je 0x510a62
call fcn.00510d3d
mov edx, 0x75f6dc
mov ecx, 0x6e3ba0
call fcn.00432237
test eax, eax
je 0x510a86
push 2
pop eax
mov dword [0x832098], eax
cmp esi, 3
je 0x510c4d
call dword [sym.imp.KERNEL32.dll_GetACP]
lea ecx, [ebp - 0xf8]
mov esi, eax
call fcn.00518a3b
test al, al
je 0x510b08
or dword [ebp - 0x264], 0xffffffff
lea edx, [ebp - 0x264]
push 1
push 1
push 1
lea ecx, [ebp - 0xf8]
call fcn.0051d5ac
test eax, eax
js 0x510aeb
mov ecx, dword [ebp - 0x264]
lea edx, [ebp - 0x260]
and dword [ebp - 0x260], 0
call fcn.0051e56a
test eax, eax
js 0x510aeb
test dword [ebp - 0x260], 0x800
je 0x510aeb
mov al, 1
jmp 0x510aed
xor al, al
lea edx, [ebp - 0xf8]
mov ecx, 0x75f578
push 0x55
test al, al
jne 0x510b03
mov ecx, str.zh_TW
call fcn.00437c04
push 1
mov ecx, 0x832228
call fcn.0051287e
pop ecx
xor ebx, ebx
lea ecx, [ebp - 0xf8]
push ebx
call fcn.0051287e
pop ecx
cmp esi, 0x4ea
jne 0x510b38
push ebx
mov ecx, str.fr_FR
call fcn.0051287e
pop ecx
push ebx
push ebx
mov ebx, dword [sym.imp.USER32.dll_GetKeyboardLayoutList]
lea esi, [ebp - 0x28]
call ebx
mov edi, eax
cmp edi, 8
jbe 0x510b62
mov ecx, edi
shl ecx, 2
push ecx
call fcn.006707e1
mov esi, eax
pop ecx
test esi, esi
je 0x510be8
push esi
push edi
call ebx
xor ebx, ebx
test edi, edi
je 0x510bda
movzx eax, word [esi + ebx*4]
lea ecx, [ebp - 0x258]
push 0
push 0x55
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_LCIDToLocaleName]
test eax, eax
je 0x510bd5
push 0
lea ecx, [ebp - 0x258]
call fcn.0051287e
lea edx, [ebp - 0x1a8]
lea ecx, [ebp - 0x258]
call fcn.0051253d
pop ecx
test eax, eax
js 0x510bd5
cmp word [ebp - 0x1a8], 0
je 0x510bd5
mov edx, 0x6d93c4
lea ecx, [ebp - 0x1a8]
call fcn.00439a18
test eax, eax
je 0x510bd5
push 0
lea ecx, [ebp - 0x1a8]
call fcn.0051287e
pop ecx
inc ebx
cmp ebx, edi
jb 0x510b6c
lea eax, [ebp - 0x28]
cmp esi, eax
je 0x510be8
push esi
call fcn.0064e37d
pop ecx
call fcn.0050e2fa
test al, al
jne 0x510c4d
lea ecx, [ebp - 0x270]
call fcn.0050feb9
mov eax, dword [ebp - 0x26c]
mov esi, dword [ebp - 0x270]
sub eax, esi
push 0x18
cdq
pop ebx
idiv ebx
mov edi, eax
test edi, edi
je 0x510c42
cmp dword [esi + 0x14], 8
mov ecx, esi
jb 0x510c20
mov ecx, dword [esi]
call fcn.0050e65d
test al, al
jne 0x510c3b
cmp dword [esi + 0x14], 8
mov ecx, esi
jb 0x510c33
mov ecx, dword [esi]
push 0
call fcn.0051287e
pop ecx
add esi, ebx
sub edi, 1
jne 0x510c16
lea ecx, [ebp - 0x270]
call fcn.004158e4
mov esi, 0x8322d8
mov ecx, esi
call fcn.0050e65d
xor ebx, ebx
test al, al
jne 0x510c68
push ebx
mov ecx, esi
call fcn.0051287e
pop ecx
mov eax, dword [0x82a5c4]
mov esi, 0xac
mov ecx, dword [0x82a5c0]
mov edi, ebx
sub eax, ecx
mov dword [0x8320a4], ebx
cdq
idiv esi
mov dword [0x8320a0], ebx
mov dword [0x83209c], ebx
mov dword [ebp - 0x260], esi
test eax, eax
je 0x510d2c
mov esi, ebx
push 1
push 1
add ecx, esi
mov dword [ebp - 0x25c], ebx
push 1
lea edx, [ebp - 0x25c]
call fcn.0051d5ac
test eax, eax
js 0x510d09
cmp dword [0x83209c], 0
jne 0x510cd7
mov ecx, dword [ebp - 0x25c]
call fcn.0050e2d3
mov dword [0x83209c], eax
cmp dword [0x8320a0], 0
jne 0x510cf0
mov ecx, dword [ebp - 0x25c]
call fcn.0050e285
mov dword [0x8320a0], eax
cmp dword [0x8320a4], 0
jne 0x510d09
mov ecx, dword [ebp - 0x25c]
call fcn.0050e2ac
mov dword [0x8320a4], eax
mov eax, dword [0x82a5c4]
inc edi
mov ecx, dword [0x82a5c0]
add esi, 0xac
sub eax, ecx
cdq
idiv dword [ebp - 0x260]
cmp edi, eax
jb 0x510ca1
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0064c681
mov esp, ebp
pop ebp
ret