diff --git a/src/NTwain/DSM/OSXLegacyDSM.cs b/src/NTwain/DSM/OSXLegacyDSM.cs new file mode 100644 index 0000000..06dc69f --- /dev/null +++ b/src/NTwain/DSM/OSXLegacyDSM.cs @@ -0,0 +1,97 @@ +using System; +using System.Runtime.InteropServices; +using TWAINWorkingGroup; + +namespace NTwain.DSM +{ + static class OSXLegacyDSM + { + const string DsmName = "/System/Library/Frameworks/framework/TWAIN"; + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref IntPtr hwnd + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_IDENTITY_MACOSX twidentity + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUSUTF8 twstatusutf8 + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_ENTRYPOINT twentrypoint + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_DEVICEEVENT twdeviceevent + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_CUSTOMDSDATA twcustomedsdata + ); + } +} diff --git a/src/NTwain/DSM/OSXNewDSM.cs b/src/NTwain/DSM/OSXNewDSM.cs new file mode 100644 index 0000000..9ef0f42 --- /dev/null +++ b/src/NTwain/DSM/OSXNewDSM.cs @@ -0,0 +1,97 @@ +using System; +using System.Runtime.InteropServices; +using TWAINWorkingGroup; + +namespace NTwain.DSM +{ + static class OSXNewDSM + { + const string DsmName = "/Library/Frameworks/TWAINDSM.framework/TWAINDSM"; + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref IntPtr hwnd + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_IDENTITY_MACOSX twidentity + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUSUTF8 twstatusutf8 + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_ENTRYPOINT twentrypoint + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_DEVICEEVENT twdeviceevent + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_MACOSX origin, + ref TW_IDENTITY_MACOSX dest, + DG dg, + DAT dat, + MSG msg, + ref TW_CUSTOMDSDATA twcustomedsdata + ); + } +} diff --git a/src/NTwain/DSM/WinLegacyDSM.cs b/src/NTwain/DSM/WinLegacyDSM.cs new file mode 100644 index 0000000..d4d76d3 --- /dev/null +++ b/src/NTwain/DSM/WinLegacyDSM.cs @@ -0,0 +1,97 @@ +using System; +using System.Runtime.InteropServices; +using TWAINWorkingGroup; + +namespace NTwain.DSM +{ + static class WinLegacyDSM + { + const string DsmName = "twain_32.dll"; + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref IntPtr hwnd + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_IDENTITY_LEGACY twidentity + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUSUTF8 twstatusutf8 + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_ENTRYPOINT twentrypoint + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_DEVICEEVENT twdeviceevent + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_CUSTOMDSDATA twcustomedsdata + ); + } +} diff --git a/src/NTwain/DSM/WinNewDSM.cs b/src/NTwain/DSM/WinNewDSM.cs new file mode 100644 index 0000000..c2d693c --- /dev/null +++ b/src/NTwain/DSM/WinNewDSM.cs @@ -0,0 +1,97 @@ +using System; +using System.Runtime.InteropServices; +using TWAINWorkingGroup; + +namespace NTwain.DSM +{ + static class WinNewDSM + { + const string DsmName = "twaindsm.dll"; + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref IntPtr hwnd + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_IDENTITY_LEGACY twidentity + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUS twstatus + ); + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_STATUSUTF8 twstatusutf8 + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + IntPtr dest, + DG dg, + DAT dat, + MSG msg, + ref TW_ENTRYPOINT twentrypoint + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_DEVICEEVENT twdeviceevent + ); + + [DllImport(DsmName, CharSet = CharSet.Ansi)] + internal static extern UInt16 DSM_Entry + ( + ref TW_IDENTITY_LEGACY origin, + ref TW_IDENTITY_LEGACY dest, + DG dg, + DAT dat, + MSG msg, + ref TW_CUSTOMDSDATA twcustomedsdata + ); + } +} diff --git a/src/NTwain/Triplets/DATCustomDsData.cs b/src/NTwain/Triplets/DATCustomDsData.cs index 21a7f41..9862616 100644 --- a/src/NTwain/Triplets/DATCustomDsData.cs +++ b/src/NTwain/Triplets/DATCustomDsData.cs @@ -1,4 +1,5 @@ -using TWAINWorkingGroup; +using NTwain.DSM; +using TWAINWorkingGroup; namespace NTwain.Triplets { @@ -41,11 +42,11 @@ namespace NTwain.Triplets var ds = Session.CurrentSource; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryCustomdsdata(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryCustomdsdata(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); + rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); } } else if (TwainPlatform.IsMacOSX) @@ -54,11 +55,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX ds = Session.CurrentSource; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryCustomdsdata(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryCustomdsdata(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CUSTOMDSDATA, msg, ref data); } } return rc; diff --git a/src/NTwain/Triplets/DATDeviceEvent.cs b/src/NTwain/Triplets/DATDeviceEvent.cs index 7f168cc..86c92de 100644 --- a/src/NTwain/Triplets/DATDeviceEvent.cs +++ b/src/NTwain/Triplets/DATDeviceEvent.cs @@ -1,4 +1,5 @@ -using TWAINWorkingGroup; +using NTwain.DSM; +using TWAINWorkingGroup; namespace NTwain.Triplets { @@ -31,11 +32,11 @@ namespace NTwain.Triplets var ds = Session.CurrentSource; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryDeviceevent(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryDeviceevent(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); + rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); } } else if (TwainPlatform.IsMacOSX) @@ -44,11 +45,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX ds = Session.CurrentSource; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryDeviceevent(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryDeviceevent(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data); } } return rc; diff --git a/src/NTwain/Triplets/DATEntryPoint.cs b/src/NTwain/Triplets/DATEntryPoint.cs index 7b30187..308cbd3 100644 --- a/src/NTwain/Triplets/DATEntryPoint.cs +++ b/src/NTwain/Triplets/DATEntryPoint.cs @@ -1,4 +1,5 @@ -using System; +using NTwain.DSM; +using System; using System.Runtime.InteropServices; using TWAINWorkingGroup; @@ -53,14 +54,13 @@ namespace NTwain.Triplets if (TwainPlatform.IsWindows) { var app = Session.AppIdentity; - TW_IDENTITY_LEGACY dummy = default; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryEntrypoint(ref app, ref dummy, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryEntrypoint(ref app, ref dummy, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); + rc = (STS)WinNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); } } //else if (TwainPlatform.IsLinux) @@ -70,14 +70,13 @@ namespace NTwain.Triplets else if (TwainPlatform.IsMacOSX) { TW_IDENTITY_MACOSX app = Session.AppIdentity; - TW_IDENTITY_MACOSX dummy = default; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryEntrypoint(ref app, ref dummy, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryEntrypoint(ref app, ref dummy, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.ENTRYPOINT, msg, ref entry); } } return rc; diff --git a/src/NTwain/Triplets/DATIdentity.cs b/src/NTwain/Triplets/DATIdentity.cs index 330777c..0f6057a 100644 --- a/src/NTwain/Triplets/DATIdentity.cs +++ b/src/NTwain/Triplets/DATIdentity.cs @@ -1,4 +1,5 @@ -using System; +using NTwain.DSM; +using System; using TWAINWorkingGroup; namespace NTwain.Triplets @@ -128,11 +129,11 @@ namespace NTwain.Triplets var app = Session.AppIdentity; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryIdentity(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref ds); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref ds); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryIdentity(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref ds); + rc = (STS)WinNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref ds); } } else if (TwainPlatform.IsMacOSX) @@ -141,11 +142,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX osxds = ds; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryIdentity(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref osxds); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref osxds); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryIdentity(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref osxds); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.IDENTITY, msg, ref osxds); } ds = osxds; } diff --git a/src/NTwain/Triplets/DATParent.cs b/src/NTwain/Triplets/DATParent.cs index ab44f9b..79ba354 100644 --- a/src/NTwain/Triplets/DATParent.cs +++ b/src/NTwain/Triplets/DATParent.cs @@ -1,4 +1,5 @@ -using System; +using NTwain.DSM; +using System; using TWAINWorkingGroup; namespace NTwain.Triplets @@ -69,11 +70,11 @@ namespace NTwain.Triplets var app = Session.AppIdentity; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryParent(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryParent(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); + rc = (STS)WinNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); } if (rc == STS.SUCCESS) Session.AppIdentity = app; } @@ -88,11 +89,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX app = Session.AppIdentity; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryParent(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryParent(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.PARENT, msg, ref hwnd); } if (rc == STS.SUCCESS) { diff --git a/src/NTwain/Triplets/DATStatus.cs b/src/NTwain/Triplets/DATStatus.cs index 07f68ae..9906abd 100644 --- a/src/NTwain/Triplets/DATStatus.cs +++ b/src/NTwain/Triplets/DATStatus.cs @@ -1,4 +1,5 @@ -using System; +using NTwain.DSM; +using System; using TWAINWorkingGroup; namespace NTwain.Triplets @@ -26,11 +27,11 @@ namespace NTwain.Triplets var app = Session.AppIdentity; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryStatusState3(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryStatusState3(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)WinNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } } else if (TwainPlatform.IsMacOSX) @@ -38,11 +39,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX app = Session.AppIdentity; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryStatusState3(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryStatusState3(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } } return rc; @@ -63,11 +64,11 @@ namespace NTwain.Triplets var app = Session.AppIdentity; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryStatus(ref app, ref ds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryStatus(ref app, ref ds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } } else if (TwainPlatform.IsMacOSX) @@ -76,11 +77,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX osxds = ds; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryStatus(ref app, ref osxds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref osxds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryStatus(ref app, ref osxds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref osxds, DG.CONTROL, DAT.STATUS, MSG.GET, ref status); } } return rc; diff --git a/src/NTwain/Triplets/DATStatusUtf8.cs b/src/NTwain/Triplets/DATStatusUtf8.cs index 8c7621f..beb2d18 100644 --- a/src/NTwain/Triplets/DATStatusUtf8.cs +++ b/src/NTwain/Triplets/DATStatusUtf8.cs @@ -1,5 +1,5 @@ -using System; -using System.Text; +using NTwain.DSM; +using System; using TWAINWorkingGroup; namespace NTwain.Triplets @@ -30,14 +30,13 @@ namespace NTwain.Triplets if (TwainPlatform.IsWindows) { var app = Session.AppIdentity; - var ds = Session.CurrentSource; if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.WindowsTwain32DsmEntryStatusutf8(ref app, ref ds, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); + rc = (STS)WinLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); } else { - rc = (STS)NativeMethods.WindowsTwaindsmDsmEntryStatusutf8(ref app, ref ds, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); + rc = (STS)WinNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); } } else if (TwainPlatform.IsMacOSX) @@ -46,11 +45,11 @@ namespace NTwain.Triplets TW_IDENTITY_MACOSX ds = Session.CurrentSource; if (TwainPlatform.PreferLegacyDSM) { - rc = (STS)NativeMethods.MacosxTwainDsmEntryStatusutf8(ref app, ref ds, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); + rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); } else { - rc = (STS)NativeMethods.MacosxTwaindsmDsmEntryStatusutf8(ref app, ref ds, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); + rc = (STS)OSXNewDSM.DSM_Entry(ref app, IntPtr.Zero, DG.CONTROL, DAT.STATUSUTF8, MSG.GET, ref extendedStatus); } } return rc;