Function at 0x1002e040
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
mov eax, dword [0x100a249c]
xor eax, ebp
mov dword [ebp - 4], eax
push edi
mov edi, ecx
cmp dword [edi + 8], 0xffffffff
je 0x1002e3a8
cmp byte [edi + 0x13c], 0
je 0x1002e397
push ebx
push esi
nop
cmp dword [edi + 8], 0xffffffff
je 0x1002e395
push 0x32
push dword [edi + 0x14c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp byte [edi + 0x13c], 0
je 0x1002e395
test eax, eax
je 0x1002e140
cmp eax, 0x102
jne 0x1002e388
mov eax, dword [edi + 8]
cmp eax, 0xffffffff
je 0x1002e0d5
lea ecx, [ebp - 0x410]
push ecx
lea ecx, [ebp - 0x424]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_ClearCommError]
test eax, eax
je 0x1002e0d5
mov eax, dword [ebp - 0x40c]
test eax, eax
je 0x1002e0fb
jmp 0x1002e0d8
or eax, 0xffffffff
test byte [edi + 4], 4
je 0x1002e0ec
push eax
mov ecx, edi
call fcn.1002d870
mov eax, dword [edi + 0xe8]
cmp eax, dword [edi + 0x170]
jb 0x1002e0fb
mov eax, dword [edi]
mov ecx, edi
call dword [eax + 0x1c]
test byte [edi + 4], 8
je 0x1002e388
lea esi, [edi + 0x108]
test esi, esi
je 0x1002e11c
mov eax, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea ebx, [esi + 0x14]
push ebx
call eax
jmp 0x1002e121
mov ebx, 0x14
mov esi, dword [esi + 0xc]
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
test esi, esi
je 0x1002e388
push ecx
mov ecx, edi
call fcn.1002d930
jmp 0x1002e388
test byte [edi + 4], 8
je 0x1002e37c
lea esi, [edi + 0x108]
test esi, esi
je 0x1002e169
lea eax, [esi + 0x14]
push eax
mov dword [ebp - 0x414], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea eax, [esi + 0x14]
jmp 0x1002e174
mov eax, 0x14
mov dword [ebp - 0x414], eax
mov ebx, dword [esi + 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
test ebx, ebx
je 0x1002e37c
mov eax, dword [edi + 4]
shr eax, 1
test al, 1
je 0x1002e22a
mov ebx, dword [ebp - 0x414]
test esi, esi
je 0x1002e1a5
mov eax, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push ebx
call eax
cmp dword [edi + 0x114], 0
jne 0x1002e1c2
test esi, esi
je 0x1002e372
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x1002e372
mov ecx, dword [edi + 0x10c]
test ecx, ecx
je 0x1002e1ed
mov eax, dword [ecx + 4]
sub eax, dword [ecx]
cmp eax, 0x400
jae 0x1002e1df
mov ebx, dword [ecx + 4]
sub ebx, dword [ecx]
jmp 0x1002e1ef
mov eax, dword [ecx]
mov ebx, 0x400
add eax, 0x10
add eax, ecx
jmp 0x1002e1fe
xor ebx, ebx
test ecx, ecx
je 0x1002e1fc
mov eax, dword [ecx]
add eax, 0x10
add eax, ecx
jmp 0x1002e1fe
xor eax, eax
push ebx
push eax
mov ecx, edi
call fcn.1002ce80
push ebx
push 0
mov ecx, esi
call fcn.1002d440
test esi, esi
je 0x1002e372
push dword [ebp - 0x414]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x1002e372
mov eax, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea ebx, [edi + 0x11c]
push ebx
mov dword [ebp - 0x418], 0
call eax
push 0x400
lea eax, [ebp - 0x404]
mov ecx, esi
push eax
call fcn.1002d440
push ebx
mov dword [ebp - 0x414], eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [ebp - 0x414], 0
jbe 0x1002e372
mov ecx, dword [ebp - 0x418]
mov esi, dword [ebp - 0x414]
nop dword [eax + eax]
lea eax, [ebp - 0x404]
mov ebx, esi
add eax, ecx
sub ebx, ecx
mov dword [ebp - 0x41c], eax
mov eax, dword [edi + 8]
cmp eax, 0xffffffff
je 0x1002e35a
test ebx, ebx
je 0x1002e35a
push 0
lea ecx, [ebp - 0x420]
mov dword [ebp - 0x414], 0
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_ClearCommError]
test eax, eax
je 0x1002e2d8
cmp dword [ebp - 0x420], 0
jbe 0x1002e2d8
push 1
push dword [edi + 8]
call dword [sym.imp.KERNEL32.dll_PurgeComm]
mov eax, dword [edi + 4]
mov ecx, dword [edi + 8]
shr eax, 1
test al, 1
je 0x1002e32f
lea eax, [edi + 0x188]
push eax
lea eax, [ebp - 0x414]
push eax
push ebx
push dword [ebp - 0x41c]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x1002e31b
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
je 0x1002e31b
mov ecx, dword [ebp - 0x418]
xor eax, eax
jmp 0x1002e35c
add dword [edi + 0x138], ebx
mov eax, dword [ebp - 0x414]
mov ecx, dword [ebp - 0x418]
jmp 0x1002e35c
push 0
lea eax, [ebp - 0x414]
push eax
push ebx
push dword [ebp - 0x41c]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp - 0x414]
add dword [edi + 0x138], eax
mov ecx, dword [ebp - 0x418]
jmp 0x1002e35c
xor eax, eax
add ecx, eax
mov dword [ebp - 0x418], ecx
cmp ecx, esi
jb 0x1002e280
lea esi, [edi + 0x108]
test byte [edi + 4], 8
jne 0x1002e150
push dword [edi + 0x14c]
call dword [sym.imp.KERNEL32.dll_ResetEvent]
cmp byte [edi + 0x13c], 0
jne 0x1002e070
pop esi
pop ebx
xor eax, eax
pop edi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1004ce09
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
mov eax, 1
xor ecx, ebp
pop edi
call fcn.1004ce09
mov esp, ebp
pop ebp
ret