Function at 0x402ae8
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x102c
call fcn.00403210
mov eax, dword [0x405390]
push ebx
xor ecx, ecx
push esi
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp + 8]
push edi
mov edi, dword [0x40538c]
mov bl, byte [edi]
xor esi, esi
cmp eax, ecx
mov dword [ebp - 0x10], ecx
mov dword [ebp - 0xc], ecx
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 4], ecx
mov dword [ebp - 0x20], esi
je 0x402b48
cmp dword [eax], ecx
je 0x402b48
push str.HEADER
push dword [eax]
call dword [sym.imp.KERNEL32.dll_lstrcmpA]
test eax, eax
je 0x402b46
mov eax, dword [ebp + 8]
inc esi
lea eax, [eax + esi*4]
cmp dword [eax], 0
mov dword [ebp - 0x20], esi
jne 0x402b26
xor ecx, ecx
cmp dword [ebp - 0x2c], 0xd
jb 0x402d4a
mov eax, dword [edi + 5]
shl esi, 2
cmp eax, 0xffffffff
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], esi
je 0x402d4a
cmp eax, esi
jb 0x402d4a
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
test eax, eax
mov dword [ebp - 0xc], eax
jne 0x402b8c
push 0xe
jmp 0x402d4c
cmp bl, 0xe1
jae 0x402d4a
and dword [ebp - 0x24], 0
cmp bl, 0x2d
jb 0x402bb2
xor ah, ah
mov al, bl
mov cl, 0x2d
div cl
movzx eax, al
mov dword [ebp - 0x24], eax
add bl, 0xd3
dec eax
jne 0x402bac
and dword [ebp - 8], 0
cmp bl, 9
jb 0x402bcf
xor ah, ah
mov al, bl
mov cl, 9
div cl
movzx eax, al
mov dword [ebp - 8], eax
add bl, 0xf7
dec eax
jne 0x402bc9
mov eax, dword [ebp - 8]
movzx esi, bl
lea ecx, [esi + eax]
mov ebx, 0x300
shl ebx, cl
lea ebx, [ebx + ebx + 0xe6c]
push ebx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
test eax, eax
mov dword [ebp - 0x1c], eax
je 0x402b85
mov ecx, dword [ebp - 8]
lea eax, [ebp - 0x24]
push eax
push dword [ebp - 0x18]
mov eax, dword [ebp - 0x2c]
push dword [ebp - 0xc]
add eax, 0xfffffff3
push eax
push dword [ebp - 0x24]
lea eax, [edi + 0xd]
push esi
push ebx
push dword [ebp - 0x1c]
call fcn.00402094
add esp, 0x20
test eax, eax
jne 0x402d4a
mov edi, dword [ebp - 0x18]
cmp dword [ebp - 0x24], edi
jne 0x402d4a
mov ecx, dword [ebp - 0xc]
mov eax, dword [ecx]
test eax, eax
jns 0x402c5d
cmp eax, 0x80000001
jne 0x402d4a
mov esi, ecx
push edi
call fcn.004029f3
pop ecx
mov dword [ebp - 0x10], eax
jmp 0x402d52
xor eax, eax
cmp dword [ebp - 0x20], eax
je 0x402d4a
mov dword [ebp - 8], eax
jbe 0x402d1b
mov esi, dword [ebp + 8]
mov dword [ebp + 8], ecx
sub dword [ebp + 8], esi
mov eax, dword [ebp + 8]
mov ebx, dword [eax + esi]
mov eax, dword [ebp - 0x14]
add eax, ebx
cmp eax, edi
mov dword [ebp - 0x18], eax
ja 0x402d4a
push dword [esi]
lea eax, [ebp - 0x102c]
push eax
mov byte [ebp - 0x102c], 0
call dword [sym.imp.KERNEL32.dll_lstrcatA]
push 0
push 0x8000080
push 2
push 0
push 1
push 0x40000000
lea eax, [ebp - 0x102c]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [ebp - 4], eax
je 0x402d52
mov ecx, dword [ebp - 0x14]
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [ebp - 0xc]
push ebx
add ecx, eax
push ecx
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402d52
cmp dword [ebp - 0x28], ebx
jne 0x402d52
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
and dword [ebp - 4], 0
mov eax, dword [ebp - 0x18]
inc dword [ebp - 8]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 8]
add esi, 4
cmp eax, dword [ebp - 0x20]
jb 0x402c7a
mov ecx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x14]
lea edx, [eax + 0x10]
cmp edx, edi
jae 0x402d3d
lea esi, [eax + ecx]
mov ecx, dword [esi]
test ecx, ecx
jns 0x402d3d
cmp ecx, 0x80000001
jne 0x402d4a
sub edi, eax
jmp 0x402c4e
cmp eax, edi
jne 0x402d4a
mov dword [ebp - 0x10], 1
jmp 0x402d52
push 0xd
call dword [sym.imp.KERNEL32.dll_SetLastError]
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp dword [ebp - 0xc], 0
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
mov dword [ebp - 0x28], eax
je 0x402d75
push dword [ebp - 0xc]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call esi
xor edi, edi
cmp dword [ebp - 0x1c], edi
je 0x402d89
push dword [ebp - 0x1c]
push edi
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call esi
cmp dword [ebp - 4], edi
pop edi
pop esi
pop ebx
je 0x402da0
cmp dword [ebp - 4], 0xffffffff
je 0x402da0
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [ebp - 0x10]
leave
ret