Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ MustRunInitializeSecurityContext() [1/4]

static unsafe int System.Net.Security.SafeDeleteContext.MustRunInitializeSecurityContext ( ref SafeFreeCredentials inCredentials,
bool isContextAbsent,
byte * targetName,
global::Interop::SspiCli::ContextFlags inFlags,
global::Interop::SspiCli::Endianness endianness,
global::Interop::SspiCli::SecBufferDesc * inputBuffer,
SafeDeleteContext outContext,
ref global::Interop::SspiCli::SecBufferDesc outputBuffer,
ref global::Interop::SspiCli::ContextFlags attributes,
SafeFreeContextBuffer handleTemplate )
inlinestaticprivateinherited

Definition at line 198 of file SafeDeleteContext.cs.

199 {
200 int num = -2146893055;
201 try
202 {
203 bool success = false;
204 inCredentials.DangerousAddRef(ref success);
205 outContext.DangerousAddRef(ref success);
206 global::Interop.SspiCli.CredHandle credentialHandle = inCredentials._handle;
207 global::Interop.SspiCli.CredHandle credHandle = outContext._handle;
208 void* ptr = (credHandle.IsZero ? null : (&credHandle));
209 isContextAbsent = ptr == null;
210 num = global::Interop.SspiCli.InitializeSecurityContextW(ref credentialHandle, ptr, targetName, inFlags, 0, endianness, inputBuffer, 0, ref outContext._handle, ref outputBuffer, ref attributes, out var _);
211 }
212 finally
213 {
214 if (outContext._EffectiveCredential != inCredentials && (num & 0x80000000u) == 0L)
215 {
216 outContext._EffectiveCredential?.DangerousRelease();
217 outContext._EffectiveCredential = inCredentials;
218 }
219 else
220 {
221 inCredentials.DangerousRelease();
222 }
223 outContext.DangerousRelease();
224 }
225 if (handleTemplate != null)
226 {
227 handleTemplate.Set(((global::Interop.SspiCli.SecBuffer*)outputBuffer.pBuffers)->pvBuffer);
228 if (handleTemplate.IsInvalid)
229 {
230 handleTemplate.SetHandleAsInvalid();
231 }
232 }
233 if (isContextAbsent && (num & 0x80000000u) != 0L)
234 {
235 outContext._handle.SetToInvalid();
236 }
237 return num;
238 }

References Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.IsInvalid, System.L, System.Net.Security.SafeFreeContextBuffer.Set(), and System.Runtime.InteropServices.SafeHandle.SetHandleAsInvalid().