Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeFreeContextBuffer.cs
Go to the documentation of this file.
3
4namespace System.Net.Security;
5
6internal abstract class SafeFreeContextBuffer : SafeHandleZeroOrMinusOneIsInvalid
7{
9 : base(ownsHandle: true)
10 {
11 }
12
13 internal void Set(IntPtr value)
14 {
15 handle = value;
16 }
17
18 internal static int EnumeratePackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
19 {
20 int num = -1;
21 SafeFreeContextBuffer_SECURITY safeFreeContextBuffer_SECURITY = null;
22 num = global::Interop.SspiCli.EnumerateSecurityPackagesW(out pkgnum, out safeFreeContextBuffer_SECURITY);
23 pkgArray = safeFreeContextBuffer_SECURITY;
24 if (num != 0)
25 {
26 pkgArray?.SetHandleAsInvalid();
27 }
28 return num;
29 }
30
32 {
34 }
35
36 public unsafe static int QueryContextAttributes(SafeDeleteContext phContext, global::Interop.SspiCli.ContextAttribute contextAttribute, byte* buffer, SafeHandle refHandle)
37 {
38 int num = -2146893055;
39 try
40 {
41 bool success = false;
42 phContext.DangerousAddRef(ref success);
43 num = global::Interop.SspiCli.QueryContextAttributesW(ref phContext._handle, contextAttribute, buffer);
44 }
45 finally
46 {
47 phContext.DangerousRelease();
48 }
49 if (num == 0 && refHandle != null)
50 {
51 if (refHandle is SafeFreeContextBuffer)
52 {
53 ((SafeFreeContextBuffer)refHandle).Set(*(IntPtr*)buffer);
54 }
55 else
56 {
57 ((SafeFreeCertContext)refHandle).Set(*(IntPtr*)buffer);
58 }
59 }
60 if (num != 0)
61 {
62 refHandle?.SetHandleAsInvalid();
63 }
64 return num;
65 }
66}
global::Interop.SspiCli.CredHandle _handle
static SafeFreeContextBuffer CreateEmptyHandle()
static unsafe int QueryContextAttributes(SafeDeleteContext phContext, global::Interop.SspiCli.ContextAttribute contextAttribute, byte *buffer, SafeHandle refHandle)
static int EnumeratePackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
void DangerousAddRef(ref bool success)
Definition SafeHandle.cs:76