Added placeholder methods for all to be supported archtectures.

This commit is contained in:
Eugene Wang
2018-11-17 10:55:37 -05:00
parent a73df1320f
commit 12d74b88f5
23 changed files with 1875 additions and 175 deletions

View File

@@ -12,27 +12,27 @@ namespace NTwain
/// <summary>
/// Gets the source name.
/// </summary>
public string Name => Identity.ProductName;
public string Name => Identity32.ProductName;
/// <summary>
/// Gets the source's manufacturer name.
/// </summary>
public string Manufacturer => Identity.Manufacturer;
public string Manufacturer => Identity32.Manufacturer;
/// <summary>
/// Gets the source's product family.
/// </summary>
public string ProductFamily => Identity.ProductFamily;
public string ProductFamily => Identity32.ProductFamily;
/// <summary>
/// Gets the source's version info.
/// </summary>
public TW_VERSION Version => Identity.Version;
public TW_VERSION Version => Identity32.Version;
/// <summary>
/// Gets the supported data group.
/// </summary>
public DataGroups DataGroup => Identity.DataGroup;
public DataGroups DataGroup => Identity32.DataGroup;
/// <summary>
/// Gets the supported TWAIN protocol version.

View File

@@ -13,12 +13,12 @@ namespace NTwain
{
internal readonly TwainSession Session;
internal TW_IDENTITY Identity { get; }
internal TW_IDENTITY Identity32 { get; }
internal DataSource(TwainSession session, TW_IDENTITY src)
{
this.Session = session;
this.Identity = src;
this.Identity32 = src;
ProtocolVersion = new Version(src.ProtocolMajor, src.ProtocolMinor);
}
@@ -26,13 +26,13 @@ namespace NTwain
/// Opens the source for capability negotiation.
/// </summary>
/// <returns></returns>
public ReturnCode Open() => Session.DGControl.Identity.OpenDS(Identity);
public ReturnCode Open() => Session.DGControl.Identity.OpenDS(Identity32);
/// <summary>
/// Closes the source.
/// </summary>
/// <returns></returns>
public ReturnCode Close() => Session.DGControl.Identity.CloseDS(Identity);
public ReturnCode Close() => Session.DGControl.Identity.CloseDS(Identity32);
/// <summary>
@@ -42,7 +42,7 @@ namespace NTwain
public TW_STATUS GetStatus()
{
TW_STATUS stat = default;
var rc = Session.DGControl.Status.GetSourceStatus(ref stat);
var rc = Session.DGControl.Status.Get(ref stat, this);
return stat;
}

View File

@@ -20,15 +20,27 @@ namespace NTwain.Triplets
protected BaseTriplet(TwainSession session)
{
this.Session = session ?? throw new ArgumentNullException(nameof(session));
// windows can always use 32bit structs even in 64bit app
Use32BitData = session.Config.Platform == System.PlatformID.Win32NT ||
!session.Config.Is64Bit;
Is32Bit = session.Config.Is32Bit;
IsWin = session.Config.Platform == System.PlatformID.Win32NT;
IsLinux = session.Config.Platform == System.PlatformID.Unix;
IsMac = session.Config.Platform == System.PlatformID.MacOSX;
}
/// <summary>
/// Whether to use 32bit data structures.
/// </summary>
protected readonly bool Use32BitData;
protected readonly bool Is32Bit;
/// <summary>
/// Whether platform is Windows.
/// </summary>
protected readonly bool IsWin;
/// <summary>
/// Whether platform is Linux.
/// </summary>
protected readonly bool IsLinux;
/// Whether platform is MacOS.
protected readonly bool IsMac;
}
}

View File

@@ -3,18 +3,36 @@ using NTwain.Internals;
namespace NTwain.Triplets.Control
{
sealed class Callback : BaseTriplet
{
internal Callback(TwainSession session) : base(session) { }
sealed class Callback : BaseTriplet
{
internal Callback(TwainSession session) : base(session) { }
public ReturnCode RegisterCallback(ref TW_CALLBACK callback)
public ReturnCode RegisterCallback(ref TW_CALLBACK callback)
{
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
return ReturnCode.Failure;
}
}
}
}

View File

@@ -7,13 +7,31 @@ namespace NTwain.Triplets.Control
{
internal Callback2(TwainSession session) : base(session) { }
public ReturnCode RegisterCallback(ref TW_CALLBACK2 callback)
public ReturnCode RegisterCallback(ref TW_CALLBACK2 callback2)
{
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
return ReturnCode.Failure;
}
}

View File

