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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x274
mov eax, dword [0x52b420]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [ebp + 8]
movzx edx, byte [ecx + 0x60]
test edx, edx
jne 0x4067c9
mov dword [ebp - 0x270], 0xc
mov dword [ebp - 0x268], 1
mov dword [ebp - 0x26c], 0
mov eax, dword [ebp + 8]
movzx ecx, byte [eax + 0x61]
test ecx, ecx
jne 0x4065e1
push 0
push 0xa0000000
push 3
lea edx, [ebp - 0x270]
push edx
push 0
push 0xc0000000
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x54]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edx, dword [ebp + 8]
mov dword [edx + 0x68], eax
jmp 0x4065eb
mov eax, dword [ebp + 8]
mov dword [eax + 0x68], 0xffffffff
mov ecx, dword [ebp + 8]
cmp dword [ecx + 0x68], 0xffffffff
jne 0x4067c2
push 0x208
call fcn.00416a09
add esp, 4
mov dword [ebp - 0x220], eax
cmp dword [ebp - 0x220], 0
je 0x406638
push 0x208
push 0
mov edx, dword [ebp - 0x220]
push edx
call fcn.004194e0
add esp, 0xc
mov eax, dword [ebp - 0x220]
mov dword [ebp - 0x234], eax
jmp 0x406642
mov dword [ebp - 0x234], 0
mov ecx, dword [ebp - 0x234]
mov dword [ebp - 0x210], ecx
mov dword [ebp - 0x274], 0
mov edx, dword [ebp + 8]
cmp dword [edx + 0x50], 0
je 0x40668d
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x64]
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x4c]
push eax
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x50]
push edx
push 0x43aa10
mov eax, dword [ebp - 0x210]
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
jmp 0x4066fb
push 0x208
push 0
lea ecx, [ebp - 0x20c]
push ecx
call fcn.004194e0
add esp, 0xc
lea edx, [ebp - 0x20c]
push edx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
je 0x4066d7
lea eax, [ebp - 0x20c]
push eax
push 0x43aa40
mov ecx, dword [ebp - 0x210]
push ecx
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0xc
jmp 0x4066fb
mov edx, dword [ebp - 0x210]
mov dword [ebp - 0x254], edx
push 2
mov eax, dword [ebp - 0x254]
push eax
call fcn.004169fb
add esp, 8
xor eax, eax
jmp 0x406ac7
push 0
push 0x80
push 3
lea ecx, [ebp - 0x270]
push ecx
push 3
push 4
mov edx, dword [ebp - 0x210]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x68], eax
mov edx, dword [ebp + 8]
cmp dword [edx + 0x68], 0xffffffff
jne 0x40679c
push 0
push 0x80
push 1
lea eax, [ebp - 0x270]
push eax
push 3
push 0x40000000
mov ecx, dword [ebp - 0x210]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edx, dword [ebp + 8]
mov dword [edx + 0x68], eax
mov eax, dword [ebp + 8]
cmp dword [eax + 0x68], 0xffffffff
jne 0x406784
mov ecx, dword [ebp - 0x210]
mov dword [ebp - 0x258], ecx
push 2
mov edx, dword [ebp - 0x258]
push edx
call fcn.004169fb
add esp, 8
xor eax, eax
jmp 0x406ac7
mov eax, dword [ebp - 0x210]
push eax
mov ecx, dword [ebp + 8]
call fcn.004074f0
mov ecx, dword [ebp + 8]
mov byte [ecx + 0x61], 1
jmp 0x4067a3
mov edx, dword [ebp + 8]
mov byte [edx + 0x61], 1
mov eax, dword [ebp - 0x210]
mov dword [ebp - 0x25c], eax
push 2
mov ecx, dword [ebp - 0x25c]
push ecx
call fcn.004169fb
add esp, 8
jmp 0x4067c9
mov edx, dword [ebp + 8]
mov byte [edx + 0x60], 1
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [ebp - 0x230], 0
mov ecx, dword [ebp + 8]
cmp dword [ecx + 0x68], 0xffffffff
je 0x406ac1
cmp dword [ebp + 0xc], 0
je 0x406a9f
lea edx, [ebp + 0x10]
mov dword [ebp - 0x224], edx
mov eax, dword [ebp - 0x224]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
push 0
push 0
call fcn.004060e0
add esp, 0x10
mov dword [ebp - 0x250], eax
mov eax, dword [ebp - 0x250]
add eax, 1
xor ecx, ecx
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
mov dword [ebp - 0x238], ecx
mov eax, dword [ebp - 0x238]
push eax
call fcn.00416a09
add esp, 4
mov dword [ebp - 0x214], eax
cmp dword [ebp - 0x214], 0
je 0x4068a9
mov ecx, dword [ebp - 0x238]
push ecx
push 0
mov edx, dword [ebp - 0x214]
push edx
call fcn.004194e0
add esp, 0xc
cmp dword [ebp - 0x214], 0
je 0x406891
xor eax, eax
mov ecx, dword [ebp - 0x214]
mov word [ecx], ax
mov edx, dword [ebp - 0x214]
mov dword [ebp - 0x23c], edx
jmp 0x40689b
mov dword [ebp - 0x23c], 0
mov eax, dword [ebp - 0x23c]
mov dword [ebp - 0x240], eax
jmp 0x4068b3
mov dword [ebp - 0x240], 0
mov ecx, dword [ebp - 0x240]
mov dword [ebp - 0x21c], ecx
mov edx, dword [ebp - 0x224]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp - 0x21c]
push ecx
call fcn.00406150
add esp, 0xc
mov dword [ebp - 0x224], 0
mov edx, dword [ebp + 8]
add edx, 0x18
push edx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [ebp + 8]
cmp dword [eax + 0x48], 0
je 0x406a42
mov ecx, dword [ebp - 0x21c]
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x48]
push eax
push 0x43aa88
push 0
push 0
call fcn.004077c0
add esp, 0x14
mov dword [ebp - 0x228], eax
mov eax, dword [ebp - 0x228]
add eax, 1
xor ecx, ecx
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
mov dword [ebp - 0x244], ecx
mov eax, dword [ebp - 0x244]
push eax
call fcn.00416a09
add esp, 4
mov dword [ebp - 0x218], eax
cmp dword [ebp - 0x218], 0
je 0x4069b1
mov ecx, dword [ebp - 0x244]
push ecx
push 0
mov edx, dword [ebp - 0x218]
push edx
call fcn.004194e0
add esp, 0xc
cmp dword [ebp - 0x218], 0
je 0x406999
xor eax, eax
mov ecx, dword [ebp - 0x218]
mov word [ecx], ax
mov edx, dword [ebp - 0x218]
mov dword [ebp - 0x248], edx
jmp 0x4069a3
mov dword [ebp - 0x248], 0
mov eax, dword [ebp - 0x248]
mov dword [ebp - 0x24c], eax
jmp 0x4069bb
mov dword [ebp - 0x24c], 0
mov ecx, dword [ebp - 0x24c]
mov dword [ebp - 0x22c], ecx
mov edx, dword [ebp - 0x21c]
push edx
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x48]
push ecx
push 0x43aa98
mov edx, dword [ebp - 0x228]
push edx
mov eax, dword [ebp - 0x22c]
push eax
call fcn.004077c0
add esp, 0x14
push 0
lea ecx, [ebp - 0x230]
push ecx
mov edx, dword [ebp - 0x228]
shl edx, 1
push edx
mov eax, dword [ebp - 0x22c]
push eax
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x68]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x68]
push ecx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov edx, dword [ebp - 0x22c]
mov dword [ebp - 0x260], edx
push 2
mov eax, dword [ebp - 0x260]
push eax
call fcn.004169fb
add esp, 8
jmp 0x406a75
push 0
lea ecx, [ebp - 0x230]
push ecx
mov edx, dword [ebp - 0x250]
shl edx, 1
push edx
mov eax, dword [ebp - 0x21c]
push eax
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x68]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x68]
push ecx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov edx, dword [ebp - 0x21c]
mov dword [ebp - 0x264], edx
push 2
mov eax, dword [ebp - 0x264]
push eax
call fcn.004169fb
add esp, 8
mov ecx, dword [ebp + 8]
add ecx, 0x18
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov edx, dword [ebp + 8]
movzx eax, byte [edx + 0x61]
test eax, eax
je 0x406ac1
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x68]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 8]
mov dword [eax + 0x68], 0xffffffff
mov eax, dword [ebp - 0x230]
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00416e65
mov esp, ebp
pop ebp
ret