Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions src/libraries/System.Data.OleDb/src/OleDbComWrappers.cs

This file was deleted.

52 changes: 17 additions & 35 deletions src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,21 @@ System.Data.OleDb.OleDbTransaction</PackageDescription>
</PropertyGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs"
Link="Common\Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetUserDefaultLCID.cs"
Link="Common\Interop\Windows\Kernel32\Interop.GetUserDefaultLCID.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetCurrentProcessId.cs"
Link="Common\Interop\Windows\Kernel32\Interop.GetCurrentProcessId.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.LocalAlloc.cs"
Link="Common\Interop\Windows\Kernel32\Interop.LocalAlloc.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.LocalFree.cs"
Link="Common\Interop\Windows\Kernel32\Interop.LocalFree.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.Semaphore.cs"
Link="Common\Interop\Windows\Kernel32\Interop.Semaphore.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WaitForSingleObject.cs"
Link="Common\Interop\Windows\Kernel32\Interop.WaitForSingleObject.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WaitForMultipleObjects.cs"
Link="Common\Interop\Windows\Kernel32\Interop.WaitForMultipleObjects.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SysAllocStringLen.cs"
Link="Common\Interop\Windows\OleAut32\Interop.SysAllocStringLen.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SetErrorInfo.cs"
Link="Common\Interop\Windows\OleAut32\Interop.SetErrorInfo.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SysFreeString.cs"
Link="Common\Interop\Windows\OleAut32\Interop.SysFreeString.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.VariantClear.cs"
Link="Common\Interop\Windows\OleAut32\Interop.VariantClear.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs"
Link="Common\Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Ole32\Interop.PropVariantClear.cs"
Link="Common\Interop\Windows\Ole32\Interop.PropVariantClear.cs" />
<Compile Include="$(CommonPath)System\Data\Common\MultipartIdentifier.cs"
Link="Common\System\Data\Common\MultipartIdentifier.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs" Link="Common\Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetUserDefaultLCID.cs" Link="Common\Interop\Windows\Kernel32\Interop.GetUserDefaultLCID.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetCurrentProcessId.cs" Link="Common\Interop\Windows\Kernel32\Interop.GetCurrentProcessId.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.LocalAlloc.cs" Link="Common\Interop\Windows\Kernel32\Interop.LocalAlloc.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.LocalFree.cs" Link="Common\Interop\Windows\Kernel32\Interop.LocalFree.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.Semaphore.cs" Link="Common\Interop\Windows\Kernel32\Interop.Semaphore.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WaitForSingleObject.cs" Link="Common\Interop\Windows\Kernel32\Interop.WaitForSingleObject.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WaitForMultipleObjects.cs" Link="Common\Interop\Windows\Kernel32\Interop.WaitForMultipleObjects.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SysAllocStringLen.cs" Link="Common\Interop\Windows\OleAut32\Interop.SysAllocStringLen.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SetErrorInfo.cs" Link="Common\Interop\Windows\OleAut32\Interop.SetErrorInfo.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SysFreeString.cs" Link="Common\Interop\Windows\OleAut32\Interop.SysFreeString.cs" />
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.VariantClear.cs" Link="Common\Interop\Windows\OleAut32\Interop.VariantClear.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs" Link="Common\Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Ole32\Interop.PropVariantClear.cs" Link="Common\Interop\Windows\Ole32\Interop.PropVariantClear.cs" />
<Compile Include="$(CommonPath)System\Data\Common\MultipartIdentifier.cs" Link="Common\System\Data\Common\MultipartIdentifier.cs" />
<Compile Include="AdapterSwitches.cs" />
<Compile Include="ColumnBinding.cs" />
<Compile Include="DbBindings.cs" />
Expand Down Expand Up @@ -136,18 +121,15 @@ System.Data.OleDb.OleDbTransaction</PackageDescription>
<Compile Include="System\Data\ProviderBase\DbMetaDataFactory.cs" />
<Compile Include="System\Data\ProviderBase\DbReferenceCollection.cs" />
<Compile Include="System\Data\ProviderBase\WrappedIUnknown.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs"
Link="Common\System\Obsoletions.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
<Compile Include="UnsafeNativeMethods.COMWrappers.cs" />
<Compile Include="OleDbComWrappers.cs" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\System.Data.OleDb.OleDbMetaData.xml"
LogicalName="System.Data.OleDb.OleDbMetaData.xml" />
<EmbeddedResource Include="Resources\System.Data.OleDb.OleDbMetaData.xml" LogicalName="System.Data.OleDb.OleDbMetaData.xml" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Data.OleDb;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;

