Function at 0x405020
Capabilities:
Check if file exists
Get common file path
Get file attributes
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xa48
mov eax, dword [0x464ce4]
xor eax, ebp
mov dword [ebp - 4], eax
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
mov eax, edx
shr eax, 0x1f
add eax, edx
push ebx
push esi
je 0x40541e
mov ecx, dword [edi + 0x2a4]
push 0
call fcn.0040cf52
mov ecx, dword [edi + 0x2a4]
push 0
call fcn.0040cf28
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
push ecx
mov ecx, dword [edi + 0x2a4]
call fcn.0040cf3d
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
mov eax, edx
shr eax, 0x1f
add eax, edx
push eax
push 0
push 0x45deb0
lea edx, [ebp - 0x210]
call fcn.00405df0
mov ecx, dword [edi + 0x2a4]
mov edx, dword [ecx]
mov edx, dword [edx + 0x2c]
add esp, 0xc
lea eax, [ebp - 0x210]
push eax
call edx
lea eax, [ebp - 0xa20]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
je 0x40541e
mov dword [ebp - 0xa38], 1
mov dword [ebp - 0xa2c], 0
mov esi, dword [edi + 0xd88]
add esi, dword [ebp - 0xa2c]
push 0x400
lea edx, [ebp - 0x610]
push 0
push edx
mov dword [ebp - 0xa44], esi
call fcn.0043a230
add esp, 0xc
push 0
call fcn.0043871c
add esp, 4
push edx
push eax
push esi
lea eax, [edi + 0xb70]
push eax
push str._s__s.bin_t_d
lea edx, [ebp - 0x610]
call fcn.00405e30
lea eax, [ebp - 0x610]
add esp, 0x14
xor edx, edx
lea ebx, [eax + 2]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x405185
sub eax, ebx
sar eax, 1
je 0x4051d3
cmp word [ebp + edx*2 - 0x610], 0x5c
jne 0x4051ae
mov eax, 0x2f
mov word [ebp + edx*2 - 0x610], ax
lea eax, [ebp - 0x610]
inc edx
lea ebx, [eax + 2]
jmp 0x4051c0
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x4051c0
sub eax, ebx
sar eax, 1
cmp edx, eax
jb 0x405196
push esi
lea ebx, [ebp - 0xa34]
lea edx, [ebp - 0x610]
mov ecx, edi
call fcn.00403e60
mov ebx, eax
mov dword [ebp - 0xa3c], ebx
push esi
lea edx, [ebp - 0x210]
test ebx, ebx
je 0x40543c
push str.ck_W
call fcn.00405df0
mov ecx, dword [edi + 0x2a0]
mov edx, dword [ecx]
mov edx, dword [edx + 0x2c]
add esp, 8
lea eax, [ebp - 0x210]
push eax
call edx
call dword [sym.imp.Shell.dll_void___cdecl_FourierTransformationStart_void_]
cmp dword [ebp - 0xa34], 0x14
jb 0x405240
push 0x10
lea ecx, [ebx + 4]
push str.PAt25IqEvNB7Gmin
call fcn.004029b0
add esp, 8
call dword [sym.imp.Shell.dll_void___cdecl_FourierTransformationEnd_void_]
mov eax, dword [ebx]
push eax
mov byte [ebp - 0xa21], 0
mov dword [ebp - 0xa40], eax
call fcn.004061d0
add esp, 4
mov dword [ebp - 0xa28], eax
test eax, eax
jne 0x405274
mov byte [ebp - 0xa21], 1
jmp 0x405366
mov ecx, dword [ebp - 0xa34]
add ecx, 0xfffffffc
push ecx
lea edx, [ebx + 4]
push edx
lea ecx, [ebp - 0xa40]
push ecx
push eax
call fcn.00435bd0
add esp, 0x10
test eax, eax
je 0x4052a2
mov byte [ebp - 0xa21], 1
jmp 0x405366
push esi
lea edx, [ebp - 0xa20]
push edx
push str._s_s
lea edx, [ebp - 0x818]
call fcn.00405df0
lea eax, [ebp - 0x818]
add esp, 0xc
push eax
call fcn.00402db0
add esp, 4
mov ebx, eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4052de
test al, 0x10
jne 0x4052eb
mov esi, ebx
call fcn.00402d10
mov esi, dword [ebp - 0xa44]
mov ebx, dword [ebp - 0xa40]
push 0x45db70
lea ecx, [ebp - 0x818]
push ecx
lea edx, [ebp - 0xa30]
push edx
call fcn.00438b75
add esp, 0xc
test eax, eax
jne 0x405430
mov eax, dword [ebp - 0xa30]
mov ecx, dword [ebp - 0xa28]
push eax
push ebx
push 1
push ecx
call fcn.00438d13
mov edx, dword [ebp - 0xa30]
push edx
call fcn.00438f17
mov eax, dword [ebp - 0xa30]
add esp, 0x14
push eax
call fcn.00438fe0
add esp, 4
push str.._patchfile.ini
lea ecx, [esi + 0x208]
push ecx
push 0x45de70
push esi
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringW]
mov ebx, dword [ebp - 0xa3c]
push ebx
call fcn.00438a6d
mov eax, dword [ebp - 0xa28]
add esp, 4
test eax, eax
je 0x405382
push eax
call fcn.00438a6d
add esp, 4
cmp byte [ebp - 0xa21], 0
jne 0x40546a
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
mov esi, dword [ebp - 0xa38]
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
mov eax, edx
shr eax, 0x1f
add eax, edx
push eax
push esi
push 0x45deb0
lea edx, [ebp - 0x210]
call fcn.00405df0
mov ecx, dword [edi + 0x2a4]
add esp, 0xc
push esi
call fcn.0040cf52
mov ecx, dword [edi + 0x2a4]
mov edx, dword [ecx]
mov edx, dword [edx + 0x2c]
lea eax, [ebp - 0x210]
push eax
call edx
mov ecx, dword [edi + 0xd8c]
sub ecx, dword [edi + 0xd88]
add dword [ebp - 0xa2c], 0x410
mov eax, 0x7e07e07f
imul ecx
sar edx, 9
inc esi
mov eax, edx
shr eax, 0x1f
mov dword [ebp - 0xa38], esi
add eax, edx
dec esi
cmp esi, eax
jb 0x40512b
mov al, 1
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0043836a
mov esp, ebp
pop ebp
ret
mov byte [ebp - 0xa21], 1
jmp 0x405360
push 0x45def0
call fcn.00405df0
mov ecx, dword [edi + 0x2a0]
mov edx, dword [ecx]
mov edx, dword [edx + 0x2c]
add esp, 8
lea eax, [ebp - 0x210]
push eax
call edx
mov ecx, dword [edi + 0x2a0]
push 0x64
call fcn.0040cf52
mov ecx, dword [ebp - 4]
pop esi
xor ecx, ebp
xor al, al
pop ebx
call fcn.0043836a
mov esp, ebp
pop ebp
ret