Function at 0x403120
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
mov eax, dword [0x519074]
xor eax, ebp
mov dword [ebp - 4], eax
push edi
mov edi, ecx
cmp dword [edi + 8], 0xffffffff
jne 0x403150
mov eax, 1
pop edi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00476066
mov esp, ebp
pop ebp
ret
cmp byte [edi + 0x13c], 0
je 0x403467
push ebx
push esi
nop
cmp dword [edi + 8], 0xffffffff
je 0x403465
push 0x32
push dword [edi + 0x14c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp byte [edi + 0x13c], 0
je 0x403465
test eax, eax
je 0x403229
cmp eax, 0x102
jne 0x403458
mov eax, dword [edi + 8]
cmp eax, 0xffffffff
je 0x4031c5
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 0x4031c5
mov eax, dword [ebp - 0x40c]
test eax, eax
je 0x4031ff
jmp 0x4031c8
or eax, 0xffffffff
test byte [edi + 4], 4
je 0x4031dc
push eax
mov ecx, edi
call fcn.004027a0
mov eax, dword [edi + 0xe8]
cmp eax, dword [edi + 0x170]
jb 0x4031ff
mov eax, dword [edi]
mov ecx, edi
cmp eax, vtable.CnComm.0
jne 0x403478
push 1
push 0
push 0x66a
call dword [eax + 0x18]
test byte [edi + 4], 8
je 0x403458
lea ecx, [edi + 0x108]
call fcn.00402110
test eax, eax
je 0x403458
push ecx
mov ecx, edi
call fcn.00402860
jmp 0x403458
test byte [edi + 4], 8
je 0x40344c
lea esi, [edi + 0x108]
nop dword [eax]
test esi, esi
je 0x403259
lea eax, [esi + 0x14]
push eax
mov dword [ebp - 0x414], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea eax, [esi + 0x14]
jmp 0x403264
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 0x40344c
mov eax, dword [edi + 4]
shr eax, 1
test al, 1
je 0x4032fc
mov ebx, dword [ebp - 0x414]
test esi, esi
je 0x403291
mov eax, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push ebx
call eax
cmp dword [edi + 0x114], 0
jne 0x4032ae
test esi, esi
je 0x403442
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x403442
mov edx, dword [edi + 0x10c]
test edx, edx
je 0x4032ce
mov eax, dword [edx + 4]
mov ebx, 0x400
sub eax, dword [edx]
cmp eax, ebx
cmovb ebx, eax
lea eax, [edx + 0x10]
add eax, dword [edx]
jmp 0x4032d2
xor ebx, ebx
xor eax, eax
push ebx
push eax
mov ecx, edi
call fcn.004018c0
push ebx
push 0
mov ecx, esi
call fcn.004021d0
test esi, esi
je 0x403442
lea eax, [esi + 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x403442
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.004021d0
push ebx
mov dword [ebp - 0x414], eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [ebp - 0x414], 0
jbe 0x403442
mov ecx, dword [ebp - 0x418]
mov esi, dword [ebp - 0x414]
nop dword [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 0x40342a
test ebx, ebx
je 0x40342a
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 0x4033a8
cmp dword [ebp - 0x420], 0
jbe 0x4033a8
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 0x4033ff
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 0x4033eb
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
je 0x4033eb
mov ecx, dword [ebp - 0x418]
xor eax, eax
jmp 0x40342c
add dword [edi + 0x138], ebx
mov eax, dword [ebp - 0x414]
mov ecx, dword [ebp - 0x418]
jmp 0x40342c
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 0x40342c
xor eax, eax
add ecx, eax
mov dword [ebp - 0x418], ecx
cmp ecx, esi
jb 0x403350
lea esi, [edi + 0x108]
test byte [edi + 4], 8
jne 0x403240
push dword [edi + 0x14c]
call dword [sym.imp.KERNEL32.dll_ResetEvent]
cmp byte [edi + 0x13c], 0
jne 0x403160
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor eax, eax
xor ecx, ebp
pop edi
call fcn.00476066
mov esp, ebp
pop ebp
ret
call dword [eax + 0x1c]
jmp 0x4031ff