@@ -7,13 +7,31 @@ namespace NTwain.Triplets.Control
{
internal DeviceEvent(TwainSession session) : base(session) { }
public ReturnCode Get(ref TW_DEVICEEVENT sourceDeviceEvent)
public ReturnCode Get(ref TW_DEVICEEVENT evt)
{
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref sourceDeviceEvent);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
return ReturnCode.Failure;
}
}

View File

@@ -10,14 +10,32 @@ namespace NTwain.Triplets.Control
{
internal EntryPoint(TwainSession session) : base(session) { }
public ReturnCode Get(out TW_ENTRYPOINT entryPoint)
public ReturnCode Get(out TW_ENTRYPOINT entry)
{
entryPoint = new TW_ENTRYPOINT();
if (Use32BitData)
entry = new TW_ENTRYPOINT();
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, null,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entryPoint);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
return ReturnCode.Failure;
}
}

View File

@@ -12,10 +12,29 @@ namespace NTwain.Triplets.Control
{
var rc = ReturnCode.Failure;
if (Use32BitData)
if (Is32Bit)
{
rc = NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
}
if (rc == ReturnCode.Success)
@@ -26,45 +45,34 @@ namespace NTwain.Triplets.Control
return rc;
}
public ReturnCode GetDefault(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
}
return ReturnCode.Failure;
}
public ReturnCode GetFirst(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
}
return ReturnCode.Failure;
}
public ReturnCode GetNext(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
}
public ReturnCode OpenDS(TW_IDENTITY source)
{
Session.StepDown(TwainState.DsmOpened);
var rc = ReturnCode.Failure;
if (Use32BitData)
if (Is32Bit)
{
rc = NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
}
if (rc == ReturnCode.Success)
@@ -76,24 +84,147 @@ namespace NTwain.Triplets.Control
return rc;
}
public ReturnCode GetDefault(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
return ReturnCode.Failure;
}
public ReturnCode GetFirst(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
return ReturnCode.Failure;
}
public ReturnCode GetNext(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
return ReturnCode.Failure;
}
public ReturnCode Set(DataSource source)
{
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
return ReturnCode.Failure;
}
public ReturnCode UserSelect(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
return ReturnCode.Failure;
}
}

View File

