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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x274
mov eax, dword [0x516c24]
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 0x4069a9
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 0x4067c1
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 0x4067cb
mov eax, dword [ebp + 8]
mov dword [eax + 0x68], 0xffffffff
mov ecx, dword [ebp + 8]
cmp dword [ecx + 0x68], 0xffffffff
jne 0x4069a2
push 0x208
call fcn.004168a6
add esp, 4
mov dword [ebp - 0x220], eax
cmp dword [ebp - 0x220], 0
je 0x406818
push 0x208
push 0
mov edx, dword [ebp - 0x220]
push edx
call fcn.00419380
add esp, 0xc
mov eax, dword [ebp - 0x220]
mov dword [ebp - 0x234], eax
jmp 0x406822
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 0x40686d
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 0x439cb0
mov eax, dword [ebp - 0x210]
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
jmp 0x4068db
push 0x208
push 0
lea ecx, [ebp - 0x20c]
push ecx
call fcn.00419380
add esp, 0xc
lea edx, [ebp - 0x20c]
push edx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
je 0x4068b7
lea eax, [ebp - 0x20c]
push eax
push 0x439ce0
mov ecx, dword [ebp - 0x210]
push ecx
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0xc
jmp 0x4068db
mov edx, dword [ebp - 0x210]
mov dword [ebp - 0x254], edx
push 2
mov eax, dword [ebp - 0x254]
push eax
call fcn.00416898
add esp, 8
xor eax, eax
jmp 0x406ca7
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 0x40697c
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 0x406964
mov ecx, dword [ebp - 0x210]
mov dword [ebp - 0x258], ecx
push 2
mov edx, dword [ebp - 0x258]
push edx
call fcn.00416898
add esp, 8
xor eax, eax
jmp 0x406ca7
mov eax, dword [ebp - 0x210]
push eax
mov ecx, dword [ebp + 8]
call fcn.004076d0
mov ecx, dword [ebp + 8]
mov byte [ecx + 0x61], 1
jmp 0x406983
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.00416898
add esp, 8
jmp 0x4069a9
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 0x406ca1
cmp dword [ebp + 0xc], 0
je 0x406c7f
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.004062e0
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.004168a6
add esp, 4
mov dword [ebp - 0x214], eax
cmp dword [ebp - 0x214], 0
je 0x406a89
mov ecx, dword [ebp - 0x238]
push ecx
push 0
mov edx, dword [ebp - 0x214]
push edx
call fcn.00419380
add esp, 0xc
cmp dword [ebp - 0x214], 0
je 0x406a71
xor eax, eax
mov ecx, dword [ebp - 0x214]
mov word [ecx], ax
mov edx, dword [ebp - 0x214]
mov dword [ebp - 0x23c], edx
jmp 0x406a7b
mov dword [ebp - 0x23c], 0
mov eax, dword [ebp - 0x23c]
mov dword [ebp - 0x240], eax
jmp 0x406a93
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.00406350
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 0x406c22
mov ecx, dword [ebp - 0x21c]
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x48]
push eax
push 0x439d28
push 0
push 0
call fcn.004079a0
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.004168a6
add esp, 4
mov dword [ebp - 0x218], eax
cmp dword [ebp - 0x218], 0
je 0x406b91
mov ecx, dword [ebp - 0x244]
push ecx
push 0
mov edx, dword [ebp - 0x218]
push edx
call fcn.00419380
add esp, 0xc
cmp dword [ebp - 0x218], 0
je 0x406b79
xor eax, eax
mov ecx, dword [ebp - 0x218]
mov word [ecx], ax
mov edx, dword [ebp - 0x218]
mov dword [ebp - 0x248], edx
jmp 0x406b83
mov dword [ebp - 0x248], 0
mov eax, dword [ebp - 0x248]
mov dword [ebp - 0x24c], eax
jmp 0x406b9b
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 0x439d38
mov edx, dword [ebp - 0x228]
push edx
mov eax, dword [ebp - 0x22c]
push eax
call fcn.004079a0
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.00416898
add esp, 8
jmp 0x406c55
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.00416898
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 0x406ca1
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.00416d02
mov esp, ebp
pop ebp
ret