コード例 #1
0
        /// <summary>
        /// Queries for context properties
        /// </summary>
        private SSPINative.SecPkgContext_Sizes GetContextSizes()
        {
            // check object state
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            // query context properties
            SSPINative.SecPkgContext_Sizes contextSizes = new SSPINative.SecPkgContext_Sizes();
            GCHandle gcSizes = GCHandle.Alloc(contextSizes, GCHandleType.Pinned);

            int error = SSPINative.QueryContextAttributes(
                ref _contextHandle,
                SSPINative.SECPKG_ATTR_SIZES,
                gcSizes.AddrOfPinnedObject());

            gcSizes.Free();

            if (error < 0)
            {
                throw new SSPIException(error, "Could not query security context information");
            }

            return(contextSizes);
        }
コード例 #2
0
		/// <summary>
		/// Queries for context properties
		/// </summary>
		private SSPINative.SecPkgContext_Sizes GetContextSizes()
		{
			// check object state
			if (_disposed)
				throw new ObjectDisposedException(GetType().FullName);

			// query context properties
			SSPINative.SecPkgContext_Sizes contextSizes = new SSPINative.SecPkgContext_Sizes();
			GCHandle gcSizes = GCHandle.Alloc(contextSizes, GCHandleType.Pinned);

			int error = SSPINative.QueryContextAttributes(
				ref _contextHandle,
				SSPINative.SECPKG_ATTR_SIZES,
				gcSizes.AddrOfPinnedObject());
			gcSizes.Free();

			if (error < 0)
				throw new SSPIException(error, "Could not query security context information");

			return contextSizes;
		}