Function at 0x406160
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
mov byte [ebp - 1], 0
push 0x415f98
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [ebp + 0x14]
push eax
mov ecx, dword [ebp + 0x10]
push ecx
call fcn.0040cfb0
add esp, 8
movzx edx, al
test edx, edx
je 0x4063a3
mov eax, dword [ebp + 0x10]
push eax
call fcn.0040cf50
add esp, 4
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
je 0x4063a3
mov byte [ebp - 1], 1
mov byte [ebp - 9], 0
mov dword [ebp - 0x10], 0
jmp 0x4061c3
mov ecx, dword [ebp - 0x10]
add ecx, 1
mov dword [ebp - 0x10], ecx
mov edx, dword [ebp - 0x10]
cmp edx, dword [0x415fb4]
jae 0x4062c6
mov eax, dword [ebp - 0x10]
imul eax, eax, 0x110
add eax, dword [0x415fb0]
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 8]
mov eax, dword [ecx + 4]
cmp eax, dword [edx + 4]
je 0x4061f4
jmp 0x4061ba
push pe_nt_image_headers32
mov ecx, dword [ebp - 8]
push ecx
mov edx, dword [ebp - 0x14]
push edx
call sub.ntdll.dll_memcpy
add esp, 0xc
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax + 0x108]
push ecx
call fcn.0040a8e0
add esp, 4
mov edx, dword [ebp + 0x14]
push edx
mov eax, dword [ebp + 0x10]
push eax
call fcn.0040a950
add esp, 8
mov ecx, dword [ebp - 0x14]
mov dword [ecx + 0x108], eax
mov edx, dword [ebp - 0x14]
mov eax, dword [ebp + 0x14]
mov dword [edx + 0x10c], eax
mov ecx, dword [ebp - 0x14]
mov edx, dword [ecx + 0x100]
push edx
call fcn.0040a8e0
add esp, 4
mov eax, dword [ebp + 0x14]
sub eax, 0x100
mov ecx, dword [ebp - 0x14]
mov dword [ecx + 0x104], eax
mov edx, dword [ebp - 0x14]
mov eax, dword [edx + 0x104]
push eax
mov ecx, dword [ebp + 0x10]
add ecx, 0x100
push ecx
push 0x14
mov edx, dword [ebp - 0x14]
add edx, 0x14
push edx
call fcn.0040c8c0
add esp, 0x10
mov ecx, dword [ebp - 0x14]
mov dword [ecx + 0x100], eax
mov edx, dword [ebp - 0x14]
mov eax, dword [edx + 8]
push eax
mov ecx, dword [ebp - 0x14]
mov edx, dword [ecx + 0x104]
push edx
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax + 0x100]
push ecx
mov edx, dword [ebp - 0x14]
mov eax, dword [edx + 4]
push eax
call fcn.004073e0
add esp, 0x10
mov byte [ebp - 9], 1
jmp 0x4062c6
movzx ecx, byte [ebp - 9]
test ecx, ecx
jne 0x4062f9
push 1
mov edx, dword [ebp + 0x14]
push edx
mov eax, dword [ebp + 0x10]
push eax
mov ecx, dword [ebp - 8]
push ecx
call fcn.00405df0
add esp, 0x10
movzx edx, al
test edx, edx
jne 0x4062f9
mov dword [0x415fb4], 0
mov byte [ebp - 1], 0
mov eax, dword [ebp - 8]
push eax
call fcn.0040a8e0
add esp, 4
movzx ecx, byte [ebp - 1]
test ecx, ecx
je 0x4063a3
push 0
push 2
push 2
push 0
push 0
push 0x40000000
push 0x4161c8
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0xffffffff
je 0x4063a3
mov dword [ebp - 0x1c], 0
jmp 0x406346
mov edx, dword [ebp - 0x1c]
add edx, 1
mov dword [ebp - 0x1c], edx
mov eax, dword [ebp - 0x1c]
cmp eax, dword [0x415fb4]
jae 0x40638f
push 0
lea ecx, [ebp - 0x20]
push ecx
mov edx, dword [ebp - 0x1c]
imul edx, edx, 0x110
mov eax, dword [0x415fb0]
mov ecx, dword [eax + edx + 0x10c]
push ecx
mov edx, dword [ebp - 0x1c]
imul edx, edx, 0x110
mov eax, dword [0x415fb0]
mov ecx, dword [eax + edx + 0x108]
push ecx
mov edx, dword [ebp - 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x40633d
mov eax, dword [ebp - 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov ecx, dword [ebp - 0x18]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0x415f98
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov al, byte [ebp - 1]
mov esp, ebp
pop ebp
ret