Function at 0x401d44
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x478
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x1c], 0
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x54], 0xffffffff
mov dword [esp + 4], 0x420216
mov eax, dword [ebp + 8]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0x1c], eax
cmp dword [ebp - 0x1c], 0
jne 0x401dbd
mov dword [esp + 4], 0x161
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], str.Fail_to_open_res_image_at_path__s_n
call fcn.0041ce30
mov eax, 0x162
jmp 0x40217f
mov dword [esp], 0x20000
call fcn.0041de60
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jne 0x401e16
mov dword [esp + 4], 0x167
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov dword [esp + 4], 0x20000
mov dword [esp], str.Fail_to_new_buffer_at_size_0x_x_n
call fcn.0041ce30
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0x1c], 0
mov eax, 0x168
jmp 0x40217f
mov eax, dword [ebp - 0x18]
add eax, 0x10000
mov dword [ebp - 0x20], eax
lea eax, [ebp - 0x54]
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov eax, dword [ebp + 0x10]
mov dword [esp + 8], eax
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call fcn.004019b0
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
je 0x401ea5
mov dword [esp + 4], 0x16e
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov dword [esp], str.Fail_at_check_image_header_n
call fcn.0041ce30
cmp dword [ebp - 0x18], 0
je 0x401e82
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call fcn.0041de30
mov dword [ebp - 0x18], 0
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0x1c], 0
mov eax, 0x171
jmp 0x40217f
mov dword [ebp - 0x24], 0x10
mov dword [ebp - 0x28], 0xf
mov dword [ebp - 0x2c], 0xfffffff0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x34], 0
mov eax, dword [ebp - 0x10]
lea edx, [eax + 1]
mov dword [ebp - 0x10], edx
mov ecx, eax
mov eax, dword [ebp - 0x54]
mov edx, dword [ebp - 0x1c]
mov dword [esp + 0xc], edx
mov dword [esp + 8], ecx
mov edx, dword [ebp - 0x20]
mov dword [esp + 4], edx
mov dword [esp], eax
call fcn.00401c6f
mov dword [ebp - 0x30], eax
cmp dword [ebp - 0x30], 0
jne 0x401f2f
mov dword [esp + 4], 0x183
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x10]
sub eax, 1
mov dword [esp + 4], eax
mov dword [esp], str.Fail_to_get_item_header_at_index__d_n
call fcn.0041ce30
jmp 0x402146
mov eax, dword [ebp - 0x30]
add eax, 0x20
mov dword [esp + 0xc], eax
mov eax, dword [ebp + 0xc]
mov dword [esp + 8], eax
mov dword [esp + 4], str._s__s
lea eax, [ebp - 0x458]
mov dword [esp], eax
call fcn.0041ce9c
mov dword [esp], str.dbg:
call fcn.0041ce30
lea eax, [ebp - 0x458]
mov dword [esp + 4], eax
mov dword [esp], str.item__s_n
call fcn.0041ce30
mov dword [esp + 4], 0x4202ae
lea eax, [ebp - 0x458]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 0
jne 0x401fe2
mov dword [esp + 4], 0x18c
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sub.msvcrt.dll_strerror
mov dword [esp + 8], eax
lea eax, [ebp - 0x458]
mov dword [esp + 4], eax
mov dword [esp], str.Fail_to_create_file__s__strerror__s__n
call fcn.0041ce30
mov dword [ebp - 0xc], 0x18d
jmp 0x402146
mov eax, dword [ebp - 0x30]
mov eax, dword [eax + 8]
mov dword [ebp - 0x38], eax
mov eax, dword [ebp - 0x38]
and eax, 0xfffffff0
add eax, 0x10
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
sub eax, dword [ebp - 0x38]
mov dword [ebp - 0x40], eax
mov dword [ebp - 0x14], 0
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x3c]
jae 0x402124
mov eax, dword [ebp - 0x3c]
sub eax, dword [ebp - 0x14]
mov dword [ebp - 0x58], eax
mov dword [ebp - 0x50], 0x10000
lea eax, [ebp - 0x50]
mov dword [esp + 4], eax
lea eax, [ebp - 0x58]
mov dword [esp], eax
call fcn.0041de00
mov eax, dword [eax]
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x44]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sub.msvcrt.dll_fread
mov dword [ebp - 0x48], eax
mov eax, dword [ebp - 0x44]
cmp eax, dword [ebp - 0x48]
je 0x4020a0
mov dword [esp + 4], 0x19b
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x48]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x44]
mov dword [esp + 4], eax
mov dword [esp], str.thisReadSz_0x_x___actualReadSz_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0xc], 0x19c
jmp 0x402146
mov eax, dword [ebp - 0x44]
add dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x38]
jb 0x4020b6
mov eax, dword [ebp - 0x44]
sub eax, dword [ebp - 0x40]
jmp 0x4020b9
mov eax, dword [ebp - 0x44]
mov dword [ebp - 0x4c], eax
mov eax, dword [ebp - 0x34]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x4c]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x48], eax
mov eax, dword [ebp - 0x4c]
cmp eax, dword [ebp - 0x48]
je 0x402007
mov dword [esp + 4], 0x1a3
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x48]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x4c]
mov dword [esp + 4], eax
mov dword [esp], str.want_write_0x_x__but_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0xc], 0x1a4
nop
jmp 0x402146
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0x34], 0
mov eax, dword [ebp - 0x30]
mov eax, dword [eax + 0x14]
test eax, eax
je 0x402145
jmp 0x401ec8
nop
cmp dword [ebp - 0x18], 0
je 0x402164
cmp dword [ebp - 0x18], 0
je 0x40215d
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call fcn.0041de30
mov dword [ebp - 0x18], 0
cmp dword [ebp - 0x1c], 0
je 0x40217c
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0x1c], 0
mov eax, dword [ebp - 0xc]
leave
ret