System.Data.SqlClient.SNINativeMethodWrapper.SNIQueryInfo C# (CSharp) Méthode

SNIQueryInfo() private méthode

private SNIQueryInfo ( QTypes QType, IntPtr &pbQInfo ) : uint
QType QTypes
pbQInfo IntPtr
Résultat uint
        internal static extern uint SNIQueryInfo(QTypes QType, ref IntPtr pbQInfo);

Same methods

SNINativeMethodWrapper::SNIQueryInfo ( QTypes QType, uint &pbQInfo ) : uint

Usage Example

        private SNILoadHandle() : base(IntPtr.Zero, true)
        {
            // SQL BU DT 346588 - from security review - SafeHandle guarantees this is only called once.
            // The reason for the safehandle is guaranteed initialization and termination of SNI to
            // ensure SNI terminates and cleans up properly.
            RuntimeHelpers.PrepareConstrainedRegions();
            try {} finally {
                _sniStatus = SNINativeMethodWrapper.SNIInitialize();

                UInt32 value = 0;

                // VSDevDiv 479597: If initialize fails, don't call QueryInfo.
                if (TdsEnums.SNI_SUCCESS == _sniStatus)
                {
                    // Query OS to find out whether encryption is supported.
                    SNINativeMethodWrapper.SNIQueryInfo(SNINativeMethodWrapper.QTypes.SNI_QUERY_CLIENT_ENCRYPT_POSSIBLE, ref value);
                }

                _encryptionOption = (value == 0) ? EncryptionOptions.NOT_SUP : EncryptionOptions.OFF;

                base.handle = (IntPtr)1;  // Initialize to non-zero dummy variable.
            }
        }