Function at 0x1054409
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
mov eax, dword [ebp + 0x10]
mov dword [ebp - 0xe10], eax
mov eax, dword [ebp + 8]
test dword [0x109857c], eax
jne 0x105443e
test dword [0x1098580], eax
je 0x1054765
inc dword [0x1098374]
push ebx
push esi
push edi
push dword [0x1098374]
mov ebx, 0x1011da4
push ebx
mov edi, 0x400
lea eax, [ebp - 0x804]
push edi
push eax
call sub.msvcrt.dll_swprintf_s
mov esi, eax
xor eax, eax
add esp, 0x10
cmp dword [ebp - 0xe10], eax
je 0x10544ab
cmp dword [ebp + 0xc], eax
mov eax, edi
je 0x105449e
push dword [ebp + 0xc]
sub eax, esi
push dword [ebp - 0xe10]
push 0x1011d90
push eax
lea eax, [ebp + esi*2 - 0x804]
push eax
call sub.msvcrt.dll_swprintf_s
add esp, 0x14
jmp 0x10544c9
push dword [ebp - 0xe10]
push 0x1011d84
jmp 0x10544b6
cmp dword [ebp + 0xc], eax
je 0x1054512
push dword [ebp + 0xc]
mov eax, edi
push ebx
sub eax, esi
push eax
lea eax, [ebp + esi*2 - 0x804]
push eax
call sub.msvcrt.dll_swprintf_s
add esp, 0x10
add esi, eax
mov eax, dword [ebp - 0xe10]
test eax, eax
je 0x1054512
mov ecx, 0x1098378
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x10544f8
test dl, dl
je 0x10544f4
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x10544f8
inc eax
inc eax
inc ecx
inc ecx
test dl, dl
jne 0x10544da
xor eax, eax
jmp 0x10544fd
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
jne 0x1054512
mov eax, dword [ebp + 0xc]
cmp eax, dword [0x108e52c]
jne 0x1054512
call dword [sym.imp.KERNEL32.dll_DebugBreak]
mov eax, dword [0x1098374]
cmp eax, dword [0x108e530]
jne 0x1054525
call dword [sym.imp.KERNEL32.dll_DebugBreak]
lea eax, [ebp + 0x18]
push eax
push dword [ebp + 0x14]
sub edi, esi
push 0xffffffffffffffff
lea eax, [ebp + esi*2 - 0x804]
push edi
push eax
call sub.msvcrt.dll__vsnwprintf_s
lea eax, [ebp - 0x804]
add esp, 0x14
lea ecx, [eax + 2]
mov dx, word [eax]
inc eax
inc eax
test dx, dx
jne 0x105454a
sub eax, ecx
sar eax, 1
lea ecx, [eax + eax]
cmp word [ebp + ecx - 0x806], 0xa
je 0x105458e
push 0xa
cmp eax, 0x3ff
pop eax
jae 0x1054584
mov word [ebp + ecx - 0x804], ax
xor eax, eax
mov word [ebp + ecx - 0x802], ax
jmp 0x105458e
mov word [ebp - 8], ax
xor eax, eax
mov word [ebp - 6], ax
mov eax, dword [ebp + 8]
xor edi, edi
test dword [0x109857c], eax
je 0x105467a
mov esi, 0x200
push esi
lea eax, [ebp - 0xe0c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
cmp eax, esi
jb 0x10545b9
mov eax, esi
lea ecx, [eax - 1]
jmp 0x10545d3
movzx edx, word [ebp + ecx*2 - 0xe0c]
cmp dx, 0x2f
je 0x10545d9
cmp dx, 0x5c
je 0x10545d9
dec ecx
cmp ecx, eax
jbe 0x10545be
jmp 0x10545e3
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 0x105467a
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 0x105464c
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 eax, dword [ebp + 8]
test dword [0x1098580], eax
je 0x1054762
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov ebx, eax
mov dword [ebp - 0xe10], ebx
cmp ebx, edi
je 0x1054762
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 0x105472f
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 0x1054762
lea eax, [ebp - 0x804]
lea edx, [eax + 2]
mov cx, word [eax]
add eax, ebx
cmp cx, di
jne 0x1054701
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 0x1054762
lea eax, [ebp - 0x804]
lea edx, [eax + 2]
mov cx, word [eax]
add eax, ebx
cmp cx, di
jne 0x1054738
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
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.01034b69
leave
ret