Function at 0x4046d0
Capabilities:
Delete file
Get file size
Read file via mapping
Set current directory
Set environment variable
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x4c
mov dword [esp + 8], 0x104
mov dword [esp + 4], 0x40b1c0
mov dword [esp], 0
call sub.kernel32.dll_GetModuleFileNameA
sub esp, 0xc
test eax, eax
je 0x404840
mov dword [esp], 0x40b0a0
call fcn.00403bb0
mov dword [esp + 4], 0x40b1c0
mov dword [esp], str.OCRA_EXECUTABLE
call sub.kernel32.dll_SetEnvironmentVariableA
sub esp, 8
mov dword [esp + 4], 1
mov dword [esp], 0x4036f0
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], 0x40b1c0
call sub.kernel32.dll_CreateFileA
sub esp, 0x1c
cmp eax, 0xffffffff
mov ebx, eax
je 0x4048a0
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], ebx
call sub.kernel32.dll_CreateFileMappingA
sub esp, 0x18
cmp eax, 0xffffffff
mov esi, eax
jne 0x4048da
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 esi, [eax + 0x40]
mov dword [esp + 0xc], esi
call sub.msvcrt.dll_fwrite
call sub.kernel32.dll_GetLastError
mov dword [esp], esi
mov dword [esp + 4], str.Failed_to_create_file_mapping__error__lu_
mov dword [esp + 8], eax
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], esi
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
mov dword [esp], ebx
call sub.kernel32.dll_CloseHandle
mov eax, 0xffffffff
sub esp, 4
lea esp, [ebp - 0xc]
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
lea esp, [ebp - 0xc]
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
mov dword [esp + 8], 0x40b1c0
mov dword [esp + 4], str.Failed_to_open_executable___s_
jmp 0x404879
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
je 0x404b26
mov dword [esp + 4], edi
mov dword [esp], eax
mov dword [ebp - 0x3c], eax
call fcn.00403ec0
mov edx, dword [ebp - 0x3c]
test eax, eax
jne 0x40492d
mov dword [0x40b02c], 0xffffffff
mov dword [esp], edx
call sub.kernel32.dll_UnmapViewOfFile
test eax, eax
push edi
jne 0x404992
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], esi
call sub.kernel32.dll_CloseHandle
test eax, eax
push ecx
jne 0x4049f7
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 esi, [eax + 0x40]
mov dword [esp + 0xc], esi
call sub.msvcrt.dll_fwrite
mov dword [esp + 0xc], esi
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], esi
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
mov dword [esp], ebx
call sub.kernel32.dll_CloseHandle
test eax, eax
push edx
jne 0x404a5c
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 [0x407044], 0
je 0x404a8c
cmp dword [0x40b024], 0
jne 0x404b7c
mov dword [esp], 0x40b0a0
call sub.kernel32.dll_SetCurrentDirectoryA
push edi
mov dword [esp], str.._src
call sub.kernel32.dll_SetCurrentDirectoryA
push eax
cmp dword [0x40b034], 0
je 0x404ac1
cmp dword [0x40b030], 0
je 0x404ac1
cmp dword [0x40b024], 0
jne 0x404bb1
mov eax, dword [0x40b030]
mov dword [esp + 4], eax
mov eax, dword [0x40b034]
mov dword [esp], eax
call fcn.00404540
cmp dword [0x40b020], 0
je 0x404b19
cmp dword [0x40b024], 0
jne 0x404c60
mov dword [esp], 0x40b0a0
mov dword [ebp - 0x36], 0
mov dword [ebp - 0x32], 3
call sub.kernel32.dll_lstrlenA
mov dword [ebp - 0x2e], 0x40b0a0
mov dword [ebp - 0x2a], 0
mov word [ebp - 0x26], 0x414
push ebx
mov byte [eax + 0x40b0a1], 0
lea eax, [ebp - 0x36]
mov dword [esp], eax
call sub.shell32.dll_SHFileOperationA
push esi
mov eax, dword [0x40b02c]
mov dword [esp], eax
call sub.kernel32.dll_ExitProcess
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], edi
mov dword [esp + 8], eax
call sub.msvcrt.dll_fprintf
mov dword [esp + 4], edi
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404992
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0x40b0a0
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 0x404a72
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0xa
mov dword [esp + 4], 1
mov dword [esp], 0x40845c
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 [0x40b024], 0
je 0x404aab
mov dword [esp + 8], 0x40b0a0
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 [0x40b024], 0
je 0x404aab
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 0xa
mov dword [esp + 4], 1
mov dword [esp], 0x40845c
call sub.msvcrt.dll_fwrite
mov dword [esp + 4], ebx
mov dword [esp], 0xa
call sub.msvcrt.dll_fputc
jmp 0x404aab
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], 0x40b0a0
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 0x404ad7