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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0x768
mov eax, dword [0x4cf008]
xor eax, esp
mov dword [esp + 0x764], eax
mov eax, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 8]
push edi
push 0x400
mov dword [esp + 0x1c], eax
lea eax, [esp + 0x36c]
push 0
push eax
mov dword [esp + 0x1c], esi
call fcn.0046ed60
add esp, 0xc
lea eax, [esp + 0x368]
push 0x400
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea eax, [esp + 0x368]
push 0x400
push eax
call fcn.0047818e
add esp, 8
cmp eax, 0x104
jl 0x40e2a3
push 0x40010
push 0x4bab48
push 0x4bab60
push 0
call dword [sym.imp.USER32.dll_MessageBoxA]
mov eax, 1
pop edi
pop esi
mov ecx, dword [esp + 0x764]
xor ecx, esp
call fcn.0046ccad
mov esp, ebp
pop ebp
ret 0x10
mov edi, dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecA]
lea eax, [esp + 0x368]
push eax
call edi
mov cl, byte [esp + 0x368]
lea edx, [esp + 0x368]
test cl, cl
je 0x40e2f4
cmp cl, 0x80
jb 0x40e2cf
cmp cl, 0x9f
jbe 0x40e2d6
lea eax, [ecx + 0x20]
cmp al, 0xf
ja 0x40e2dd
mov eax, 2
jmp 0x40e2eb
cmp cl, 0x3f
je 0x40e3af
mov eax, 1
mov cl, byte [edx + eax]
add edx, eax
test cl, cl
jne 0x40e2c5
push 0x104
lea eax, [esp + 0x36c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea eax, [esp + 0x368]
push eax
call edi
lea ecx, [esp + 0x368]
dec ecx
nop word [eax + eax]
mov al, byte [ecx + 1]
lea ecx, [ecx + 1]
test al, al
jne 0x40e320
mov eax, dword [str.dllPAL.dll]
mov dword [ecx], eax
mov eax, dword [0x4bab1c]
mov dword [ecx + 4], eax
mov eax, dword [0x4bab20]
mov dword [ecx + 8], eax
mov al, byte [0x4bab24]
push 8
mov byte [ecx + 0xc], al
lea eax, [esp + 0x36c]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryExA]
test eax, eax
je 0x40e288
mov ecx, esi
call fcn.0040d680
test eax, eax
je 0x40e288
cmp byte [0x4d1ec1], 0
mov dword [esp + 0x1c], 0
jne 0x40e3e4
push 0x4d20f0
push 1
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
mov dword [esp + 0x1c], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x40e3e4
mov esi, 1
jmp 0x40ec68
lea eax, [esp + 0x368]
push eax
lea eax, [esp + 0x164]
push 0x4babd0
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x160]
push 0x40010
push 0x4bab48
push eax
jmp 0x40e280
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.PAL.dll_PalDefaultCreate]
mov ecx, dword [0x4d1ed4]
add esp, 4
mov dword [esp + 0x28], esi
mov dword [esp + 0x74], 0x40d080
cmp ecx, 8
ja 0x40e42e
shl ecx, 4
mov eax, dword [ecx + 0x4b8c68]
mov edi, dword [ecx + 0x4b8c60]
mov esi, dword [ecx + 0x4b8c64]
mov dword [esp + 0x60], eax
mov eax, dword [ecx + 0x4b8c6c]
mov dword [esp + 0x64], eax
jmp 0x40e440
mov edi, 0x500
mov esi, 0x2d0
mov dword [esp + 0x60], edi
mov dword [esp + 0x64], esi
lea eax, [esp + 0x130]
mov dword [esp + 0x5c], esi
push eax
mov dword [esp + 0x5c], edi
call dword [sym.imp.USER32.dll_GetDesktopWindow]
push eax
call dword [sym.imp.USER32.dll_GetWindowRect]
mov eax, dword [esp + 0x138]
sub eax, dword [esp + 0x130]
cmp eax, edi
jle 0x40e6ae
mov eax, dword [esp + 0x13c]
sub eax, dword [esp + 0x134]
cmp eax, esi
jle 0x40e6ae
cmp byte [0x4d1ec0], 0
je 0x40e4a4
mov edi, dword [esp + 0x10]
mov eax, 1
mov dword [esp + 0x2c], eax
jmp 0x40e6ba
push str.system.dat
push 0x4d22f8
xorps xmm0, xmm0
mov dword [esp + 0x150], 0
lea eax, [esp + 0x370]
movaps xmmword [esp + 0x138], xmm0
push str._s_s
push eax
movq qword [esp + 0x150], xmm0
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
lea eax, [esp + 0x160]
push eax
lea eax, [esp + 0x36c]
push eax
call dword [sym.imp.KERNEL32.dll_FindFirstFileA]
cmp eax, 0xffffffff
je 0x40e520
mov esi, dword [esp + 0x160]
push eax
call dword [sym.imp.KERNEL32.dll_FindClose]
and esi, 0x10
jne 0x40e520
mov edi, dword [esp + 0x10]
xor eax, eax
mov dword [esp + 0x2c], eax
jmp 0x40e6ba
mov esi, dword [esp + 0x10]
xorps xmm0, xmm0
push 0x7f00
push 0
movlpd qword [esp + 0xa8], xmm0
movlpd qword [esp + 0xb4], xmm0
movlpd qword [esp + 0xbc], xmm0
mov dword [esp + 0xb0], esi
mov dword [esp + 0xc4], 0x4d20f0
mov dword [esp + 0xa4], 0x466180
mov dword [esp + 0xa0], 3
call dword [sym.imp.USER32.dll_LoadCursorA]
push 0x7f00
push 0
mov dword [esp + 0xb8], eax
call dword [sym.imp.USER32.dll_LoadIconA]
push 5
mov dword [esp + 0xb0], eax
mov dword [esp + 0xa8], 0x1e
call dword [sym.imp.GDI32.dll_GetStockObject]
mov dword [esp + 0xb4], eax
lea eax, [esp + 0x98]
push eax
call dword [sym.imp.USER32.dll_RegisterClassA]
test ax, ax
jne 0x40e5cc
xor eax, eax
mov edi, esi
mov dword [esp + 0x2c], eax
jmp 0x40e6ba
push 0x96
lea eax, [esp + 0x24]
push 0x12c
push eax
call dword [sym.imp.PAL.dll_PalWindowGetPosCenter]
add esp, 0xc
push 0
push esi
push 0
push 0
push 0x96
push 0x12c
push dword [esp + 0x3c]
push dword [esp + 0x3c]
push 0x400000
push 0x4d20f0
push 0x4d20f0
push 8
call dword [sym.imp.USER32.dll_CreateWindowExA]
mov esi, eax
test esi, esi
jne 0x40e627
mov edi, dword [esp + 0x10]
mov dword [esp + 0x2c], eax
jmp 0x40e6ba
push 5
push esi
call dword [sym.imp.USER32.dll_ShowWindow]
push esi
call dword [sym.imp.USER32.dll_UpdateWindow]
mov edi, dword [sym.imp.USER32.dll_PeekMessageA]
nop dword [eax]
push 1
push 0
push 0
push 0
lea eax, [esp + 0x140]
push eax
call edi
test eax, eax
je 0x40e640
lea eax, [esp + 0x130]
push eax
push esi
call dword [sym.imp.USER32.dll_IsDialogMessageA]
test eax, eax
jne 0x40e640
cmp dword [esp + 0x134], 0x12
je 0x40e691
lea eax, [esp + 0x130]
push eax
call dword [sym.imp.USER32.dll_TranslateMessage]
lea eax, [esp + 0x130]
push eax
call dword [sym.imp.USER32.dll_DispatchMessageA]
jmp 0x40e640
mov edi, dword [esp + 0x10]
push edi
push 0x4d20f0
call dword [sym.imp.USER32.dll_UnregisterClassA]
mov eax, dword [esp + 0x138]
mov dword [esp + 0x2c], eax
jmp 0x40e6ba
mov edi, dword [esp + 0x10]
mov dword [esp + 0x2c], 1
mov eax, dword [esp + 0x58]
mov dword [0x4d1ed8], eax
mov eax, dword [esp + 0x5c]
push 0x208
mov dword [0x4d1ecc], eax
lea eax, [esp + 0x164]
push 0
push eax
mov dword [esp + 0x58], 0x3c
mov dword [esp + 0x74], 0x5ff
mov dword [esp + 0x78], 0x5ff
mov dword [esp + 0x40], 0x4d20f0
mov dword [esp + 0x44], 0x4d20f0
mov dword [esp + 0x48], 0x65
mov dword [esp + 0x3c], 0
call fcn.0046ed60
add esp, 0xc
lea eax, [esp + 0x160]
push 0x4d22f8
push str._sconfig.dat
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x160]
push 0
push 0x80
push 3
push 0
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x40e83b
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
test eax, eax
je 0x40e83b
push 0
lea eax, [esp + 0x18]
push eax
push 0x24
lea eax, [esp + 0x13c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x14], 0x24
jne 0x40e83b
mov eax, dword [esp + 0x130]
mov esi, dword [sym.imp.USER32.dll_GetSystemMetrics]
mov dword [esp + 0x50], eax
mov eax, dword [esp + 0x134]
mov dword [esp + 0x54], eax
mov eax, dword [esp + 0x138]
mov dword [esp + 0x58], eax
mov eax, dword [esp + 0x13c]
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x140]
mov dword [esp + 0x84], eax
mov eax, dword [esp + 0x148]
mov dword [esp + 0x8c], eax
mov eax, dword [esp + 0x14c]
mov dword [esp + 0x88], eax
mov eax, dword [esp + 0x144]
mov dword [esp + 0x7c], eax
mov eax, dword [esp + 0x150]
push 0x22
mov dword [esp + 0x94], eax
call esi
mov ecx, dword [esp + 0x58]
cmp ecx, eax
push 0x23
cmovl ecx, dword [0x4d1ed8]
mov dword [esp + 0x5c], ecx
call esi
cmp dword [esp + 0x5c], eax
jge 0x40e84b
mov eax, dword [0x4d1ecc]
mov dword [esp + 0x5c], eax
jmp 0x40e84b
lea edx, [esp + 0x28]
lea ecx, [esp + 0x160]
call fcn.00466610
push 0x4bab28
push dword [esp + 0x1c]
call fcn.0046e660
mov esi, eax
add esp, 8
test esi, esi
je 0x40e937
push 9
inc esi
push str.MOVIESKIP
push esi
call fcn.00477b50
add esp, 0xc
test eax, eax
jne 0x40e88a
mov byte [0x4d1ec2], 1
add esi, 9
jmp 0x40e91f
push 3
push 0x4bab38
push esi
call fcn.00477b50
add esp, 0xc
test eax, eax
jne 0x40e8b8
mov eax, dword [esp + 0x84]
not eax
or eax, 8
add esi, 3
not eax
mov dword [esp + 0x84], eax
jmp 0x40e91f
push 2
push 0x4bab3c
push esi
call fcn.00477b50
add esp, 0xc
test eax, eax
jne 0x40e8d5
mov dword [esp + 0x88], eax
jmp 0x40e91c
push 2
push 0x4bab40
push esi
call fcn.00477b50
add esp, 0xc
test eax, eax
jne 0x40e900
mov eax, dword [esp + 0x84]
not eax
or eax, 1
not eax
mov dword [esp + 0x84], eax
jmp 0x40e91c
push 2
push 0x4bab44
push esi
call fcn.00477b50
add esp, 0xc
test eax, eax
jne 0x40e91f
or dword [esp + 0x84], 8
add esi, 2
push 0x4bab28
push esi
call fcn.0046e660
mov esi, eax
add esp, 8
test esi, esi
jne 0x40e866
mov ecx, edi
call fcn.004620d0
mov dword [0x4cf8d0], eax
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.PAL.dll_PalInit]
add esp, 4
test eax, eax
je 0x40ec66
xor ecx, ecx
call fcn.00466c70
push str.system.dat
push 0x4d22f8
lea eax, [esp + 0x370]
push str._s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
lea eax, [esp + 0x140]
push eax
lea eax, [esp + 0x37c]
push eax
call dword [sym.imp.PAL.dll_PalFileCreate]
mov edi, dword [sym.imp.USER32.dll_MessageBoxA]
mov esi, eax
add esp, 0x18
cmp esi, 0xffffffff
je 0x40eaad
push 1
push 0
push 2
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [esp + 0x1c]
push eax
push 4
lea eax, [esp + 0x20]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea eax, [esp + 0x130]
push eax
push str.Script.src
call dword [sym.imp.PAL.dll_PalFileCreate]
mov esi, eax
add esp, 8
cmp esi, 0xffffffff
je 0x40ea2d
mov ecx, dword [esp + 0x130]
push 0
push 0
add ecx, 4
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [esp + 0x1c]
push eax
push 4
lea eax, [esp + 0x2c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x14]
cmp eax, dword [esp + 0x20]
je 0x40eaad
cmp byte [0x4d1ec0], 0
je 0x40ea66
call fcn.004669c0
test eax, eax
jne 0x40eaad
push 0x40020
push 0x4bac74
push 0x4bac84
call dword [sym.imp.USER32.dll_GetActiveWindow]
push eax
call dword [sym.imp.USER32.dll_MessageBoxA]
call dword [sym.imp.PAL.dll_PalUninit]
jmp 0x40ec66
mov esi, dword [sym.imp.USER32.dll_GetActiveWindow]
push 0x40024
push 0x4bacbc
push 0x4bacc8
call esi
push eax
call edi
cmp eax, 6
jne 0x40ea5b
call fcn.004669c0
test eax, eax
jne 0x40eaad
push 0x40020
push 0x4bac74
push 0x4bac84
call esi
push eax
call edi
call dword [sym.imp.PAL.dll_PalUninit]
jmp 0x40ec66
push str.User32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [0x4d2514], eax
test eax, eax
je 0x40ead5
push str.GetProductInfo
push dword [esp + 0x14]
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov dword [0x4d2518], eax
call dword [sym.imp.PAL.dll_PalDebugIs]
test eax, eax
je 0x40eae4
call fcn.0040ca70
call dword [sym.imp.PAL.dll_PalRun]
push 0x208
lea eax, [esp + 0x164]
push 0
push eax
call fcn.0046ed60
add esp, 0xc
lea eax, [esp + 0x160]
push 0x4d22f8
push str._sconfig.dat
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x160]
push 0
push 0x80
push 2
push 0
push 2
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x40ec3c
lea eax, [esp + 0xc0]
push eax
call dword [sym.imp.PAL.dll_PalGetSystemParameters]
mov eax, dword [esp + 0xec]
add esp, 4
mov ecx, dword [esp + 0x11c]
mov dword [esp + 0x130], eax
or ecx, 8
mov eax, dword [esp + 0xec]
mov dword [esp + 0x134], eax
mov eax, dword [esp + 0xf0]
mov dword [esp + 0x138], eax
mov eax, dword [esp + 0xf4]
mov dword [esp + 0x13c], eax
mov eax, dword [esp + 0x124]
mov dword [esp + 0x148], eax
mov eax, dword [esp + 0x120]
mov dword [esp + 0x14c], eax
mov eax, dword [esp + 0x114]
mov dword [esp + 0x144], eax
mov eax, dword [esp + 0x128]
push 0
mov dword [esp + 0x154], eax
lea eax, [esp + 0x24]
push eax
push 0x24
lea eax, [esp + 0x13c]
mov dword [esp + 0x128], ecx
push eax
push esi
mov dword [esp + 0x154], ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40ec35
lea eax, [esp + 0x160]
push eax
lea eax, [esp + 0x36c]
push 0x4c0ee4
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x368]
push 0x40030
push 0x4c0f24
push eax
call dword [sym.imp.USER32.dll_GetActiveWindow]
push eax
call edi
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
call dword [sym.imp.PAL.dll_PalUninit]
mov eax, dword [0x4d2514]
test eax, eax
je 0x40ec52
push eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov dword [0x4d2514], 0
mov dword [0x4d2518], 0
xor esi, esi
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x40ec77
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esp + 0x76c]
mov eax, esi
pop edi
pop esi
xor ecx, esp
call fcn.0046ccad
mov esp, ebp
pop ebp
ret 0x10