Function at 0x404981
Capabilities:
Write file on windows

Disassembly:
push ecx
push ebp
push esi
mov esi, dword [esp + 0x10]
mov eax, dword [esi]
xor ebp, ebp
cmp eax, ebp
je 0x4049a3
cmp dword [esi + 8], ebp
je 0x4049a3
cmp dword [esi + 0xc], ebp
je 0x4049a3
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esi], ebp
push edi
cmp dword [esi + 8], ebp
je 0x4049d4
cmp dword [esi], ebp
jne 0x4049dc
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x4049d4
push ebp
push pe_nt_image_headers32
push 2
push ebp
push 1
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [esi], eax
cmp eax, 0xffffffff
jne 0x4049d4
mov dword [esi], ebp
cmp dword [esi], ebp
je 0x404b6c
cmp dword [esi + 8], ebp
je 0x404b4f
cmp dword [esi + 0x18], 0xfde9
push ebx
jne 0x4049f4
push 5
pop ebx
jmp 0x4049f6
xor ebx, ebx
mov edi, dword [esi + 0x1c]
jmp 0x404a34
mov eax, dword [edi + 8]
cmp eax, 1
je 0x404a25
cmp eax, 2
je 0x404a25
push dword [edi + 0xc]
call sub.MSVCRT.dll_strlen
push dword [edi + 8]
mov ebx, eax
call sub.MSVCRT.dll_strlen
add eax, dword [esp + 0x20]
pop ecx
lea ebx, [eax + ebx + 5]
jmp 0x404a31
push dword [edi + 0xc]
call sub.MSVCRT.dll_strlen
lea ebx, [ebx + eax + 4]
mov edi, dword [edi]
pop ecx
mov dword [esp + 0x18], ebx
cmp edi, ebp
jne 0x4049fb
cmp ebx, ebp
jne 0x404a58
push ebp
push ebp
push ebp
push dword [esi]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push dword [esi]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
jmp 0x404b4e
inc ebx
push ebx
push ebp
push dword [0x40fd74]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
mov dword [esp + 0x18], ebx
cmp ebx, ebp
je 0x404b4e
cmp dword [esi + 0x18], 0xfde9
mov edi, ebx
jne 0x404a97
push 0x4090d4
push ebx
call sub.MSVCRT.dll_strcpy
push ebx
call sub.MSVCRT.dll_strlen
add esp, 0xc
lea edi, [ebx + eax]
mov ebx, dword [esi + 0x1c]
jmp 0x404b13
mov eax, dword [ebx + 8]
cmp eax, 1
jne 0x404abf
push 0x4090d0
push edi
call sub.MSVCRT.dll_strcpy
push dword [ebx + 0xc]
push edi
call sub.MSVCRT.dll_strcat
push 0x4090cc
jmp 0x404af2
cmp eax, 2
jne 0x404add
push 0x4090c8
push edi
call sub.MSVCRT.dll_strcpy
push dword [ebx + 0xc]
push edi
call sub.MSVCRT.dll_strcat
add esp, 0x10
jmp 0x404afb
push eax
push edi
call sub.MSVCRT.dll_strcpy
push 0x4090c4
push edi
call sub.MSVCRT.dll_strcat
push dword [ebx + 0xc]
push edi
call sub.MSVCRT.dll_strcat
add esp, 0x18
push 0x4090c0
push edi
call sub.MSVCRT.dll_strcat
push edi
call sub.MSVCRT.dll_strlen
mov ebx, dword [ebx]
add esp, 0xc
add edi, eax
cmp ebx, ebp
jne 0x404a9c
push ebp
push ebp
push ebp
push dword [esi]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebx, dword [esp + 0x18]
push ebp
lea eax, [esp + 0x14]
push eax
sub edi, ebx
push edi
push ebx
push dword [esi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [esi]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
push ebx
push ebp
push dword [0x40fd74]
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop ebx
mov eax, dword [esi + 0x10]
cmp eax, ebp
je 0x404b64
push eax
push ebp
push dword [0x40fd74]
call dword [sym.imp.KERNEL32.dll_HeapFree]
push dword [esi]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea edi, [esi + 0x1c]
jmp 0x404b7f
mov eax, dword [edi]
add eax, 8
push eax
push edi
call fcn.0040760d
pop ecx
pop ecx
cmp dword [edi], ebp
jne 0x404b71
mov eax, dword [esi + 0x28]
pop edi
cmp eax, ebp
je 0x404b99
push eax
push ebp
push dword [0x40fd74]
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x404bae
push eax
push ebp
push dword [0x40fd74]
call dword [sym.imp.KERNEL32.dll_HeapFree]
push 0x2c
push ebp
push esi
call sub.MSVCRT.dll_memset
add esp, 0xc
pop esi
pop ebp
pop ecx
ret 4