Пример #1
0
        internal static int EnumeratePackages(SecurDll Dll, out int pkgnum, out SafeFreeContextBuffer pkgArray)
        {
            int num = -1;

            switch (Dll)
            {
            case SecurDll.SECURITY:
            {
                SafeFreeContextBuffer_SECURITY handle = null;
                num      = UnsafeNclNativeMethods.SafeNetHandles_SECURITY.EnumerateSecurityPackagesW(out pkgnum, out handle);
                pkgArray = handle;
                break;
            }

            case SecurDll.SECUR32:
            {
                SafeFreeContextBuffer_SECUR32 r_secur = null;
                num      = UnsafeNclNativeMethods.SafeNetHandles_SECUR32.EnumerateSecurityPackagesA(out pkgnum, out r_secur);
                pkgArray = r_secur;
                break;
            }

            case SecurDll.SCHANNEL:
            {
                SafeFreeContextBuffer_SCHANNEL r_schannel = null;
                num      = UnsafeNclNativeMethods.SafeNetHandles_SCHANNEL.EnumerateSecurityPackagesA(out pkgnum, out r_schannel);
                pkgArray = r_schannel;
                break;
            }

            default:
                throw new ArgumentException(SR.GetString("net_invalid_enum", new object[] { "SecurDll" }), "Dll");
            }
            if ((num != 0) && (pkgArray != null))
            {
                pkgArray.SetHandleAsInvalid();
            }
            return(num);
        }
 internal static extern int EnumerateSecurityPackagesA(out int pkgnum, out SafeFreeContextBuffer_SCHANNEL handle);