Esempio n. 1
0
        public static int AcquireCredentialsHandle(SecurDll dll, string package, CredentialUse intent, ref AuthIdentity authdata, out SafeFreeCredentials outCredential)
        {
            long num2;
            int  num = -1;

            switch (dll)
            {
            case SecurDll.SECURITY:
                outCredential = new SafeFreeCredential_SECURITY();
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    goto Label_008D;
                }
                finally
                {
                    num = UnsafeNclNativeMethods.SafeNetHandles_SECURITY.AcquireCredentialsHandleW(null, package, (int)intent, null, ref authdata, null, null, ref outCredential._handle, out num2);
                }
                break;

            case SecurDll.SECUR32:
                break;

            default:
                goto Label_0068;
            }
            outCredential = new SafeFreeCredential_SECUR32();
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                goto Label_008D;
            }
            finally
            {
                num = UnsafeNclNativeMethods.SafeNetHandles_SECUR32.AcquireCredentialsHandleA(null, package, (int)intent, null, ref authdata, null, null, ref outCredential._handle, out num2);
            }
            Label_0068 :;
            throw new ArgumentException(SR.GetString("net_invalid_enum", new object[] { "SecurDll" }), "Dll");
Label_008D:
            if (num != 0)
            {
                outCredential.SetHandleAsInvalid();
            }
            return(num);
        }
        public static int AcquireCredentialsHandle(SecurDll dll, string package, CredentialUse intent, ref AuthIdentity authdata, out SafeFreeCredentials outCredential)
        {
            long num2;
            int num = -1;
            switch (dll)
            {
                case SecurDll.SECURITY:
                    outCredential = new SafeFreeCredential_SECURITY();
                    RuntimeHelpers.PrepareConstrainedRegions();
                    try
                    {
                        goto Label_008D;
                    }
                    finally
                    {
                        num = UnsafeNclNativeMethods.SafeNetHandles_SECURITY.AcquireCredentialsHandleW(null, package, (int) intent, null, ref authdata, null, null, ref outCredential._handle, out num2);
                    }
                    break;

                case SecurDll.SECUR32:
                    break;

                default:
                    goto Label_0068;
            }
            outCredential = new SafeFreeCredential_SECUR32();
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                goto Label_008D;
            }
            finally
            {
                num = UnsafeNclNativeMethods.SafeNetHandles_SECUR32.AcquireCredentialsHandleA(null, package, (int) intent, null, ref authdata, null, null, ref outCredential._handle, out num2);
            }
        Label_0068:;
            throw new ArgumentException(SR.GetString("net_invalid_enum", new object[] { "SecurDll" }), "Dll");
        Label_008D:
            if (num != 0)
            {
                outCredential.SetHandleAsInvalid();
            }
            return num;
        }