Function at 0x409831
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x338
push ebx
mov ebx, dword [ebp + 0x14]
push esi
cmp ebx, 3
push edi
mov esi, ecx
je 0x409863
cmp ebx, 2
je 0x40990b
cmp ebx, 1
je 0x40990b
mov eax, 0x10000
jmp 0x409b6f
mov eax, dword [esi + 4]
mov edi, dword [ebp + 8]
cmp edi, eax
je 0x4098b2
cmp eax, 0xffffffff
je 0x40987a
push dword [esi]
call fcn.00409152
pop ecx
mov eax, dword [esi]
or dword [esi + 4], 0xffffffff
cmp edi, dword [eax + 4]
jge 0x409859
cmp edi, dword [eax + 0x10]
jge 0x409891
push eax
call fcn.00408b9a
pop ecx
mov eax, dword [esi]
cmp dword [eax + 0x10], edi
jge 0x4098a0
push eax
call fcn.00408bd8
jmp 0x409890
push dword [esi + 0x138]
push dword [esi]
call fcn.00408dd5
pop ecx
mov dword [esi + 4], edi
pop ecx
lea eax, [ebp + 0xb]
push eax
push dword [ebp + 0x10]
push dword [ebp + 0xc]
push dword [esi]
call fcn.00408f38
mov edi, eax
add esp, 0x10
test edi, edi
jg 0x4098d8
push dword [esi]
call fcn.00409152
or dword [esi + 4], 0xffffffff
pop ecx
cmp byte [ebp + 0xb], 0
je 0x4098e5
xor eax, eax
jmp 0x409b6f
test edi, edi
jle 0x4098f3
mov eax, 0x600
jmp 0x409b6f
xor eax, eax
cmp edi, 0xffffff96
setne al
dec eax
and eax, 0xfb001000
add eax, 0x5000000
jmp 0x409b6f
cmp dword [esi + 4], 0xffffffff
je 0x409919
push dword [esi]
call fcn.00409152
pop ecx
mov eax, dword [esi]
mov edi, dword [ebp + 8]
or dword [esi + 4], 0xffffffff
cmp edi, dword [eax + 4]
jge 0x409859
cmp edi, dword [eax + 0x10]
jge 0x409937
push eax
call fcn.00408b9a
pop ecx
mov eax, dword [esi]
cmp dword [eax + 0x10], edi
jge 0x409946
push eax
call fcn.00408bd8
jmp 0x409936
lea eax, [ebp - 0x234]
mov ecx, esi
push eax
push edi
call fcn.0040933b
test byte [ebp - 0x12c], 0x10
je 0x409997
cmp ebx, 1
je 0x4098de
mov ecx, dword [ebp + 0xc]
mov al, byte [ecx]
cmp al, 0x2f
je 0x40997e
cmp al, 0x5c
je 0x40997e
test al, al
je 0x409983
cmp byte [ecx + 1], 0x3a
jne 0x409983
push ecx
push 0
jmp 0x40998b
add esi, 0x140
push ecx
push esi
call fcn.0040976b
pop ecx
pop ecx
jmp 0x4098de
cmp ebx, 1
jne 0x4099a4
mov eax, dword [ebp + 0xc]
jmp 0x409a2c
mov edi, dword [ebp + 0xc]
mov ebx, edi
mov ecx, edi
mov al, byte [edi]
test al, al
je 0x4099c2
cmp al, 0x2f
je 0x4099b9
cmp al, 0x5c
jne 0x4099bc
lea ebx, [ecx + 1]
mov al, byte [ecx + 1]
inc ecx
jmp 0x4099ad
lea eax, [ebp - 0x108]
push edi
push eax
call sub.MSVCRT.dll_strcpy
pop ecx
cmp ebx, edi
pop ecx
jne 0x409a3e
and byte [ebp - 0x108], 0
lea eax, [ebp - 0x108]
lea edi, [esi + 0x140]
push ebx
push eax
push edi
lea eax, [ebp - 0x338]
push str._s_s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
lea eax, [ebp - 0x108]
push eax
push edi
call fcn.0040976b
add esp, 0x1c
xor eax, eax
push eax
push dword [ebp - 0x12c]
push 2
push eax
push eax
lea eax, [ebp - 0x338]
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [ebp + 8], eax
jne 0x409aa6
mov eax, 0x200
jmp 0x409b6f
mov eax, ebx
sub eax, edi
and byte [ebp + eax - 0x108], 0
cmp byte [ebp - 0x108], 0x2f
je 0x409a76
cmp byte [ebp - 0x108], 0x5c
je 0x409a76
cmp byte [ebp - 0x108], 0
je 0x4099dc
cmp byte [ebp - 0x107], 0x3a
jne 0x4099dc
lea eax, [ebp - 0x108]
push ebx
push eax
lea eax, [ebp - 0x338]
push 0x419448
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
lea eax, [ebp - 0x108]
push eax
push 0
call fcn.0040976b
add esp, 0x18
jmp 0x409a0d
push dword [esi + 0x138]
push dword [esi]
call fcn.00408dd5
cmp dword [esi + 0x13c], 0
pop ecx
pop ecx
mov ebx, 0x4000
jne 0x409ad0
push ebx
call sub.MFC42.DLL_operatornew
pop ecx
mov dword [esi + 0x13c], eax
and dword [ebp + 0x10], 0
lea eax, [ebp + 0xf]
push eax
push ebx
push dword [esi + 0x13c]
push dword [esi]
call fcn.00408f38
mov edi, eax
add esp, 0x10
cmp edi, 0xffffff96
je 0x409b1c
test edi, edi
jl 0x409b25
jle 0x409b10
lea eax, [ebp - 4]
push 0
push eax
push edi
push dword [esi + 0x13c]
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x409b2e
cmp byte [ebp + 0xf], 0
jne 0x409b37
test edi, edi
je 0x409b25
jmp 0x409ad4
mov dword [ebp + 0x10], 0x1000
jmp 0x409b55
mov dword [ebp + 0x10], 0x5000000
jmp 0x409b55
mov dword [ebp + 0x10], 0x400
jmp 0x409b55
lea eax, [ebp - 0x118]
push eax
lea eax, [ebp - 0x128]
push eax
lea eax, [ebp - 0x120]
push eax
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_SetFileTime]
cmp dword [ebp + 0x14], 1
je 0x409b64
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esi]
call fcn.00409152
mov eax, dword [ebp + 0x10]
pop ecx
pop edi
pop esi
pop ebx
leave
ret 0x10