Function at 0x4011e0
Capabilities:
Execute command
Read file on windows
Write and execute a file
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xffffffc0
sub esp, 0x34
mov eax, dword [section..data]
xor eax, esp
mov dword [esp + 0x30], eax
cmp dword [ebp + 8], 2
push ebx
push esi
mov esi, dword [ebp + 0xc]
push edi
jge 0x401230
push str.No_arguments._Please_drag_and_drop_a_firmware_or_map_file._n
call fcn.00401040
add esp, 4
push str.pause
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_system]
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push 0
push 0x80
push 3
push 0
push 0
push 0xc0000000
push str.COM4
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [0x4063dc], eax
cmp eax, 0xffffffff
jne 0x401287
push str.Error_opening_serial_port_n
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.00401010
add esp, 8
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push 0x4063e4
push eax
mov dword [0x4063e4], 0x1c
call dword [sym.imp.KERNEL32.dll_GetCommState]
test eax, eax
jne 0x4012dd
push str.Error_getting_serial_port_state_n
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.00401010
add esp, 8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
mov eax, dword [0x4063ec]
and eax, 0xffffffdf
mov dword [0x4063e8], 0x1c200
or eax, 0x90
mov dword [0x4063f4], 0x80200
push 0x4063e4
push dword [0x4063dc]
mov dword [0x4063ec], eax
mov eax, 0x800
mov byte [0x4063f8], 0
mov word [0x4063f2], ax
call dword [sym.imp.KERNEL32.dll_SetCommState]
test eax, eax
jne 0x401366
push str.Error_setting_serial_port_state_n
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.00401010
add esp, 8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push 0x406404
push dword [0x4063dc]
mov dword [0x406404], 0x32
mov dword [0x40640c], 0x32
mov dword [0x406408], 0xa
mov dword [0x406414], 0x32
mov dword [0x406410], 0xa
call dword [sym.imp.KERNEL32.dll_SetCommTimeouts]
test eax, eax
jne 0x4013e9
push str.Error_setting_timeouts_n
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.00401010
add esp, 8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push 0
call dword [sym.imp.api_ms_win_crt_time_l1_1_0.dll__time64]
mov esi, dword [esi + 4]
add esp, 4
mov dword [esp + 0x28], eax
lea eax, [esp + 0x2c]
mov dword [esp + 0x24], edx
push 0x403298
push esi
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen_s]
add esp, 0xc
test eax, eax
je 0x40143c
push esi
push str.Error_opening__s
call fcn.00401040
add esp, 8
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push 2
push 0
push dword [esp + 0x34]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
add esp, 0xc
push dword [esp + 0x2c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ftell]
add esp, 4
mov ebx, eax
push dword [esp + 0x2c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_rewind]
add esp, 4
push ebx
push str.Filesize:__d_n
call fcn.00401040
add esp, 8
cmp ebx, 0x186a0
jae 0x401489
push str.Wrong_file_selected
jmp 0x401ace
mov eax, ebx
shr eax, 9
movzx eax, ax
mov word [0x4053cc], ax
test ebx, 0x1ff
je 0x4014a6
inc eax
mov word [0x4053cc], ax
xor esi, esi
xor cl, cl
mov byte [esp + 0x13], cl
mov ecx, 0x405059
mov dword [esp + 0x14], esi
lea edx, [esi + 1]
call fcn.00401160
push esi
push 0x4063e0
push dword [0x4053c8]
push 0x405bd8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x401509
push str.Error_writing_to_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
push 0
push 0x406400
push 0x802
push 0x4053d0
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x401547
push str.Error_reading_from_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
cmp byte [0x4053d3], 0x42
jne 0x401ac9
cmp byte [0x4053d4], 0x61
jne 0x401ac9
cmp byte [0x4053d5], 0x76
jne 0x401ac9
cmp byte [0x4053d6], 0x69
jne 0x401ac9
cmp byte [0x4053d7], 0x63
jne 0x401ac9
cmp byte [0x4053d8], 0x20
jne 0x401ac9
cmp byte [0x4053d9], 0x42
jne 0x401ac9
cmp byte [0x4053da], 0x6f
jne 0x401ac9
cmp byte [0x4053db], 0x6f
jne 0x401ac9
cmp byte [0x4053dc], 0x74
jne 0x401ac9
cmp byte [0x4053dd], 0x6c
jne 0x401ac9
cmp byte [0x4053de], 0x6f
jne 0x401ac9
cmp byte [0x4053df], 0x61
jne 0x401ac9
cmp byte [0x4053e0], 0x64
jne 0x401ac9
cmp byte [0x4053e1], 0x65
jne 0x401ac9
cmp byte [0x4053e2], 0x72
jne 0x401ac9
cmp byte [0x4053e3], 0x2d
jne 0x401ac9
cmp byte [0x4053e4], 0x30
jne 0x401ac9
cmp byte [0x4053e5], 0x30
jne 0x401ac9
cmp byte [0x4053e6], 0x31
jne 0x401ac9
push str.We_are_in_bootloader_n
call fcn.00401040
add esp, 4
mov edx, 5
mov ecx, 0x40505c
call fcn.00401160
push 0
mov eax, ebx
mov byte [0x405060], bl
shr eax, 0x18
mov dword [esp + 0x1c], eax
mov byte [0x40505d], al
mov eax, ebx
push 0x4063e0
push dword [0x4053c8]
shr eax, 0x10
mov dword [esp + 0x28], eax
mov byte [0x40505e], al
mov eax, ebx
push 0x405bd8
push dword [0x4063dc]
shr eax, 8
mov dword [esp + 0x34], eax
mov byte [0x40505f], al
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4016d6
push str.Error_writing_to_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
push 0
push 0x406400
push 0x802
push 0x4053d0
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x401714
push str.Error_reading_from_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
cmp byte [0x4053d0], 0
jne 0x401758
cmp byte [0x4053d1], 1
jne 0x401758
cmp byte [0x4053d2], 0
jne 0x401758
cmp byte [0x4053d3], 0xd2
jne 0x401758
cmp byte [0x4053d4], 2
jne 0x401758
cmp byte [0x4053d5], 0xef
jne 0x401758
cmp byte [0x4053d6], 0x8d
mov eax, str.Flash_init_success_n
je 0x40175d
mov eax, str.Flash_init_fail._n
push eax
call fcn.00401040
add esp, 4
push str.Flash_Erase_requested._n
call fcn.00401040
mov eax, dword [esp + 0x1c]
lea ecx, [esp + 0x34]
mov byte [esp + 0x35], al
add esp, 4
mov eax, dword [esp + 0x1c]
mov edx, 5
mov byte [esp + 0x32], al
mov eax, dword [esp + 0x20]
mov byte [esp + 0x30], 0x65
mov byte [esp + 0x33], al
mov byte [esp + 0x34], bl
call fcn.00401160
push 0
push 0x4063e0
push dword [0x4053c8]
push 0x405bd8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4017e1
push str.Error_writing_to_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
push 0
push 0x406400
push 0x802
push 0x4053d0
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40181f
push str.Error_reading_from_serial_port_n
push 2
call edi
add esp, 4
push eax
call fcn.00401010
add esp, 8
push dword [0x4063dc]
call esi
cmp byte [0x4053d0], 0
jne 0x401a93
cmp byte [0x4053d1], 7
jne 0x401a93
cmp byte [0x4053d2], 4
jne 0x401a93
cmp byte [0x4053d3], 2
jne 0x401a93
push str.Flash_Erase_Success_n
call fcn.00401040
mov edx, 0x64
add esp, 4
lea ecx, [edx - 0x63]
call fcn.00401080
nop dword [eax]
cmp ebx, 0x200
mov eax, 0x200
mov esi, ebx
cmova esi, eax
xor ecx, ecx
mov eax, esi
add eax, 2
setb cl
neg ecx
or ecx, eax
push ecx
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov edi, eax
add esp, 4
test edi, edi
je 0x401a61
mov eax, dword [esp + 0x14]
mov ecx, eax
sar ecx, 8
mov byte [edi + 2], al
lea eax, [edi + 3]
mov byte [edi], 0x66
mov byte [edi + 1], cl
push dword [esp + 0x2c]
push esi
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
add esp, 0x10
lea edx, [esi + 3]
mov ecx, edi
call fcn.00401160
push 0
push 0x4063e0
push dword [0x4053c8]
push 0x405bd8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x401919
push str.Error_writing_to_serial_port_n
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.00401010
add esp, 8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0
push 0x406400
push 0x802
push 0x4053d0
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40195f
push str.Error_reading_from_serial_port_n
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.00401010
add esp, 8
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
inc dword [esp + 0x14]
sub ebx, esi
push 5
call dword [sym.imp.KERNEL32.dll_Sleep]
push edi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov esi, dword [esp + 0x18]
add esp, 4
movzx edx, word [0x4053cc]
mov ecx, esi
call fcn.00401080
cmp byte [0x4053d0], 0
jne 0x4019df
mov al, byte [0x4053d1]
cmp al, 1
jne 0x4019b3
cmp byte [0x4053d2], 4
jne 0x4019df
cmp byte [0x4053d3], 0xd5
jne 0x4019df
mov byte [esp + 0x13], al
jmp 0x4019c9
cmp al, 7
jne 0x4019df
cmp byte [0x4053d2], 0
jne 0x4019df
cmp byte [0x4053d3], 8
jne 0x4019df
movzx edx, word [0x4053cc]
mov ecx, esi
call fcn.00401080
test ebx, ebx
jne 0x401870
cmp byte [esp + 0x13], 0
mov edx, str._nFlashing_completed_successfuly._n
mov eax, str._nFlashing_Failed._n
cmovne eax, edx
push eax
call fcn.00401040
add esp, 4
push dword [esp + 0x2c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
push 0
call dword [sym.imp.api_ms_win_crt_time_l1_1_0.dll__time64]
add esp, 4
push dword [esp + 0x24]
push dword [esp + 0x2c]
push edx
push eax
call dword [sym.imp.api_ms_win_crt_time_l1_1_0.dll__difftime64]
add esp, 8
fstp qword [esp + 0x38]
movsd xmm0, qword [esp + 0x38]
movsd qword [esp], xmm0
push str.Total_Flashing_time:__.2f_sec_n
call fcn.00401040
add esp, 0xc
push dword [0x4063dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push str.Memory_allocation_error
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 4
push dword [esp + 0x2c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push str.Flash_Erase_fail._n
call fcn.00401040
add esp, 4
push dword [esp + 0x2c]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
push dword [0x4063dc]
call esi
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret
push str.We_are_not_in_bootloader_n
call fcn.00401040
mov ecx, dword [esp + 0x40]
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00401aea
mov esp, ebp
pop ebp
ret