diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
index c42fc5b18e..ef8113aa21 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -745,13 +745,11 @@
-
-
@@ -792,8 +790,6 @@
-
-
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/AdapterSwitches.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/AdapterSwitches.cs
deleted file mode 100644
index fdbdf4f270..0000000000
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/AdapterSwitches.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if DEBUG
-
-using System.Diagnostics;
-
-namespace System.Data.Common {
-
- internal static class AdapterSwitches {
-
- static private TraceSwitch _dataSchema;
-
- static internal TraceSwitch DataSchema {
- get {
- TraceSwitch dataSchema = _dataSchema;
- if (dataSchema == null) {
- _dataSchema = dataSchema = new TraceSwitch("Data.Schema", "Enable tracing for schema actions.");
- }
- return dataSchema;
- }
- }
- }
-}
-#endif
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/NativeMethods.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/NativeMethods.cs
index 965b947879..66bfede48e 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/NativeMethods.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/NativeMethods.cs
@@ -8,44 +8,16 @@
namespace Microsoft.Data.Common
{
-
internal static class NativeMethods
{
-
- //[Guid("0c733a1e-2a1c-11ce-ade5-00aa0044773d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport]
- //internal interface ISourcesRowset {
-
- // [PreserveSig] System.Data.OleDb.OleDbHResult GetSourcesRowset(
- // [In] IntPtr pUnkOuter,
- // [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
- // [In] int cPropertySets,
- // [In] IntPtr rgProperties,
- // [Out, MarshalAs(UnmanagedType.Interface)] out object ppRowset);
- //}
-
- [Guid("0C733A5E-2A1C-11CE-ADE5-00AA0044773D"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), ComImport]
- internal interface ITransactionJoin
- {
- [Obsolete("not used", true)]
- [PreserveSig]
- int GetOptionsObject(
- /*deleted parameter signature*/);
-
- void JoinTransaction(
- [In, MarshalAs(UnmanagedType.Interface)] object punkTransactionCoord,
- [In] Int32 isoLevel,
- [In] Int32 isoFlags,
- [In] IntPtr pOtherOptions);
- }
-
- [DllImport(ExternDll.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[ResourceExposure(ResourceScope.Machine)]
static internal extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, IntPtr dwNumberOfBytesToMap);
// OpenFileMappingA contains a security venerability, in the unicode->ansi conversion
// Its possible to spoof the directory and construct ../ sequences, See FxCop Warning
// Specify marshaling for pinvoke string arguments
- [DllImport(ExternDll.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
// [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
[ResourceExposure(ResourceScope.Machine)]
static internal extern IntPtr OpenFileMappingA(int dwDesiredAccess, bool bInheritHandle, [MarshalAs(UnmanagedType.LPStr)] string lpName);
@@ -53,20 +25,20 @@ void JoinTransaction(
// CreateFileMappingA contains a security venerability, in the unicode->ansi conversion
// Its possible to spoof the directory and construct ../ sequences, See FxCop Warning
// Specify marshaling for pinvoke string arguments
- [DllImport(ExternDll.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
// [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
[ResourceExposure(ResourceScope.Machine)]
static internal extern IntPtr CreateFileMappingA(IntPtr hFile, IntPtr pAttr, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, [MarshalAs(UnmanagedType.LPStr)] string lpName);
- [DllImport(ExternDll.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[ResourceExposure(ResourceScope.Machine)]
static internal extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
- [DllImport(ExternDll.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.Machine)]
static internal extern bool CloseHandle(IntPtr handle);
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool AllocateAndInitializeSid(
IntPtr pIdentifierAuthority, // authority
@@ -82,19 +54,19 @@ static internal extern bool AllocateAndInitializeSid(
ref IntPtr pSid); // SID
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern int GetLengthSid(
IntPtr pSid); // SID to query
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool InitializeAcl(
IntPtr pAcl, // ACL
int nAclLength, // size of ACL
int dwAclRevision); // revision level of ACL
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool AddAccessDeniedAce(
IntPtr pAcl, // access control list
@@ -102,7 +74,7 @@ static internal extern bool AddAccessDeniedAce(
int AccessMask, // access mask
IntPtr pSid); // security identifier
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool AddAccessAllowedAce(
IntPtr pAcl, // access control list
@@ -110,12 +82,12 @@ static internal extern bool AddAccessAllowedAce(
uint AccessMask, // access mask
IntPtr pSid); // security identifier
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool InitializeSecurityDescriptor(
IntPtr pSecurityDescriptor, // SD
int dwRevision); // revision level
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern bool SetSecurityDescriptorDacl(
IntPtr pSecurityDescriptor, // SD
@@ -123,7 +95,7 @@ static internal extern bool SetSecurityDescriptorDacl(
IntPtr pDacl, // DACL
bool bDaclDefaulted); // default DACL
- [DllImport(ExternDll.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
+ [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern IntPtr FreeSid(
IntPtr pSid); // SID to free
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/SafeNativeMethods.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/SafeNativeMethods.cs
index bfcb461602..bab34c2ec5 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/SafeNativeMethods.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/SafeNativeMethods.cs
@@ -16,137 +16,24 @@ namespace Microsoft.Data.Common
[SuppressUnmanagedCodeSecurityAttribute()]
internal static class SafeNativeMethods
{
-
- [DllImport(ExternDll.Ole32, SetLastError = false)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern IntPtr CoTaskMemAlloc(IntPtr cb);
-
- [DllImport(ExternDll.Ole32, SetLastError = false)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern void CoTaskMemFree(IntPtr handle);
-
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Unicode, PreserveSig = true)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern int GetUserDefaultLCID();
-
- [DllImport(ExternDll.Kernel32, PreserveSig = true)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern void ZeroMemory(IntPtr dest, IntPtr length);
-
- //
- // Using the int versions of the Increment() and Decrement() methods is correct.
- // Please check \fx\src\Data\System\Data\Odbc\OdbcHandle.cs for the memory layout.
- //
-
- //
- // The following casting operations require these three methods to be unsafe. This is
- // a workaround for this issue to meet the M1 exit criteria. We need to revisit this in M2.
-
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- static internal unsafe IntPtr InterlockedExchangePointer(
- IntPtr lpAddress,
- IntPtr lpValue)
- {
- IntPtr previousPtr;
- IntPtr actualPtr = *(IntPtr*)lpAddress.ToPointer();
-
- do
- {
- previousPtr = actualPtr;
- actualPtr = Interlocked.CompareExchange(ref *(IntPtr*)lpAddress.ToPointer(), lpValue, previousPtr);
- }
- while (actualPtr != previousPtr);
-
- return actualPtr;
- }
-
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getcomputernameex.asp
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameExW", SetLastError = true)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameExW", SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
static internal extern int GetComputerNameEx(int nameType, StringBuilder nameBuffer, ref int bufferSize);
- [DllImport(ExternDll.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[ResourceExposure(ResourceScope.Process)]
static internal extern int GetCurrentProcessId();
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
// [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]
[ResourceExposure(ResourceScope.Process)]
static internal extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr), In] string moduleName/*lpctstr*/);
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true, SetLastError = true)]
+ [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true, SetLastError = true)]
// [DllImport(ExternDll.Kernel32, CharSet=CharSet.Ansi)]
[ResourceExposure(ResourceScope.None)]
static internal extern IntPtr GetProcAddress(IntPtr HModule, [MarshalAs(UnmanagedType.LPStr), In] string funcName/*lpcstr*/);
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern IntPtr LocalAlloc(int flags, IntPtr countOfBytes);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern IntPtr LocalFree(IntPtr handle);
-
- [DllImport(ExternDll.Oleaut32, CharSet = CharSet.Unicode)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.None)]
- internal static extern IntPtr SysAllocStringLen(String src, int len); // BSTR
-
- [DllImport(ExternDll.Oleaut32)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- internal static extern void SysFreeString(IntPtr bstr);
-
- // only using this to clear existing error info with null
- [DllImport(ExternDll.Oleaut32, CharSet = CharSet.Unicode, PreserveSig = false)]
- // TLS values are preserved between threads, need to check that we use this API to clear the error state only.
- [ResourceExposure(ResourceScope.Process)]
- static private extern void SetErrorInfo(Int32 dwReserved, IntPtr pIErrorInfo);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.Machine)]
- static internal extern int ReleaseSemaphore(IntPtr handle, int releaseCount, IntPtr previousCount);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern int WaitForMultipleObjectsEx(uint nCount, IntPtr lpHandles, bool bWaitAll, uint dwMilliseconds, bool bAlertable);
-
- [DllImport(ExternDll.Kernel32/*, SetLastError=true*/)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern int WaitForSingleObjectEx(IntPtr lpHandles, uint dwMilliseconds, bool bAlertable);
-
- [DllImport(ExternDll.Ole32, PreserveSig = false)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern void PropVariantClear(IntPtr pObject);
-
- [DllImport(ExternDll.Oleaut32, PreserveSig = false)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern void VariantClear(IntPtr pObject);
-
- sealed internal class Wrapper
- {
-
- private Wrapper() { }
-
- // SxS: clearing error information is considered safe
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
- static internal void ClearErrorInfo()
- { // MDAC 68199
- SafeNativeMethods.SetErrorInfo(0, ADP.s_ptrZero);
- }
- }
-
-
}
}
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/UnsafeNativeMethods.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/UnsafeNativeMethods.cs
deleted file mode 100644
index a742620575..0000000000
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/UnsafeNativeMethods.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using System.Security;
-
-namespace Microsoft.Data.Common
-{
-
- [SuppressUnmanagedCodeSecurityAttribute()]
- internal static class UnsafeNativeMethods
- {
-
- [Guid("00000567-0000-0010-8000-00AA006D2EA4"), InterfaceType(ComInterfaceType.InterfaceIsDual), ComImport, SuppressUnmanagedCodeSecurity]
- internal interface ADORecordConstruction
- {
-
- [return: MarshalAs(UnmanagedType.Interface)] object get_Row();
-
- //void put_Row(
- // [In, MarshalAs(UnmanagedType.Interface)] object pRow);
-
- //void put_ParentRow(
- // [In, MarshalAs(UnmanagedType.Interface)]object pRow);
- }
-
- [Guid("00000283-0000-0010-8000-00AA006D2EA4"), InterfaceType(ComInterfaceType.InterfaceIsDual), ComImport, SuppressUnmanagedCodeSecurity]
- internal interface ADORecordsetConstruction
- {
-
- [return: MarshalAs(UnmanagedType.Interface)] object get_Rowset();
-
- [Obsolete("not used", true)] void put_Rowset(/*deleted parameters signature*/);
-
- /*[return:MarshalAs(UnmanagedType.SysInt)]*/
- IntPtr get_Chapter();
-
- //[[PreserveSig]
- //iint put_Chapter (
- // [In]
- // IntPtr pcRefCount);
-
- //[[PreserveSig]
- //iint get_RowPosition (
- // [Out, MarshalAs(UnmanagedType.Interface)]
- // out object ppRowPos);
-
- //[[PreserveSig]
- //iint put_RowPosition (
- // [In, MarshalAs(UnmanagedType.Interface)]
- // object pRowPos);
- }
-
-
- [Guid("0C733A64-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
- internal interface ICommandWithParameters
- {
-
- [Obsolete("not used", true)] void GetParameterInfo(/*deleted parameters signature*/);
-
- [Obsolete("not used", true)] void MapParameterNames(/*deleted parameter signature*/);
-
- /*[local]
- HRESULT SetParameterInfo(
- [in] DB_UPARAMS cParams,
- [in, unique, size_is((ULONG)cParams)] const DB_UPARAMS rgParamOrdinals[],
- [in, unique, size_is((ULONG)cParams)] const DBPARAMBINDINFO rgParamBindInfo[]
- );*/
- //[PreserveSig] System.Data.OleDb.OleDbHResult SetParameterInfo(
- // [In] IntPtr cParams,
- // [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] rgParamOrdinals,
- // [In, MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.Struct)] System.Data.OleDb.tagDBPARAMBINDINFO[] rgParamBindInfo);
- }
-
- [Guid("2206CCB1-19C1-11D1-89E0-00C04FD7A829"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
- internal interface IDataInitialize
- {
-
- }
-
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- internal struct Trustee
- {
- internal IntPtr _pMultipleTrustee; // PTRUSTEE
- internal int _MultipleTrusteeOperation; // MULTIPLE_TRUSTEE_OPERATION
- internal int _TrusteeForm; // TRUSTEE_FORM
- internal int _TrusteeType; // TRUSTEE_TYPE
- [MarshalAs(UnmanagedType.LPTStr)]
- internal string _name;
-
- internal Trustee(string name)
- {
- _pMultipleTrustee = IntPtr.Zero;
- _MultipleTrusteeOperation = 0; // NO_MULTIPLE_TRUSTEE
- _TrusteeForm = 1; // TRUSTEE_IS_NAME
- _TrusteeType = 1; // TRUSTEE_IS_USER
- _name = name;
- }
- }
-
- [DllImport(ExternDll.Advapi32, CharSet = CharSet.Unicode)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern uint GetEffectiveRightsFromAclW(byte[] pAcl, ref Trustee pTrustee, out uint pAccessMask);
-
- [DllImport(ExternDll.Advapi32, SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- [return: MarshalAs(UnmanagedType.Bool)]
- static internal extern bool CheckTokenMembership(IntPtr tokenHandle, byte[] sidToCheck, out bool isMember);
-
- [DllImport(ExternDll.Advapi32, SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- [return: MarshalAs(UnmanagedType.Bool)]
- static internal extern bool ConvertSidToStringSidW(IntPtr sid, out IntPtr stringSid);
-
- [DllImport(ExternDll.Advapi32, EntryPoint = "CreateWellKnownSid", SetLastError = true, CharSet = CharSet.Unicode)]
- [ResourceExposure(ResourceScope.None)]
- static internal extern int CreateWellKnownSid(
- int sidType,
- byte[] domainSid,
- [Out] byte[] resultSid,
- ref uint resultSidLength);
-
- [DllImport(ExternDll.Advapi32, SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- [return: MarshalAs(UnmanagedType.Bool)]
- static internal extern bool GetTokenInformation(IntPtr tokenHandle, uint token_class, IntPtr tokenStruct, uint tokenInformationLength, ref uint tokenString);
-
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Unicode)]
- [ResourceExposure(ResourceScope.None)]
- internal static extern int lstrlenW(IntPtr ptr);
-
- /* For debugging purposes...
- [DllImport(ExternDll.Advapi32)]
- [return:MarshalAs(UnmanagedType.I4)]
- static internal extern int GetLengthSid(IntPtr sid1);
- */
- }
-}
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperARM64.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperARM64.cs
index e4c938a3f9..fad1fa9f8a 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperARM64.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperARM64.cs
@@ -73,9 +73,6 @@ internal static class SNINativeManagedWrapperARM64
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, [MarshalAs(UnmanagedType.Bool)] out bool pbQInfo);
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, ref IntPtr pbQInfo);
-
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ushort portNum);
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
index 298f6cc3f5..17c02bd514 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
@@ -73,9 +73,6 @@ internal static class SNINativeManagedWrapperX64
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, [MarshalAs(UnmanagedType.Bool)] out bool pbQInfo);
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, ref IntPtr pbQInfo);
-
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ushort portNum);
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
index 7215c54ced..d70d2872c6 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
@@ -73,9 +73,6 @@ internal static class SNINativeManagedWrapperX86
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, [MarshalAs(UnmanagedType.Bool)] out bool pbQInfo);
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, ref IntPtr pbQInfo);
-
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ushort portNum);
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
index dff730c02c..bdfa9f300f 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
@@ -186,38 +186,6 @@ internal struct AuthProviderInfo
public string serverCertFileName;
};
- [StructLayout(LayoutKind.Sequential)]
- internal struct CredHandle
- {
- internal IntPtr dwLower;
- internal IntPtr dwUpper;
- };
-
- internal enum ContextAttribute
- {
- // sspi.h
- SECPKG_ATTR_SIZES = 0,
- SECPKG_ATTR_NAMES = 1,
- SECPKG_ATTR_LIFESPAN = 2,
- SECPKG_ATTR_DCE_INFO = 3,
- SECPKG_ATTR_STREAM_SIZES = 4,
- SECPKG_ATTR_AUTHORITY = 6,
- SECPKG_ATTR_PACKAGE_INFO = 10,
- SECPKG_ATTR_NEGOTIATION_INFO = 12,
- SECPKG_ATTR_UNIQUE_BINDINGS = 25,
- SECPKG_ATTR_ENDPOINT_BINDINGS = 26,
- SECPKG_ATTR_CLIENT_SPECIFIED_TARGET = 27,
- SECPKG_ATTR_APPLICATION_PROTOCOL = 35,
-
- // minschannel.h
- SECPKG_ATTR_REMOTE_CERT_CONTEXT = 0x53, // returns PCCERT_CONTEXT
- SECPKG_ATTR_LOCAL_CERT_CONTEXT = 0x54, // returns PCCERT_CONTEXT
- SECPKG_ATTR_ROOT_STORE = 0x55, // returns HCERTCONTEXT to the root store
- SECPKG_ATTR_ISSUER_LIST_EX = 0x59, // returns SecPkgContext_IssuerListInfoEx
- SECPKG_ATTR_CONNECTION_INFO = 0x5A, // returns SecPkgContext_ConnectionInfo
- SECPKG_ATTR_UI_INFO = 0x68, // sets SEcPkgContext_UiInfo
- }
-
internal enum ConsumerNumber
{
SNI_Consumer_SNI,
@@ -377,12 +345,6 @@ internal struct SNI_Error
#endregion
#region DLL Imports
- [DllImport("kernel32.dll", SetLastError = true)]
- public static extern IntPtr LoadLibrary(string dllToLoad);
-
- [DllImport("secur32.dll", ExactSpelling = true, SetLastError = true)]
- internal static extern uint QueryContextAttributes(ref CredHandle contextHandle, [In] ContextAttribute attribute, [In] IntPtr buffer);
-
internal static uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo)
{
switch (s_architecture)
@@ -692,21 +654,6 @@ private static uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapp
}
}
- private static uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, ref IntPtr pbQInfo)
- {
- switch (s_architecture)
- {
- case System.Runtime.InteropServices.Architecture.Arm64:
- return SNINativeManagedWrapperARM64.SNIGetInfoWrapper(pConn, QType, ref pbQInfo);
- case System.Runtime.InteropServices.Architecture.X64:
- return SNINativeManagedWrapperX64.SNIGetInfoWrapper(pConn, QType, ref pbQInfo);
- case System.Runtime.InteropServices.Architecture.X86:
- return SNINativeManagedWrapperX86.SNIGetInfoWrapper(pConn, QType, ref pbQInfo);
- default:
- throw ADP.SNIPlatformNotSupported(s_architecture.ToString());
- }
- }
-
private static uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ushort portNum)
{
switch (s_architecture)
@@ -909,52 +856,6 @@ private static uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacke
}
}
#endregion
-
- internal static uint SNISecGetServerCertificate(SNIHandle pConnectionObject, ref X509Certificate2 certificate)
- {
- System.UInt32 ret;
- CredHandle pSecHandle;
- X509Certificate pCertContext = null;
-
- // provides a guaranteed finally block – without this it isn’t guaranteed – non interruptable by fatal exceptions
- bool mustRelease = false;
- RuntimeHelpers.PrepareConstrainedRegions();
- try
- {
- pConnectionObject.DangerousAddRef(ref mustRelease);
- Debug.Assert(mustRelease, "AddRef Failed!");
-
- IntPtr secHandlePtr = Marshal.AllocHGlobal(Marshal.SizeOf());
-
- ret = SNIGetInfoWrapper(pConnectionObject, QTypes.SNI_QUERY_CONN_SSL_SECCTXTHANDLE, ref secHandlePtr);
- //ERROR_SUCCESS
- if (0 == ret)
- {
- // Cast an unmanaged block to pSecHandle;
- pSecHandle = Marshal.PtrToStructure(secHandlePtr);
-
- // SEC_E_OK
- if (0 == (ret = QueryContextAttributes(ref pSecHandle, ContextAttribute.SECPKG_ATTR_REMOTE_CERT_CONTEXT, pCertContext.Handle)))
- {
- certificate = new X509Certificate2(pCertContext.Handle);
- }
- }
- Marshal.FreeHGlobal(secHandlePtr);
- }
- finally
- {
- if (pCertContext != null)
- {
- pCertContext.Dispose();
- }
- if (mustRelease)
- {
- pConnectionObject.DangerousRelease();
- }
- }
- return ret;
- }
-
internal static uint SniGetConnectionId(SNIHandle pConn, ref Guid connId)
{
return SNIGetInfoWrapper(pConn, QTypes.SNI_QUERY_CONN_CONNID, out connId);
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlTypes/UnsafeNativeMethods.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlTypes/UnsafeNativeMethods.cs
deleted file mode 100644
index 4396137798..0000000000
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlTypes/UnsafeNativeMethods.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Security;
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.Versioning;
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Data.Common;
-
-namespace Microsoft.Data.SqlTypes
-{
- [SuppressUnmanagedCodeSecurity]
- internal static class UnsafeNativeMethods
- {
- #region PInvoke methods
-
- [DllImport("NtDll.dll", CharSet = CharSet.Unicode)]
- [ResourceExposure(ResourceScope.Machine)]
- internal static extern UInt32 NtCreateFile
- (
- out Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle,
- Int32 desiredAccess,
- ref OBJECT_ATTRIBUTES objectAttributes,
- out IO_STATUS_BLOCK ioStatusBlock,
- ref Int64 allocationSize,
- UInt32 fileAttributes,
- System.IO.FileShare shareAccess,
- UInt32 createDisposition,
- UInt32 createOptions,
- SafeHandle eaBuffer,
- UInt32 eaLength
- );
-
- [DllImport("Kernel32.dll", SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- internal static extern FileType GetFileType
- (
- Microsoft.Win32.SafeHandles.SafeFileHandle hFile
- );
-
- // RTM versions of Win7 and Windows Server 2008 R2
- private static readonly Version ThreadErrorModeMinOsVersion = new Version(6, 1, 7600);
-
- // do not use this method directly, use SetErrorModeWrapper instead
- [DllImport("Kernel32.dll", ExactSpelling = true)]
- [ResourceExposure(ResourceScope.Process)]
- private static extern uint SetErrorMode(uint mode);
-
- // do not use this method directly, use SetErrorModeWrapper instead
- // this API exists since Windows 7 / Windows Server 2008 R2
- [DllImport("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- [SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
- private static extern bool SetThreadErrorMode(uint newMode, out uint oldMode);
-
- ///
- /// this method uses thread-safe version of SetErrorMode on Windows 7/Windows Server 2008 R2 operating systems.
- ///
- [ResourceExposure(ResourceScope.Process)] // None on Windows7 / Windows Server 2008 R2 or later
- [ResourceConsumption(ResourceScope.Process)]
- internal static void SetErrorModeWrapper(uint mode, out uint oldMode)
- {
- if (Environment.OSVersion.Version >= ThreadErrorModeMinOsVersion)
- {
- // safe to use new API
- if (!SetThreadErrorMode(mode, out oldMode))
- {
- throw new System.ComponentModel.Win32Exception();
- }
- }
- else
- {
- // cannot use the new SetThreadErrorMode API on current OS, fallback to the old one
- oldMode = SetErrorMode(mode);
- }
- }
-
- [DllImport("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- [ResourceExposure(ResourceScope.Machine)]
- internal static extern bool DeviceIoControl
- (
- Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle,
- uint ioControlCode,
- IntPtr inBuffer,
- uint cbInBuffer,
- IntPtr outBuffer,
- uint cbOutBuffer,
- out uint cbBytesReturned,
- IntPtr overlapped
- );
-
- [DllImport("NtDll.dll")]
- [ResourceExposure(ResourceScope.None)]
- internal static extern UInt32 RtlNtStatusToDosError
- (
- UInt32 status
- );
-
- #region definitions from devioctl.h
-
- internal const ushort FILE_DEVICE_FILE_SYSTEM = 0x0009;
-
- internal enum Method
- {
- METHOD_BUFFERED,
- METHOD_IN_DIRECT,
- METHOD_OUT_DIRECT,
- METHOD_NEITHER
- };
-
- internal enum Access
- {
- FILE_ANY_ACCESS,
- FILE_READ_ACCESS,
- FILE_WRITE_ACCESS
- }
-
- internal static uint CTL_CODE
- (
- ushort deviceType,
- ushort function,
- byte method,
- byte access
- )
- {
- if (function > 4095)
- throw ADP.ArgumentOutOfRange("function");
-
- return (uint)((deviceType << 16) | (access << 14) | (function << 2) | method);
- }
-
- #endregion
-
- #endregion
-
- #region Error codes
-
- internal const int ERROR_INVALID_HANDLE = 6;
- internal const int ERROR_MR_MID_NOT_FOUND = 317;
-
- internal const uint STATUS_INVALID_PARAMETER = 0xc000000d;
- internal const uint STATUS_SHARING_VIOLATION = 0xc0000043;
- internal const uint STATUS_OBJECT_NAME_NOT_FOUND = 0xc0000034;
-
- #endregion
-
- internal const uint SEM_FAILCRITICALERRORS = 0x0001;
-
- internal enum FileType : uint
- {
- Unknown = 0x0000, // FILE_TYPE_UNKNOWN
- Disk = 0x0001, // FILE_TYPE_DISK
- Char = 0x0002, // FILE_TYPE_CHAR
- Pipe = 0x0003, // FILE_TYPE_PIPE
- Remote = 0x8000 // FILE_TYPE_REMOTE
- }
-
- #region definitions from wdm.h
-
- [StructLayoutAttribute(LayoutKind.Sequential)]
- internal struct OBJECT_ATTRIBUTES
- {
- internal int length;
- internal IntPtr rootDirectory;
- internal SafeHandle objectName;
- internal int attributes;
- internal IntPtr securityDescriptor;
- internal SafeHandle securityQualityOfService;
- }
-
- [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- internal struct UNICODE_STRING
- {
- internal UInt16 length;
- internal UInt16 maximumLength;
- internal string buffer;
- }
-
- // VSTFDevDiv # 547461 [Backport SqlFileStream fix on Win7 to QFE branch]
- // Win7 enforces correct values for the _SECURITY_QUALITY_OF_SERVICE.qos member.
- // taken from _SECURITY_IMPERSONATION_LEVEL enum definition in winnt.h
- internal enum SecurityImpersonationLevel
- {
- SecurityAnonymous,
- SecurityIdentification,
- SecurityImpersonation,
- SecurityDelegation
- }
-
- [StructLayoutAttribute(LayoutKind.Sequential)]
- internal struct SECURITY_QUALITY_OF_SERVICE
- {
- internal UInt32 length;
- [MarshalAs(UnmanagedType.I4)]
- internal int impersonationLevel;
- internal byte contextDynamicTrackingMode;
- internal byte effectiveOnly;
- }
-
- [StructLayoutAttribute(LayoutKind.Sequential)]
- internal struct IO_STATUS_BLOCK
- {
- internal UInt32 status;
- internal IntPtr information;
- }
-
- [StructLayoutAttribute(LayoutKind.Sequential)]
- internal struct FILE_FULL_EA_INFORMATION
- {
- internal UInt32 nextEntryOffset;
- internal Byte flags;
- internal Byte EaNameLength;
- internal UInt16 EaValueLength;
- internal Byte EaName;
- }
-
- [Flags]
- internal enum CreateOption : uint
- {
- FILE_WRITE_THROUGH = 0x00000002,
- FILE_SEQUENTIAL_ONLY = 0x00000004,
- FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008,
- FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020,
- FILE_RANDOM_ACCESS = 0x00000800
- }
-
- internal enum CreationDisposition : uint
- {
- FILE_SUPERSEDE = 0,
- FILE_OPEN = 1,
- FILE_CREATE = 2,
- FILE_OPEN_IF = 3,
- FILE_OVERWRITE = 4,
- FILE_OVERWRITE_IF = 5
- }
-
- #endregion
-
- #region definitions from winnt.h
-
- internal const int FILE_READ_DATA = 0x0001;
- internal const int FILE_WRITE_DATA = 0x0002;
- internal const int FILE_READ_ATTRIBUTES = 0x0080;
- internal const int SYNCHRONIZE = 0x00100000;
-
- #endregion
-
- #region definitions from ntdef.h
-
- [Flags]
- internal enum Attributes : uint
- {
- Inherit = 0x00000002,
- Permanent = 0x00000010,
- Exclusive = 0x00000020,
- CaseInsensitive = 0x00000040,
- OpenIf = 0x00000080,
- OpenLink = 0x00000100,
- KernelHandle = 0x00000200,
- ForceAccessCheck = 0x00000400,
- ValidAttributes = 0x000007F2
- }
-
- #endregion
-
- }
-}
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Misc/ExternDll.cs b/src/Microsoft.Data.SqlClient/netfx/src/Misc/ExternDll.cs
deleted file mode 100644
index dbf8f4a9ee..0000000000
--- a/src/Microsoft.Data.SqlClient/netfx/src/Misc/ExternDll.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System
-{
- internal static class ExternDll
- {
- public const string Advapi32 = "advapi32.dll";
- public const string Kernel32 = "kernel32.dll";
- public const string Ole32 = "ole32.dll";
- public const string Oleaut32 = "oleaut32.dll";
- }
-}
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Interop.Libraries.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Interop.Libraries.cs
index f3c5526e0f..c4e3bf1c9d 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Interop.Libraries.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Interop.Libraries.cs
@@ -6,11 +6,14 @@ internal static partial class Interop
{
internal static partial class Libraries
{
- internal const string Crypt32 = "crypt32.dll";
internal const string Kernel32 = "kernel32.dll";
internal const string NtDll = "ntdll.dll";
#if !NET8_0_OR_GREATER
+ internal const string Crypt32 = "crypt32.dll";
internal const string SspiCli = "sspicli.dll";
+#endif
+#if NETFRAMEWORK
+ internal const string Advapi32 = "advapi32.dll";
#endif
}
}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
index 25f87b3a8b..9eb82546ce 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
@@ -2515,7 +2515,7 @@ private static IEnumerable Map(IEnumerable source, Func
#if NET6_0_OR_GREATER
internal static Exception SocketDidNotThrow()
{
- return new InternalException(StringsHelper.GetString(Strings.SQL_SocketDidNotThrow, nameof(SocketException), nameof(SocketError.WouldBlock)));
+ return new Exception(StringsHelper.GetString(Strings.SQL_SocketDidNotThrow, nameof(SocketException), nameof(SocketError.WouldBlock)));
}
#else
static internal Exception SnapshotNotSupported(System.Data.IsolationLevel level)