Function at 0x402f80
Capabilities:
Check mutex on windows
Create mailslot
Create thread
Initialize winsock library
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
mov eax, 0x4878
call fcn.004045a0
mov eax, dword [0x408004]
xor eax, esp
mov dword [esp + 0x4874], eax
push esi
push edi
mov edi, dword [ebp + 0xc]
xor esi, esi
push str.Socks_Over_RDP_by_Balazs_Bucsay____xoreipeip___n_n
mov dword [esp + 0x1c], esi
mov dword [0x4083b4], 0x406348
mov byte [0x4083b8], 4
mov dword [0x4083b0], 0x406354
call fcn.00402b90
mov eax, dword [ebp + 8]
add esp, 4
cmp eax, 1
jle 0x403039
dec eax
mov dword [esp + 0x74], eax
test eax, eax
jle 0x403039
mov eax, dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_wcsncmp]
inc esi
push 1
push 0x405f00
push dword [edi + esi*4]
call eax
add esp, 0xc
test eax, eax
jne 0x403071
mov ecx, dword [edi + esi*4]
movzx eax, word [ecx + 2]
add eax, 0xffffffc1
cmp eax, 0x37
ja case.0x403011.64
movzx eax, byte [eax + 0x4037f8]
jmp dword [eax*4 + 0x4037e8]
mov dword [0x408398], 1
jmp 0x40302e
mov dword [0x4083a0], 1
mov eax, dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_wcsncmp]
cmp esi, dword [esp + 0x74]
jl 0x402fe7
movzx eax, byte [0x4083b8]
or eax, 1
mov dword [esp + 0x28], 0
push eax
push str.SocksChannel
push 0xffffffffffffffff
call dword [sym.imp.WTSAPI32.dll_WTSVirtualChannelOpenEx]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [0x4083bc], eax
test eax, eax
jne 0x40308e
call esi
mov esi, eax
jmp 0x4030ed
push ecx
jmp 0x403074
push dword [edi + esi*4]
push 0x405f04
call fcn.00402b90
add esp, 8
mov eax, dword [edi]
push eax
push 0x405e80
jmp 0x4037c7
lea ecx, [esp + 0x74]
push ecx
lea ecx, [esp + 0x2c]
push ecx
push 1
push eax
call dword [sym.imp.WTSAPI32.dll_WTSVirtualChannelQuery]
test eax, eax
jne 0x4030ab
call esi
mov esi, eax
jmp 0x4030ed
cmp dword [esp + 0x74], 4
je 0x4030b9
mov esi, 0x57
jmp 0x4030ed
mov eax, dword [esp + 0x28]
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push 2
push 0
mov edi, dword [eax]
push 0
push 0x40839c
call esi
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
test eax, eax
jne 0x4030eb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
jmp 0x4030ed
xor esi, esi
mov eax, dword [esp + 0x28]
test eax, eax
je 0x4030fc
push eax
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
mov eax, dword [0x4083bc]
test eax, eax
je 0x40310c
push eax
call dword [sym.imp.WTSAPI32.dll_WTSVirtualChannelClose]
test esi, esi
je 0x403146
cmp esi, 0x1f
jne 0x403120
push esi
push str.____Could_not_open_Dynamic_Virtual_Channel__plugin_was_not_loaded_on_the_client_side:__ld_n
jmp 0x4037c7
push esi
push esi
push str.____Could_not_open_Dynamic_Virtual_Channel:__ld___08X_n
call fcn.00402b90
add esp, 0xc
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x4874]
xor ecx, esp
call fcn.00403830
mov esp, ebp
pop ebp
ret
push str.___Channel_opened_over_RDP_n
call fcn.00402b90
mov esi, dword [sym.imp.KERNEL32.dll_CreateMutexW]
add esp, 4
push 0
push 0
push 0
call esi
push 0
push 0
push 0
mov dword [0x408394], eax
call esi
push 0
push 0
push 0
xorps xmm0, xmm0
mov dword [0x4083ac], eax
push 0
movaps xmmword [esp + 0x60], xmm0
mov dword [esp + 0x70], 0
call dword [sym.imp.KERNEL32.dll_CreateEventW]
mov dword [esp + 0x40], 0
xorps xmm0, xmm0
mov dword [esp + 0x40], eax
lea eax, [esp + 0x80]
push eax
push 0x202
movaps xmmword [esp + 0x38], xmm0
call dword [sym.imp.WS2_32.dll_WSAStartup]
test eax, eax
je 0x4031c7
push eax
push str.____WSAStartup___failed_with_error:__ld_n
jmp 0x4037c7
push 1
push 0x402eb0
call dword [sym.imp.KERNEL32.dll_SetConsoleCtrlHandler]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [esp + 0x30]
push eax
lea eax, [esp + 0x7c]
push eax
push 0x648
lea eax, [esp + 0x23c]
push eax
push dword [0x40839c]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40323a
call esi
cmp eax, 0x3e5
jne 0x4037bf
push 0xffffffffffffffff
push dword [esp + 0x44]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push 0
lea eax, [esp + 0x7c]
push eax
lea eax, [esp + 0x38]
push eax
push dword [0x40839c]
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
je 0x4037bf
mov edi, dword [esp + 0x78]
lea esi, [esp + 0x238]
mov eax, dword [esp + 0x18]
add edi, 0xfffffff8
mov dword [esp + 0x28], edi
mov dword [esp + 0x14], esi
mov dword [esp + 0x74], 0
test eax, eax
je 0x4032c0
cmp dword [0x4083a0], 0
je 0x403282
lea esi, [edi + eax]
push esi
push edi
push eax
push str.___Overflow_was_present_from_previous_call._Stored_bytes:__ld._Received_bytes:__ld___ld__n
call fcn.004010b0
mov eax, dword [esp + 0x28]
add esp, 0x10
jmp 0x403285
lea esi, [eax + edi]
lea ecx, [esp + 0x238]
push edi
push ecx
lea ecx, [esp + 0x880]
add ecx, eax
call fcn.00402ae0
mov edi, esi
mov dword [esp + 0x7c], 1
add esp, 8
mov dword [esp + 0x28], edi
xor esi, esi
lea eax, [esp + 0x878]
mov dword [esp + 0x18], esi
mov esi, eax
mov dword [esp + 0x14], eax
test edi, edi
je 0x4031d4
nop dword [eax + eax]
cmp edi, 9
jb 0x403733
mov edi, dword [esi]
mov eax, dword [esi + 4]
mov esi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push 0xffffffffffffffff
push dword [0x4083ac]
mov dword [esp + 0x24], edi
mov dword [esp + 0x2c], eax
call esi
test eax, eax
je 0x403317
cmp eax, 0x80
jne 0x40337c
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str._08X:_LookupThreadRemote_lock_abandoned_n
call fcn.004010b0
add esp, 8
jmp 0x40337c
mov esi, dword [0x4083a8]
test esi, esi
jne 0x403340
push dword [0x4083ac]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test eax, eax
jne 0x403376
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____LookupThreadRemote_Release_Failed0:__08X
jmp 0x40336c
cmp dword [esi + 4], edi
je 0x4035a7
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x403340
push dword [0x4083ac]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test eax, eax
jne 0x403376
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____LookupThreadRemote_Release_Failed2:__08X
push 0
call fcn.00402c90
add esp, 0xc
mov esi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push edi
push str..mailslotRDPSocks__08X
xorps xmm0, xmm0
lea eax, [esp + 0x218]
push 0x20
push eax
movaps xmmword [esp + 0x220], xmm0
movaps xmmword [esp + 0x230], xmm0
call fcn.00402bd0
add esp, 0x10
lea eax, [esp + 0x210]
push 0
push 0xffffffffffffffff
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateMailslotA]
mov edi, eax
cmp edi, 0xffffffff
je 0x403607
push 0
push 0x80
push 3
push 0
push 1
push 0x40000000
lea eax, [esp + 0x228]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [esp + 0x20], eax
cmp eax, 0xffffffff
je 0x4035ec
push 0xffffffffffffffff
push dword [0x4083ac]
call esi
test eax, eax
je 0x403425
cmp eax, 0x80
je 0x40340f
xor esi, esi
jmp 0x4034a9
push 0
push str._08X:_AddThread_lock_abandoned_n
call fcn.004010b0
add esp, 8
xor esi, esi
jmp 0x4034a9
push 0x20
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov esi, eax
add esp, 4
mov eax, dword [esp + 0x1c]
mov dword [esi + 4], eax
mov eax, dword [esp + 0x20]
mov dword [esi + 0x14], eax
mov eax, dword [0x4083a8]
mov dword [esi], 0
mov dword [esi + 8], 0
mov dword [esi + 0xc], 1
mov dword [esi + 0x10], edi
mov dword [esi + 0x18], 0
mov dword [esi + 0x1c], 0
test eax, eax
jne 0x403476
mov dword [0x4083a8], esi
jmp 0x40348c
mov ecx, dword [eax + 0x1c]
test ecx, ecx
je 0x403489
nop dword [eax]
mov eax, ecx
mov ecx, dword [eax + 0x1c]
test ecx, ecx
jne 0x403480
mov dword [eax + 0x1c], esi
push dword [0x4083ac]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test eax, eax
jne 0x4034a9
push str.Release_failed_n
call fcn.004010b0
add esp, 4
lea eax, [esp + 0x7c]
push eax
push 0
push esi
push 0x402090
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
cmp dword [0x4083a0], 0
mov ecx, dword [esp + 0x7c]
mov edi, dword [esp + 0x1c]
mov dword [esi], ecx
mov dword [esi + 8], eax
je 0x4034e4
push edi
push str.____08X:_Thread_not_found__Mailslot_created_n
call fcn.004010b0
add esp, 8
mov ecx, dword [esp + 0x20]
mov esi, dword [esp + 0x28]
mov edx, dword [esp + 0x24]
lea eax, [esi - 9]
cmp edx, eax
ja 0x40364b
lea eax, [esp + 0x50]
push eax
lea eax, [esp + 0x30]
push eax
mov eax, dword [esp + 0x1c]
lea esi, [edx + 1]
push esi
add eax, 8
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x403559
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x403622
push 0xffffffffffffffff
push dword [esp + 0x64]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push 1
lea eax, [esp + 0x30]
push eax
lea eax, [esp + 0x58]
push eax
push dword [0x40839c]
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
je 0x403622
cmp dword [0x4083a0], 0
je 0x403579
push dword [esp + 0x28]
push esi
push dword [esp + 0x34]
push edi
push str.____08X:_no_error__written:__ld__should_have_written:__ld__cbFullSize:__ld_n
call fcn.004010b0
add esp, 0x14
mov esi, dword [esp + 0x14]
mov eax, 0xfffffff8
mov ecx, dword [esp + 0x2c]
sub eax, ecx
mov edi, dword [esp + 0x28]
add edi, eax
lea esi, [esi + 8]
mov dword [esp + 0x28], edi
lea esi, [esi + ecx]
mov dword [esp + 0x14], esi
jne 0x4032d0
jmp 0x4031d4
push dword [0x4083ac]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test eax, eax
jne 0x4035cd
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____LookupThreadRemote_Release_Failed1:__08X
push 0
call fcn.00402c90
add esp, 0xc
cmp dword [0x4083a0], 0
je 0x4035e4
push edi
push str.____08X:_Thread_found__Mailslot_found_n
call fcn.004010b0
add esp, 8
mov ecx, dword [esi + 0x14]
jmp 0x4034e8
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
push eax
push str.CreateMailslot_w_failed_with__d._n
call fcn.004010b0
add esp, 8
jmp 0x4031da
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
push eax
push str.CreateMailslot_r_failed_with__d_n
call fcn.004010b0
add esp, 8
jmp 0x4031da
cmp dword [0x4083a0], 0
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
je 0x4031da
call esi
push eax
push edi
push str._____08X:_WriteChannel_error:__ld_n
call fcn.004010b0
add esp, 0xc
jmp 0x4031da
cmp dword [0x4083a0], 0
je 0x403663
push esi
push edx
push str._______OVERFLOW_HAPPENED__ld____ld__9_n
call fcn.004010b0
add esp, 0xc
cmp dword [esp + 0x74], 0
je 0x4036c3
cmp dword [0x4083a0], 0
je 0x403681
push esi
push str.___Data_left_in_buffer__ofused:__ld_n
call fcn.004010b0
add esp, 8
cmp esi, 0x4000
jbe 0x4036a4
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 0x22
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo]
mov dword [esp + 0x18], esi
jmp 0x4031d4
mov eax, dword [esp + 0x14]
push esi
push eax
lea eax, [esp + 0x880]
push eax
call sub.VCRUNTIME140.dll_memmove
add esp, 0xc
mov dword [esp + 0x18], esi
jmp 0x4031d4
cmp dword [0x4083a0], 0
je 0x4036da
push esi
push str.___Data_left_in_buffer__not_ofused:__ld_n
call fcn.004010b0
add esp, 8
cmp esi, 0x4000
ja 0x403701
mov eax, dword [esp + 0x14]
push esi
push eax
lea eax, [esp + 0x880]
push eax
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
mov dword [esp + 0x18], esi
jmp 0x4031d4
push 0x4000
lea eax, [esp + 0x87c]
push 0
push eax
call sub.VCRUNTIME140.dll_memset
add esp, 0xc
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 0x22
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo]
mov dword [esp + 0x18], esi
jmp 0x4031d4
cmp dword [esp + 0x74], 0
je 0x40375a
cmp dword [0x4083a0], 0
je 0x4037b6
push edi
push str.___Not_enough_data__ofused:__ld_n
call fcn.004010b0
add esp, 8
mov dword [esp + 0x18], edi
jmp 0x4031d4
cmp dword [0x4083a0], 0
je 0x403771
push edi
push str.___Not_enough_data__no_ofused:__ld_n
call fcn.004010b0
add esp, 8
test edi, edi
je 0x4037b6
lea eax, [esp + 0x878]
test esi, esi
je 0x403794
push edi
push esi
push eax
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
mov dword [esp + 0x18], edi
jmp 0x4031d4
push 0x4000
push 0
push eax
call sub.VCRUNTIME140.dll_memset
add esp, 0xc
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 0x16
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo]
mov dword [esp + 0x18], edi
jmp 0x4031d4
call esi
push eax
push str.____ReadFile___WaitForSingleObject___error:__ld_n
call fcn.00402b90
mov ecx, dword [esp + 0x4884]
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
xor ecx, esp
call fcn.00403830
mov esp, ebp
pop ebp
ret