From b43939726a736b8892a9b6248c7c1e5b997222fb Mon Sep 17 00:00:00 2001 From: Eugene Wang Date: Fri, 30 Nov 2018 22:17:16 -0500 Subject: [PATCH] Added non-ref IntPtr dsm entry call. --- src/NTwain/Triplets/Audio/AudioFileXfer.cs | 13 ++++++------- src/NTwain/Triplets/BaseTriplet.cs | 2 ++ src/NTwain/Triplets/NativeMethods.Linux32.cs | 9 +++++++++ src/NTwain/Triplets/NativeMethods.Linux64.cs | 9 +++++++++ src/NTwain/Triplets/NativeMethods.Mac32.cs | 9 +++++++++ src/NTwain/Triplets/NativeMethods.Mac64.cs | 9 +++++++++ src/NTwain/Triplets/NativeMethods.Win32.cs | 9 +++++++++ src/NTwain/Triplets/NativeMethods.Win64.cs | 9 +++++++++ 8 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/NTwain/Triplets/Audio/AudioFileXfer.cs b/src/NTwain/Triplets/Audio/AudioFileXfer.cs index 4893568..58ee105 100644 --- a/src/NTwain/Triplets/Audio/AudioFileXfer.cs +++ b/src/NTwain/Triplets/Audio/AudioFileXfer.cs @@ -10,29 +10,28 @@ namespace NTwain.Triplets.Audio public ReturnCode Get() { - IntPtr zero = IntPtr.Zero; if (Is32Bit) { if (IsWin) return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); if (IsLinux) return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); if (IsMac) return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); } if (IsWin) return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); if (IsLinux) return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); if (IsMac) return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32, - DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, ref zero); + DataGroups.Audio, DataArgumentType.AudioFileXfer, Message.Get, IntPtr.Zero); return ReturnCode.Failure; } diff --git a/src/NTwain/Triplets/BaseTriplet.cs b/src/NTwain/Triplets/BaseTriplet.cs index 5dafa8b..a9fc0fd 100644 --- a/src/NTwain/Triplets/BaseTriplet.cs +++ b/src/NTwain/Triplets/BaseTriplet.cs @@ -40,7 +40,9 @@ namespace NTwain.Triplets /// Whether platform is Linux. /// protected readonly bool IsLinux; + /// /// Whether platform is MacOS. + /// protected readonly bool IsMac; } } \ No newline at end of file diff --git a/src/NTwain/Triplets/NativeMethods.Linux32.cs b/src/NTwain/Triplets/NativeMethods.Linux32.cs index 7900d04..bb8c384 100644 --- a/src/NTwain/Triplets/NativeMethods.Linux32.cs +++ b/src/NTwain/Triplets/NativeMethods.Linux32.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(LinuxDll, EntryPoint = EntryName)] + public static extern ReturnCode DsmLinux32( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(LinuxDll, EntryPoint = EntryName)] public static extern ReturnCode DsmLinux32( [In, Out]TW_IDENTITY origin, diff --git a/src/NTwain/Triplets/NativeMethods.Linux64.cs b/src/NTwain/Triplets/NativeMethods.Linux64.cs index 5fece09..4d6ddf9 100644 --- a/src/NTwain/Triplets/NativeMethods.Linux64.cs +++ b/src/NTwain/Triplets/NativeMethods.Linux64.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(LinuxDll, EntryPoint = EntryName)] + public static extern ReturnCode DsmLinux64( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(LinuxDll, EntryPoint = EntryName)] public static extern ReturnCode DsmLinux64( [In, Out]TW_IDENTITY origin, diff --git a/src/NTwain/Triplets/NativeMethods.Mac32.cs b/src/NTwain/Triplets/NativeMethods.Mac32.cs index 0e0e2e5..fef95b1 100644 --- a/src/NTwain/Triplets/NativeMethods.Mac32.cs +++ b/src/NTwain/Triplets/NativeMethods.Mac32.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(Mac32Dll, EntryPoint = EntryName)] + public static extern ReturnCode DsmMac32( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(Mac32Dll, EntryPoint = EntryName)] public static extern ReturnCode DsmMac32( [In, Out]TW_IDENTITY origin, diff --git a/src/NTwain/Triplets/NativeMethods.Mac64.cs b/src/NTwain/Triplets/NativeMethods.Mac64.cs index 24dd1d8..318af46 100644 --- a/src/NTwain/Triplets/NativeMethods.Mac64.cs +++ b/src/NTwain/Triplets/NativeMethods.Mac64.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(Mac64Dll, EntryPoint = EntryName)] + public static extern ReturnCode DsmMac64( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(Mac64Dll, EntryPoint = EntryName)] public static extern ReturnCode DsmMac64( [In, Out]TW_IDENTITY origin, diff --git a/src/NTwain/Triplets/NativeMethods.Win32.cs b/src/NTwain/Triplets/NativeMethods.Win32.cs index a0b217b..8f66998 100644 --- a/src/NTwain/Triplets/NativeMethods.Win32.cs +++ b/src/NTwain/Triplets/NativeMethods.Win32.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(WinDll, EntryPoint = EntryName)] + public static extern ReturnCode DsmWin32( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(WinDll, EntryPoint = EntryName)] public static extern ReturnCode DsmWin32( [In, Out]TW_IDENTITY origin, diff --git a/src/NTwain/Triplets/NativeMethods.Win64.cs b/src/NTwain/Triplets/NativeMethods.Win64.cs index e4fdbaf..e151687 100644 --- a/src/NTwain/Triplets/NativeMethods.Win64.cs +++ b/src/NTwain/Triplets/NativeMethods.Win64.cs @@ -18,6 +18,15 @@ namespace NTwain.Triplets Message msg, ref IntPtr data); + [DllImport(WinDll, EntryPoint = EntryName)] + public static extern ReturnCode DsmWin64( + [In, Out]TW_IDENTITY origin, + [In, Out]TW_IDENTITY destination, + DataGroups dg, + DataArgumentType dat, + Message msg, + IntPtr data); + [DllImport(WinDll, EntryPoint = EntryName)] public static extern ReturnCode DsmWin64( [In, Out]TW_IDENTITY origin,