System.Net.Security.SafeSspiAuthDataHandle.SafeFreeContextBuffer.SafeFreeCertContext.SafeFreeCredentials.SafeCredentialReference.SafeDeleteContext.SafeFreeContextBufferChannelBinding.QueryContextChannelBinding_SECURITY C# (CSharp) Method

QueryContextChannelBinding_SECURITY() private static method

private static QueryContextChannelBinding_SECURITY ( System.Net.Security.SafeDeleteContext phContext, Interop contextAttribute, SecPkgContext_Bindings buffer, System.Net.Security.SafeFreeContextBufferChannelBinding refHandle ) : int
phContext System.Net.Security.SafeDeleteContext
contextAttribute Interop
buffer SecPkgContext_Bindings
refHandle System.Net.Security.SafeFreeContextBufferChannelBinding
return int
        private unsafe static int QueryContextChannelBinding_SECURITY(SafeDeleteContext phContext, Interop.SspiCli.ContextAttribute contextAttribute, SecPkgContext_Bindings* buffer, SafeFreeContextBufferChannelBinding refHandle)
        {
            int status = (int)Interop.SECURITY_STATUS.InvalidHandle;

            // SCHANNEL only supports SECPKG_ATTR_ENDPOINT_BINDINGS and SECPKG_ATTR_UNIQUE_BINDINGS which
            // map to our enum ChannelBindingKind.Endpoint and ChannelBindingKind.Unique.
            if (contextAttribute != Interop.SspiCli.ContextAttribute.SECPKG_ATTR_ENDPOINT_BINDINGS &&
                contextAttribute != Interop.SspiCli.ContextAttribute.SECPKG_ATTR_UNIQUE_BINDINGS)
            {
                return status;
            }

            try
            {
                bool ignore = false;
                phContext.DangerousAddRef(ref ignore);
                status = Interop.SspiCli.QueryContextAttributesW(ref phContext._handle, contextAttribute, buffer);
            }
            finally
            {
                phContext.DangerousRelease();
            }

            if (status == 0 && refHandle != null)
            {
                refHandle.Set((*buffer).Bindings);
                refHandle._size = (*buffer).BindingsLength;
            }

            if (status != 0 && refHandle != null)
            {
                refHandle.SetHandleAsInvalid();
            }

            return status;
        }
    }
SafeSspiAuthDataHandle.SafeFreeContextBuffer.SafeFreeCertContext.SafeFreeCredentials.SafeCredentialReference.SafeDeleteContext.SafeFreeContextBufferChannelBinding