Function at 0x40597d
Capabilities:
Get common file path
Get disk information
Get disk size
Set current directory

Disassembly:
push ecx
pop ecx
push ebp
mov ebp, esp
sub esp, 0x330
mov eax, dword [0x408004]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
lea eax, [ebp - 0x110]
mov dword [ebp - 0x320], edx
push eax
push 0x104
mov esi, ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryA]
push esi
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
sub ebx, ebx
or eax, eax
jne 0x4059dd
push ebx
push 0x10
push ebx
push ebx
mov edx, 0x4bc
xor ecx, ecx
call fcn.004044b9
call fcn.00406285
mov dword [0x409124], eax
sub eax, eax
jmp 0x405c05
push edi
lea eax, [ebp - 0x324]
mov dword [ebp - 0x318], ebx
push eax
lea eax, [ebp - 0x31c]
mov dword [ebp - 0x314], ebx
push eax
lea eax, [ebp - 0x314]
mov dword [ebp - 0x31c], ebx
push eax
lea eax, [ebp - 0x318]
mov dword [ebp - 0x324], ebx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetDiskFreeSpaceA]
or eax, eax
je 0x405ba1
mov eax, dword [ebp - 0x314]
imul eax, dword [ebp - 0x318]
push 0x400
push dword [ebp - 0x31c]
push eax
mov dword [ebp - 0x328], eax
call dword [sym.imp.KERNEL32.dll_MulDiv]
mov edi, eax
test edi, edi
je 0x405ba1
push ebx
push ebx
lea eax, [ebp - 0x32c]
push eax
lea eax, [ebp - 0x330]
push eax
push ebx
push ebx
push ebx
push ebx
call dword [sym.imp.KERNEL32.dll_GetVolumeInformationA]
or eax, eax
jne 0x405ab5
mov edi, 0x200
lea eax, [ebp - 0x310]
push edi
push ebx
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
call fcn.00406285
push ebx
mov dword [0x409124], eax
lea eax, [ebp - 0x310]
push edi
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push ebx
push 0x1000
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
mov edx, 0x4f9
jmp 0x405be3
lea eax, [ebp - 0x110]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
lea ecx, [ebp - 0xc]
push 6
push ecx
pop eax
pop edx
sub esi, eax
lea eax, [edx - 4]
or eax, eax
je 0x405ae2
mov al, byte [esi + ecx]
test al, al
je 0x405ae2
mov byte [ecx], al
inc ecx
sub edx, 1
jne 0x405acc
test edx, edx
jne 0x405ae7
dec ecx
push 8
mov byte [ecx], bl
mov edx, 0x200
mov ecx, dword [ebp - 0x328]
mov eax, ebx
pop esi
cmp ecx, edx
je 0x405b05
add edx, edx
inc eax
cmp ax, si
jb 0x405af9
cmp ax, si
jne 0x405b20
push ebx
push 0x10
push ebx
push ebx
mov edx, 0x4c5
sub ecx, ecx
call fcn.004044b9
jmp 0x405c02
test byte [0x409a34], 8
je 0x405b52
test dword [ebp - 0x32c], 0x8000
je 0x405b52
mov ecx, dword [0x409a38]
movzx eax, ax
shr ecx, 2
mov edx, dword [eax*4 + 0x4089e0]
add edx, edx
add ecx, dword [0x409a38]
jmp 0x405b62
mov ecx, dword [0x409a38]
movzx eax, ax
mov edx, dword [eax*4 + 0x4089e0]
mov eax, dword [ebp - 0x320]
and eax, 3
cmp al, 3
jne 0x405b76
lea eax, [ecx + edx]
cmp eax, edi
jmp 0x405b85
test byte [ebp - 0x320], 1
je 0x405b83
cmp edx, edi
jmp 0x405b85
cmp ecx, edi
jbe 0x405b96
lea eax, [ebp - 0xc]
push eax
push ecx
mov ecx, dword [ebp + 8]
call fcn.0040268b
jmp 0x405c04
xor eax, eax
mov dword [0x409124], ebx
inc eax
jmp 0x405c04
mov edi, 0x200
lea eax, [ebp - 0x310]
push edi
push ebx
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
call fcn.00406285
push ebx
mov dword [0x409124], eax
lea eax, [ebp - 0x310]
push edi
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push ebx
push 0x1000
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
mov edx, 0x4b0
push ebx
push 0x10
lea eax, [ebp - 0x310]
xor ecx, ecx
push eax
push esi
call fcn.004044b9
lea eax, [ebp - 0x110]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
sub eax, eax
pop edi
mov ecx, dword [ebp - 4]
pop esi
xor ecx, ebp
pop ebx
call fcn.00406ce0
mov esp, ebp
pop ebp
ret 4