Function at 0x4029d0
Capabilities:
Get file size
Read file on windows
Resolve function by parsing pe exports
Write file on windows

Disassembly:
sub esp, 0x258
mov eax, dword [esp + 0x25c]
push esi
xor esi, esi
cmp eax, 0xffffffff
mov dword [esp + 0x1c], esi
mov dword [esp + 0x14], esi
jne 0x402a04
mov dword [0x428388], 6
mov eax, 1
pop esi
add esp, 0x258
ret
mov eax, dword [esp + 0x264]
push ebp
push esi
push esi
push 1
push esi
push esi
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebp, eax
cmp ebp, 0xffffffff
mov dword [esp + 8], ebp
jne 0x402a41
pop ebp
mov dword [0x428388], 2
mov eax, 1
pop esi
add esp, 0x258
ret
push esi
lea ecx, [esp + 0x18]
push ecx
push 0x2e
push str.Master_of_Magic
push ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x402a78
push ebp
mov dword [0x428388], 0x1d
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
mov eax, dword [esp + 0x264]
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push edi
lea edi, [eax + 0x610]
mov dword [esp + 0x4c], edi
mov ecx, 0xb
mov esi, str.Master_of_Magic
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [eax + 0x640]
test ecx, ecx
movsw word es:[edi], word [esi]
mov dword [esp + 0x18], 0
jbe 0x402e1b
mov dword [esp + 0x14], 0
lea ecx, [ecx]
mov edx, dword [esp + 0x26c]
mov esi, dword [edx + 0x608]
mov ecx, dword [esp + 0x14]
mov al, byte [esi + ecx + 0x8b]
add esi, ecx
test al, 0x10
jne 0x402deb
mov eax, dword [esp + 0x274]
test eax, eax
je 0x402b09
mov ecx, edx
mov edx, dword [ecx + 0x640]
mov ecx, dword [esp + 0x18]
push edx
push ecx
push esi
call eax
add esp, 0xc
test eax, eax
jne 0x402ea4
mov al, byte [esi + 0x8b]
cmp al, 1
jne 0x402be2
mov edx, dword [esi]
push 0
lea ebp, [esi + 0x1f]
push ebp
push edx
call fcn.00401ce0
mov edi, eax
add esp, 0xc
test edi, edi
je 0x402ec9
mov eax, dword [esi + 0x18]
cmp eax, 0x200
mov ecx, dword [0x4252ec]
jb 0x402b78
cmp ecx, 0x200
jae 0x402b71
mov eax, dword [esi + 4]
push eax
push ebp
call fcn.00401830
xor edx, edx
test al, al
sete dl
movsx ecx, al
mov eax, dword [esi + 8]
push 1
push ecx
push edx
push eax
push edi
call fcn.00401540
add esp, 0x1c
jmp 0x402ba2
cmp eax, 0x200
jae 0x402ba2
cmp ecx, 0x200
jb 0x402ba2
mov al, byte [esi + 0x1e]
test al, al
jl 0x402ba2
xor edx, edx
test al, al
sete dl
movsx ecx, al
mov eax, dword [esi + 8]
push 0
push ecx
push edx
push eax
push edi
call fcn.00401540
add esp, 0x14
mov ebp, dword [esp + 0x10]
push 1
push 0
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [esi + 8]
push 0
lea ecx, [esp + 0x20]
push ecx
push edx
push edi
push ebp
mov dword [esi + 0x10], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402eee
push edi
push 0
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x402deb
test al, 0xc
je 0x402deb
test al, 1
je 0x402c53
mov eax, dword [esi]
push 0
lea ebp, [esi + 0x1f]
push ebp
push eax
call fcn.00401ce0
mov edi, eax
add esp, 0xc
test edi, edi
je 0x402f02
mov eax, dword [esi + 0x18]
cmp eax, 0x200
mov ecx, dword [0x4252ec]
jb 0x402b78
cmp ecx, 0x200
jae 0x402b71
mov ecx, dword [esi + 4]
push ecx
push ebp
call fcn.00401830
xor ecx, ecx
test al, al
sete cl
movsx edx, al
push 1
push edx
mov edx, dword [esi + 8]
push ecx
push edx
push edi
call fcn.00401540
add esp, 0x1c
jmp 0x402ba2
test al, 2
je 0x402deb
lea eax, [esi + 0x1f]
push eax
call fcn.00401e70
mov dword [esp + 0x30], eax
add eax, 8
push eax
push 0x428180
lea eax, [esp + 0x6c]
push str._s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
push 0
push 0
push 3
push 0
push 1
push 0x80000000
lea ecx, [esp + 0x78]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x402f27
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push eax
push 8
mov dword [esi + 0xc], eax
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
push 0
mov ebp, eax
mov eax, dword [esi + 0xc]
lea edx, [esp + 0x60]
push edx
push eax
push ebp
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x402f41
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esi + 0xc]
add ecx, 0x400
push ecx
push 8
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esi + 0xc]
mov edi, eax
mov eax, dword [0x4252e8]
add edx, 0x400
push eax
mov dword [esp + 0x28], edx
mov ecx, dword [esi + 0xc]
push ecx
push ebp
lea edx, [esp + 0x30]
push edx
push edi
call fcn.00406b90
mov eax, dword [esp + 0x38]
mov dword [esi + 4], eax
mov eax, dword [0x4252ec]
add esp, 0x14
cmp eax, 0x200
jae 0x402d45
mov ecx, dword [esp + 0x24]
push ecx
lea eax, [esi + 0x1f]
push eax
call fcn.00401830
jmp 0x402d55
mov edx, dword [esp + 0x24]
xor eax, eax
mov al, byte [esi + 0x14]
push edx
push eax
call fcn.004018d0
mov byte [esi + 0x1e], al
mov eax, dword [0x4252ec]
add esp, 8
cmp eax, 0x200
jae 0x402d85
mov al, byte [esi + 0x1e]
xor edx, edx
test al, al
sete dl
movsx ecx, al
mov eax, dword [esi + 4]
push 1
push ecx
push edx
push eax
push edi
call fcn.00401540
add esp, 0x14
mov ecx, dword [esi + 4]
push ecx
call fcn.00401500
mov edx, dword [esp + 0x14]
add esp, 4
push 1
push 0
push 0
push edx
mov dword [esi + 8], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [esi + 8]
mov edx, dword [esp + 0x10]
push 0
mov dword [esi + 0x10], eax
lea eax, [esp + 0x20]
push eax
push ecx
push edi
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
push 0
mov esi, eax
call ebx
mov edi, dword [sym.imp.KERNEL32.dll_HeapFree]
push eax
call edi
push ebp
push 0
call ebx
push eax
call edi
mov eax, dword [esp + 0x2c]
push eax
push 0
call ebx
push eax
call edi
test esi, esi
je 0x402f67
mov eax, dword [esp + 0x18]
mov esi, dword [esp + 0x14]
mov ecx, dword [esp + 0x26c]
mov edx, dword [ecx + 0x640]
inc eax
add esi, 0x8c
cmp eax, edx
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], esi
jb 0x402ac0
mov ebp, dword [esp + 0x10]
push 1
push 0
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [esp + 0x58], eax
mov eax, dword [0x4252ec]
shr eax, 8
dec eax
je 0x4030ca
dec eax
jne 0x40324c
mov esi, dword [esp + 0x26c]
mov eax, dword [esi + 0x640]
imul eax, eax, 0x111
push eax
push 8
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ecx, dword [esi + 0x640]
mov dword [esp + 0x2c], eax
mov ebp, eax
xor eax, eax
cmp ecx, eax
mov dword [esp + 0x18], eax
jbe 0x403042
mov dword [esp + 0x14], eax
nop
mov edx, dword [esi + 0x608]
mov ecx, dword [esp + 0x14]
mov al, byte [edx + ecx + 0x8b]
add edx, ecx
test al, 0x10
je 0x402f8c
inc dword [esp + 0x28]
jmp 0x40301d
mov edx, dword [esp + 0x10]
push edx
mov dword [0x428388], 1
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebx
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
mov eax, dword [esp + 0x10]
push eax
mov dword [0x428388], 0xd
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebx
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
push ebp
mov dword [0x428388], 0x1d
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push edi
jmp 0x402f4c
mov ecx, dword [esp + 0x10]
push ecx
mov dword [0x428388], 0xd
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebx
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
pop edi
pop ebx
pop ebp
mov dword [0x428388], 2
mov eax, 1
pop esi
add esp, 0x258
ret
mov dword [0x428388], 0x1e
push ebp
push 0
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop ebx
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
mov edx, dword [esp + 0x10]
push edx
mov dword [0x428388], 0x1d
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebx
pop ebp
mov eax, 1
pop esi
add esp, 0x258
ret
lea eax, [edx + 0x1f]
mov ecx, eax
lea esi, [ecx + 1]
mov bl, byte [ecx]
inc ecx
test bl, bl
jne 0x402f94
sub ecx, esi
inc ecx
mov ebx, ecx
shr ecx, 2
mov esi, eax
mov edi, ebp
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, eax
lea esi, [ecx + 1]
mov bl, byte [ecx]
inc ecx
test bl, bl
jne 0x402fb5
sub ecx, esi
lea ebp, [ecx + ebp + 1]
lea esi, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x402fc5
mov ecx, dword [edx + 8]
mov edi, dword [edx + 0xc]
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
sub eax, esi
mov esi, dword [edx + 4]
mov edx, dword [edx + 0x10]
sub edx, 0x2e
mov dword [esp + 0x41], edx
mov edx, ebp
mov dword [edx], esi
mov esi, dword [esp + 0x26c]
mov dword [edx + 4], ecx
mov dword [edx + 8], edi
mov byte [esp + 0x40], 1
mov ecx, dword [esp + 0x40]
mov dword [edx + 0xc], ecx
mov ecx, dword [esp + 0x41]
shr ecx, 0x18
mov byte [edx + 0x10], cl
mov edx, dword [esp + 0x20]
lea eax, [edx + eax + 0x12]
add ebp, 0x11
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x14]
mov ecx, dword [esi + 0x640]
inc eax
add edx, 0x8c
cmp eax, ecx
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], edx
jb 0x402e80
mov edi, dword [esp + 0x20]
lea ebp, [edi + 0x400]
push ebp
push 8
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
push 9
mov dword [esp + 0x28], ebp
mov ebp, dword [esp + 0x30]
push edi
push ebp
lea ecx, [esp + 0x30]
mov esi, eax
push ecx
push esi
call fcn.00406b90
mov edx, dword [esp + 0x38]
add esp, 0x14
push 0
lea eax, [esp + 0x20]
push eax
push 8
lea ecx, [esp + 0x5c]
mov dword [esp + 0x5c], edx
mov edx, dword [esp + 0x1c]
push ecx
mov dword [esp + 0x64], edi
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
push edx
call edi
mov ecx, dword [esp + 0x50]
mov edx, dword [esp + 0x10]
push 0
lea eax, [esp + 0x20]
push eax
push ecx
push esi
push edx
call edi
push esi
push 0
call ebx
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
push eax
call esi
push ebp
push 0
call ebx
push eax
call esi
jmp 0x40324c
mov eax, dword [esp + 0x26c]
mov ecx, dword [eax + 0x640]
test ecx, ecx
mov dword [esp + 0x18], 0
jbe 0x40324c
mov dword [esp + 0x14], 0
nop
mov ebp, dword [eax + 0x608]
mov edx, dword [esp + 0x14]
mov cl, byte [ebp + edx + 0x8b]
add ebp, edx
test cl, 0x10
je 0x403111
inc dword [esp + 0x28]
jmp 0x403227
lea esi, [ebp + 0x1f]
mov eax, esi
lea edx, [eax + 1]
lea esp, [esp]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x403120
sub eax, edx
inc eax
push eax
call fcn.00401500
add esp, 4
push eax
push 8
mov dword [esp + 0x28], eax
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
mov eax, esi
lea edi, [eax + 1]
mov edi, edi
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x403150
sub eax, edi
lea ecx, [eax + 1]
mov eax, dword [esp + 0x20]
mov edx, ecx
shr ecx, 2
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
push 0
mov ecx, edx
push eax
and ecx, 3
push ebx
rep movsb byte es:[edi], byte [esi]
call fcn.004017a0
mov ecx, dword [esp + 0x2c]
add ecx, 6
add esp, 0xc
mov dword [esp + 0x2c], ecx
call fcn.004181c4
cdq
mov ecx, 0xffff
idiv ecx
mov edi, dword [esp + 0x10]
mov esi, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [esp + 0x30]
mov word [esp + 0x34], dx
lea edx, [esp + 0x20]
push edx
push 6
push eax
push edi
call esi
mov edx, dword [esp + 0x20]
push 0
lea ecx, [esp + 0x20]
push ecx
push edx
push ebx
push edi
call esi
mov dword [esp + 0x34], 0
mov eax, dword [ebp + 4]
mov ecx, dword [ebp + 0xc]
lea edx, [eax + ecx + 0x2cb]
mov dword [esp + 0x38], edx
mov eax, dword [ebp + 8]
add eax, 0x92cb
mov dword [esp + 0x3c], eax
mov ecx, dword [ebp + 0xc]
push 0
lea eax, [esp + 0x20]
push eax
mov dword [esp + 0x48], ecx
push 0x15
mov byte [esp + 0x50], 1
mov edx, dword [ebp + 0x10]
lea ecx, [esp + 0x40]
push ecx
sub edx, 0x2e
push edi
mov dword [esp + 0x59], edx
call esi
push ebx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [esp + 0x26c]
mov ecx, dword [esp + 0x18]
mov esi, dword [esp + 0x14]
mov edx, dword [eax + 0x640]
inc ecx
add esi, 0x8c
cmp ecx, edx
mov dword [esp + 0x18], ecx
mov dword [esp + 0x14], esi
jb 0x4030f0
mov edx, dword [esp + 0x58]
mov eax, dword [0x4252ec]
mov esi, dword [esp + 0x26c]
add edx, 0xffffffd2
cmp eax, 0x200
mov dword [esi + 0x62e], edx
jb 0x403270
xor eax, eax
jmp 0x403275
call fcn.004181c4
mov ecx, dword [esi + 0x640]
sub ecx, dword [esp + 0x28]
push 0
mov dword [esi + 0x632], eax
lea edx, [ecx + eax + 7]
mov eax, dword [0x4252ec]
push 0
mov dword [esi + 0x636], edx
mov dword [esi + 0x63a], eax
mov esi, dword [esp + 0x18]
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [esp + 0x4c]
push 0
lea ecx, [esp + 0x20]
push ecx
push 0x2e
push edx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebx
pop ebp
xor eax, eax
pop esi
add esp, 0x258
ret