Made my own dsm pinvokes for what I need.

This commit is contained in:
Eugene Wang
2023-04-01 23:02:02 -04:00
parent d6438c2f54
commit 94fc3f623c
11 changed files with 434 additions and 43 deletions

View File

@@ -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
);
}
}

View File

@@ -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
);
}
}

View File

@@ -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
);
}
}

View File

@@ -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
);
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;