Function at 0x40ddc0
Capabilities:
Get file size
Read .ini file
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, 0x778
mov eax, dword [0x50b070]
xor eax, esp
mov dword [esp + 0x774], eax
mov eax, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 8]
push edi
push 0x400
mov dword [esp + 0x20], eax
lea eax, [esp + 0x37c]
push 0
push eax
mov dword [esp + 0x20], esi
call fcn.0048cf70
add esp, 0xc
lea eax, [esp + 0x378]
push 0x400
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea eax, [esp + 0x378]
push 0x400
push eax
call fcn.0049797f
add esp, 8
cmp eax, 0x104
jl 0x40de63
push 0x40010
push 0x4f55d0
push 0x4f55e8
push 0
call dword [sym.imp.USER32.dll_MessageBoxA]
mov eax, 1
pop edi
pop esi
mov ecx, dword [esp + 0x774]
xor ecx, esp
call fcn.0048a3ac
mov esp, ebp
pop ebp
ret 0x10
mov edi, dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecA]
lea eax, [esp + 0x378]
push eax
call edi
mov cl, byte [esp + 0x378]
lea edx, [esp + 0x378]
test cl, cl
je 0x40deb4
cmp cl, 0x80
jb 0x40de8f
cmp cl, 0x9f
jbe 0x40de96
lea eax, [ecx + 0x20]
cmp al, 0xf
ja 0x40de9d
mov eax, 2
jmp 0x40deab
cmp cl, 0x3f
je 0x40df73
mov eax, 1
mov cl, byte [edx + eax]
add edx, eax
test cl, cl
jne 0x40de85
push 0x104
lea eax, [esp + 0x37c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea eax, [esp + 0x378]
push eax
call edi
lea ecx, [esp + 0x378]
dec ecx
nop word [eax + eax]
mov al, byte [ecx + 1]
lea ecx, [ecx + 1]
test al, al
jne 0x40dee0
mov eax, dword [str.dllPAL.dll]
mov dword [ecx], eax
mov eax, dword [0x4f55a4]
mov dword [ecx + 4], eax
mov eax, dword [0x4f55a8]
mov dword [ecx + 8], eax
mov al, byte [0x4f55ac]
push 8
mov byte [ecx + 0xc], al
lea eax, [esp + 0x37c]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryExA]
test eax, eax
je 0x40de48
mov ecx, esi
call fcn.0040d2c0
test eax, eax
je 0x40de48
cmp byte [0x50f101], 0
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
jne 0x40dfb2
push 0x50f330
push 1
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
mov dword [0x50f110], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x40dfa8
push dword [0x50f110]
call edi
mov eax, 1
jmp 0x40dfaa
lea eax, [esp + 0x378]
push eax
lea eax, [esp + 0x174]
push 0x4f5658
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x170]
push 0x40010
push 0x4f55d0
push eax
jmp 0x40de40
xor eax, eax
test eax, eax
jne 0x40de48
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.PAL.dll_PalDefaultCreate]
add esp, 4
mov dword [esp + 0x28], esi
cmp byte [0x50f100], 0
mov dword [esp + 0x74], 0x40cfa0
je 0x40dfdf
mov eax, 1
jmp 0x40e1c2
push str.system.dat
push 0x50f538
xorps xmm0, xmm0
mov dword [esp + 0x150], 0
lea eax, [esp + 0x380]
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 + 0x170]
push eax
lea eax, [esp + 0x37c]
push eax
call dword [sym.imp.KERNEL32.dll_FindFirstFileA]
cmp eax, 0xffffffff
je 0x40e057
mov esi, dword [esp + 0x170]
push eax
call dword [sym.imp.KERNEL32.dll_FindClose]
and esi, 0x10
jne 0x40e053
xor eax, eax
jmp 0x40e1c2
mov esi, dword [esp + 0x14]
xorps xmm0, xmm0
mov dword [esp + 0xa8], esi
push 0x7f00
push 0
movlpd qword [esp + 0xa8], xmm0
movlpd qword [esp + 0xb4], xmm0
movlpd qword [esp + 0xbc], xmm0
mov dword [esp + 0xc4], 0x50f330
mov dword [esp + 0xa4], 0x467630
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 0x40e0f9
xor eax, eax
jmp 0x40e1c2
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 0x50f330
push 0x50f330
push 8
call dword [sym.imp.USER32.dll_CreateWindowExA]
mov esi, eax
test esi, esi
je 0x40e1c2
push 5
push esi
call dword [sym.imp.USER32.dll_ShowWindow]
push esi
call dword [sym.imp.USER32.dll_UpdateWindow]
push 1
push 0
push 0
push 0
lea eax, [esp + 0x140]
push eax
call dword [sym.imp.USER32.dll_PeekMessageA]
test eax, eax
je 0x40e157
lea eax, [esp + 0x130]
push eax
push esi
call dword [sym.imp.USER32.dll_IsDialogMessageA]
test eax, eax
jne 0x40e157
cmp dword [esp + 0x134], 0x12
je 0x40e1ac
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 0x40e157
push dword [esp + 0x14]
push 0x50f330
call dword [sym.imp.USER32.dll_UnregisterClassA]
mov eax, dword [esp + 0x138]
mov dword [esp + 0x2c], eax
mov eax, dword [0x50f118]
cmp eax, 1
jne 0x40e1dc
mov eax, 0x280
mov ecx, 0x1e0
jmp 0x40e251
cmp eax, 2
jne 0x40e1ed
mov eax, 0x320
mov ecx, 0x258
jmp 0x40e251
cmp eax, 3
jne 0x40e1fe
mov eax, 0x3c0
mov ecx, 0x258
jmp 0x40e251
cmp eax, 4
je 0x40e247
cmp eax, 5
jne 0x40e214
mov eax, 0x780
mov ecx, 0x438
jmp 0x40e251
cmp eax, 6
jne 0x40e225
mov eax, 0xa00
mov ecx, 0x5a0
jmp 0x40e251
cmp eax, 7
jne 0x40e236
mov eax, 0xf00
mov ecx, 0x870
jmp 0x40e251
cmp eax, 8
jne 0x40e247
mov eax, 0x1e00
mov ecx, 0x10e0
jmp 0x40e251
mov ecx, 0x2d0
mov eax, 0x500
push 0x208
mov dword [esp + 0x5c], eax
mov dword [esp + 0x64], eax
mov dword [0x50f740], eax
lea eax, [esp + 0x174]
push 0
push eax
mov dword [esp + 0x68], ecx
mov dword [esp + 0x70], ecx
mov dword [esp + 0x58], 0x3c
mov dword [esp + 0x74], 0x5ff
mov dword [esp + 0x78], 0x5ff
mov dword [esp + 0x40], 0x50f330
mov dword [esp + 0x44], 0x50f330
mov dword [esp + 0x48], 0x65
mov dword [0x50f10c], ecx
mov dword [esp + 0x3c], 0
call fcn.0048cf70
add esp, 0xc
lea eax, [esp + 0x170]
push 0x50f538
push str._sconfig.dat
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x170]
push 0
push 0x80
push 3
push 0
push 1
push connect
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x40e3d7
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
test eax, eax
je 0x40e3d7
push 0
lea eax, [esp + 0x1c]
push eax
push 0x24
lea eax, [esp + 0x13c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call edi
cmp dword [esp + 0x18], 0x24
jne 0x40e3d7
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 [0x50f740]
mov dword [esp + 0x5c], ecx
call esi
cmp dword [esp + 0x5c], eax
jge 0x40e3e7
mov eax, dword [0x50f10c]
mov dword [esp + 0x5c], eax
jmp 0x40e3e7
lea edx, [esp + 0x28]
lea ecx, [esp + 0x170]
call fcn.00467ac0
push 0x4f55b0
push dword [esp + 0x20]
call fcn.0048bf80
mov esi, eax
add esp, 8
test esi, esi
je 0x40e4d3
push 9
inc esi
push str.MOVIESKIP
push esi
call fcn.00497190
add esp, 0xc
test eax, eax
jne 0x40e426
mov byte [0x50f102], 1
add esi, 9
jmp 0x40e4bb
push 3
push 0x4f55c0
push esi
call fcn.00497190
add esp, 0xc
test eax, eax
jne 0x40e454
mov eax, dword [esp + 0x84]
not eax
or eax, 8
add esi, 3
not eax
mov dword [esp + 0x84], eax
jmp 0x40e4bb
push 2
push 0x4f55c4
push esi
call fcn.00497190
add esp, 0xc
test eax, eax
jne 0x40e471
mov dword [esp + 0x88], eax
jmp 0x40e4b8
push 2
push 0x4f55c8
push esi
call fcn.00497190
add esp, 0xc
test eax, eax
jne 0x40e49c
mov eax, dword [esp + 0x84]
not eax
or eax, 1
not eax
mov dword [esp + 0x84], eax
jmp 0x40e4b8
push 2
push 0x4f55cc
push esi
call fcn.00497190
add esp, 0xc
test eax, eax
jne 0x40e4bb
or dword [esp + 0x84], 8
add esi, 2
push 0x4f55b0
push esi
call fcn.0048bf80
mov esi, eax
add esp, 8
test esi, esi
jne 0x40e402
mov ecx, dword [esp + 0x14]
call fcn.004636d0
mov dword [0x50b9e0], eax
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.PAL.dll_PalInit]
add esp, 4
test eax, eax
je 0x40e95f
xor ecx, ecx
call fcn.00468120
push str.system.dat
push 0x50f538
lea eax, [esp + 0x380]
push str._s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
lea eax, [esp + 0x174]
push eax
lea eax, [esp + 0x38c]
push eax
call dword [sym.imp.PAL.dll_PalFileCreate]
mov esi, eax
add esp, 0x18
cmp esi, 0xffffffff
je 0x40e65b
push 1
push 0
push 2
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [esp + 0x20]
push eax
push 4
lea eax, [esp + 0x24]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call edi
lea eax, [esp + 0x164]
push eax
push str.Script.src
call dword [sym.imp.PAL.dll_PalFileCreate]
mov esi, eax
add esp, 8
cmp esi, 0xffffffff
je 0x40e5bd
mov ecx, dword [esp + 0x164]
push 0
push 0
add ecx, 4
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [esp + 0x20]
push eax
push 4
lea eax, [esp + 0x2c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call edi
mov eax, dword [esp + 0x18]
cmp eax, dword [esp + 0x20]
je 0x40e65b
cmp byte [0x50f100], 0
je 0x40e615
call fcn.00467e70
test eax, eax
jne 0x40e65b
push 0x40020
push 0x4f56fc
push 0x4f570c
call dword [sym.imp.USER32.dll_GetActiveWindow]
push eax
call dword [sym.imp.USER32.dll_MessageBoxA]
call dword [sym.imp.PAL.dll_PalUninit]
push dword [0x50f110]
call edi
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x774]
xor ecx, esp
call fcn.0048a3ac
mov esp, ebp
pop ebp
ret 0x10
push 0x40024
push 0x4f5744
push 0x4f5750
call dword [sym.imp.USER32.dll_GetActiveWindow]
mov esi, dword [sym.imp.USER32.dll_MessageBoxA]
push eax
call esi
cmp eax, 6
jne 0x40e5ef
call fcn.00467e70
test eax, eax
jne 0x40e65b
push 0x40020
push 0x4f56fc
push 0x4f570c
call dword [sym.imp.USER32.dll_GetActiveWindow]
push eax
call esi
jmp 0x40e5ef
push str.User32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [0x50f758], eax
test eax, eax
je 0x40e683
push str.GetProductInfo
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov dword [0x50f75c], eax
call dword [sym.imp.PAL.dll_PalDebugIs]
test eax, eax
je 0x40e7dd
push 0x50f434
call dword [sym.imp.PAL.dll_PalGetFilePath]
push eax
lea eax, [esp + 0x380]
push str._s_s.ini
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
mov edi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntA]
lea eax, [esp + 0x388]
add esp, 0x10
push eax
push 1
push str.History
push str.DebugWindow
call edi
mov esi, dword [sym.imp.PAL.dll_PalDebugWindowCreate]
test eax, eax
je 0x40e6e7
push 1
push 0x4f5198
push 0xa
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push str.UserMemory
push str.DebugWindow
call edi
test eax, eax
je 0x40e70f
push 3
push 0x4f51ac
push 0xb
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push str.SystemMemory
push str.DebugWindow
call edi
test eax, eax
je 0x40e737
push 3
push 0x4f51cc
push 0xc
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push str.TempMemory
push str.DebugWindow
call edi
test eax, eax
je 0x40e75f
push 3
push 0x4f51e8
push 0xd
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push 0x4f51fc
push str.DebugWindow
call edi
test eax, eax
je 0x40e787
push 3
push 0x4f5200
push 0xe
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push 0x4f5210
push str.DebugWindow
call edi
test eax, eax
je 0x40e7af
push 3
push 0x4f5214
push 0xf
call esi
add esp, 0xc
lea eax, [esp + 0x378]
push eax
push 1
push str.Output
push str.DebugWindow
call edi
test eax, eax
je 0x40e7d7
push 1
push str.output
push 0x10
call esi
add esp, 0xc
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call dword [sym.imp.PAL.dll_PalRun]
push 0x208
lea eax, [esp + 0x174]
push 0
push eax
call fcn.0048cf70
add esp, 0xc
lea eax, [esp + 0x170]
push 0x50f538
push str._sconfig.dat
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x170]
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 0x40e935
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 0x40e932
lea eax, [esp + 0x170]
push eax
lea eax, [esp + 0x37c]
push 0x4fb28c
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x378]
push 0x40030
push 0x4fb280
push eax
call dword [sym.imp.USER32.dll_GetActiveWindow]
push eax
call dword [sym.imp.USER32.dll_MessageBoxA]
push esi
call edi
call dword [sym.imp.PAL.dll_PalUninit]
mov eax, dword [0x50f758]
test eax, eax
je 0x40e94b
push eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov dword [0x50f758], 0
mov dword [0x50f75c], 0
push dword [0x50f110]
call edi
mov ecx, dword [esp + 0x77c]
xor eax, eax
pop edi
pop esi
xor ecx, esp
mov dword [0x50f110], 0
call fcn.0048a3ac
mov esp, ebp
pop ebp
ret 0x10