Function at 0x140040970
Capabilities:
Read file on windows
Read pipe
Write file on windows

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r12
push r15
lea rbp, [rsp - 0xff58]
mov eax, 0x10058
call fcn.140117f90
sub rsp, rax
mov eax, dword [rcx + 8]
mov r15, rdx
dec eax
mov rdi, rcx
test eax, 0xfffffffd
jne 0x140040fcb
xor r12d, r12d
nop word [rax + rax]
mov rbx, qword [rdi]
test rbx, rbx
je 0x140040f2e
mov rcx, qword [rbx + 8]
cmp rcx, 0xffffffffffffffff
je 0x140040f48
lea rax, [rbp + 0xff90]
mov qword [rsp + 0x28], r12
xor r9d, r9d
mov qword [rsp + 0x20], rax
xor r8d, r8d
mov dword [rbp + 0xff90], r12d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x140040f17
cmp dword [rbp + 0xff90], 8
jb 0x140040f48
mov rcx, qword [rbx + 8]
lea r9, [rbp + 0xffa0]
mov r8d, 8
mov dword [rbp + 0xffa0], r12d
lea rdx, [rsp + 0x50]
mov qword [rsp + 0x20], r12
call qword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x140040f17
cmp dword [rbp + 0xffa0], 8
je 0x140040a57
lea r8d, [rax + 0x73]
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_srcconnection_win.cpp
lea rcx, str.bytesToRead__bytesRead
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov ecx, dword [rsp + 0x54]
test ecx, ecx
je 0x140040b17
mov rbx, qword [rdi]
mov esi, ecx
test rbx, rbx
je 0x140040c43
mov rcx, qword [rbx + 8]
cmp rcx, 0xffffffffffffffff
je 0x140040c5d
lea rax, [rbp + 0xffa8]
mov qword [rsp + 0x28], r12
xor r9d, r9d
mov qword [rsp + 0x20], rax
xor r8d, r8d
mov dword [rbp + 0xffa8], r12d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x140040c2c
mov eax, dword [rbp + 0xffa8]
cmp rax, rsi
jb 0x140040c5d
mov rcx, qword [rbx + 8]
lea r9, [rbp + 0xffa0]
mov r8d, esi
mov dword [rbp + 0xffa0], r12d
lea rdx, [rsp + 0x58]
mov qword [rsp + 0x20], r12
call qword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x140040c2c
cmp esi, dword [rbp + 0xffa0]
je 0x140040b0a
lea r8d, [rax + 0x73]
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_srcconnection_win.cpp
lea rcx, str.bytesToRead__bytesRead
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov eax, dword [rsp + 0x54]
mov byte [rsp + rax + 0x58], r12b
mov ecx, dword [rsp + 0x54]
mov eax, dword [rsp + 0x50]
test eax, eax
je 0x140040b3f
sub eax, 1
je 0x140040edf
sub eax, 1
je 0x140040cc3
sub eax, 1
je 0x140040b86
cmp eax, 1
je 0x1400409b0
lea rdx, str.Bad_ipc_frame
mov dword [rdi + 0x60], 2
mov ecx, 1
lea r8, [rdi + 0x64]
sub rcx, rdx
nop dword [rax]
lea rax, [rcx + rdx]
cmp rax, 0x100
jae 0x140040f8d
movzx eax, byte [rdx]
inc rdx
mov byte [r8], al
inc r8
cmp byte [rdx], r12b
jne 0x140040b60
jmp 0x140040f8d
mov rax, qword [rdi]
mov ebx, ecx
add rbx, 8
mov dword [rsp + 0x50], 4
test rax, rax
jne 0x140040bb6
lea r8d, [rax + 0x4f]
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_srcconnection_win.cpp
lea rcx, str.self
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
jmp 0x140040bec
mov rcx, qword [rax + 8]
cmp rcx, 0xffffffffffffffff
je 0x140040bec
lea r9, [rsp + 0x30]
mov dword [rsp + 0x30], r12d
mov r8d, ebx
mov qword [rsp + 0x20], r12
lea rdx, [rsp + 0x50]
call qword [sym.imp.KERNEL32.dll_WriteFile]
cmp eax, 1
jne 0x140040bec
cmp dword [rsp + 0x30], ebx
je 0x1400409b0
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140040c0b
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140040c0b
mov ecx, dword [rdi + 0x60]
lea rdx, [rdi + 0x64]
call r8
mov rbx, qword [rdi]
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r12b
mov dword [rdi + 8], r12d
jmp 0x1400409b0
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r12b
jmp 0x140040c5d
mov r8d, 0x67
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_srcconnection_win.cpp
lea rcx, str.self
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
lea r8, str.Partial_data_in_frame
mov dword [rdi + 0x60], 2
lea rdx, [rdi + 0x64]
mov ecx, 1
mov r9, rdx
sub rcx, r8
nop word [rax + rax]
lea rax, [rcx + r8]
cmp rax, 0x100
jae 0x140040c9e
movzx eax, byte [r8]
inc r8
mov byte [r9], al
inc r9
cmp byte [r8], r12b
jne 0x140040c80
mov byte [r9], r12b
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140040faf
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140040faf
jmp 0x140040fa9
lea rax, [rsp + 0x58]
mov qword [rsp + 0x10098], r13
mov qword [rsp + 0x38], rax
lea rdx, [rsp + 0x38]
lea rax, [rsp + 0x58]
mov qword [rsp + 0x10050], r14
mov rcx, r15
mov qword [rsp + 0x48], rax
mov qword [rsp + 0x40], r12
call fcn.140040fe0
movabs r13, 0xffffffffffff
test r15, r15
je 0x140040d9c
lea r8, str.code
mov rcx, r15
lea rdx, [rbp + 0xff90]
call fcn.14003fdc0
cmp word [r15 + 0xe], 3
lea rsi, [r15 + 0xe]
je 0x140040d48
mov r8d, 0x4b0
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_src_rapidjsondocument.h
lea rcx, str.IsObject__
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov rcx, qword [r15 + 8]
lea r14, [r15 + 8]
mov eax, dword [r15]
and rcx, r13
mov rbx, qword [rbp + 0xff90]
shl rax, 5
add rax, rcx
cmp rbx, rax
je 0x140040d9c
movzx eax, byte [rbx + 0x1e]
shr al, 5
test al, 1
je 0x140040d9c
test byte [rbx + 0x1e], 0x20
jne 0x140040d94
mov r8d, 0x6e7
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_src_rapidjsondocument.h
lea rcx, str.data_.f.flags__kIntFlag
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov eax, dword [rbx + 0x10]
mov dword [rdi + 0x60], eax
jmp 0x140040db1
mov dword [rdi + 0x60], r12d
lea rsi, [r15 + 0xe]
lea r14, [r15 + 8]
test r15, r15
je 0x140040e59
lea r8, str.message
mov rcx, r15
lea rdx, [rbp + 0xff90]
call fcn.14003fdc0
cmp word [rsi], 3
je 0x140040de7
mov r8d, 0x4b0
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_src_rapidjsondocument.h
lea rcx, str.IsObject__
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov eax, dword [r15]
mov rcx, qword [r14]
and rcx, r13
shl rax, 5
add rax, rcx
mov rcx, qword [rbp + 0xff90]
cmp rcx, rax
je 0x140040e59
movzx eax, word [rcx + 0x1e]
shr ax, 0xa
test al, 1
je 0x140040e59
movzx eax, word [rcx + 0x1e]
lea rbx, [rcx + 0x10]
shr ax, 0xa
test al, 1
jne 0x140040e39
mov r8d, 0x70b
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_src_rapidjsondocument.h
lea rcx, str.IsString__
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov eax, 0x1000
test word [rbx + 0xe], ax
jne 0x140040e4b
mov rbx, qword [rbx + 8]
and rbx, r13
mov rax, rbx
test rbx, rbx
jne 0x140040e63
lea r8, [rdi + 0x64]
jmp 0x140040e9f
lea rax, [0x1401468fa]
mov rbx, rax
lea r8, [rdi + 0x64]
mov rdx, r8
cmp byte [rax], r12b
je 0x140040e9c
mov ecx, 1
sub rcx, rax
nop word [rax + rax]
lea rax, [rcx + rbx]
cmp rax, 0x100
jae 0x140040e9c
movzx eax, byte [rbx]
inc rbx
mov byte [rdx], al
inc rdx
cmp byte [rbx], r12b
jne 0x140040e80
mov byte [rdx], r12b
mov r9, qword [rdi + 0x18]
mov r14, qword [rsp + 0x10050]
mov r13, qword [rsp + 0x10098]
test r9, r9
je 0x140040faf
mov eax, dword [rdi + 8]
cmp eax, 3
je 0x140040ed1
cmp eax, 1
jne 0x140040faf
lea r8, [rdi + 0x64]
mov ecx, dword [rdi + 0x60]
mov rdx, r8
call r9
jmp 0x140040faf
lea rax, [rsp + 0x58]
mov qword [rsp + 0x40], r12
mov qword [rsp + 0x38], rax
lea rdx, [rsp + 0x38]
lea rax, [rsp + 0x58]
mov rcx, r15
mov qword [rsp + 0x48], rax
call fcn.140040fe0
mov al, 1
add rsp, 0x10058
pop r15
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r12b
jmp 0x140040f48
mov r8d, 0x67
lea rdx, str.D:FUCKXSDBypassDh___Copyexamplesexample_win32_directx11DiscordSDK_srcconnection_win.cpp
lea rcx, str.self
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov rax, qword [rdi]
cmp byte [rax], r12b
jne 0x140040fcb
mov ecx, 1
lea rdx, str.Pipe_closed
mov dword [rdi + 0x60], ecx
lea r8, [rdi + 0x64]
sub rcx, rdx
nop word [rax + rax]
lea rax, [rcx + rdx]
cmp rax, 0x100
jae 0x140040f8d
movzx eax, byte [rdx]
inc rdx
mov byte [r8], al
inc r8
cmp byte [rdx], r12b
jne 0x140040f70
mov byte [r8], r12b
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140040faf
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140040faf
lea rdx, [rdi + 0x64]
mov ecx, dword [rdi + 0x60]
call r8
mov rbx, qword [rdi]
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r12b
mov dword [rdi + 8], r12d
xor al, al
add rsp, 0x10058
pop r15
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret