public unsafe string QueryContextAttributeAsString(SecurityContextAttribute attr) { SecPkgContext_SecString pBuffer = default; SecStatus status; string strValue = null; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { status = QueryContextAttributesString(ref this.securityContext, attr, ref pBuffer); if (status == SecStatus.SEC_E_OK) { try { strValue = Marshal.PtrToStringUni((IntPtr)pBuffer.sValue); } finally { ThrowIfError(FreeContextBuffer(pBuffer.sValue)); } } } if (status != SecStatus.SEC_E_UNSUPPORTED_FUNCTION && status > SecStatus.SEC_E_ERROR) { throw new Win32Exception((int)status); } return(strValue); }
internal static extern SecStatus QueryContextAttributesString( ref SECURITY_HANDLE phContext, SecurityContextAttribute ulAttribute, ref SecPkgContext_SecString pBuffer );