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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x51c
push ebx
xor ebx, ebx
cmp dword [ebp + 8], ebx
push esi
push edi
je 0x40431f
cmp dword [ebp + 0xc], ebx
je 0x40431f
cmp byte [0x41fd7c], bl
mov esi, 0x104
jne 0x4040b0
mov edi, 0x41fd7c
push esi
push edi
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
push 0x41d97c
push edi
call dword [sym.imp.SHLWAPI.dll_PathAppendA]
push 0x40
xor eax, eax
pop ecx
lea edi, [ebp - 0x313]
mov byte [ebp - 0x314], bl
push 0x40
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
pop ecx
xor eax, eax
lea edi, [ebp - 0x20f]
mov byte [ebp - 0x210], bl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
push 0x40
xor eax, eax
pop ecx
lea edi, [ebp - 0x10b]
mov byte [ebp - 0x10c], bl
push dword [ebp + 8]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov edi, dword [sym.imp.KERNEL32.dll_lstrlenW]
call edi
lea eax, [eax + eax + 2]
mov dword [ebp - 4], eax
add eax, 3
and al, 0xfc
call fcn.00402f40
mov eax, esp
push ebx
push ebx
mov dword [ebp - 8], eax
push dword [ebp - 4]
mov byte [eax], bl
push eax
push 0xffffffffffffffff
push dword [ebp + 8]
push ebx
push ebx
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
lea eax, [ebp - 0x314]
push esi
push eax
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
test eax, eax
je 0x40431f
push dword [ebp + 0xc]
call edi
lea eax, [eax + eax + 2]
mov dword [ebp - 4], eax
add eax, 3
and al, 0xfc
call fcn.00402f40
mov edi, esp
push ebx
push ebx
push dword [ebp - 4]
mov byte [edi], bl
push edi
push 0xffffffffffffffff
push dword [ebp + 0xc]
push ebx
push ebx
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
lea eax, [ebp - 0x210]
push esi
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
test eax, eax
je 0x40431f
lea eax, [ebp - 0x314]
push eax
lea eax, [ebp - 0x210]
push eax
push str._s_s_n
lea eax, [ebp - 0x10c]
push 0x103
push eax
call dword [sym.imp.MSVCRT.dll__snprintf]
mov edi, dword [sym.imp.MSVCRT.dll_fopen]
push 0x41d970
push 0x41fd7c
call edi
mov esi, eax
add esp, 0x1c
cmp esi, ebx
jne 0x4041dd
push 0x41d96c
push 0x41fd7c
call edi
mov esi, eax
pop ecx
cmp esi, ebx
pop ecx
je 0x40431f
push esi
call dword [sym.imp.MSVCRT.dll_rewind]
mov ecx, 0x81
xor eax, eax
lea edi, [ebp - 0x51b]
mov byte [ebp - 0x51c], bl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov edi, dword [sym.imp.MSVCRT.dll_fgets]
push esi
lea eax, [ebp - 0x51c]
push 0x208
push eax
call edi
add esp, 0x10
test eax, eax
je 0x404253
lea eax, [ebp - 0x51c]
push eax
call dword [sym.imp.MSVCRT.dll__strlwr]
lea eax, [ebp - 0x51c]
mov dword [esp], str._rename_
push eax
call dword [sym.imp.MSVCRT.dll_strstr]
pop ecx
pop ecx
test eax, eax
push esi
jne 0x404273
lea eax, [ebp - 0x51c]
push 0x208
push eax
call edi
add esp, 0xc
jmp 0x404214
mov edi, dword [sym.imp.MSVCRT.dll_fputs]
push esi
push str._rename__n
call edi
lea eax, [ebp - 0x10c]
push esi
push eax
call edi
add esp, 0x10
jmp 0x404312
call dword [sym.imp.MSVCRT.dll_ftell]
mov edi, dword [sym.imp.MSVCRT.dll_fseek]
push 2
push ebx
push esi
mov dword [ebp + 8], eax
call edi
push esi
call dword [sym.imp.MSVCRT.dll_ftell]
add esp, 0x14
cmp dword [ebp + 8], eax
jne 0x4042a8
lea eax, [ebp - 0x10c]
push esi
push eax
call dword [sym.imp.MSVCRT.dll_fputs]
pop ecx
jmp 0x404311
sub eax, dword [ebp + 8]
dec eax
push eax
mov dword [ebp - 4], eax
call dword [sym.imp.MSVCRT.dll_malloc]
cmp eax, ebx
pop ecx
mov dword [ebp + 0xc], eax
je 0x40431f
push dword [ebp - 4]
push ebx
push eax
call sub.MSVCRT.dll_memset
push ebx
push dword [ebp + 8]
push esi
call edi
push esi
push dword [ebp - 4]
push 1
push dword [ebp + 0xc]
call dword [sym.imp.MSVCRT.dll_fread]
push ebx
mov dword [ebp - 8], eax
push dword [ebp + 8]
push esi
call edi
lea eax, [ebp - 0x10c]
push esi
push eax
call dword [sym.imp.MSVCRT.dll_fputs]
push esi
push 1
push dword [ebp - 8]
push dword [ebp + 0xc]
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x4c
push dword [ebp + 0xc]
call dword [sym.imp.MSVCRT.dll_free]
pop ecx
push esi
call dword [sym.imp.MSVCRT.dll_fclose]
pop ecx
push 1
pop eax
jmp 0x404321
xor eax, eax
lea esp, [ebp - 0x528]
pop edi
pop esi
pop ebx
leave
ret