Function at 0x4f002e80
Capabilities:
Get keyboard layout

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x18
push ebx
mov ebx, ecx
mov dword [ebp - 0xc], edx
mov dword [ebp - 4], ebx
push esi
push edi
test ebx, ebx
je 0x4f006356
mov esi, dword fs:[0x18]
mov eax, dword [esi + 0xfdc]
test eax, eax
jns 0x4f002eae
add esi, eax
mov eax, dword [0x4f01ac28]
xor ecx, ecx
movzx edi, bx
cmp ecx, dword [eax + 0xc]
jb 0x4f002ecc
ja 0x4f00634e
cmp edi, dword [eax + 8]
jae 0x4f00634e
mov eax, dword [0x4f01a9f0]
imul eax, edi
add eax, dword [0x4f01a9e8]
cdq
mov ecx, eax
mov dword [ebp - 0x14], edx
mov eax, ebx
shr eax, 0x10
mov dword [ebp - 0x14], eax
movzx eax, ax
cmp ax, word [ecx + 0x1a]
jne 0x4f006337
test byte [ecx + 0x19], 1
jne 0x4f00634e
cmp byte [ecx + 0x18], 0x11
jne 0x4f00634e
mov edx, dword [esi + 0x820]
mov eax, edx
or eax, dword [esi + 0x824]
je 0x4f00635d
mov eax, dword [ecx + 0x10]
cmp eax, dword [edx]
jne 0x4f00635d
mov eax, dword [ecx + 0x14]
cmp eax, dword [edx + 4]
jne 0x4f00635d
mov ebx, dword [esi + 0x828]
add ebx, dword [ecx]
mov eax, dword [esi + 0x82c]
adc eax, dword [ecx + 4]
mov ecx, ebx
or ecx, eax
je 0x4f00634e
movzx esi, word [ebx]
imul esi, dword [0x4f01a9f0]
mov eax, dword fs:[0x18]
add esi, dword [0x4f01a9e8]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f002f71
add eax, ecx
cmp dword [eax + 0x78], 0
je 0x4f00636f
mov eax, dword fs:[0x18]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f002f8d
add eax, ecx
mov ecx, dword [eax + 0x78]
mov dword [ebp - 8], ecx
mov ecx, dword [eax + 0x7c]
mov eax, dword [esi + 8]
cdq
cmp eax, dword [ebp - 8]
jne 0x4f006389
cmp edx, ecx
jne 0x4f006389
mov ebx, dword [ebx + 0x18]
test ebx, ebx
je 0x4f0063a5
test byte [ebx + 8], 0x40
jne 0x4f006356
lock inc dword [ebx + 4]
lea esi, [ebx + 0x10]
push esi
call dword [sym.imp.ntdll.dll_RtlEnterCriticalSection]
mov eax, dword fs:[0x18]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f002fe0
add eax, ecx
mov eax, dword [eax + 0x800]
and eax, 0x100
or eax, 0
je 0x4f003196
cmp dword [ebx], 0
je 0x4f0031e4
mov eax, dword fs:[0x18]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f00300f
add eax, ecx
mov eax, dword [eax + 0x800]
and eax, 0x800
or eax, 0
jne 0x4f006428
mov eax, dword fs:[0x18]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f003035
add eax, ecx
mov eax, dword [eax + 0x800]
and eax, 0x100
or eax, 0
je 0x4f00317d
mov esi, dword fs:[0x18]
mov eax, dword [esi + 0xfdc]
test eax, eax
jns 0x4f00305c
add esi, eax
mov ecx, dword [0x4f01ac28]
xor eax, eax
cmp eax, dword [ecx + 0xc]
jb 0x4f003078
ja 0x4f006492
cmp edi, dword [ecx + 8]
jae 0x4f006492
imul edi, dword [0x4f01a9f0]
add edi, dword [0x4f01a9e8]
mov eax, edi
cdq
mov ecx, eax
mov eax, dword [ebp - 0x14]
movzx eax, ax
cmp ax, word [ecx + 0x1a]
jne 0x4f00647b
test byte [ecx + 0x19], 1
jne 0x4f006492
cmp byte [ecx + 0x18], 0x11
jne 0x4f006492
mov edx, dword [esi + 0x820]
mov eax, edx
or eax, dword [esi + 0x824]
je 0x4f00649f
mov eax, dword [ecx + 0x10]
cmp eax, dword [edx]
jne 0x4f00649f
mov eax, dword [ecx + 0x14]
cmp eax, dword [edx + 4]
jne 0x4f00649f
mov edi, dword [esi + 0x828]
add edi, dword [ecx]
mov eax, dword [esi + 0x82c]
adc eax, dword [ecx + 4]
mov ecx, edi
or ecx, eax
je 0x4f006492
movzx esi, word [edi]
imul esi, dword [0x4f01a9f0]
mov eax, dword fs:[0x18]
add esi, dword [0x4f01a9e8]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f003116
add eax, ecx
cmp dword [eax + 0x78], 0
je 0x4f0064b3
mov eax, dword fs:[0x18]
mov ecx, dword [eax + 0xfdc]
test ecx, ecx
jns 0x4f003132
add eax, ecx
mov ecx, dword [eax + 0x78]
mov dword [ebp - 8], ecx
mov ecx, dword [eax + 0x7c]
mov eax, dword [esi + 8]
cdq
cmp eax, dword [ebp - 8]
jne 0x4f0064cd
cmp edx, ecx
jne 0x4f0064cd
mov esi, dword [edi + 0x18]
test esi, esi
je 0x4f0064ed
test byte [esi + 8], 0x40
jne 0x4f00317d
lock inc dword [esi + 4]
cmp dword [esi + 0x30], 0
je 0x4f006561
or eax, 0xffffffff
lock xadd dword [esi + 4], eax
je 0x4f0065bd
lea eax, [ebx + 0x10]
push eax
call dword [sym.imp.ntdll.dll_RtlLeaveCriticalSection]
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_LocalLock]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 1
push dword [ebp - 4]
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp esi, eax
jne 0x4f0031dc
mov ecx, dword [0x4f01ac28]
mov eax, ecx
or eax, dword [0x4f01ac2c]
je 0x4f0031dc
test byte [ecx], 4
je 0x4f0031dc
push 0
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
movzx ecx, ax
mov eax, ecx
shl eax, 0x10
push 1
or eax, ecx
push eax
call sym.IMM32.dll_CtfImmTIMActivate
lea esi, [ebx + 0x10]
jmp 0x4f002ff4
push 2
push dword [ebp - 4]
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
test eax, eax
je 0x4f006416
push 0x164
push 0x42
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov dword [ebx], eax
test eax, eax
je 0x4f006416
push 1
push dword [ebp - 4]
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
push ebx
push dword [ebp - 0xc]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardLayout]
mov ecx, dword [ebp - 4]
mov edx, eax
call fcn.4f0027a0
test eax, eax
jne 0x4f002ffd
jmp 0x4f006408
test ax, ax
je 0x4f002ef5
mov edx, 0xffff
cmp ax, dx
je 0x4f002ef5
push 6
call dword [sym.imp.ntdll.dll_RtlSetLastWin32Error]
xor eax, eax
jmp 0x4f00318f
push 0x38
push ebx
call dword [sym.imp.win32u.dll_NtUserCallOneParam]
mov ebx, eax
xor eax, eax
jmp 0x4f002f45
push 0xe
call dword [sym.imp.win32u.dll_NtUserGetThreadState]
test eax, eax
jne 0x4f002f7b
mov dword [ebp - 8], eax
xor ecx, ecx
jmp 0x4f002f96
mov eax, dword [ebx]
mov esi, dword fs:[0x18]
push 0
push eax
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
cmp eax, dword [esi + 0x20]
jne 0x4f006356
jmp 0x4f002fab
mov edx, 0x34
lea ecx, [edx - 0x2c]
call fcn.4f002470
mov ebx, eax
test ebx, ebx
je 0x4f006356
lea esi, [ebx + 0x10]
push esi
call dword [sym.imp.ntdll.dll_RtlInitializeCriticalSection]
lock inc dword [ebx + 4]
push 0xb
call dword [sym.imp.win32u.dll_NtUserGetThreadState]
push ebx
push 0
push dword [ebp - 4]
mov dword [ebx + 0xc], eax
call dword [sym.imp.win32u.dll_NtUserUpdateInputContext]
test eax, eax
jne 0x4f0063fc
push esi
call dword [sym.imp.ntdll.dll_RtlDeleteCriticalSection]
push ebx
push 0
push dword [0x4f01a9dc]
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x4f006356
or dword [ebx + 8], 0x100
jmp 0x4f002fc0
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov dword [ebx], 0
push esi
call dword [sym.imp.ntdll.dll_RtlLeaveCriticalSection]
push ebx
call sym.IMM32.dll_ImmUnlockClientImc
jmp 0x4f006356
mov edi, dword [ebp - 4]
push edi
call sym.IMM32.dll_ImmLockClientImc
mov esi, eax
test esi, esi
je 0x4f00317d
cmp dword [esi + 0x30], 0
jne 0x4f00316f
push 1
push edi
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
mov edi, eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp edi, eax
jne 0x4f00316f
push dword [ebp - 4]
mov dword [esi + 0x30], 1
call dword [sym.imp.MSCTF.dll_CtfImeCreateInputContext]
test eax, eax
jns 0x4f00316f
jmp 0x4f0065b1
test ax, ax
je 0x4f00309a
mov edx, 0xffff
cmp ax, dx
je 0x4f00309a
push 6
call dword [sym.imp.ntdll.dll_RtlSetLastWin32Error]
jmp 0x4f00317d
push 0x38
push dword [ebp - 4]
call dword [sym.imp.win32u.dll_NtUserCallOneParam]
mov edi, eax
xor eax, eax
jmp 0x4f0030ea
push 0xe
call dword [sym.imp.win32u.dll_NtUserGetThreadState]
test eax, eax
jne 0x4f003120
mov dword [ebp - 8], eax
xor ecx, ecx
jmp 0x4f00313b
mov eax, dword [edi]
mov esi, dword fs:[0x18]
push 0
push eax
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
cmp eax, dword [esi + 0x20]
jne 0x4f00317d
jmp 0x4f003150
mov edx, 0x34
lea ecx, [edx - 0x2c]
call fcn.4f002470
mov esi, eax
test esi, esi
je 0x4f00317d
lea edi, [esi + 0x10]
push edi
call dword [sym.imp.ntdll.dll_RtlInitializeCriticalSection]
lock inc dword [esi + 4]
push 0xb
call dword [sym.imp.win32u.dll_NtUserGetThreadState]
push esi
push 0
push dword [ebp - 4]
mov dword [esi + 0xc], eax
call dword [sym.imp.win32u.dll_NtUserUpdateInputContext]
test eax, eax
jne 0x4f006555
push edi
jmp 0x4f00653b
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [esi + 0x10]
push eax
call dword [sym.imp.ntdll.dll_RtlDeleteCriticalSection]
push esi
push 0
push dword [0x4f01a9dc]
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x4f00317d
or dword [esi + 8], 0x100
jmp 0x4f003161
push 1
push dword [ebp - 4]
call dword [sym.imp.win32u.dll_NtUserQueryInputContext]
mov edi, eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp edi, eax
jne 0x4f00316f
mov ecx, dword [0x4f01ac28]
mov eax, ecx
or eax, dword [0x4f01ac2c]
je 0x4f00316f
test byte [ecx], 4
je 0x4f00316f
push dword [ebp - 4]
mov dword [esi + 0x30], 1
call dword [sym.imp.MSCTF.dll_CtfImeCreateInputContext]
test eax, eax
jns 0x4f00316f
mov dword [esi + 0x30], 0
jmp 0x4f00316f
test byte [esi + 8], 0x40
je 0x4f00317d
mov eax, dword [esi]
test eax, eax
je 0x4f006537
jmp 0x4f006530