Function at 0x4019b0
Capabilities:
Log keystrokes via polling

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x104
mov ebx, dword [esp + 0x120]
mov eax, dword [esp + 0x11c]
cmp dword [0x40d040], eax
jne 0x4019dd
mov ecx, ebx
call dbg.handle_mame_start(unsigned int, long)
xor edi, edi
mov eax, edi
jmp 0x4019ec
cmp dword [0x40d044], eax
jne 0x4019f9
mov ecx, ebx
call dbg.handle_mame_stop(unsigned int, long)
add esp, 0x104
pop esi
pop edi
pop ebx
pop ebp
ret 0x10
mov esi, dword [esp + 0x124]
cmp dword [0x40d048], eax
jne 0x401a20
mov eax, 0x40d070
nop dword [eax]
mov eax, dword [eax]
test eax, eax
je 0x401a8e
cmp dword [eax + 8], ebx
jne 0x401a10
jmp 0x401abb
cmp eax, 0x4a
jne 0x401ac0
mov edi, 1
cmp dword [0x40d054], ebx
jne 0x4019d9
mov ebx, dword [esi + 8]
push 0xc
call sym._malloc
add esp, 4
xor edi, edi
test eax, eax
je 0x4019d9
mov esi, eax
lea ebp, [ebx + 4]
push ebp
call sym._strlen
add esp, 4
inc eax
push eax
call sym._malloc
add esp, 4
test eax, eax
je 0x401c7f
mov ecx, dword [0x40d070]
mov dword [esi], ecx
mov dword [esi + 4], eax
mov ecx, dword [ebx]
mov dword [esi + 8], ecx
push ebp
push eax
call sub.msvcrt.dll_strcpy
add esp, 8
mov dword [0x40d070], esi
jmp 0x4019d9
push ebx
push dword [0x40d03c]
push dword [0x40d050]
push dword [0x40d054]
call dword [sym.imp.USER32.dll_SendMessageA]
mov eax, 0x40d070
nop dword [eax]
mov eax, dword [eax]
test eax, eax
je 0x401ad0
cmp dword [eax + 8], ebx
jne 0x401ab0
mov edi, dword [eax + 4]
jmp 0x401ad5
add esp, 0x104
pop esi
pop edi
pop ebx
pop ebp
jmp dword [sym.imp.USER32.dll_DefWindowProcA]
mov edi, 0x40a0d0
push str.pause
push edi
call sub.msvcrt.dll_strcmp
add esp, 8
test eax, eax
je 0x401b43
push str.led0
push edi
call sub.msvcrt.dll_strcmp
add esp, 8
test eax, eax
je 0x401b8a
push str.led1
push edi
call sub.msvcrt.dll_strcmp
add esp, 8
test eax, eax
je 0x401b9e
push str.led2
push edi
call sub.msvcrt.dll_strcmp
add esp, 8
xor edi, edi
test eax, eax
jne 0x4019d9
mov eax, dword [0x40d064]
and eax, 0xfffffffb
and esi, 1
lea ecx, [eax + esi*4]
call dbg.led_set_state(int)
jmp 0x4019d9
movzx eax, byte [0x40d068]
test esi, esi
je 0x401bb1
test al, 1
je 0x401be9
lea eax, [esp + 4]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardState]
movzx eax, byte [esp + 0x94]
and eax, 1
movzx ecx, byte [esp + 0x18]
and ecx, 1
lea eax, [eax + ecx*2]
movzx ecx, byte [esp + 0x95]
and ecx, 1
lea eax, [eax + ecx*4]
jmp 0x401c23
mov eax, dword [0x40d064]
and eax, 0xfffffffe
and esi, 1
or esi, eax
mov ecx, esi
jmp 0x401c75
mov eax, dword [0x40d064]
and eax, 0xfffffffd
and esi, 1
lea ecx, [eax + esi*2]
jmp 0x401c75
test al, 1
je 0x401c30
lea eax, [esp + 4]
push eax
call dword [sym.imp.USER32.dll_GetKeyboardState]
movzx eax, byte [esp + 0x94]
and eax, 1
movzx ecx, byte [esp + 0x18]
and ecx, 1
lea eax, [eax + ecx*2]
movzx ecx, byte [esp + 0x95]
and ecx, 1
lea eax, [eax + ecx*4]
jmp 0x401c6a
mov word [esp + 4], 0
mov eax, esp
lea ecx, [esp + 4]
push 0
push eax
push 4
push ecx
push 0
push 0
push 0xb0040
push dword [0x40d06c]
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
movzx eax, word [esp + 6]
mov ecx, eax
shr ecx, 1
and ecx, 3
and eax, 1
lea eax, [ecx + eax*4]
mov dword [0x40d05c], eax
mov ecx, dword [0x40d060]
jmp 0x401c75
mov word [esp + 4], 0
mov eax, esp
lea ecx, [esp + 4]
push 0
push eax
push 4
push ecx
push 0
push 0
push 0xb0040
push dword [0x40d06c]
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
movzx eax, word [esp + 6]
mov ecx, eax
shr ecx, 1
and ecx, 3
and eax, 1
lea eax, [ecx + eax*4]
mov dword [0x40d060], eax
mov ecx, dword [0x40d05c]
call dbg.led_set_state(int)
jmp 0x4019d7
push esi
call sub.msvcrt.dll_free
add esp, 4
jmp 0x4019d9