Function at 0x407100
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x48
push esi
mov esi, ecx
mov dword [esp + 4], 0
mov eax, dword [esi + 0x14]
cmp eax, 0xffffffff
jne 0x407122
mov eax, 0x80
pop esi
add esp, 0x48
ret 0x14
push ebx
push ebp
lea eax, [esi + 0x2dc]
push edi
push eax
mov dword [esp + 0x18], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 4]
push eax
call dword [sym.imp.KERNEL32.dll_ResetEvent]
mov edi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
lea ebp, [esi + 0x2d0]
push 0
push ebp
call edi
mov ebx, dword [esp + 0x5c]
lea edx, [esi + 0x2cc]
mov ecx, ebx
and ecx, 0xff
push ecx
push edx
call edi
mov cl, byte [esp + 0x64]
mov al, byte [esp + 0x60]
push 0
push 0
lea edx, [esp + 0x20]
mov byte [esp + 0x24], cl
push 5
push edx
mov ecx, esi
mov byte [esp + 0x28], bl
mov byte [esp + 0x29], 0x2b
mov byte [esp + 0x2a], 0xe
mov byte [esp + 0x2b], al
call fcn.00406780
xor ecx, ecx
lea edx, [esi + 0x1cc]
mov cl, ah
mov dword [esi + 0x2d4], 7
mov byte [esp + 0x1d], cl
mov ecx, dword [esp + 0x18]
mov dword [edx], ecx
mov cx, word [esp + 0x1c]
mov byte [esp + 0x1e], al
mov word [edx + 4], cx
mov byte [edx + 6], al
mov edi, dword [esi + 0x2d4]
mov eax, dword [esi + 0x14]
cmp eax, 0xffffffff
je 0x407252
lea edx, [esp + 0x64]
push 0
push edx
mov eax, dword [esi + 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_ClearCommError]
test eax, eax
je 0x4071fc
mov eax, dword [esp + 0x64]
test eax, eax
jbe 0x4071fc
push 5
mov ecx, dword [esi + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_PurgeComm]
lea eax, [esi + 0x74]
lea edx, [esp + 0x60]
push eax
push edx
lea eax, [esp + 0x20]
push edi
mov dword [esp + 0x6c], 0
push eax
mov ecx, dword [esi + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x407252
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
je 0x407252
mov edx, dword [esi + 0x84]
push 0x14
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [esp + 0x60]
push 0
push eax
lea eax, [esi + 0x74]
push eax
mov ecx, dword [esi + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
mov edx, dword [esi + 0xc8]
mov eax, dword [esi + 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x4072e4
mov cx, word [ebp]
lea edi, [esi + 0xcc]
push ecx
push edi
push ebx
mov ecx, esi
call fcn.00406ec0
test eax, eax
je 0x4072da
cmp byte [edi], bl
jne 0x4072da
mov al, byte [edi + 1]
mov dl, al
and dl, 0x7f
cmp dl, 0x2b
jne 0x4072da
test al, 0x80
je 0x40729f
xor eax, eax
mov al, byte [edi + 2]
mov dword [esp + 0x10], eax
jmp 0x4072ec
mov ebx, dword [esp + 0x68]
test ebx, ebx
je 0x4072ec
mov edx, dword [esp + 0x6c]
test edx, edx
je 0x4072ec
mov ebp, dword [ebp]
xor eax, eax
mov ax, word [edx]
lea ecx, [ebp - 7]
cmp eax, ecx
jle 0x4072c0
mov eax, ecx
mov ecx, eax
lea esi, [edi + 5]
mov edi, ebx
mov ebx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov word [edx], ax
jmp 0x4072ec
mov dword [esp + 0x10], 0x81
jmp 0x4072ec
mov dword [esp + 0x10], 0x82
mov ecx, dword [esp + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0x10]
pop edi
pop ebp
pop ebx
pop esi
add esp, 0x48
ret 0x14