@@ -16,10 +16,32 @@ namespace NTwain.Triplets.Control
bool isDsm2 = false;
if (Use32BitData)
if (Is32Bit)
{
rc = NativeMethods.Dsm32(Session.Config.App32, null,
DataGroups.Control, DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
isDsm2 = rc == ReturnCode.Success &&
(Session.Config.App32.DataFlags & DataFlags.DSM2) == DataFlags.DSM2;
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
isDsm2 = rc == ReturnCode.Success &&
(Session.Config.App32.DataFlags & DataFlags.DSM2) == DataFlags.DSM2;
@@ -45,10 +67,29 @@ namespace NTwain.Triplets.Control
{
var rc = ReturnCode.Failure;
if (Use32BitData)
if (Is32Bit)
{
rc = NativeMethods.Dsm32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
}
if (rc == ReturnCode.Success)

View File

@@ -7,23 +7,30 @@ namespace NTwain.Triplets.Control
{
internal Status(TwainSession session) : base(session) { }
public ReturnCode GetManagerStatus(ref TW_STATUS status)
public ReturnCode Get(ref TW_STATUS status, DataSource source)
{
if (Use32BitData)
if (Is32Bit)
{
return NativeMethods.Dsm32(Session.Config.App32, null,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
}
return ReturnCode.Failure;
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
public ReturnCode GetSourceStatus(ref TW_STATUS status)
{
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
}
return ReturnCode.Failure;
}
}

View File

@@ -10,16 +10,35 @@ namespace NTwain.Triplets.Control
{
internal StatusUtf8(TwainSession session) : base(session) { }
public ReturnCode Get(ref TW_STATUS status, out string message)
public ReturnCode Get(ref TW_STATUS status, DataSource source, out string message)
{
message = null;
var rc = ReturnCode.Failure;
TW_STATUSUTF8 real = new TW_STATUSUTF8 { Status = status };
if (Use32BitData)
if (Is32Bit)
{
rc = NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource?.Identity,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
}
if (rc == ReturnCode.Success)

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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,
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,
ref DataGroups 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,
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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,
ref TW_CUSTOMDSDATA 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,
ref TW_DEVICEEVENT 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,
ref TW_CALLBACK 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,
ref TW_CALLBACK2 data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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,
ref TW_EVENT 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,
ref TW_FILESYSTEM data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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,
ref TW_PASSTHRU 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,
ref TW_PENDINGXFERS 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,
ref TW_SETUPFILEXFER 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,
ref TW_SETUPMEMXFER 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,
ref TW_STATUSUTF8 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,
ref TW_USERINTERFACE 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,
ref TW_CIECOLOR 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,
ref TW_EXTIMAGEINFO 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,
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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,
ref TW_IMAGEINFO 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,
ref TW_IMAGELAYOUT 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,
ref TW_IMAGEMEMXFER 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,
ref TW_JPEGCOMPRESSION 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,
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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,
ref TW_STATUS 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,
ref TW_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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,
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,
ref DataGroups 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,
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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,
ref TW_CUSTOMDSDATA 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,
ref TW_DEVICEEVENT 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,
ref TW_CALLBACK 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,
ref TW_CALLBACK2 data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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,
ref TW_EVENT 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,
ref TW_FILESYSTEM data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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,
ref TW_PASSTHRU 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,
ref TW_PENDINGXFERS 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,
ref TW_SETUPFILEXFER 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,
ref TW_SETUPMEMXFER 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,
ref TW_STATUSUTF8 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,
ref TW_USERINTERFACE 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,
ref TW_CIECOLOR 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,
ref TW_EXTIMAGEINFO 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,
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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,
ref TW_IMAGEINFO 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,
ref TW_IMAGELAYOUT 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,
ref TW_IMAGEMEMXFER 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,
ref TW_JPEGCOMPRESSION 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,
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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,
ref TW_STATUS 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,
ref TW_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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,
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,
ref DataGroups 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,
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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,
ref TW_CUSTOMDSDATA 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,
ref TW_DEVICEEVENT 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,
ref TW_CALLBACK 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,
ref TW_CALLBACK2 data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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,
ref TW_EVENT 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,
ref TW_FILESYSTEM data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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,
ref TW_PASSTHRU 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,
ref TW_PENDINGXFERS 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,
ref TW_SETUPFILEXFER 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,
ref TW_SETUPMEMXFER 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,
ref TW_STATUSUTF8 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,
ref TW_USERINTERFACE 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,
ref TW_CIECOLOR 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,
ref TW_EXTIMAGEINFO 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,
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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,
ref TW_IMAGEINFO 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,
ref TW_IMAGELAYOUT 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,
ref TW_IMAGEMEMXFER 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,
ref TW_JPEGCOMPRESSION 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,
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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,
ref TW_STATUS 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,
ref TW_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref IntPtr data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref DataGroups data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_CUSTOMDSDATA data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_DEVICEEVENT data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_CALLBACK data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_CALLBACK2 data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_EVENT data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_FILESYSTEM data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_PASSTHRU data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_PENDINGXFERS data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_SETUPFILEXFER data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_SETUPMEMXFER data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_STATUSUTF8 data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_USERINTERFACE data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_CIECOLOR data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_EXTIMAGEINFO data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_IMAGEINFO data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_IMAGELAYOUT data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_IMAGEMEMXFER data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_JPEGCOMPRESSION data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_STATUS data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref TW_MEMORY data);
}
}

View File

@@ -9,8 +9,8 @@ namespace NTwain.Triplets
{
static partial class NativeMethods
{
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -18,8 +18,8 @@ namespace NTwain.Triplets
Message msg,
ref IntPtr data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -27,8 +27,8 @@ namespace NTwain.Triplets
Message msg,
ref DataGroups data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -37,7 +37,7 @@ namespace NTwain.Triplets
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32(
//public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
@@ -45,8 +45,8 @@ namespace NTwain.Triplets
// Message msg,
// ref TWCapability data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -54,8 +54,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_CUSTOMDSDATA data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -63,8 +63,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_DEVICEEVENT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -72,8 +72,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_CALLBACK data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -81,17 +81,17 @@ namespace NTwain.Triplets
Message msg,
ref TW_CALLBACK2 data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -99,8 +99,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_EVENT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -108,8 +108,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_FILESYSTEM data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
@@ -117,8 +117,8 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TW_IDENTITY data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -126,8 +126,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_PASSTHRU data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -135,8 +135,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_PENDINGXFERS data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -144,8 +144,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_SETUPFILEXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -153,8 +153,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_SETUPMEMXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -162,8 +162,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_STATUSUTF8 data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -171,8 +171,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_USERINTERFACE data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -180,8 +180,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_CIECOLOR data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -189,8 +189,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_EXTIMAGEINFO data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -199,7 +199,7 @@ namespace NTwain.Triplets
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32(
//public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
@@ -207,8 +207,8 @@ namespace NTwain.Triplets
// Message msg,
// ref TWGrayResponse data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -216,8 +216,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_IMAGEINFO data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -225,8 +225,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_IMAGELAYOUT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -234,8 +234,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_IMAGEMEMXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -243,8 +243,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_JPEGCOMPRESSION data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -253,7 +253,7 @@ namespace NTwain.Triplets
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32(
//public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
@@ -261,8 +261,8 @@ namespace NTwain.Triplets
// Message msg,
// ref TWRgbResponse data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
@@ -270,8 +270,8 @@ namespace NTwain.Triplets
Message msg,
ref TW_STATUS data);
[DllImport(WinDsmDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32(
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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,
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,
ref DataGroups 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,
ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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,
ref TW_CUSTOMDSDATA 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,
ref TW_DEVICEEVENT 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,
ref TW_CALLBACK 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,
ref TW_CALLBACK2 data);
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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,
ref TW_EVENT 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,
ref TW_FILESYSTEM data);
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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,
ref TW_PASSTHRU 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,
ref TW_PENDINGXFERS 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,
ref TW_SETUPFILEXFER 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,
ref TW_SETUPMEMXFER 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,
ref TW_STATUSUTF8 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,
ref TW_USERINTERFACE 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,
ref TW_CIECOLOR 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,
ref TW_EXTIMAGEINFO 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,
ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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,
ref TW_IMAGEINFO 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,
ref TW_IMAGELAYOUT 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,
ref TW_IMAGEMEMXFER 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,
ref TW_JPEGCOMPRESSION 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,
ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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,
ref TW_STATUS 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,
ref TW_MEMORY data);
}
}

View File

@@ -10,9 +10,10 @@ namespace NTwain.Triplets
{
const string EntryName = "DSM_Entry";
const string WinDsmDll = "twaindsm.dll";
const string LinuxDsmDll = "/usr/local/lib/libtwaindsm.so";
const string MacDsmDll = "/Library/Frameworks/TWAINDSM.framework/TWAINDSM";
const string WinDll = "twaindsm.dll";
const string LinuxDll = "/usr/local/lib/libtwaindsm.so";
const string Mac32Dll = "/System/Library/Frameworks/TWAIN.framework/TWAIN";
const string Mac64Dll = "/Library/Frameworks/TWAINDSM.framework/TWAINDSM";
}
}

View File

@@ -17,9 +17,9 @@ namespace NTwain
internal TwainConfig() { }
/// <summary>
/// Gets whether the app is running in 64bit.
/// Gets whether the app is running in 32bit.
/// </summary>
public bool Is64Bit { get; internal set; }
public bool Is32Bit { get; internal set; }
/// <summary>
/// Gets the platform the app is running on.

View File

@@ -17,7 +17,7 @@ namespace NTwain
private string _companyName;
private Language _lang;
private DataGroups _dg = DataGroups.Image;
private bool _64bit;
private bool _32bit;
private PlatformID _platform;
private Country _country;
@@ -26,7 +26,7 @@ namespace NTwain
/// </summary>
public TwainConfigBuilder()
{
_64bit = IntPtr.Size == 8;
_32bit = IntPtr.Size == 4;
_platform = Environment.OSVersion.Platform;
}
@@ -108,7 +108,7 @@ namespace NTwain
var config = new TwainConfig
{
Platform = _platform,
Is64Bit = _64bit
Is32Bit = _32bit
};
// todo: change id based on platform

View File

@@ -74,7 +74,7 @@ namespace NTwain
if (rc != ReturnCode.Success) return rc;
break;
case TwainState.SourceOpened:
rc = DGControl.Identity.CloseDS(CurrentSource.Identity);
rc = DGControl.Identity.CloseDS(CurrentSource.Identity32);
if (rc != ReturnCode.Success) return rc;
break;
}
@@ -89,7 +89,7 @@ namespace NTwain
public TW_STATUS GetStatus()
{
TW_STATUS stat = default;
var rc = DGControl.Status.GetManagerStatus(ref stat);
var rc = DGControl.Status.Get(ref stat, null);
return stat;
}
@@ -97,10 +97,11 @@ namespace NTwain
/// Gets the translated string for a <see cref="TW_STATUS"/>.
/// </summary>
/// <param name="status"></param>
/// <param name="source"></param>
/// <returns></returns>
public string GetLocalizedStatus(ref TW_STATUS status)
public string GetLocalizedStatus(ref TW_STATUS status, DataSource source = null)
{
var rc = DGControl.StatusUtf8.Get(ref status, out string message);
var rc = DGControl.StatusUtf8.Get(ref status, source, out string message);
return message;
}