Function at 0x404920
Capabilities:
Get common file path
Get file size
Read file via mapping
Set current directory
Set environment variable
Write file on windows

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x13c
call fcn.00403f30
mov dword [esp + 8], 0x104
mov dword [esp + 4], 0x40c1c0
mov dword [esp], 0
call sub.KERNEL32.dll_GetModuleFileNameA
sub esp, 0xc
test eax, eax
je 0x404aa0
mov dword [esp], 0x40c0a0
call fcn.004039c0
mov dword [esp + 4], 0x40c1c0
mov dword [esp], str.OCRA_EXECUTABLE
call sub.KERNEL32.dll_SetEnvironmentVariableA
sub esp, 8
mov dword [esp + 4], 1
mov dword [esp], 0x4034f0
call sub.KERNEL32.dll_SetConsoleCtrlHandler
sub esp, 8
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 3
mov dword [esp + 4], 0x80000000
mov dword [esp], 0x40c1c0
call sub.KERNEL32.dll_CreateFileA
sub esp, 0x1c
cmp eax, 0xffffffff
mov esi, eax
je 0x404af3
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.KERNEL32.dll_GetFileSize
sub esp, 8
mov edi, eax
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 2
mov dword [esp + 4], 0
mov dword [esp], esi
call sub.KERNEL32.dll_CreateFileMappingA
sub esp, 0x18
cmp eax, 0xffffffff
mov ebx, eax
jne 0x404b2d
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
call sub.KERNEL32.dll_GetLastError
mov dword [esp + 4], str.Failed_to_create_file_mapping__error__lu_
mov dword [esp + 8], eax
mov dword [esp], ebx
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
mov dword [esp], esi
call sub.KERNEL32.dll_CloseHandle
sub esp, 4
add esp, 0x13c
mov eax, 0xffffffff
pop ebx
pop esi
pop edi
pop ebp
ret 0x10
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
call sub.KERNEL32.dll_GetLastError
mov dword [esp + 4], str.Failed_to_get_executable_name__error__lu_.
mov dword [esp + 8], eax
mov dword [esp], ebx
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404a85
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
mov dword [esp + 8], 0x40c1c0
mov dword [esp + 4], str.Failed_to_open_executable___s_
jmp 0x404ad9
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 4
mov dword [esp], eax
call sub.KERNEL32.dll_MapViewOfFile
sub esp, 0x14
test eax, eax
mov ebp, eax
je 0x404e58
mov dword [esp + 4], edi
mov dword [esp], eax
call fcn.004040f0
test eax, eax
jne 0x404b7c
mov dword [0x40c02c], 0xffffffff
mov dword [esp], ebp
call sub.KERNEL32.dll_UnmapViewOfFile
test eax, eax
push edx
jne 0x404be1
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea edi, [eax + 0x40]
mov dword [esp + 0xc], edi
call sub.msvcrt.dll_fwrite
mov dword [esp + 0xc], edi
mov dword [esp + 8], 0x23
mov dword [esp + 4], 1
mov dword [esp], str.Failed_to_unmap_view_of_executable.
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], edi
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
mov dword [esp], ebx
call sub.KERNEL32.dll_CloseHandle
test eax, eax
push ebp
jne 0x404c46
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 0x1d
mov dword [esp + 4], 1
mov dword [esp], str.Failed_to_close_file_mapping.
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
mov dword [esp], esi
call sub.KERNEL32.dll_CloseHandle
test eax, eax
push edi
jne 0x404cab
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 0x1b
mov dword [esp + 4], 1
mov dword [esp], str.Failed_to_close_executable.
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
cmp dword [0x408064], 0
je 0x404cdb
cmp dword [0x40c024], 0
jne 0x404eae
mov dword [esp], 0x40c0a0
call sub.KERNEL32.dll_SetCurrentDirectoryA
push ebx
mov dword [esp], str.._src
call sub.KERNEL32.dll_SetCurrentDirectoryA
push esi
cmp dword [0x40c034], 0
je 0x404d0c
cmp dword [0x40c030], 0
je 0x404d0c
cmp dword [0x40c024], 0
jne 0x404d62
mov eax, dword [0x40c030]
mov dword [esp + 4], eax
mov eax, dword [0x40c034]
mov dword [esp], eax
call fcn.00404780
cmp dword [0x40c020], 0
je 0x404d55
cmp dword [0x40c024], 0
jne 0x404e23
lea ebx, [esp + 0x2c]
mov dword [esp + 4], 0x104
mov dword [esp], ebx
call sub.KERNEL32.dll_GetSystemDirectoryA
test eax, eax
push ecx
push ecx
je 0x404e11
mov dword [esp], ebx
call sub.KERNEL32.dll_SetCurrentDirectoryA
push edx
mov dword [esp], 0x40c0a0
call fcn.00403f00
mov eax, dword [0x40c02c]
mov dword [esp], eax
call sub.KERNEL32.dll_ExitProcess
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xa
mov dword [esp + 4], 1
mov dword [esp], 0x409488
lea ebx, [eax + 0x40]
mov dword [esp + 0xc], ebx
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
cmp dword [0x40c024], 0
je 0x404cf6
mov dword [esp + 8], 0x40c0a0
mov dword [esp + 4], str.Starting_app_in:__s
mov dword [esp], ebx
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
cmp dword [0x40c024], 0
je 0x404cf6
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 0xa
mov dword [esp + 4], 1
mov dword [esp], 0x409488
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404cf6
mov dword [esp], 0x4094d5
call sub.KERNEL32.dll_SetCurrentDirectoryA
push eax
jmp 0x404d49
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0x40c0a0
mov dword [esp + 4], str.Deleting_temporary_installation_directory__s
lea ebx, [eax + 0x40]
mov dword [esp], ebx
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404d22
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xd
mov dword [esp + 4], 1
mov dword [esp], str.FATAL_ERROR:
lea edi, [eax + 0x40]
mov dword [esp + 0xc], edi
call sub.msvcrt.dll_fwrite
call sub.KERNEL32.dll_GetLastError
mov dword [esp + 4], str.Failed_to_map_view_of_executable_into_memory__error__lu_.
mov dword [esp + 8], eax
mov dword [esp], edi
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], edi
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404be1
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0x40c0a0
mov dword [esp + 4], str.Changing_CWD_to_unpacked_directory__s_src
lea ebx, [eax + 0x40]
mov dword [esp], ebx
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404cc1