Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeFreeContextBufferChannelBinding.cs
Go to the documentation of this file.
3
4namespace System.Net.Security;
5
7{
8 private int _size;
9
10 public override int Size => _size;
11
12 public override bool IsInvalid
13 {
14 get
15 {
16 if (!(handle == new IntPtr(0)))
17 {
18 return handle == new IntPtr(-1);
19 }
20 return true;
21 }
22 }
23
24 internal void Set(IntPtr value)
25 {
26 handle = value;
27 }
28
33
34 public unsafe static int QueryContextChannelBinding(SafeDeleteContext phContext, global::Interop.SspiCli.ContextAttribute contextAttribute, SecPkgContext_Bindings* buffer, SafeFreeContextBufferChannelBinding refHandle)
35 {
36 int num = -2146893055;
37 if (contextAttribute != global::Interop.SspiCli.ContextAttribute.SECPKG_ATTR_ENDPOINT_BINDINGS && contextAttribute != global::Interop.SspiCli.ContextAttribute.SECPKG_ATTR_UNIQUE_BINDINGS)
38 {
39 return num;
40 }
41 try
42 {
43 bool success = false;
44 phContext.DangerousAddRef(ref success);
45 num = global::Interop.SspiCli.QueryContextAttributesW(ref phContext._handle, contextAttribute, buffer);
46 }
47 finally
48 {
49 phContext.DangerousRelease();
50 }
51 if (num == 0 && refHandle != null)
52 {
53 refHandle.Set(buffer->Bindings);
54 refHandle._size = buffer->BindingsLength;
55 }
56 if (num != 0)
57 {
58 refHandle?.SetHandleAsInvalid();
59 }
60 return num;
61 }
62
63 public override string ToString()
64 {
65 if (IsInvalid)
66 {
67 return null;
68 }
69 byte[] array = new byte[_size];
70 Marshal.Copy(handle, array, 0, array.Length);
71 return BitConverter.ToString(array).Replace('-', ' ');
72 }
73}
static string ToString(byte[] value, int startIndex, int length)
global::Interop.SspiCli.CredHandle _handle
static unsafe int QueryContextChannelBinding(SafeDeleteContext phContext, global::Interop.SspiCli.ContextAttribute contextAttribute, SecPkgContext_Bindings *buffer, SafeFreeContextBufferChannelBinding refHandle)
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
Definition Marshal.cs:800
void DangerousAddRef(ref bool success)
Definition SafeHandle.cs:76