Function at 0x403a50
Capabilities:
Write file on windows

Disassembly:
mov eax, 0x100c
call fcn.0042b680
push ebx
push ebp
push esi
mov esi, ecx
xor eax, eax
push edi
cmp word [esi + 0x2e], ax
mov dword [esp + 0x10], eax
mov dword [esp + 0x18], eax
jne 0x403a8b
push str.COMMS:_Port_is_not_open__SubmitBlocks_
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
mov ax, 0x207
pop ecx
jmp 0x403ebb
lea ebx, [esi + 0x2cc]
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 0x224]
cmp eax, dword [esi + 0x228]
jae 0x403eb1
lea edi, [esi + 0x214]
mov eax, dword [edi]
lea ebp, [esi + 0x218]
cmp eax, dword [ebp]
je 0x403eb1
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
push dword [eax + 0x1010]
call dword [sym.imp.KERNEL32.dll_ResetEvent]
cmp word [0x45349a], 0
je 0x403b44
mov ecx, dword [esi + 0x2b0]
call fcn.0041eaa4
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
push dword [eax + 0x1014]
push str.COMMS:_Submit_Tx_block__length__u_...
push dword [esi + 0x2b0]
call fcn.0041e63d
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov edx, dword [0x4534a6]
add esp, 0xc
mov eax, dword [ecx + eax*4]
mov ecx, dword [eax + 0x1014]
cmp ecx, edx
jb 0x403b2c
mov ecx, edx
push ecx
mov ecx, dword [esi + 0x2b0]
push eax
call fcn.0041e766
mov ecx, dword [esi + 0x2b0]
call fcn.0041eaaf
test byte [esi + 6], 4
je 0x403b75
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0
mov ecx, esi
call fcn.00403049
test ax, ax
jne 0x403eb8
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [edi]
cmp eax, dword [ebp]
je 0x403ec6
push ebx
mov word [esi + 0x244], 1
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp word [0x45349a], 0
je 0x403bf3
mov ecx, dword [esi + 0x2b0]
call fcn.0041eaa4
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
push dword [eax + 0x1014]
push str.COMMS:_Call_WriteFile__length__u_...
push dword [esi + 0x2b0]
call fcn.0041e63d
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov edx, dword [0x4534a6]
add esp, 0xc
mov eax, dword [ecx + eax*4]
mov ecx, dword [eax + 0x1014]
cmp ecx, edx
jb 0x403bdb
mov ecx, edx
push ecx
mov ecx, dword [esi + 0x2b0]
push eax
call fcn.0041e766
mov ecx, dword [esi + 0x2b0]
call fcn.0041eaaf
test byte [esi + 6], 4
je 0x403bfd
xor ecx, ecx
jmp 0x403c0e
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov ecx, dword [ecx + eax*4]
add ecx, 0x1000
mov eax, dword [edi]
mov edx, dword [esi + 0x208]
push ecx
lea ecx, [esp + 0x18]
mov eax, dword [edx + eax*4]
push ecx
push dword [eax + 0x1014]
push eax
push dword [esi + 0x194]
call dword [sym.imp.KERNEL32.dll_WriteFile]
cmp word [0x45349a], 0
mov ebp, eax
je 0x403c78
test ebp, ebp
je 0x403c49
mov eax, 0x438ccc
jmp 0x403c60
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
mov eax, str.Pending
je 0x403c60
mov eax, str.ERROR
push dword [esp + 0x14]
push eax
push str.COMMS:_WriteFile_returned__s__length__u
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0x10
mov ecx, esi
call fcn.00403100
test ebp, ebp
je 0x403d0f
test byte [esi + 6], 4
jne 0x403c9f
push str.COMMS:_Write_completed_immediately
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
pop ecx
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
push dword [eax + 0x1010]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
push 1
mov eax, dword [ecx + eax*4]
pop ebp
mov word [eax + 0x1020], bp
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
mov eax, dword [eax + 0x1014]
cmp eax, dword [esp + 0x14]
je 0x403d03
push dword [esp + 0x14]
push eax
push str.COMMS:_Timeout_sending_immediate_block__length__u__sent__u_
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0x10
mov dword [esp + 0x18], ebp
jmp 0x403deb
mov ecx, esi
call fcn.00403a21
jmp 0x403deb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
cmp ebp, 0x3e5
je 0x403dc0
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp word [esi + 0x246], 0
je 0x403d40
push dword [esi + 0x238]
call dword [sym.imp.KERNEL32.dll_SetEvent]
and word [esi + 0x244], 0
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
lea eax, [esp + 0x1c]
push 0x1000
push eax
push ebp
call fcn.004017d5
add esp, 0xc
push eax
push str.COMMS:_WriteFile_error____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
mov ecx, esi
push ebp
call fcn.0040761a
cmp dword [esi + 0x224], 0
movzx eax, ax
je 0x403d92
test eax, eax
je 0x403ed6
test eax, eax
jne 0x403f0a
push str.COMMS:_Error_writing_when_nothing_submitted_
push dword [esi + 0x2b0]
call fcn.0041e63d
inc dword [esp + 0x18]
pop ecx
cmp dword [esp + 0x14], 0xa
pop ecx
jae 0x403ef8
jmp 0x403e98
test byte [esi + 6], 4
je 0x403dd8
push str.COMMS:_Unexpected_overlapped_write_result_for_GF1190
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
pop ecx
mov eax, dword [edi]
mov ecx, dword [esi + 0x208]
mov eax, dword [ecx + eax*4]
and word [eax + 0x1020], 0
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [edi]
lea ebp, [esi + 0x218]
cmp eax, dword [ebp]
jne 0x403e19
push str.COMMS:_Block_sent_has_already_been_discarded
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
pop ecx
push ebp
mov ecx, esi
call fcn.00401852
push edi
mov ecx, esi
call fcn.00401852
inc dword [esi + 0x224]
cmp word [0x45349a], 0
mov eax, dword [esi + 0x224]
je 0x403e56
push eax
push dword [ebp]
push dword [edi]
push dword [esi + 0x210]
push str.COMMS:_Submitted_block_f_u__r_u__n_u__submitted__u
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0x18
cmp word [esi + 0x246], 0
je 0x403e6c
push dword [esi + 0x238]
call dword [sym.imp.KERNEL32.dll_SetEvent]
and word [esi + 0x244], 0
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp word [esp + 0x18], 0
je 0x403e93
push 1
mov ecx, esi
call fcn.0040596e
mov ecx, esi
call fcn.00403f20
and dword [esp + 0x10], 0
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 0x224]
cmp eax, dword [esi + 0x228]
jb 0x403ab0
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor ax, ax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x100c
ret
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ecx, esi
call fcn.00403100
jmp 0x403eb8
mov eax, dword [esi + 0x224]
push eax
push str.COMMS:_Max_blocks_to_be_submitted_reduced_to__u
push dword [esi + 0x2b0]
mov dword [esi + 0x228], eax
call fcn.0041e63d
add esp, 0xc
jmp 0x403f1a
push str.COMMS:_Ten_failures_to_write___giving_up
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
pop ecx
push 2
mov ecx, esi
call fcn.0040596e
mov ecx, esi
call fcn.00403f20
mov ax, 1
jmp 0x403ebb