Function at 0x401540
Capabilities:
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x41dc8d
mov eax, dword fs:[0]
push eax
push ecx
sub esp, 0x5b4
mov eax, dword [0x426ad0]
xor eax, ebp
mov dword [ebp - 0x50], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x10], esp
mov byte [ebp - 0x568], 0
push 0xf9
push 0
lea eax, [ebp - 0x567]
push eax
call fcn.0040e2d0
add esp, 0xc
mov dword [ebp - 0x24], 0
lea ecx, [ebp - 0x18]
push ecx
call fcn.00401c20
add esp, 4
push str.COM1
lea edx, [ebp - 0x64]
push edx
call fcn.0040dde0
add esp, 8
cmp dword [ebp + 8], 1
jle 0x4015cc
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + 4]
push ecx
lea edx, [ebp - 0x64]
push edx
call fcn.0040dde0
add esp, 8
mov dword [ebp - 0x48], 0x1c200
cmp dword [ebp + 8], 2
jle 0x4015eb
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + 8]
push ecx
call fcn.0040ddcc
add esp, 4
mov dword [ebp - 0x48], eax
push 0x10
call fcn.00401c80
mov dword [ebp - 0x5ac], eax
mov dword [ebp - 4], 0
cmp dword [ebp - 0x5ac], 0
je 0x40161b
mov ecx, dword [ebp - 0x5ac]
call fcn.00401fd0
mov dword [ebp - 0x5bc], eax
jmp 0x401625
mov dword [ebp - 0x5bc], 0
mov edx, dword [ebp - 0x5bc]
mov dword [ebp - 0x5a8], edx
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp - 0x5a8]
mov dword [ebp - 0x1c], eax
mov ecx, dword [ebp - 0x48]
push ecx
lea edx, [ebp - 0x64]
push edx
push str.ComPort:_s__BaudRate:_d_n
push 0x400
lea eax, [ebp - 0x468]
push eax
call fcn.0040dd98
add esp, 0x14
lea ecx, [ebp - 0x468]
push ecx
call fcn.00401000
add esp, 4
mov dword [ebp - 4], 1
push 0
push 0
push 0
push 8
push 2
mov edx, dword [ebp - 0x48]
push edx
lea eax, [ebp - 0x64]
push eax
mov ecx, dword [ebp - 0x1c]
call fcn.00402080
jmp 0x401732
mov dword [ebp - 4], 0xffffffff
mov ecx, dword [ebp - 0x1c]
call fcn.00401c40
test eax, eax
jne 0x40174f
mov eax, 0xfffffba9
jmp 0x401bf8
push 0x41f524
call fcn.0040dbc5
add esp, 4
push str.hCom__Open_success_n
call fcn.00401000
add esp, 4
push 0x2710
push 0x2710
mov ecx, dword [ebp - 0x1c]
call fcn.00402e10
push 0x41f54c
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [0x42ae80], eax
push str.OpenThread
mov ecx, dword [0x42ae80]
push ecx
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov dword [0x427e84], eax
cmp dword [0x427e84], 0
jne 0x4017b5
mov dword [0x427e84], 0x401010
lea edx, [ebp - 0x64]
push edx
call fcn.004014c0
add esp, 4
push eax
push str.FRSAGENT__d_
lea eax, [ebp - 0x598]
push eax
call fcn.0040dd1b
add esp, 0xc
lea ecx, [ebp - 0x598]
push ecx
push 0x64820
push 0
push 4
push 0
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingA]
mov dword [ebp - 0x4c], eax
cmp dword [ebp - 0x4c], 0
jne 0x401801
or eax, 0xffffffff
jmp 0x401bf8
push 0x64820
push 0
push 0
push 6
mov edx, dword [ebp - 0x4c]
push edx
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov dword [0x427e80], eax
cmp dword [0x427e80], 0
jne 0x40182e
mov eax, 0xfffffffe
jmp 0x401bf8
mov eax, dword [ebp - 0x48]
push eax
lea ecx, [ebp - 0x64]
push ecx
push str.Open_ComPort_s_BaudRate_d_..._..._r_n
call fcn.0040dbc5
add esp, 0xc
push 0
push 0x400
push 0x400
push 0
lea edx, [ebp - 0x44]
push edx
call dword [sym.imp.USER32.dll_PeekMessageA]
push 0
push 0
push 0
lea eax, [ebp - 0x44]
push eax
call dword [sym.imp.USER32.dll_GetMessageA]
mov dword [ebp - 0x68], eax
cmp dword [ebp - 0x68], 0
je 0x401bca
cmp dword [ebp - 0x68], 0xffffffff
jne 0x401890
push str.Error_of_GetMessage_r_n
call fcn.0040dbc5
add esp, 4
jmp 0x401aee
cmp dword [ebp - 0x40], 0xc
jne 0x4018b3
mov ecx, dword [ebp - 0x38]
add ecx, 0xa
push ecx
mov edx, dword [ebp - 0x38]
push edx
push str.SETTEXT:__s__s
call fcn.0040dbc5
add esp, 0xc
jmp 0x401aee
cmp dword [ebp - 0x40], 0x464
jne 0x40192f
mov eax, dword [ebp - 0x38]
push eax
mov ecx, dword [ebp - 0x3c]
push ecx
push str.QUERY:_CLIENT_X__X_n
call fcn.0040dbc5
add esp, 0xc
mov edx, dword [ebp - 0x38]
push edx
call fcn.00401280
add esp, 4
test eax, eax
jne 0x401904
mov eax, dword [ebp - 0x48]
push eax
lea ecx, [ebp - 0x64]
push ecx
call fcn.004014c0
add esp, 4
push eax
mov edx, dword [ebp - 0x40]
push edx
mov eax, dword [ebp - 0x3c]
push eax
call fcn.004013e0
add esp, 0x10
jmp 0x40192a
mov ecx, dword [ebp - 0x48]
push ecx
lea edx, [ebp - 0x64]
push edx
call fcn.004014c0
add esp, 4
or eax, 0x10000
push eax
mov eax, dword [ebp - 0x40]
push eax
mov ecx, dword [ebp - 0x3c]
push ecx
call fcn.004013e0
add esp, 0x10
jmp 0x401aee
cmp dword [ebp - 0x40], 0x465
jne 0x40199e
mov edx, dword [ebp - 0x38]
push edx
mov eax, dword [ebp - 0x3c]
push eax
push str.Register:_CLIENT_X__X_n
call fcn.0040dbc5
add esp, 0xc
movzx ecx, byte [ebp - 0x38]
push ecx
mov edx, dword [ebp - 0x3c]
push edx
call fcn.00401160
add esp, 8
test eax, eax
je 0x401985
mov eax, dword [ebp - 0x48]
push eax
lea ecx, [ebp - 0x64]
push ecx
call fcn.004014c0
add esp, 4
push eax
mov edx, dword [ebp - 0x40]
push edx
mov eax, dword [ebp - 0x3c]
push eax
call fcn.004013e0
add esp, 0x10
jmp 0x401999
push 0
push 0
mov ecx, dword [ebp - 0x40]
push ecx
mov edx, dword [ebp - 0x3c]
push edx
call fcn.004013e0
add esp, 0x10
jmp 0x401aee
cmp dword [ebp - 0x40], 0x466
jne 0x401a09
mov eax, dword [ebp - 0x38]
push eax
mov ecx, dword [ebp - 0x3c]
push ecx
push str.UnRegister:_CLIENT_X__X_n
call fcn.0040dbc5
add esp, 0xc
mov edx, dword [ebp - 0x3c]
push edx
call fcn.00401340
add esp, 4
mov eax, dword [ebp - 0x48]
push eax
lea ecx, [ebp - 0x64]
push ecx
call fcn.004014c0
add esp, 4
push eax
mov edx, dword [ebp - 0x40]
push edx
mov eax, dword [ebp - 0x3c]
push eax
call fcn.004013e0
add esp, 0x10
cmp dword [0x42ae84], 0
jne 0x401a04
push str.NO_CLIENT__n
call fcn.0040dbc5
add esp, 4
jmp 0x401bca
jmp 0x401aee
cmp dword [ebp - 0x40], 0x467
jne 0x401a79
mov ecx, dword [ebp - 0x38]
push ecx
mov edx, dword [ebp - 0x3c]
push edx
push str.Send:_CLIENT_X__X_n
call fcn.0040dbc5
add esp, 0xc
mov eax, dword [ebp - 0x3c]
push eax
call fcn.00401230
add esp, 4
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x28], 0
je 0x401a6a
mov ecx, dword [ebp - 0x38]
push ecx
mov edx, dword [0x427e80]
add edx, 0x1c
push edx
mov ecx, dword [ebp - 0x1c]
call fcn.00402510
mov eax, dword [ebp - 0x38]
push eax
mov ecx, dword [ebp - 0x38]
push ecx
mov edx, dword [ebp - 0x40]
push edx
mov eax, dword [ebp - 0x3c]
push eax
call fcn.004013e0
add esp, 0x10
mov ecx, dword [0x427e80]
mov dword [ecx + 0x18], 0
jmp 0x401aee
cmp dword [ebp - 0x40], 0x468
jne 0x401a84
jmp 0x401aee
cmp dword [ebp - 0x40], 0x469
jne 0x401aa9
mov edx, dword [ebp - 0x38]
push edx
mov eax, dword [ebp - 0x3c]
push eax
push str.Quit:_CLIENT_X__X_n
call fcn.0040dbc5
add esp, 0xc
jmp 0x401bca
cmp dword [ebp - 0x40], 0xc0c0
jne 0x401ac1
push 0x41f648
call fcn.0040dbc5
add esp, 4
jmp 0x401aee
mov ecx, dword [ebp - 0x38]
push ecx
mov edx, dword [ebp - 0x3c]
push edx
mov eax, dword [ebp - 0x40]
push eax
push str.Message_d__wParam_d__lParam_d_n
call fcn.0040dbc5
add esp, 0x10
lea ecx, [ebp - 0x44]
push ecx
call dword [sym.imp.USER32.dll_TranslateMessage]
lea edx, [ebp - 0x44]
push edx
call dword [sym.imp.USER32.dll_DispatchMessageA]
mov eax, dword [ebp - 0x1c]
push eax
call fcn.00401520
add esp, 4
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x401bc5
mov ecx, dword [0x427e80]
mov edx, dword [ecx + 0x6481c]
mov dword [ebp - 0x5a0], edx
mov dword [ebp - 0x56c], 0
mov dword [ebp - 0x5a4], 0x2800
mov eax, dword [ebp - 0x5a4]
cmp eax, dword [ebp - 0x20]
jle 0x401b41
mov ecx, dword [ebp - 0x20]
mov dword [ebp - 0x5a4], ecx
mov edx, dword [ebp - 0x5a4]
push edx
push 0x427e88
mov ecx, dword [ebp - 0x1c]
call fcn.00402450
mov dword [ebp - 0x5a4], eax
mov eax, dword [ebp - 0x5a4]
push eax
push 0x427e88
call fcn.00401030
add esp, 8
mov ecx, dword [ebp - 0x56c]
add ecx, dword [ebp - 0x5a4]
mov dword [ebp - 0x56c], ecx
mov edx, dword [ebp - 0x20]
sub edx, dword [ebp - 0x5a4]
mov dword [ebp - 0x20], edx
jne 0x401b23
mov eax, dword [0x427e80]
mov ecx, dword [eax + 0x6481c]
push ecx
mov edx, dword [ebp - 0x56c]
push edx
push str.Read:__d_Bytes_at__d__n
call fcn.0040dbc5
add esp, 0xc
mov eax, dword [ebp - 0x56c]
push eax
mov ecx, dword [ebp - 0x5a0]
push ecx
call fcn.00401460
add esp, 8
jmp 0x40185b
mov ecx, dword [ebp - 0x1c]
call fcn.00402350
push str.Exit_
call fcn.0040dbc5
add esp, 4
mov edx, dword [0x42ae80]
push edx
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov dword [0x42ae80], 0
xor eax, eax
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x50]
xor ecx, ebp
call fcn.0040e2be
mov esp, ebp
pop ebp
ret