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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
push esi
push edi
mov ax, word [0x522180]
mov word [ebp - 0x10], ax
mov cl, byte [0x522182]
mov byte [ebp - 0xe], cl
mov ecx, 0xa
mov esi, str.device_SystemRoot__system32haspdos.sys
lea edi, [ebp - 0x48]
rep movsd dword es:[edi], dword [esi]
movsb byte es:[edi], byte [esi]
push 0x2710
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x5ac18c], eax
cmp dword [0x5ac18c], 0
jne 0x40fe70
push 5
call fcn.00406ccc
add esp, 4
or eax, 0xffffffff
jmp 0x4104f7
push 0x200
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push 0x5221b0
push 0x5abd60
call fcn.0041e940
add esp, 8
push 0x5abd60
push 0x5abf80
call fcn.0041e930
add esp, 8
push 0x5221b4
push 0x5abd60
call fcn.0041e940
add esp, 8
push str.config.hsp
push 0x5abf80
call fcn.0041e940
add esp, 8
cmp dword [ebp + 8], 0
jne 0x40fee2
push 0
push 0x5abf80
push 0x5abd60
call fcn.00408ae7
add esp, 0xc
push 0
push 0x80
push 4
push 0
push 1
push 0x80000000
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [0x5abd40], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x40ff19
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
cmp dword [0x5abd40], 0xffffffff
jne 0x40ff44
push 0x40003
call fcn.00406ccc
add esp, 4
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
push 0
lea eax, [ebp - 0x1c]
push eax
push 0x270f
mov ecx, dword [0x5ac18c]
push ecx
mov edx, dword [0x5abd40]
push edx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x40ff9a
push 0x4000a
call fcn.00406ccc
add esp, 4
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov ecx, dword [0x5abd40]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
jmp 0x4104f7
mov edx, dword [0x5abd40]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x40ffcc
push 0x40005
call fcn.00406ccc
add esp, 4
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
mov dword [ebp - 4], 1
mov dword [ebp - 0x14], 0
jmp 0x40ffe5
mov ecx, dword [ebp - 0x14]
add ecx, 1
mov dword [ebp - 0x14], ecx
mov edx, dword [ebp - 0x14]
cmp edx, dword [ebp - 0x1c]
jae 0x410053
cmp dword [ebp - 4], 1
jne 0x410053
mov eax, dword [0x5ac18c]
add eax, dword [ebp - 0x14]
xor ecx, ecx
mov cl, byte [eax]
movsx edx, byte [0x521a1c]
cmp ecx, edx
jne 0x410051
mov dword [ebp - 4], 0
mov dword [ebp - 0x18], 0
jmp 0x410023
mov eax, dword [ebp - 0x18]
add eax, 1
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0xb
jae 0x410051
mov ecx, dword [ebp - 0x14]
add ecx, dword [ebp - 0x18]
mov edx, dword [0x5ac18c]
xor eax, eax
mov al, byte [edx + ecx]
mov ecx, dword [ebp - 0x18]
movsx edx, byte [ecx + 0x521a1c]
cmp eax, edx
je 0x41004f
mov dword [ebp - 4], 1
jmp 0x41001a
jmp 0x40ffdc
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x1c]
jne 0x410239
cmp dword [ebp - 4], 1
jne 0x410239
cmp dword [ebp + 8], 0
jne 0x410226
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x1c]
xor edx, edx
mov dl, byte [ecx - 1]
cmp edx, 0x1a
jne 0x410091
mov eax, dword [ebp - 0x1c]
sub eax, 1
mov dword [ebp - 0x1c], eax
jmp 0x4100ba
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x1c]
mov byte [ecx], 0xd
mov edx, dword [ebp - 0x1c]
add edx, 1
mov dword [ebp - 0x1c], edx
mov eax, dword [0x5ac18c]
add eax, dword [ebp - 0x1c]
mov byte [eax], 0xa
mov ecx, dword [ebp - 0x1c]
add ecx, 1
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x18], 0
mov edx, dword [ebp - 0x1c]
mov dword [ebp - 0x14], edx
jmp 0x4100db
mov eax, dword [ebp - 0x14]
add eax, 1
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x18]
add ecx, 1
mov dword [ebp - 0x18], ecx
mov edx, dword [ebp - 0x18]
xor eax, eax
mov al, byte [ebp + edx - 0x48]
test eax, eax
je 0x4100fc
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x18]
mov al, byte [ebp + edx - 0x48]
mov byte [ecx], al
jmp 0x4100c9
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x14]
mov byte [ecx], 0xd
mov edx, dword [0x5ac18c]
add edx, dword [ebp - 0x14]
mov byte [edx + 1], 0xa
push 0x200
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push 0x5221cc
push 0x5abd60
call fcn.0041e940
add esp, 8
push 0x5221d0
push 0x5abd60
call fcn.0041e940
add esp, 8
push 0
push 0x80
push 4
push 0
push 0
push 0xc0000000
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [0x5abd40], eax
cmp dword [0x5abd40], 0xffffffff
jne 0x410195
push 0x40003
call fcn.00406ccc
add esp, 4
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
push 0
lea ecx, [ebp - 0x1c]
push ecx
mov edx, dword [ebp - 0x14]
add edx, 1
push edx
mov eax, dword [0x5ac18c]
push eax
mov ecx, dword [0x5abd40]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x4101e0
push 0x40004
call fcn.00406ccc
add esp, 4
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
mov eax, dword [0x5abd40]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x410212
push 0x40005
call fcn.00406ccc
add esp, 4
mov ecx, dword [0x5ac18c]
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
jmp 0x4104f7
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
jmp 0x4104f7
mov ecx, dword [ebp - 0x14]
sub ecx, 1
mov dword [ebp - 0x14], ecx
jmp 0x41024d
mov edx, dword [ebp - 0x14]
sub edx, 1
mov dword [ebp - 0x14], edx
mov eax, dword [0x5ac18c]
add eax, dword [ebp - 0x14]
xor ecx, ecx
mov cl, byte [eax]
cmp ecx, 0xa
je 0x410260
jmp 0x410244
mov edx, dword [ebp - 0x14]
add edx, 1
mov dword [ebp - 0x14], edx
jmp 0x410274
mov eax, dword [ebp - 0x14]
add eax, 1
mov dword [ebp - 0x14], eax
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x14]
xor edx, edx
mov dl, byte [ecx]
cmp edx, 0x14
jne 0x410288
jmp 0x41026b
mov dword [ebp - 4], 0
mov dword [ebp - 0x18], 0
jmp 0x4102a1
mov eax, dword [ebp - 0x18]
add eax, 1
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 3
jae 0x4102ef
mov ecx, dword [ebp - 0x14]
add ecx, dword [ebp - 0x18]
mov edx, dword [0x5ac18c]
xor eax, eax
mov al, byte [edx + ecx]
mov ecx, dword [ebp - 0x18]
xor edx, edx
mov dl, byte [ebp + ecx - 0x10]
cmp eax, edx
je 0x4102ed
mov eax, dword [ebp - 0x14]
add eax, dword [ebp - 0x18]
mov ecx, dword [0x5ac18c]
xor edx, edx
mov dl, byte [ecx + eax]
mov eax, dword [ebp - 0x18]
xor ecx, ecx
mov cl, byte [ebp + eax - 0x10]
sub ecx, 0x20
cmp edx, ecx
je 0x4102ed
mov dword [ebp - 4], 1
jmp 0x410298
cmp dword [ebp - 4], 1
jne 0x41032c
cmp dword [ebp + 8], 1
jne 0x41032c
mov edx, dword [0x5ac18c]
push edx
mov eax, dword [ebp - 0x1c]
push eax
mov ecx, dword [ebp - 0x14]
push ecx
call fcn.004104fd
add esp, 0xc
cmp eax, 0xffffffff
jne 0x41032c
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
cmp dword [ebp - 4], 1
jne 0x41034b
cmp dword [ebp + 8], 0
jne 0x41034b
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
jmp 0x4104f7
cmp dword [ebp - 4], 0
jne 0x41036b
cmp dword [ebp + 8], 1
jne 0x41036b
mov ecx, dword [0x5ac18c]
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
jmp 0x4104f7
cmp dword [ebp - 4], 0
jne 0x4104e8
cmp dword [ebp + 8], 0
jne 0x4104e8
jmp 0x41038a
mov edx, dword [ebp - 0x14]
add edx, 1
mov dword [ebp - 0x14], edx
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x1c]
jae 0x4103ab
mov ecx, dword [0x5ac18c]
add ecx, dword [ebp - 0x14]
mov edx, dword [0x5ac18c]
add edx, dword [ebp - 0x14]
mov al, byte [edx + 4]
mov byte [ecx], al
jmp 0x410381
mov ecx, dword [ebp - 0x14]
sub ecx, 4
mov dword [ebp - 0x14], ecx
mov edx, dword [0x5ac18c]
add edx, dword [ebp - 0x14]
mov byte [edx], 0xd
mov eax, dword [0x5ac18c]
add eax, dword [ebp - 0x14]
mov byte [eax + 1], 0xa
mov ecx, dword [ebp - 0x14]
add ecx, 2
mov dword [ebp - 0x14], ecx
push 0x200
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push 0x5221dc
push 0x5abd60
call fcn.0041e940
add esp, 8
push 0x5221e0
push 0x5abd60
call fcn.0041e940
add esp, 8
push 0x5abd60
call fcn.00408ac1
add esp, 4
push 0
push 0x80
push 2
push 0
push 0
push 0xc0000000
push 0x5abd60
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [0x5abd40], eax
cmp dword [0x5abd40], 0xffffffff
jne 0x410463
push 0x40003
call fcn.00406ccc
add esp, 4
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
push 0
lea eax, [ebp - 8]
push eax
mov ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [0x5ac18c]
push edx
mov eax, dword [0x5abd40]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x4104a8
push 0x40003
call fcn.00406ccc
add esp, 4
mov ecx, dword [0x5ac18c]
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
mov edx, dword [0x5abd40]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x4104d7
push 0x40005
call fcn.00406ccc
add esp, 4
mov eax, dword [0x5ac18c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
or eax, 0xffffffff
jmp 0x4104f7
mov ecx, dword [0x5ac18c]
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
jmp 0x4104f7
mov edx, dword [0x5ac18c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret