Function at 0x1054776
Capabilities:
Get common file path
Set current directory
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0xe1c
mov eax, dword [0x108e1f8]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 8]
test dword [0x109857c], ebx
jne 0x10547a3
test dword [0x1098580], ebx
je 0x1054a17
inc dword [0x1098374]
mov eax, dword [0x1098374]
cmp eax, dword [0x108e530]
jne 0x10547bc
call dword [sym.imp.KERNEL32.dll_DebugBreak]
push esi
push edi
push dword [0x1098374]
mov esi, 0x400
push 0x1011da4
lea eax, [ebp - 0x804]
push esi
push eax
call sub.msvcrt.dll_swprintf_s
lea ecx, [ebp + 0x10]
push ecx
push dword [ebp + 0xc]
sub esi, eax
push 0xffffffffffffffff
lea eax, [ebp + eax*2 - 0x804]
push esi
push eax
call sub.msvcrt.dll__vsnwprintf_s
lea eax, [ebp - 0x804]
add esp, 0x24
lea ecx, [eax + 2]
xor edi, edi
mov dx, word [eax]
inc eax
inc eax
cmp dx, di
jne 0x1054802
sub eax, ecx
sar eax, 1
lea ecx, [eax + eax]
cmp word [ebp + ecx - 0x806], 0xa
je 0x1054846
push 0xa
cmp eax, 0x3ff
pop eax
jae 0x105483c
mov word [ebp + ecx - 0x804], ax
xor eax, eax
mov word [ebp + ecx - 0x802], ax
jmp 0x1054846
mov word [ebp - 8], ax
xor eax, eax
mov word [ebp - 6], ax
test dword [0x109857c], ebx
je 0x1054930
mov esi, 0x200
push esi
lea eax, [ebp - 0xe0c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
cmp eax, esi
jb 0x105486c
mov eax, esi
lea ecx, [eax - 1]
jmp 0x1054886
movzx edx, word [ebp + ecx*2 - 0xe0c]
cmp dx, 0x2f
je 0x105488c
cmp dx, 0x5c
je 0x105488c
dec ecx
cmp ecx, eax
jbe 0x1054871
jmp 0x1054896
xor eax, eax
mov word [ebp + ecx*2 - 0xe0c], ax
lea eax, [ebp - 0xa0c]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
mov esi, dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
lea eax, [ebp - 0xe0c]
push eax
call esi
push edi
push 0x80
push 4
push edi
push edi
push 0x40000000
push 0x1011d74
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
lea eax, [ebp - 0xa0c]
push eax
call esi
cmp ebx, 0xffffffff
je 0x105492d
push 2
push edi
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push edi
push dword [ebp + 8]
push ebx
call fcn.0105424d
lea eax, [ebp - 0x804]
lea ecx, [eax + 2]
mov dx, word [eax]
inc eax
inc eax
cmp dx, di
jne 0x10548ff
sub eax, ecx
push edi
sar eax, 1
lea ecx, [ebp - 0xe10]
push ecx
add eax, eax
push eax
lea eax, [ebp - 0x804]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [ebp + 8]
test dword [0x1098580], ebx
je 0x1054a15
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov ebx, eax
mov dword [ebp - 0xe10], ebx
cmp ebx, edi
je 0x1054a15
xor esi, esi
inc esi
push esi
push dword [ebp + 8]
push ebx
call fcn.0105424d
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileType]
push 2
pop ebx
cmp eax, ebx
je 0x10549e2
push edi
push 0x80
push 3
lea eax, [ebp - 0xe1c]
push eax
push ebx
push 0xc0000000
push 0x1011c5c
mov dword [ebp - 0xe1c], 0xc
mov dword [ebp - 0xe18], edi
mov dword [ebp - 0xe14], esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, edi
je 0x1054a15
lea eax, [ebp - 0x804]
lea edx, [eax + 2]
mov cx, word [eax]
add eax, ebx
cmp cx, di
jne 0x10549b4
push edi
sub eax, edx
lea ecx, [ebp - 0xe10]
push ecx
sar eax, 1
push eax
lea eax, [ebp - 0x804]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteConsoleW]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x1054a15
lea eax, [ebp - 0x804]
lea edx, [eax + 2]
mov cx, word [eax]
add eax, ebx
cmp cx, di
jne 0x10549eb
push edi
sub eax, edx
lea ecx, [ebp - 0xe10]
push ecx
sar eax, 1
push eax
lea eax, [ebp - 0x804]
push eax
push dword [ebp - 0xe10]
call dword [sym.imp.KERNEL32.dll_WriteConsoleW]
pop edi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
pop ebx
call fcn.01034b69
leave
ret