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

Disassembly:
push ebp
mov ebp, esp
push ebx
sub esp, 0x694
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x24], 0
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x30], 0x10000
mov dword [ebp - 0x34], 0
mov dword [ebp - 0x38], 0
mov dword [ebp - 0x3c], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x270], 0
mov dword [ebp - 0x40], 0x10
mov dword [ebp - 0x44], 0xf
mov dword [ebp - 0x48], 0xfffffff0
cmp dword [ebp + 0x14], 0
jne 0x402205
mov eax, dword [ebp + 8]
mov eax, dword [eax]
mov dword [esp], eax
call fcn.004017b2
jmp 0x402208
mov eax, dword [ebp + 0x14]
mov dword [ebp - 0x4c], eax
mov eax, dword [ebp - 0x4c]
add eax, 1
shl eax, 6
mov dword [ebp - 0x50], eax
cmp dword [ebp - 0x50], 0x10000
jbe 0x402259
mov dword [esp + 4], 0x1cc
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov dword [esp + 8], 0x10000
mov eax, dword [ebp - 0x50]
mov dword [esp + 4], eax
mov dword [esp], str.head_size_0x_x___max_0x_x__n
call fcn.0041ce30
mov eax, 0x1cc
jmp 0x402986
mov dword [esp + 4], 0x420339
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0x24], eax
cmp dword [ebp - 0x24], 0
jne 0x4022bb
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sub.msvcrt.dll_strerror
mov ebx, eax
mov dword [esp], 2
mov eax, dword [fcn.00416eb0]
call eax
mov dword [esp + 0xc], ebx
mov edx, dword [ebp + 0xc]
mov dword [esp + 8], edx
mov dword [esp + 4], str.open__s_failed:__s_n
mov dword [esp], eax
call fcn.0041ce6c
mov eax, 0x1d1
jmp 0x402986
mov dword [esp], 0x20000
call fcn.0041de60
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 0
jne 0x402305
mov dword [esp + 4], 0x1d6
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov dword [esp], str.Exception:_fail_to_alloc_buuffer_n
call fcn.0041ce30
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov eax, 0x1d7
jmp 0x402986
mov dword [esp + 8], 0x20000
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_memset
mov eax, dword [ebp - 0x34]
add eax, 0x10000
mov dword [ebp - 0x54], eax
mov eax, dword [ebp - 0x24]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x54]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
cmp eax, dword [ebp - 0x50]
je 0x4023ab
mov dword [esp + 4], 0x1de
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x3c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 4], eax
mov dword [esp], str.fail_to_write_head__want_0x_x__but_0x_x_n
call fcn.0041ce30
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
cmp dword [ebp - 0x34], 0
je 0x4023a1
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call fcn.0041de30
mov eax, 0x1e0
jmp 0x402986
mov eax, dword [ebp - 0x50]
add dword [ebp - 0x10], eax
mov eax, dword [ebp - 0x54]
add eax, 0x40
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x18]
mov dword [ebp - 0x58], eax
mov dword [esp], str.dbg:
call fcn.0041ce30
mov eax, dword [ebp - 0x4c]
mov dword [esp + 4], eax
mov dword [esp], str.item_num__d_n
call fcn.0041ce30
mov dword [ebp - 0x1c], 0
mov eax, dword [ebp - 0x1c]
cmp eax, dword [ebp - 0x4c]
jae 0x4027c2
cmp dword [ebp + 0x14], 0
je 0x402422
mov eax, dword [ebp - 0x1c]
lea edx, [ebp - 0x674]
mov dword [esp + 8], edx
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
mov eax, dword [ebp + 0x10]
call eax
test eax, eax
setne al
test al, al
je 0x40244e
jmp 0x4027c2
lea eax, [ebp - 0x674]
mov dword [esp + 8], eax
lea eax, [ebp - 0x270]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
mov eax, dword [ebp + 0x10]
call eax
test eax, eax
setne al
test al, al
jne 0x4027c1
lea eax, [ebp - 0x674]
mov dword [esp], eax
call fcn.004015d0
mov dword [ebp - 0x5c], eax
lea eax, [ebp - 0x674]
mov dword [esp], eax
call fcn.00401640
mov dword [ebp - 0x60], eax
mov eax, dword [ebp - 0x5c]
and eax, 0xfffffff0
add eax, 0x10
mov dword [ebp - 0x64], eax
mov eax, dword [ebp - 0x64]
sub eax, dword [ebp - 0x5c]
mov dword [ebp - 0x68], eax
mov eax, dword [ebp - 0x60]
mov dword [esp], eax
call sub.msvcrt.dll_strlen
cmp eax, 0x1f
jbe 0x4024df
mov dword [esp + 4], 0x1ff
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x60]
mov dword [esp], eax
call sub.msvcrt.dll_strlen
mov dword [esp + 0xc], 0x1f
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x60]
mov dword [esp + 4], eax
mov dword [esp], str.Item_name__s_len__d___max__d__n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x200
jmp 0x402935
mov eax, dword [ebp - 0x18]
mov dword [eax], 0x27051956
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0x5c]
mov dword [eax + 8], edx
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0x10]
mov dword [eax + 0xc], edx
mov eax, dword [ebp - 0x18]
add eax, 0x40
sub eax, dword [ebp - 0x54]
mov edx, eax
mov eax, dword [ebp - 0x18]
mov dword [eax + 0x14], edx
mov eax, dword [ebp - 0x1c]
mov edx, eax
mov eax, dword [ebp - 0x18]
mov byte [eax + 0x1c], dl
mov eax, dword [ebp - 0x64]
add dword [ebp - 0x10], eax
mov eax, dword [ebp - 0x4c]
mov edx, eax
mov eax, dword [ebp - 0x18]
mov byte [eax + 0x1d], dl
mov eax, dword [ebp - 0x60]
mov dword [esp], eax
call fcn.0040169d
mov dword [ebp - 0x6c], eax
mov eax, dword [ebp - 0x6c]
mov dword [esp], eax
call sub.msvcrt.dll_strlen
mov edx, dword [ebp - 0x18]
add edx, 0x20
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x6c]
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.msvcrt.dll_memcpy
mov dword [esp], str.dbg:
call fcn.0041ce30
mov eax, dword [ebp - 0x6c]
mov dword [esp + 4], eax
mov dword [esp], str.pack_item___s__n
call fcn.0041ce30
add dword [ebp - 0x18], 0x40
mov eax, dword [ebp - 0x6c]
cmp eax, dword [ebp - 0x60]
je 0x40258f
mov eax, dword [ebp - 0x6c]
mov dword [esp], eax
call sub.msvcrt.dll_free
mov dword [esp + 4], 0x420216
lea eax, [ebp - 0x674]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x4025f9
mov dword [esp + 4], 0x216
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 - 0x674]
mov dword [esp + 4], eax
mov dword [esp], str.Fail_to_open_file___s___strerror__s__n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x217
jmp 0x402935
mov dword [ebp - 0x20], 0
mov eax, dword [ebp - 0x20]
cmp eax, dword [ebp - 0x5c]
jae 0x402720
mov eax, dword [ebp - 0x5c]
sub eax, dword [ebp - 0x20]
mov dword [ebp - 0x274], eax
mov eax, dword [ebp - 0x274]
cmp eax, 0x10000
ja 0x40262f
lea eax, [ebp - 0x274]
mov eax, dword [eax]
jmp 0x402634
mov eax, 0x10000
mov dword [ebp - 0x38], eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_fread
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
cmp eax, dword [ebp - 0x38]
je 0x4026ae
mov dword [esp + 4], 0x220
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x274]
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x3c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 4], eax
mov dword [esp], str.Want_to_read_0x_x_but_actual_0x_x__at_itemWriteLen_0x_x__leftLen_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x222
jmp 0x402935
mov eax, dword [ebp - 0x24]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
cmp eax, dword [ebp - 0x38]
je 0x402715
mov dword [esp + 4], 0x226
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x3c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 4], eax
mov dword [esp], str.Want_to_write_0x_x_but_actual_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x227
nop
jmp 0x402935
mov eax, dword [ebp - 0x38]
add dword [ebp - 0x20], eax
jmp 0x402600
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0xc], 0
mov eax, dword [ebp - 0x68]
mov dword [esp + 8], eax
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_memset
mov eax, dword [ebp - 0x68]
mov dword [ebp - 0x38], eax
mov eax, dword [ebp - 0x24]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
cmp eax, dword [ebp - 0x38]
je 0x4027b8
mov dword [esp + 4], 0x22f
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x3c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x38]
mov dword [esp + 4], eax
mov dword [esp], str.Want_to_write_0x_x__but_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x230
jmp 0x402935
add dword [ebp - 0x1c], 1
jmp 0x4023e6
nop
sub dword [ebp - 0x18], 0x40
mov eax, dword [ebp - 0x18]
mov dword [eax + 0x14], 0
mov eax, dword [ebp - 0x54]
mov dword [eax + 4], 2
mov eax, dword [ebp - 0x54]
add eax, 8
mov dword [esp + 8], 8
mov dword [esp + 4], str.AML_RES_
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0x54]
mov edx, dword [ebp - 0x10]
mov dword [eax + 0x10], edx
mov eax, dword [ebp - 0x54]
mov edx, dword [ebp - 0x4c]
mov dword [eax + 0x14], edx
mov eax, dword [ebp - 0x54]
mov dword [eax + 0x18], 0x10
mov eax, dword [ebp - 0x54]
mov dword [eax], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebp - 0x24]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x54]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x3c]
cmp eax, dword [ebp - 0x50]
je 0x40289e
mov dword [esp + 4], 0x241
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x3c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 4], eax
mov dword [esp], str.Want_to_write_0x_x__but_0x_x_n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x242
jmp 0x402935
mov dword [esp + 8], 0
mov dword [esp + 4], 4
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call fcn.00402bcb
mov edx, dword [ebp - 0x54]
mov dword [edx], eax
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebp - 0x54]
mov edx, dword [ebp - 0x24]
mov dword [esp + 0xc], edx
mov dword [esp + 8], 4
mov dword [esp + 4], 1
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov dword [ebp - 0x3c], eax
cmp dword [ebp - 0x3c], 4
je 0x402934
mov dword [esp + 4], 0x249
mov dword [esp], str.ERR_L_d_:
call fcn.0041ce30
mov eax, dword [ebp - 0x3c]
mov dword [esp + 4], eax
mov dword [esp], str.Want_to_write_4__but__d_n
call fcn.0041ce30
mov dword [ebp - 0x14], 0x24a
jmp 0x402935
nop
cmp dword [ebp - 0x34], 0
je 0x402953
cmp dword [ebp - 0x34], 0
je 0x40294c
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call fcn.0041de30
mov dword [ebp - 0x34], 0
cmp dword [ebp - 0xc], 0
je 0x40296b
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0xc], 0
cmp dword [ebp - 0x24], 0
je 0x402983
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebp - 0x24], 0
mov eax, dword [ebp - 0x14]
mov ebx, dword [ebp - 4]
leave
ret