Function at 0x401810
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xd0
mov eax, dword [0x406008]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x20]
push ebx
mov ebx, dword [ebp + 8]
push esi
mov esi, dword [ebp + 0x10]
push 0x404660
push esi
mov dword [ebp - 0xb4], eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
add esp, 8
mov dword [ebp - 0x9c], eax
test eax, eax
jne 0x40188c
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
add esp, 4
push eax
push esi
push 0x404664
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00401180
add esp, 0x10
or eax, 0xffffffff
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004026f8
mov esp, ebp
pop ebp
ret
push edi
push esi
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push 0x40467c
push 2
call esi
add esp, 4
push eax
call fcn.00401180
lea eax, [ebp - 0x18]
push eax
push 9
push 0
push dword [ebx]
call dword [sym.imp.modbus.dll_modbus_read_input_registers]
mov edi, eax
add esp, 0x1c
test edi, edi
jns 0x4018e8
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call dword [sym.imp.modbus.dll_modbus_strerror]
add esp, 4
push eax
push str.Read_bootloader_config_error:__s_n
push 2
call esi
add esp, 4
push eax
call fcn.00401180
jmp 0x401bfd
movzx eax, word [ebp - 0x18]
movzx esi, word [ebp - 0x10]
movzx ecx, word [ebp - 0xc]
mov dword [ebp - 0xac], eax
movzx eax, word [ebp - 0x12]
shl ecx, 0x10
shl esi, 0x10
or esi, eax
movzx eax, word [ebp - 0xe]
or ecx, eax
movzx eax, word [ebp - 0xa]
mov dword [ebp - 0xa0], ecx
movzx ecx, word [ebp - 8]
shl ecx, 0x10
or ecx, eax
push 0x64
mov dword [ebp - 0xb0], ecx
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp esi, 0x8000
je 0x40195a
push dword [ebp - 0xb0]
push dword [ebx]
call dword [sym.imp.modbus.dll_modbus_get_slave]
add esp, 4
push eax
push ebx
call fcn.004016f0
mov edi, eax
add esp, 0xc
test edi, edi
js 0x401c00
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
push 2
push 0
push dword [ebp - 0x9c]
call esi
push dword [ebp - 0x9c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ftell]
push 0
push 0
push dword [ebp - 0x9c]
mov dword [ebp - 0xa4], eax
call esi
mov esi, dword [ebp - 0x9c]
lea eax, [ebp - 0x98]
push esi
push 0x1c
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
movups xmm0, xmmword [ebp - 0x98]
sub dword [ebp - 0xa4], 0x1c
push esi
movups xmmword [ebp - 0xd0], xmm0
mov dword [ebp - 0xa8], 0
movq xmm0, qword [ebp - 0x88]
movq qword [ebp - 0xc0], xmm0
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_feof]
add esp, 0x30
test eax, eax
jne 0x401b1d
mov eax, dword [ebp - 0xac]
movzx ecx, ax
mov dword [ebp - 0xac], ecx
nop word [eax + eax]
mov esi, dword [ebp - 0xa0]
xor edx, edx
mov eax, esi
div ecx
test edx, edx
jne 0x401a38
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
push esi
push dword [ebx]
call dword [sym.imp.modbus.dll_modbus_get_slave]
add esp, 4
push eax
push ebx
call fcn.004016f0
mov edi, eax
add esp, 0xc
test edi, edi
js 0x401c00
push dword [ebp - 0x9c]
lea eax, [ebp - 0x98]
push 0x80
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov esi, eax
add esp, 0x10
test esi, esi
js 0x401c00
mov ecx, esi
and ecx, 0x80000001
jns 0x401a6e
dec ecx
or ecx, 0xfffffffe
inc ecx
cmp ecx, 1
jne 0x401a7c
mov byte [ebp + esi - 0x98], 0xff
inc esi
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
test esi, esi
jle 0x401ab5
push esi
lea eax, [ebp - 0x98]
push eax
push dword [ebp - 0xa0]
push dword [ebx]
call dword [sym.imp.modbus.dll_modbus_get_slave]
add esp, 4
push eax
push ebx
call fcn.00401cb0
mov edi, eax
add esp, 0x14
test edi, edi
js 0x401c00
mov eax, dword [ebp - 0xa8]
add dword [ebp - 0xa0], esi
add eax, esi
cmp dword [ebp + 0x18], 0
mov dword [ebp - 0xa8], eax
je 0x401b00
imul eax, eax, 0x64
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
cdq
idiv dword [ebp - 0xa4]
push eax
push str.__d___r
push 1
call esi
add esp, 4
push eax
call fcn.00401180
push 1
call esi
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
add esp, 0x14
push dword [ebp - 0x9c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_feof]
mov ecx, dword [ebp - 0xac]
add esp, 4
test eax, eax
je 0x401a00
cmp dword [ebp + 0x14], 0
je 0x401bd7
mov ecx, dword [ebp - 0xa4]
mov eax, ecx
and eax, 0x80000001
jns 0x401b3b
dec eax
or eax, 0xfffffffe
inc eax
cmp eax, 1
jne 0x401b41
inc ecx
mov dx, word [ebp - 0xc4]
mov al, dl
mov byte [ebp - 0x94], cl
mov byte [ebp - 0x96], al
mov eax, dword [ebp - 0xc4]
shr eax, 8
mov byte [ebp - 0x95], al
mov eax, ecx
sar eax, 8
mov byte [ebp - 0x93], al
mov eax, ecx
sar eax, 0x10
mov byte [ebp - 0x92], al
mov eax, dword [ebp - 0xb4]
sar ecx, 0x18
mov word [section..data], dx
mov word [ebp - 0x98], 0xb007
mov byte [ebp - 0x91], cl
test eax, eax
je 0x401ba1
mov word [eax], dx
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
mov esi, dword [sym.imp.modbus.dll_modbus_get_slave]
lea eax, [ebp - 0x98]
push 8
push eax
push dword [ebp - 0xb0]
push dword [ebx]
call esi
add esp, 4
push eax
push ebx
call fcn.00401cb0
mov edi, eax
add esp, 0x14
test edi, edi
js 0x401c00
jmp 0x401bdd
mov esi, dword [sym.imp.modbus.dll_modbus_get_slave]
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp dword [ebp + 0x1c], 0
je 0x401c00
push 0
push dword [ebx]
call esi
add esp, 4
push eax
push ebx
call fcn.004024c0
mov edi, eax
add esp, 0xc
push dword [ebp - 0x9c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov ecx, dword [ebp - 4]
add esp, 4
mov eax, edi
xor ecx, ebp
pop edi
pop esi
pop ebx
call fcn.004026f8
mov esp, ebp
pop ebp
ret