Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Create() [2/2]

void System.IO.Pipes.AnonymousPipeServerStream.Create ( PipeDirection direction,
HandleInheritability inheritability,
int bufferSize,
PipeSecurity pipeSecurity )
inlineprivate

Definition at line 154 of file AnonymousPipeServerStream.cs.

155 {
156 GCHandle pinningHandle = default(GCHandle);
157 bool flag;
158 SafePipeHandle hWritePipe;
159 try
160 {
161 global::Interop.Kernel32.SECURITY_ATTRIBUTES lpPipeAttributes = PipeStream.GetSecAttrs(inheritability, pipeSecurity, ref pinningHandle);
162 flag = ((direction != PipeDirection.In) ? global::Interop.Kernel32.CreatePipe(out _clientHandle, out hWritePipe, ref lpPipeAttributes, bufferSize) : global::Interop.Kernel32.CreatePipe(out hWritePipe, out _clientHandle, ref lpPipeAttributes, bufferSize));
163 }
164 finally
165 {
166 if (pinningHandle.IsAllocated)
167 {
168 pinningHandle.Free();
169 }
170 }
171 if (!flag)
172 {
174 }
175 if (!global::Interop.Kernel32.DuplicateHandle(global::Interop.Kernel32.GetCurrentProcess(), hWritePipe, global::Interop.Kernel32.GetCurrentProcess(), out var lpTargetHandle, 0u, bInheritHandle: false, 2u))
176 {
178 }
179 hWritePipe.Dispose();
180 InitializeHandle(lpTargetHandle, isExposed: false, isAsync: false);
181 base.State = PipeState.Connected;
182 }
PipeStream(PipeDirection direction, int bufferSize)
void InitializeHandle(SafePipeHandle? handle, bool isExposed, bool isAsync)
static Exception GetExceptionForLastWin32Error(string path="")

References System.IO.Pipes.AnonymousPipeServerStream._clientHandle, System.Runtime.InteropServices.SafeHandle.Dispose(), System.Runtime.InteropServices.GCHandle.Free(), System.IO.Win32Marshal.GetExceptionForLastWin32Error(), System.IO.Pipes.PipeStream.GetSecAttrs(), System.IO.Pipes.PipeStream.InitializeHandle(), and System.Runtime.InteropServices.GCHandle.IsAllocated.