Function at 0x4164d4
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
push esi
mov esi, dword [ebp + 8]
test esi, esi
push edi
je 0x416e96
cmp dword [ebp + 0xc], 0
je 0x416e96
mov ecx, dword [ebp + 0x14]
test ecx, ecx
je 0x416e96
cmp byte [ecx], 0
je 0x416e96
test word [esi + 0x16c], 0x8000
jne 0x416518
push 5
jmp 0x416e98
xor eax, eax
inc eax
test byte [ebp + 0x18], al
je 0x416525
xor dword [ebp + 0x18], eax
jmp 0x416527
xor eax, eax
push eax
push dword [0x46d630]
push ecx
push esi
call fcn.0041502d
add esp, 0x10
test eax, eax
mov dword [ebp - 0x40], eax
je 0x416e9e
mov cl, byte [esi + 0x142]
mov ebx, dword [ebp + 0x10]
mov edi, 0x200
shl edi, cl
xor edx, edx
mov eax, ebx
and dword [ebp - 0x38], 0
div edi
mov dword [ebp - 8], ebx
mov dword [ebp - 4], edi
test edx, edx
mov dword [ebp - 0x14], eax
je 0x41656d
inc dword [ebp - 0x14]
mov eax, dword [ebp + 0x18]
xor edi, edi
and eax, 0x200
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x24], eax
jne 0x416587
test word [ebp + 0x18], 0x100
je 0x416594
mov edi, dword [ebp - 0x14]
lea edi, [edi*4 + 4]
mov dword [ebp - 0x2c], edi
push 4
push dword [0x468014]
lea eax, [esi + 0x124]
push eax
call fcn.00437c6b
add esp, 0xc
test eax, eax
lea eax, [edi + ebx]
mov dword [ebp - 0x20], eax
jne 0x416614
add eax, 0x144
push eax
mov dword [ebp - 0x38], 1
call fcn.00417a63
mov edi, eax
test edi, edi
mov dword [ebp - 0x34], edi
je 0x416e9e
push dword [ebp + 0x14]
mov byte [edi], 0x44
mov byte [edi + 1], 1
call fcn.00437be0
pop ecx
mov ecx, 0x104
cmp eax, ecx
ja 0x4165fc
push eax
push dword [ebp + 0x14]
lea eax, [edi + 0x40]
push eax
call fcn.00437870
jmp 0x416609
push ecx
push dword [ebp + 0x14]
lea eax, [edi + 0x40]
push eax
call fcn.00439500
add esp, 0xc
lea eax, [edi + 0x144]
jmp 0x41661d
push eax
call fcn.00417a63
mov edi, dword [ebp - 0x34]
test eax, eax
mov dword [ebp + 8], eax
mov ecx, 0x10000
mov edx, 0x20000
jne 0x416688
test ebx, ebx
jne 0x416e9e
cmp dword [ebp - 0x24], 0
je 0x416643
xor dword [ebp + 0x18], 0x200
mov eax, pe_nt_image_headers32
test dword [ebp + 0x18], eax
je 0x416650
xor dword [ebp + 0x18], eax
test dword [ebp + 0x18], ecx
je 0x416658
xor dword [ebp + 0x18], ecx
test dword [ebp + 0x18], edx
je 0x416660
xor dword [ebp + 0x18], edx
mov ebx, dword [ebp - 0x14]
mov eax, ebx
shl eax, 2
mov dword [ebp - 0x3c], eax
add eax, 4
push eax
call fcn.00417a63
test eax, eax
mov dword [ebp - 0x10], eax
jne 0x41669d
push dword [ebp + 8]
call fcn.004179da
jmp 0x416e9e
test ebx, ebx
je 0x416636
push ebx
push dword [ebp + 0xc]
push dword [ebp + 8]
call fcn.00437870
add esp, 0xc
jmp 0x416660
mov eax, dword [ebp + 0x18]
and eax, 0x200
mov dword [ebp - 0x24], eax
jne 0x4166e4
test word [ebp + 0x18], 0x100
jne 0x4166e4
lea edx, [ebx + 1]
xor eax, eax
test edx, edx
jbe 0x416951
xor ecx, ecx
cmp eax, dword [ebp - 0x14]
mov ebx, dword [ebp - 0x10]
jae 0x4166ce
mov dword [ebx + eax*4], ecx
jmp 0x4166d7
mov edi, dword [ebp + 0x10]
mov dword [ebx + eax*4], edi
mov edi, dword [ebp - 0x34]
add ecx, dword [ebp - 4]
inc eax
cmp eax, edx
jb 0x4166c1
jmp 0x416951
and dword [ebp - 8], 0
test byte [ebp + 0x1c], 0xc0
push 8
pop ebx
je 0x416733
mov edi, dword [ebp + 8]
push 4
push dword [0x468018]
push edi
call fcn.00437c6b
add esp, 0xc
test eax, eax
jne 0x41672c
push ebx
push dword [0x46801c]
lea eax, [edi + 8]
push eax
call fcn.00437c6b
add esp, 0xc
test eax, eax
jne 0x41672c
cmp byte [edi + 0x14], 1
jne 0x41672c
cmp byte [edi + 0x22], 0x10
je 0x416733
and dword [ebp + 0x20], 0
mov dword [ebp + 0x1c], ebx
mov eax, dword [ebp + 0x1c]
mov dword [ebp - 0x30], eax
and dword [ebp - 0x30], 0x40
jne 0x41676d
test al, al
js 0x41676d
test al, 9
jne 0x416765
cmp dword [ebp - 0x24], 0x200
je 0x416758
test word [ebp + 0x18], 0x100
jne 0x416765
test al, 2
je 0x41678c
mov dword [ebp - 8], 1
jmp 0x41678c
mov eax, dword [ebp + 0x20]
mov dword [ebp - 8], eax
jmp 0x416776
mov eax, dword [ebp + 0x20]
dec eax
je 0x416785
dec eax
je 0x41677c
and dword [ebp + 0x20], 0
jmp 0x41678c
mov dword [ebp + 0x20], 3
jmp 0x41678c
mov dword [ebp + 0x20], 1
push dword [ebp - 4]
mov edi, dword [ebp - 0x2c]
call fcn.00417a63
mov ebx, eax
test ebx, ebx
jne 0x4167aa
push dword [ebp - 0x10]
call fcn.004179da
jmp 0x41667b
push dword [ebp - 4]
call fcn.00417a63
test eax, eax
mov dword [ebp - 0xc], eax
jne 0x4167c1
push ebx
call fcn.004179da
jmp 0x41679d
push dword [ebp - 0x20]
call fcn.00417a63
test eax, eax
mov dword [ebp - 0x20], eax
jne 0x4167da
push dword [ebp - 0xc]
call fcn.004179da
jmp 0x4167b9
mov eax, dword [ebp - 0x14]
and dword [ebp - 0x18], 0
and dword [ebp - 0x1c], 0
test eax, eax
jbe 0x41690e
mov ecx, dword [ebp - 0x1c]
mov edx, dword [ebp - 0x10]
dec eax
cmp ecx, eax
mov dword [edx + ecx*4], edi
jne 0x41680a
mov eax, dword [ebp + 0x10]
xor edx, edx
div dword [ebp - 4]
test edx, edx
je 0x41680a
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
mov ecx, dword [ebp + 8]
push eax
mov dword [ebp + 0xc], eax
mov eax, dword [ebp - 0x18]
add eax, ecx
push eax
push ebx
call fcn.00437870
add esp, 0xc
cmp dword [ebp - 0x24], 0
je 0x416894
cmp dword [ebp - 0x1c], 0
jne 0x416843
cmp dword [ebp - 0x30], 0
jne 0x41683b
test byte [ebp + 0x1c], 0x80
je 0x416843
push 0
push 0
push 8
jmp 0x416878
test byte [ebp + 0x1c], 0x34
je 0x41686f
call fcn.00413dfe
mov eax, dword [0x46d660]
test eax, eax
je 0x4168c5
push dword [ebp + 0x20]
lea ecx, [ebp + 0xc]
push dword [ebp - 8]
push dword [ebp + 0x1c]
push dword [ebp - 4]
push ebx
push ecx
push dword [ebp - 0xc]
call eax
jmp 0x416888
push dword [ebp + 0x20]
push dword [ebp - 8]
push dword [ebp + 0x1c]
push dword [ebp - 4]
lea eax, [ebp + 0xc]
push ebx
push eax
push dword [ebp - 0xc]
call fcn.004172a9
test eax, eax
jne 0x4168c5
mov eax, dword [ebp - 4]
mov dword [ebp + 0xc], eax
jmp 0x4168c5
test word [ebp + 0x18], 0x100
je 0x4168c5
push 0
push dword [ebp - 8]
lea eax, [ebp + 0xc]
push 8
push dword [ebp - 4]
push ebx
push eax
push dword [ebp - 0xc]
call fcn.004172a9
test eax, eax
jne 0x4168bf
mov eax, dword [ebp - 4]
mov dword [ebp + 0xc], eax
jmp 0x4168cd
inc dword [ebp - 0xc]
dec dword [ebp + 0xc]
mov eax, dword [ebp + 0xc]
cmp eax, dword [ebp - 4]
jb 0x4168e4
push dword [ebp - 4]
mov eax, dword [ebp - 0x20]
add eax, edi
push ebx
push eax
call fcn.00437870
add esp, 0xc
add edi, dword [ebp - 4]
jmp 0x4168f9
push eax
mov eax, dword [ebp - 0x20]
push dword [ebp - 0xc]
add eax, edi
push eax
call fcn.00437870
add esp, 0xc
add edi, dword [ebp + 0xc]
mov eax, dword [ebp - 4]
add dword [ebp - 0x18], eax
inc dword [ebp - 0x1c]
mov eax, dword [ebp - 0x14]
cmp dword [ebp - 0x1c], eax
jb 0x4167ed
mov eax, dword [ebp - 0x10]
push dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x3c]
push eax
push dword [ebp - 0x20]
mov dword [ebp - 8], edi
mov dword [ecx + eax], edi
call fcn.00437870
add esp, 0xc
push dword [ebp - 0xc]
call fcn.004179da
push ebx
call fcn.004179da
push edi
push dword [ebp - 0x20]
push dword [ebp + 8]
call fcn.00437870
add esp, 0xc
push dword [ebp - 0x20]
call fcn.004179da
mov edi, dword [ebp - 0x34]
cmp dword [ebp - 0x38], 1
jne 0x416961
add dword [ebp - 8], 0x144
mov dword [ebp + 8], edi
mov ebx, dword [ebp - 0x40]
mov ecx, dword [ebx + 4]
mov eax, dword [esi + 0x13c]
and dword [ebp + 0x20], 0
shl eax, 4
and ecx, 0xfffffffe
cmp ecx, 0xfffffffe
mov dword [ebp + 0x1c], eax
jne 0x4169d3
add eax, 0x10
push eax
call fcn.00417a63
mov edi, eax
test edi, edi
je 0x41667b
mov eax, dword [esi + 0x11c]
test eax, eax
je 0x4169b0
mov ecx, dword [esi + 0x13c]
shl ecx, 4
push ecx
push eax
push edi
call fcn.00437870
add esp, 0xc
mov eax, dword [esi + 0x11c]
inc dword [esi + 0x13c]
test eax, eax
je 0x4169c6
push eax
call fcn.004179da
mov dword [esi + 0x11c], edi
mov dword [ebp + 0x20], 1
mov eax, dword [ebx + 4]
mov edi, dword [esi + 0x13c]
mov ecx, eax
and ecx, 0xfffffffe
dec edi
cmp ecx, 0xfffffffe
jne 0x416a1f
push 1
push dword [ebp + 0x14]
call fcn.00413c14
push 2
push dword [ebp + 0x14]
mov dword [ebx + 8], eax
call fcn.00413c14
mov dword [ebx + 0xc], eax
mov eax, dword [0x46d630]
mov dword [ebx], eax
mov dword [ebx + 4], edi
mov ecx, dword [esi + 0x11c]
mov eax, edi
shl eax, 4
add esp, 0x10
and dword [eax + ecx], 0
jmp 0x416a21
mov edi, eax
mov eax, dword [esi + 0x11c]
shl edi, 4
add eax, edi
mov ecx, dword [eax]
test ecx, ecx
je 0x416a3e
mov ecx, dword [ebp - 8]
cmp dword [eax + 8], ecx
jae 0x416b3d
mov ebx, dword [esi + 0x138]
mov edx, dword [esi + 0x130]
mov ecx, dword [esi + 0x12c]
shl ebx, 4
add ebx, edx
mov edx, ebx
mov ebx, dword [ebp + 0x1c]
add edx, ebx
cmp edx, ecx
jne 0x416aca
mov ebx, dword [eax + 8]
add ebx, dword [eax]
mov edx, dword [esi + 0x130]
cmp ebx, edx
jne 0x416aab
sub edx, dword [eax + 8]
mov ebx, dword [ebp - 8]
add edx, ebx
mov dword [esi + 0x130], edx
mov edx, ebx
sub edx, dword [eax + 8]
add dword [esi + 0x134], edx
sub ecx, dword [eax + 8]
add ecx, ebx
cmp dword [ebp + 0x20], 1
mov dword [esi + 0x12c], ecx
jne 0x416b3d
add ecx, 0x10
mov dword [esi + 0x12c], ecx
jmp 0x416b3d
mov dword [eax], edx
mov eax, dword [ebp - 8]
add dword [esi + 0x130], eax
add dword [esi + 0x134], eax
add dword [esi + 0x12c], eax
mov eax, dword [esi + 0x12c]
jmp 0x416b2e
mov edx, dword [esi + 0x134]
add ebx, edx
cmp ebx, ecx
jne 0x416b00
mov ecx, dword [eax + 8]
add ecx, dword [eax]
cmp ecx, edx
jne 0x416af9
sub edx, dword [eax + 8]
mov ecx, dword [ebp - 8]
add edx, dword [ebp - 8]
mov dword [esi + 0x134], edx
sub ecx, dword [eax + 8]
add dword [esi + 0x12c], ecx
jmp 0x416ac2
mov dword [eax], edx
mov eax, dword [ebp - 8]
jmp 0x416ab6
mov edx, dword [eax + 8]
add edx, dword [eax]
cmp edx, ecx
jne 0x416b0d
mov eax, dword [eax]
jmp 0x416b18
mov dword [eax], ecx
mov eax, dword [esi + 0x11c]
mov eax, dword [eax + edi]
mov ecx, dword [ebp - 8]
add eax, ecx
mov ecx, dword [ebp + 0x1c]
mov dword [esi + 0x134], eax
add eax, ecx
mov dword [esi + 0x12c], eax
cmp dword [ebp + 0x20], 1
jne 0x416b3d
add eax, 0x10
mov dword [esi + 0x12c], eax
mov eax, dword [esi + 0x11c]
mov ecx, dword [ebp - 8]
mov ebx, dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [eax + edi + 8], ecx
mov eax, dword [esi + 0x11c]
mov ecx, dword [ebp + 0x10]
mov dword [eax + edi + 0xc], ecx
mov eax, dword [ebp + 0x18]
mov ecx, dword [esi + 0x11c]
push 0
or eax, 0x80000000
mov dword [ecx + edi + 4], eax
mov eax, dword [esi + 0x11c]
mov eax, dword [edi + eax]
push 0
push dword [esi + 0x15c]
mov dword [ebp + 0x10], eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
push dword [esi + 0x128]
lea eax, [esi + 0x124]
push eax
push dword [esi + 0x120]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test dword [ebp + 0x18], 0x10000
je 0x416c5f
push 3
push dword [ebp + 0x14]
call fcn.00413c14
test dword [ebp + 0x18], 0x20000
pop ecx
pop ecx
mov dword [ebp + 0x20], eax
je 0x416be4
mov eax, dword [esi + 0x11c]
add eax, edi
mov ecx, dword [eax]
add ecx, dword [ebp + 0x20]
xor ecx, dword [eax + 0xc]
mov dword [ebp + 0x20], ecx
mov cl, byte [esi + 0x142]
mov eax, 0x200
shl eax, cl
xor edx, edx
mov dword [ebp + 0x1c], eax
mov eax, dword [esi + 0x11c]
mov eax, dword [eax + edi + 0xc]
div dword [ebp + 0x1c]
test edx, edx
mov dword [ebp + 0x1c], eax
je 0x416c0d
inc dword [ebp + 0x1c]
cmp dword [ebp - 0x24], 0x200
je 0x416c1e
test word [ebp + 0x18], 0x100
je 0x416c31
mov eax, dword [ebp + 0x20]
dec eax
push eax
push dword [ebp - 0x2c]
push dword [ebp + 8]
call fcn.00413c9d
add esp, 0xc
xor edi, edi
cmp dword [ebp + 0x1c], edi
jbe 0x416c5f
mov ecx, dword [ebp - 0x10]
mov eax, dword [ecx + edi*4]
mov ecx, dword [ecx + edi*4 + 4]
push dword [ebp + 0x20]
sub ecx, eax
push ecx
mov ecx, dword [ebp + 8]
add eax, ecx
push eax
call fcn.00413c9d
add esp, 0xc
inc dword [ebp + 0x20]
inc edi
cmp edi, dword [ebp + 0x1c]
jb 0x416c38
push dword [ebp - 0x10]
call fcn.004179da
mov eax, dword [esi + 0x15c]
add eax, dword [ebp + 0x10]
xor edi, edi
push edi
push edi
push eax
push dword [esi + 0x120]
call ebx
push edi
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 8]
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.004179da
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
call fcn.00417a63
mov dword [ebp + 8], eax
test eax, eax
mov eax, dword [esi + 0x138]
je 0x416d25
shl eax, 4
push eax
push dword [esi + 0x118]
push dword [ebp + 8]
call fcn.00437870
push dword [0x46d520]
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [ebp + 8]
call fcn.00413c9d
mov eax, dword [esi + 0x130]
add eax, dword [esi + 0x15c]
add esp, 0x18
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.004179da
jmp 0x416d92
push dword [0x46d520]
shl eax, 4
push eax
push dword [esi + 0x118]
call fcn.00413c9d
mov eax, dword [esi + 0x130]
add eax, dword [esi + 0x15c]
add esp, 0xc
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [esi + 0x118]
push dword [esi + 0x120]
call edi
push dword [0x46d520]
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [esi + 0x118]
call fcn.00413d00
add esp, 0xc
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
call fcn.00417a63
mov dword [ebp + 8], eax
test eax, eax
mov eax, dword [esi + 0x13c]
je 0x416e19
shl eax, 4
push eax
push dword [esi + 0x11c]
push dword [ebp + 8]
call fcn.00437870
push dword [0x46d524]
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [ebp + 8]
call fcn.00413c9d
mov eax, dword [esi + 0x134]
add eax, dword [esi + 0x15c]
add esp, 0x18
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.004179da
jmp 0x416e86
push dword [0x46d524]
shl eax, 4
push eax
push dword [esi + 0x11c]
call fcn.00413c9d
mov eax, dword [esi + 0x134]
add eax, dword [esi + 0x15c]
add esp, 0xc
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [esi + 0x11c]
push dword [esi + 0x120]
call edi
push dword [0x46d524]
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [esi + 0x11c]
call fcn.00413d00
add esp, 0xc
push dword [ebp + 0x14]
push esi
call fcn.004155f7
pop ecx
xor eax, eax
pop ecx
inc eax
jmp 0x416ea0
push 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret 0x1c