Function at 0x402200
Capabilities:
Get common file path
Get file size
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x720
mov eax, dword [str._q_]
xor eax, esp
push ebp
push esi
mov esi, dword [esp + 0x730]
xor ebp, ebp
cmp esi, ebp
mov dword [esp + 0x724], eax
mov eax, dword [esp + 0x72c]
mov dword [esp + 0x14], ebp
jne 0x40224a
pop esi
mov eax, 0x57
pop ebp
mov ecx, dword [esp + 0x71c]
xor ecx, esp
call fcn.0040f175
add esp, 0x720
ret
cmp eax, ebp
push edi
mov edi, dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
je 0x402267
push 0x104
lea ecx, [esp + 0x228]
push ecx
push eax
call edi
jmp 0x40226f
mov byte [esp + 0x224], 0
push 0x104
lea edx, [esp + 0x20]
push edx
push esi
call edi
push 0x104
lea eax, [esp + 0x124]
push eax
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
cmp eax, ebp
jbe 0x4022ad
cmp byte [esp + eax + 0x11f], 0x5c
je 0x4022ad
mov byte [esp + eax + 0x120], 0x5c
mov byte [esp + eax + 0x121], 0
lea edi, [esp + 0x120]
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x4022b5
mov ecx, dword [str.WinInit.ini]
mov edx, dword [0x41b958]
mov eax, dword [0x41b95c]
mov dword [edi], ecx
lea ecx, [esp + 0x120]
push ebx
mov dword [edi + 4], edx
push ecx
mov dword [edi + 8], eax
call fcn.0040dd50
add esp, 4
test eax, eax
push ebp
push 0x80
je 0x4024ec
push 3
push ebp
push 1
push 0xc0000000
lea edx, [esp + 0x13c]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x40231f
call dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x40255c
push ebp
push ebx
mov dword [esp + 0x18], ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebp, eax
test ebp, ebp
je 0x4023c1
lea esi, [ebp + 1]
push esi
call fcn.0040f6e7
mov dword [esp + 0x18], eax
mov ecx, esi
mov edx, ecx
shr ecx, 2
xor eax, eax
lea edi, [esp + 0x18]
rep stosd dword es:[edi], eax
add esp, 4
mov ecx, edx
and ecx, 3
push 0
rep stosb byte es:[edi], al
mov edi, dword [esp + 0x18]
lea eax, [esp + 0x1c]
push eax
push ebp
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4023c1
mov al, byte [edi]
xor esi, esi
test al, al
je 0x4023c1
jmp 0x402380
mov eax, dword [esp + 0x10]
test eax, eax
je 0x40238e
cmp byte [esi + edi], 0x5b
je 0x40240a
mov cl, byte [esi + edi]
cmp cl, 0x5b
lea eax, [esi + edi]
jne 0x4023ba
push 8
push str._rename_
push eax
call fcn.0040f7c8
add esp, 0xc
test eax, eax
jne 0x4023ba
add esi, 8
mov dword [esp + 0x10], 1
jmp 0x4023bb
inc esi
cmp byte [esi + edi], 0
jne 0x402380
push 2
push 0
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov al, byte [esp + 0x228]
test al, al
mov eax, dword [esp + 0x10]
jne 0x40249d
test eax, eax
mov eax, str.NUL_s_r_n
jne 0x4023ef
mov eax, str._rename__r_nNUL_s_r_n
lea ecx, [esp + 0x20]
push ecx
push eax
lea edx, [esp + 0x334]
push edx
call fcn.0040f6f9
add esp, 0xc
jmp 0x4024cc
push 0
push 0
lea ecx, [esi - 1]
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov al, byte [esp + 0x228]
test al, al
lea edx, [esp + 0x20]
jne 0x402440
push edx
lea eax, [esp + 0x330]
push str.NUL_s_r_n
push eax
call fcn.0040f6f9
add esp, 0xc
jmp 0x402463
lea ecx, [esp + 0x228]
push ecx
push edx
lea eax, [esp + 0x28]
push eax
lea ecx, [esp + 0x338]
push str.NUL_s_r_n_s_s_r_n
push ecx
call fcn.0040f6f9
add esp, 0x14
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea edx, [esp + 0x18]
push edx
push eax
lea eax, [esp + 0x338]
push eax
push ebx
call edi
push 0
lea ecx, [esp + 0x18]
push ecx
sub ebp, esi
push ebp
lea edx, [esp + esi + 0x338]
push edx
push ebx
call edi
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402558
test eax, eax
mov eax, str.NUL_s_r_n_s_s_r_n
jne 0x4024ab
mov eax, str._rename__r_nNUL_s_r_n_s_s_r_n
lea ecx, [esp + 0x228]
push ecx
lea edx, [esp + 0x24]
push edx
mov ecx, edx
push ecx
push eax
lea edx, [esp + 0x33c]
push edx
call fcn.0040f6f9
add esp, 0x14
push 0
lea ecx, [esp + 0x1c]
push ecx
push eax
lea edx, [esp + 0x338]
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402558
push 2
push ebp
push ebp
push 0x40000000
lea eax, [esp + 0x13c]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x40254e
lea ecx, [esp + 0x228]
push ecx
lea edx, [esp + 0x24]
push edx
mov eax, edx
push eax
lea ecx, [esp + 0x338]
push str._rename__r_nNUL_s_r_n_s_s_r_n
push ecx
call fcn.0040f6f9
add esp, 0x14
push ebp
lea edx, [esp + 0x1c]
push edx
push eax
lea eax, [esp + 0x338]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402558
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x72c]
pop ebx
pop edi
pop esi
pop ebp
xor ecx, esp
call fcn.0040f175
add esp, 0x720
ret