namespace System.Data.Common
{
Expand All @@ -15,27 +16,11 @@ internal static partial class UnsafeNativeMethods
[LibraryImport(Interop.Libraries.OleAut32)]
internal static unsafe partial OleDbHResult GetErrorInfo(
int dwReserved,
System.IntPtr* ppIErrorInfo);
out IErrorInfo? ppIErrorInfo);

internal static unsafe OleDbHResult GetErrorInfo(
int dwReserved,
out UnsafeNativeMethods.IErrorInfo? ppIErrorInfo)
{
ppIErrorInfo = null;
IntPtr pErrorInfo;
var hr = GetErrorInfo(dwReserved, &pErrorInfo);
if (hr == OleDbHResult.S_OK)
{
ppIErrorInfo = (UnsafeNativeMethods.IErrorInfo)OleDbComWrappers.Instance
.GetOrCreateObjectForComInstance(pErrorInfo, CreateObjectFlags.UniqueInstance);
}

return hr;
}

internal static void ReleaseErrorInfoObject(UnsafeNativeMethods.IErrorInfo errorInfo)
internal static void ReleaseErrorInfoObject(IErrorInfo errorInfo)
{
((IDisposable)errorInfo).Dispose();
((ComObject)(object)errorInfo).FinalRelease();
}
}
}
35 changes: 18 additions & 17 deletions src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
using System.Security;

#pragma warning disable 0618 // ComInterfaceType.InterfaceIsDual is obsolete
Expand Down Expand Up @@ -507,8 +508,16 @@ System.Data.OleDb.OleDbHResult GetSchemas(
[Out] out IntPtr prgRestrictionSupport);
}

[Guid("1CF2B120-547D-101B-8E65-08002B2BD119"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
internal interface IErrorInfo
[Guid("0C733A74-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface, SuppressUnmanagedCodeSecurity]
internal partial interface ISQLErrorInfo
{
[return: MarshalAs(UnmanagedType.I4)]
int GetSQLInfo(
[MarshalAs(UnmanagedType.BStr)] out string pbstrSQLState);
}

[Guid("1CF2B120-547D-101B-8E65-08002B2BD119"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface, SuppressUnmanagedCodeSecurity]
internal partial interface IErrorInfo
{
[Obsolete("not used", true)] void GetGUID(/*deleted parameter signature*/);

Expand Down Expand Up @@ -539,23 +548,23 @@ virtual HRESULT STDMETHODCALLTYPE GetHelpContext(
/* [out] */ DWORD *pdwHelpContext) = 0;
#endif

[Guid("0C733A67-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
internal interface IErrorRecords
[Guid("0C733A67-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface, SuppressUnmanagedCodeSecurity]
internal partial interface IErrorRecords
{
[Obsolete("not used", true)] void AddErrorRecord(/*deleted parameter signature*/);

[Obsolete("not used", true)] void GetBasicErrorInfo(/*deleted parameter signature*/);

[PreserveSig]
System.Data.OleDb.OleDbHResult GetCustomErrorObject( // may return E_NOINTERFACE when asking for IID_ISQLErrorInfo
[In] int ulRecordNum,
[In] in Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out ISQLErrorInfo ppObject);
int ulRecordNum,
in Guid riid,
out ISQLErrorInfo ppObject);

[return: MarshalAs(UnmanagedType.Interface)]
IErrorInfo GetErrorInfo(
[In] int ulRecordNum,
[In] int lcid);
int ulRecordNum,
int lcid);

[Obsolete("not used", true)] void GetErrorParameters(/*deleted parameter signature*/);

Expand Down Expand Up @@ -725,14 +734,6 @@ System.Data.OleDb.OleDbHResult GetReferencedRowset(
//int GetSpecification(/*deleted parameter signature*/);
}

[Guid("0C733A74-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
internal interface ISQLErrorInfo
{
[return: MarshalAs(UnmanagedType.I4)]
int GetSQLInfo(
[Out, MarshalAs(UnmanagedType.BStr)] out string pbstrSQLState);
}

[Guid("0C733A5F-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
internal interface ITransactionLocal
{
Expand Down
Loading