Function at 0x10666c7
Capabilities:
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x144
mov eax, dword [0x1099a38]
mov edx, dword [ebp + 0x2c]
mov ecx, dword [ebp + 8]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x10]
mov dword [ebp - 0x120], eax
mov eax, dword [ebp + 0x14]
mov dword [ebp - 0x134], edx
mov edx, dword [ebp + 0x30]
mov dword [ebp - 0x144], eax
mov eax, dword [ebp + 0x18]
mov dword [ebp - 0x118], edx
mov edx, dword [ebp + 0x34]
push ebx
mov ebx, dword [ebp + 0x28]
mov dword [ebp - 0x138], eax
mov eax, dword [ebp + 0x20]
mov dword [ebp - 0x128], edx
mov edx, dword [ebp + 0x3c]
push esi
mov esi, dword [ebp + 0x38]
mov dword [ebp - 0x124], eax
mov eax, dword [ebp + 0x24]
cmp dword [eax], 0
push edi
mov edi, dword [ebp + 0x1c]
mov dword [ebp - 0x130], edx
mov edx, dword [ebp + 0x44]
mov dword [ebp - 0x10c], ecx
mov dword [ebp - 0x110], edi
mov dword [ebp - 0x13c], eax
mov dword [ebp - 0x12c], esi
mov dword [ebp - 0x140], edx
jne 0x1066860
push dword [ebp + 0xc]
push 0xa
push ecx
call dword [sym.imp.msvcrt.dll_memchr]
mov edi, eax
mov eax, dword [0x10c6030]
add esp, 0xc
test edi, edi
jne 0x10667a5
test eax, eax
je 0x1066794
push edi
lea ecx, [ebp - 0x11c]
push ecx
push dword [ebp + 0xc]
push dword [ebp - 0x10c]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 0x1021b00
call fcn.01071aad
push 0xd
jmp 0x1066c97
test eax, eax
je 0x10667c9
push 0
lea ecx, [ebp - 0x11c]
push ecx
mov ecx, edi
sub ecx, dword [ebp - 0x10c]
inc ecx
push ecx
push dword [ebp - 0x10c]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov byte [edi], 0
inc edi
push 9
mov dword [ebp - 0x114], edi
sub edi, dword [ebp - 0x10c]
push 0x1021af4
push edi
push dword [ebp - 0x10c]
call fcn.01033542
test eax, eax
jne 0x10667f7
push 0x1021ab0
jmp 0x1066799
add eax, 9
push eax
call fcn.01033517
test eax, eax
je 0x106699d
cmp eax, dword [esi + 0x14]
ja 0x106699d
mov ecx, dword [ebp + 0x40]
mov ecx, dword [ecx]
cmp ecx, edi
jb 0x1066831
mov edx, dword [ebp - 0x10c]
sub edx, dword [ebp - 0x114]
mov edi, eax
add ecx, edx
shl edi, 3
cmp ecx, edi
jae 0x106683b
push 0x1021a70
jmp 0x1066799
mov edi, dword [ebp - 0x13c]
add dword [ebp + 0xc], edx
mov dword [edi], eax
mov eax, dword [ebp - 0x130]
mov edi, dword [ebp - 0x110]
mov dword [eax], ecx
mov eax, dword [ebp - 0x114]
mov dword [ebp - 0x10c], eax
mov eax, dword [0x10c6030]
test eax, eax
je 0x1066882
push 0
lea ecx, [ebp - 0x11c]
push ecx
push dword [ebp + 0xc]
push dword [ebp - 0x10c]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [ebp + 0xc]
mov eax, dword [ebp - 0x130]
sub dword [eax], ecx
test ecx, ecx
jbe 0x1066c0b
call fcn.01040cef
test eax, eax
jne 0x1066c9c
cmp dword [esi + 0x10], 8
jae 0x1066a01
xor eax, eax
inc eax
cmp dword [ebp + 0xc], eax
jb 0x1066c0e
mov ecx, dword [ebp - 0x10c]
mov eax, dword [esi + 0x10]
mov cl, byte [ecx]
mov byte [eax + esi + 8], cl
inc dword [esi + 0x10]
inc dword [ebp - 0x10c]
dec dword [ebp + 0xc]
cmp dword [esi + 0x10], 8
jb 0x10668ac
movzx eax, word [esi + 0xa]
cmp eax, dword [esi + 0x14]
jae 0x1066c1d
mov ecx, dword [esi + 0x18]
mov ax, word [ecx + eax*4]
mov word [esi + 0xa], ax
movzx eax, ax
cmp eax, dword [esi + 4]
jae 0x1066c33
mov ecx, dword [ebp - 0x140]
test byte [ecx + eax*4], 1
jne 0x1066c33
mov ecx, dword [ebp - 0x130]
mov ecx, dword [ecx]
add ecx, dword [ebp + 0xc]
mov eax, dword [esi + 0xc]
cmp eax, ecx
ja 0x1066c33
mov ecx, dword [ebx]
mov edx, dword [ebp - 0x124]
mov dword [edx + ecx*4], eax
movzx eax, word [esi + 0xa]
mov ecx, dword [esi]
lea eax, [eax + eax*2]
mov eax, dword [ecx + eax*8]
lea ecx, [eax + 1]
mov dl, byte [eax]
inc eax
test dl, dl
jne 0x106693d
sub eax, ecx
mov ecx, dword [ebp - 0x120]
lea edx, [eax + 0xa]
call fcn.0106e037
test edi, edi
mov ecx, dword [ebx]
mov dword [edi + ecx*4], eax
je 0x1066c27
movzx eax, word [esi + 0xa]
mov ecx, dword [esi]
lea eax, [eax + eax*2]
mov eax, dword [ecx + eax*8]
mov ecx, dword [ebx]
mov ecx, dword [edi + ecx*4]
mov dl, byte [eax]
inc eax
mov byte [ecx], dl
inc ecx
test dl, dl
jne 0x1066972
movzx eax, byte [esi + 9]
dec eax
je 0x10669f7
dec eax
je 0x10669d3
dec eax
je 0x10669bd
sub eax, 0x7d
je 0x10669a7
sub eax, 0x7f
je 0x1066a01
push 0x1021a44
jmp 0x1066799
push 0x1021a04
jmp 0x1066799
mov eax, dword [ebx]
mov edi, dword [edi + eax*4]
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x10669ad
mov esi, 0x1021a00
movsd dword es:[edi], dword [esi]
jmp 0x10669e9
mov eax, dword [ebx]
mov edi, dword [edi + eax*4]
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x10669c3
mov esi, 0x10219f8
movsd dword es:[edi], dword [esi]
jmp 0x10669e8
mov eax, dword [ebx]
mov edi, dword [edi + eax*4]
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x10669d9
mov esi, 0x10219f4
movsw word es:[edi], word [esi]
movsb byte es:[edi], byte [esi]
mov esi, dword [ebp - 0x12c]
mov edi, dword [ebp - 0x110]
jmp 0x1066a01
mov eax, dword [ebx]
push dword [edi + eax*4]
call fcn.010711a2
mov eax, dword [ebp - 0x118]
mov eax, dword [eax]
test eax, eax
je 0x1066a16
cmp eax, 0xffffffff
jne 0x1066b54
mov eax, dword [ebx]
mov ecx, dword [ebp - 0x13c]
cmp eax, dword [ecx]
jae 0x1066c3d
mov ecx, dword [ebp - 0x120]
push 0x10
pop edx
call fcn.0106e037
mov edi, eax
test edi, edi
je 0x1066c4b
mov eax, dword [ebx]
mov ecx, dword [ebp - 0x110]
mov edx, dword [ecx + eax*4]
mov ecx, dword [ebp - 0x120]
call fcn.0106e0ce
test eax, eax
mov edx, dword [ebp - 0x124]
mov dword [edi + 4], eax
mov ecx, dword [ebx]
mov ecx, dword [edx + ecx*4]
mov dword [edi + 8], ecx
movzx ecx, byte [esi + 8]
mov dword [edi + 0xc], ecx
je 0x1066c52
mov eax, dword [ebp - 0x138]
mov ecx, dword [eax + 0x14]
mov dword [ecx], edi
mov ecx, dword [ebp - 0x110]
mov dword [eax + 0x14], edi
push 0x104
lea eax, [ebp - 0x108]
push eax
mov eax, dword [ebx]
push dword [ecx + eax*4]
push dword [ebp - 0x144]
call fcn.01070fc9
mov eax, dword [ebx]
mov ecx, dword [ebp - 0x124]
mov eax, dword [ecx + eax*4]
mov ecx, dword [ebp - 0x134]
push 0
push 0x80
push 2
mov dword [ecx], eax
mov ecx, dword [ebp - 0x128]
push 0
push 1
mov dword [ecx], eax
push 0x40000000
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov edi, dword [ebp - 0x118]
mov dword [edi], eax
jne 0x1066b25
lea eax, [ebp - 0x108]
push eax
call fcn.010300d2
test eax, eax
je 0x1066b25
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [edi], eax
je 0x1066c59
mov eax, dword [ebp - 0x134]
push 0
push 0
push dword [eax]
push dword [edi]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push dword [edi]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
xor eax, eax
push eax
push eax
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [ebp - 0x110]
mov eax, dword [ebp - 0x128]
mov ecx, dword [ebp + 0xc]
mov eax, dword [eax]
cmp ecx, eax
mov dword [ebp - 0x114], ecx
jb 0x1066b6f
mov dword [ebp - 0x114], eax
push 0
lea eax, [ebp - 0x11c]
push eax
push dword [ebp - 0x114]
mov eax, dword [ebp - 0x118]
push dword [ebp - 0x10c]
push dword [eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1066c76
mov eax, dword [ebp - 0x114]
cmp dword [ebp - 0x11c], eax
jne 0x1066c8b
mov ecx, dword [ebp - 0x128]
sub dword [ecx], eax
jne 0x1066bfc
mov eax, dword [ebp - 0x118]
push dword [eax]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x118]
and dword [eax], 0
movzx eax, word [esi + 0xa]
mov ecx, dword [ebp - 0x140]
lea eax, [ecx + eax*4]
or dword [eax], 1
mov eax, dword [ebp - 0x138]
push 0
push 1
push dword [eax + 0x18]
call dword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
inc dword [ebx]
and dword [esi + 0x10], 0
mov eax, dword [ebp - 0x114]
add dword [ebp - 0x10c], eax
sub dword [ebp + 0xc], eax
jne 0x1066895
xor eax, eax
inc eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
pop ebx
call fcn.0106bc50
leave
ret 0x40
push 0x10219a8
jmp 0x1066799
push 0x102196c
call fcn.01071aad
jmp 0x1066c9c
push 0x1021928
jmp 0x1066799
push 0xd
call fcn.01037f35
push 0x10218f4
jmp 0x1066c2c
push 0x10218bc
jmp 0x1066c2c
push 0x1021870
jmp 0x1066c2c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [ebp - 0x108]
push eax
push 0x1021830
call fcn.01071ac0
add esp, 0xc
jmp 0x1066c9c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [ebp - 0x108]
push eax
push 0x10217e8
jmp 0x1066c6c
push 0x10217a0
call fcn.01071aad
push 0x57
call fcn.01037f35
xor eax, eax
jmp 0x1066c0e