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

Disassembly:
sub esp, 0x460
mov edx, dword [esp + 0x464]
push ebx
push ebp
xor ebx, ebx
push esi
push edi
test edx, edx
mov dword [esp + 0x10], ebx
je 0x40d91d
cmp byte [edx], 0
je 0x40d91d
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x165]
mov byte [esp + 0x164], bl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
lea eax, [esp + 0x164]
push 0x104
push eax
push edx
call dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
test eax, eax
je 0x40d91d
lea ecx, [esp + 0x60]
push 0x104
push ecx
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
lea edx, [esp + 0x60]
push 0x104
push edx
call fcn.0040c710
add esp, 8
lea eax, [esp + 0x60]
push str.Wininit.ini
push eax
call dword [sym.imp.KERNEL32.dll_lstrcatA]
lea ecx, [esp + 0x60]
push ebx
push ecx
call fcn.0040c650
mov esi, eax
add esp, 8
test esi, esi
jbe 0x40d8f5
lea edx, [esi + 0x64]
push edx
call fcn.0041a915
mov ebp, eax
add esp, 4
test ebp, ebp
je 0x40d8f5
push ebx
push 0x80
push 4
push ebx
push ebx
lea eax, [esp + 0x74]
push 0xc0000000
push eax
mov byte [ebp], bl
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edi, eax
cmp edi, 0xffffffff
je 0x40d8e8
lea ecx, [esp + 0x1c]
push ebx
push ecx
push esi
push ebp
push edi
mov dword [esp + 0x30], ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x1c]
cmp eax, esi
jne 0x40d8e1
push str.rename
lea edx, [esp + 0x24]
push str.__s_
push edx
mov byte [eax + ebp], bl
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [esp + 0x20]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ebx, dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [esp + 0x18], eax
mov esi, ebp
movsx ecx, byte [esp + 0x20]
push ecx
push esi
call fcn.0041b0a0
mov esi, eax
add esp, 8
test esi, esi
je 0x40d8dd
mov edx, dword [esp + 0x18]
lea eax, [esp + 0x20]
push edx
push eax
push esi
call fcn.00423b20
add esp, 0xc
test eax, eax
jne 0x40d8d0
mov ecx, dword [esp + 0x18]
mov al, byte [esi + ecx + 1]
lea esi, [esi + ecx + 1]
cmp al, 0xd
jne 0x40d84c
inc esi
cmp byte [esi], 0xa
jne 0x40d852
inc esi
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, esi
lea edx, [esp + 0x14]
push 0
sub eax, ebp
push edx
push eax
push ebp
push edi
call ebx
lea ecx, [esp + 0x164]
lea edx, [esp + 0x268]
push ecx
push 0x42b5a8
push str._s_s_r_n
push edx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
lea eax, [esp + 0x268]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
lea ecx, [esp + 0x14]
push 0
push ecx
lea edx, [esp + 0x270]
push eax
push edx
push edi
call ebx
push esi
call dword [sym.imp.KERNEL32.dll_lstrlenA]
lea ecx, [esp + 0x14]
push 0
push ecx
push eax
push esi
push edi
call ebx
mov dword [esp + 0x10], 1
jmp 0x40d8d1
inc esi
mov eax, dword [esp + 0x10]
test eax, eax
je 0x40d807
mov ebx, dword [esp + 0x10]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebp
call fcn.0041a842
add esp, 4
test ebx, ebx
jne 0x40d91d
lea edx, [esp + 0x60]
lea eax, [esp + 0x164]
push edx
push eax
push 0x42b5a8
push str.rename
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringA]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x460
ret
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x460
ret