Function at 0x403370
Capabilities:
Access peb ldr_data
Get kernel32 base address
Get process heap flags
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x5c
mov edi, dword [ebp + 0x10]
mov edx, dword [ebp + 0xc]
mov ebx, dword [ebp + 8]
movzx eax, word [edi]
test edx, edx
je 0x403400
mov edx, dword [ebp + 0x14]
or edx, 0x80000000
mov dword [ebp - 0x3c], edx
test ax, ax
je 0x403719
mov ecx, edi
add ecx, 2
cmp word [ecx], 0
jne 0x4033a0
sub ecx, edi
lea eax, [ecx + 2]
add ecx, 0x14
mov dword [ebp + 0x1c], eax
mov dword [esp + 8], ecx
mov eax, dword fs:[0x18]
mov dword [ebp - 0x40], ecx
mov dword [esp + 4], 0
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapAlloc]
mov ecx, dword [ebp - 0x40]
mov dword [ebp + 0x18], edi
mov edi, 0x41abc6
mov dword [eax], 0x57494e45
mov esi, eax
mov eax, dword [ebp - 0x3c]
sub esp, 0xc
mov dword [esi + 4], ecx
mov dword [esi + 0xc], eax
mov eax, 1
jmp 0x403478
mov edx, dword [ebp + 0x1c]
lea ecx, [edx + 0x12]
test ax, ax
je 0x40341d
mov eax, edi
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x403410
sub eax, edi
add ecx, eax
mov dword [esp + 8], ecx
mov eax, dword fs:[0x18]
mov dword [ebp - 0x3c], ecx
mov dword [esp + 4], 0
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapAlloc]
mov ecx, dword [ebp - 0x3c]
mov dword [eax], 0x57494e45
mov esi, eax
mov eax, dword [ebp + 0x14]
sub esp, 0xc
mov dword [esi + 4], ecx
mov dword [esi + 0xc], eax
cmp word [edi], 0
je 0x4037f5
mov eax, edi
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x403468
sub eax, edi
sar eax, 1
add eax, 1
mov dword [esi + 8], eax
xor eax, eax
lea esi, [esi]
movzx ecx, word [edi + eax]
mov word [esi + eax + 0x10], cx
add eax, 2
test cx, cx
jne 0x403480
mov eax, dword [ebp + 0x1c]
test eax, eax
jne 0x4035c0
mov eax, dword [ebx + 0x24]
mov ecx, dword [esi + 4]
lea edi, [ebp - 0x30]
mov dword [ebp - 0x24], 0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x1c], eax
lea eax, [ebp - 0x2c]
mov dword [esp + 8], ecx
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], edi
mov dword [ebp - 0x3c], ecx
mov dword [esp + 4], esi
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_WriteFile]
mov ecx, dword [ebp - 0x3c]
sub esp, 0x14
test eax, eax
jne 0x4035a0
mov eax, dword fs:[0x18]
cmp dword [eax + 0x34], 0x3e5
je 0x403540
test byte [section..data], 2
jne 0x403730
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov edx, dword [ebp + 0x20]
xor ebx, ebx
mov dword [edx], eax
mov dword [esp + 8], esi
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapFree]
mov eax, ebx
sub esp, 0xc
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [0x41906c]
mov dword [ebp - 0x3c], ecx
mov dword [esp + 4], eax
mov eax, dword [ebx + 0x24]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
mov ecx, dword [ebp - 0x3c]
sub esp, 8
cmp eax, 0x102
je 0x403759
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x3c], ecx
mov dword [esp + 0xc], 0
mov dword [esp + 8], edi
mov dword [esp + 4], eax
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetOverlappedResult]
mov ecx, dword [ebp - 0x3c]
sub esp, 0x10
test eax, eax
je 0x4034f5
lea esi, [esi]
cmp ecx, dword [ebp - 0x30]
je 0x4035e8
test byte [section..data], 2
jne 0x4036f0
mov eax, 0x1d
jmp 0x40350b
mov edx, dword [ebp + 0x1c]
mov eax, dword [esi + 8]
mov dword [esp + 8], edx
mov edx, dword [ebp + 0x18]
lea eax, [esi + eax*2 + 0x10]
mov dword [esp], eax
mov dword [esp + 4], edx
call sub.ucrtbase.dll_memcpy
jmp 0x40349c
lea eax, [ebp - 0x2c]
mov dword [esp + 0xc], edi
mov dword [esp + 0x10], eax
mov dword [esp + 8], 4
mov eax, dword [ebp + 0x20]
mov dword [esp + 4], eax
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_ReadFile]
sub esp, 0x14
test eax, eax
jne 0x4036c0
mov eax, dword fs:[0x18]
cmp dword [eax + 0x34], 0x3e5
je 0x40366d
test byte [section..data], 2
je 0x403502
mov eax, dword [ebp - 0x30]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], str.service_protocol_error___failed_to_read_pipe_r___d__count___ld__n
mov dword [esp + 0x14], eax
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x403502
mov eax, dword [0x41906c]
mov dword [esp + 4], eax
mov eax, dword [ebx + 0x24]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
sub esp, 8
cmp eax, 0x102
je 0x4037c3
lea eax, [ebp - 0x2c]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edi
mov dword [esp + 4], eax
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetOverlappedResult]
sub esp, 0x10
test eax, eax
je 0x403628
lea esi, [esi]
mov ecx, dword [ebp - 0x30]
mov ebx, 1
cmp ecx, 4
je 0x403512
test byte [section..data], 2
jne 0x40376c
mov eax, 0x1e
jmp 0x40350b
mov dword [esp + 0xc], str.service_protocol_error___failed_to_write_pipe__n
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x4035b2
mov dword [ebp + 0x1c], 2
mov ecx, 0x14
jmp 0x4033b4
mov dword [esp + 0xc], str.service_protocol_error___failed_to_write_pipe__n
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x403502
test byte [section..data], 2
jne 0x40379d
mov eax, 0x41d
jmp 0x40350b
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.service_protocol_error___failed_to_read_pipe_r___d__count___ld__n
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x4036de
mov dword [esp + 0xc], str.sending_command_timed_out_n
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x403762
test byte [section..data], 2
je 0x403762
mov dword [esp + 0xc], str.receiving_command_result_timed_out_n
mov dword [esp + 8], str.process_send_command
mov dword [esp + 4], 0x419000
mov dword [esp], 1
call fcn.00401520
jmp 0x403762
mov eax, 1
jmp 0x403478