Function at 0x406790
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
cmp dword [edi + 8], 0
je 0x4067d1
cmp dword [edi], 0
jne 0x4067d1
cmp dword [edi + 4], 0
je 0x4067d1
push 0
push pe_nt_image_headers32
push 4
push 0
push 1
push 0xc0000000
push dword [edi + 4]
call sub.KERNEL32.dll_CreateFileA
mov dword [edi], eax
cmp eax, 0xffffffff
jne 0x4067d1
and dword [edi], 0
cmp dword [edi], 0
je 0x406995
cmp dword [edi + 8], 0
je 0x406961
xor ebx, ebx
cmp dword [edi + 0x14], 0xfde9
setne bl
dec ebx
and ebx, 5
mov esi, dword [edi + 0x18]
jmp 0x406836
mov eax, dword [esi + 8]
cmp eax, 1
je 0x406806
cmp eax, 2
jne 0x406815
push dword [esi + 0xc]
call sub.MSVCRT.dll_strlen
pop ecx
lea ebx, [ebx + eax + 4]
jmp 0x406834
push dword [esi + 8]
call sub.MSVCRT.dll_strlen
mov dword [ebp - 0xc], eax
push dword [esi + 0xc]
call sub.MSVCRT.dll_strlen
add esp, 8
mov edx, dword [ebp - 0xc]
lea edx, [edx + eax + 5]
add ebx, edx
mov esi, dword [esi]
or esi, esi
jne 0x4067f9
or ebx, ebx
jne 0x406857
push 0
push 0
push 0
push dword [edi]
call sub.KERNEL32.dll_SetFilePointer
push dword [edi]
call sub.KERNEL32.dll_SetEndOfFile
jmp 0x406961
mov eax, ebx
inc eax
push eax
push 0
push dword [0x45d298]
call sub.KERNEL32.dll_HeapAlloc
mov dword [ebp - 4], eax
or eax, eax
je 0x406961
mov ebx, eax
cmp dword [edi + 0x14], 0xfde9
jne 0x406895
push 0x45685e
push ebx
call sub.MSVCRT.dll_strcpy
push ebx
call sub.MSVCRT.dll_strlen
add esp, 0xc
lea ebx, [ebx + eax]
mov esi, dword [edi + 0x18]
jmp 0x40691f
cmp dword [esi + 8], 1
jne 0x4068c7
push 0x45685c
push ebx
call sub.MSVCRT.dll_strcpy
push dword [esi + 0xc]
push ebx
call sub.MSVCRT.dll_strcat
push 0x45685a
push ebx
call sub.MSVCRT.dll_strcat
add esp, 0x18
jmp 0x406906
cmp dword [esi + 8], 2
jne 0x4068e6
push 0x456857
push ebx
call sub.MSVCRT.dll_strcpy
push dword [esi + 0xc]
push ebx
call sub.MSVCRT.dll_strcat
add esp, 0x10
jmp 0x406906
push dword [esi + 8]
push ebx
call sub.MSVCRT.dll_strcpy
push 0x456853
push ebx
call sub.MSVCRT.dll_strcat
push dword [esi + 0xc]
push ebx
call sub.MSVCRT.dll_strcat
add esp, 0x18
push 0x456850
push ebx
call sub.MSVCRT.dll_strcat
push ebx
call sub.MSVCRT.dll_strlen
add esp, 0xc
lea ebx, [ebx + eax]
mov esi, dword [esi]
or esi, esi
jne 0x40689d
push 0
push 0
push 0
push dword [edi]
call sub.KERNEL32.dll_SetFilePointer
push 0
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp - 4]
mov edx, ebx
sub edx, eax
push edx
push eax
push dword [edi]
call sub.KERNEL32.dll_WriteFile
push dword [edi]
call sub.KERNEL32.dll_SetEndOfFile
push dword [ebp - 4]
push 0
push dword [0x45d298]
call sub.KERNEL32.dll_HeapFree
cmp dword [edi + 0xc], 0
je 0x406977
push dword [edi + 0xc]
push 0
push dword [0x45d298]
call sub.KERNEL32.dll_HeapFree
push dword [edi]
call sub.KERNEL32.dll_CloseHandle
jmp 0x406995
mov eax, dword [edi + 0x18]
add eax, 8
push eax
mov eax, edi
add eax, 0x18
push eax
call fcn.0042d300
add esp, 8
cmp dword [edi + 0x18], 0
jne 0x406980
cmp dword [edi + 0x24], 0
je 0x4069b1
push dword [edi + 0x24]
push 0
push dword [0x45d298]
call sub.KERNEL32.dll_HeapFree
cmp dword [edi + 4], 0
je 0x4069c7
push dword [edi + 4]
push 0
push dword [0x45d298]
call sub.KERNEL32.dll_HeapFree
push 0x28
push edi
call fcn.0042da80
pop edi
pop esi
pop ebx
leave
ret 4