mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
Tried to generate linux DSM files.
This commit is contained in:
parent
5bd4a42015
commit
0d75d44d30
@ -6,14 +6,17 @@
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension="dummy" #>
|
||||
<#
|
||||
List<(string, string, string)> className_dllPath_identityStruct = new() {
|
||||
List<(string className, string dllPath, string identityClass)> outputs = new() {
|
||||
("OSXLegacyDSM", "/System/Library/Frameworks/framework/TWAIN", "TW_IDENTITY_MACOSX"),
|
||||
("OSXNewDSM", "/Library/Frameworks/TWAINDSM.framework/TWAINDSM", "TW_IDENTITY_MACOSX"),
|
||||
("LinuxDSM", "/usr/local/lib/libtwaindsm.so", "TW_IDENTITY_LEGACY"),
|
||||
("Linux64DSM", "/usr/local/lib64/libtwaindsm.so", "TW_IDENTITY_LEGACY"),
|
||||
("LinuxBotched64DSM", "/usr/local/lib/libtwaindsm.so.2.3.2", "TW_IDENTITY"),
|
||||
("WinLegacyDSM", "twain_32.dll", "TW_IDENTITY_LEGACY"),
|
||||
("WinNewDSM", "twaindsm.dll", "TW_IDENTITY_LEGACY")
|
||||
};
|
||||
|
||||
foreach(var file in className_dllPath_identityStruct) {
|
||||
foreach(var file in outputs) {
|
||||
#>
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
@ -22,173 +25,173 @@ using System.Runtime.InteropServices;
|
||||
namespace NTwain.DSM
|
||||
{
|
||||
/// <summary>
|
||||
/// Low-level pinvoke methods using <#= file.Item2 #>.
|
||||
/// Low-level pinvoke methods using <#= file.dllPath #>.
|
||||
/// </summary>
|
||||
public static class <#= file.Item1 #>
|
||||
public static class <#= file.className #>
|
||||
{
|
||||
const string DsmName = "<#= file.Item2 #>";
|
||||
const string DsmName = "<#= file.dllPath #>";
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr hwnd
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr mem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref <#= file.Item3 #> twidentity
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref <#= file.identityClass #> twidentity
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUSUTF8 twstatusutf8
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, IntPtr dest,
|
||||
ref <#= file.identityClass #> origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_ENTRYPOINT twentrypoint
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_DEVICEEVENT twdeviceevent
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CUSTOMDSDATA twcustomedsdata
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK twcallback
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_USERINTERFACE userinterface
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_EVENT evt
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PENDINGXFERS pendingxfers
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPMEMXFER memxfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPFILEXFER filexfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PASSTHRU passthru
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_FILESYSTEM filesystem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CAPABILITY cap
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref <#= file.Item3 #> origin, ref <#= file.Item3 #> dest,
|
||||
ref <#= file.identityClass #> origin, ref <#= file.identityClass #> dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_AUDIOINFO auioinfo
|
||||
);
|
||||
}
|
||||
}
|
||||
<#
|
||||
SaveOutput(file.Item1 + ".cs");
|
||||
SaveOutput(file.className + ".cs");
|
||||
}#>
|
||||
|
||||
<#+
|
||||
|
172
src/NTwain/DSM/Linux64DSM.cs
Normal file
172
src/NTwain/DSM/Linux64DSM.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NTwain.DSM
|
||||
{
|
||||
/// <summary>
|
||||
/// Low-level pinvoke methods using /usr/local/lib64/libtwaindsm.so.
|
||||
/// </summary>
|
||||
public static class Linux64DSM
|
||||
{
|
||||
const string DsmName = "/usr/local/lib64/libtwaindsm.so";
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr hwnd
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr mem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUSUTF8 twstatusutf8
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_ENTRYPOINT twentrypoint
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CUSTOMDSDATA twcustomedsdata
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK twcallback
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_USERINTERFACE userinterface
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_EVENT evt
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PENDINGXFERS pendingxfers
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPMEMXFER memxfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPFILEXFER filexfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PASSTHRU passthru
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_FILESYSTEM filesystem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CAPABILITY cap
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_AUDIOINFO auioinfo
|
||||
);
|
||||
}
|
||||
}
|
172
src/NTwain/DSM/LinuxBotched64DSM.cs
Normal file
172
src/NTwain/DSM/LinuxBotched64DSM.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NTwain.DSM
|
||||
{
|
||||
/// <summary>
|
||||
/// Low-level pinvoke methods using /usr/local/lib/libtwaindsm.so.2.3.2.
|
||||
/// </summary>
|
||||
public static class LinuxBotched64DSM
|
||||
{
|
||||
const string DsmName = "/usr/local/lib/libtwaindsm.so.2.3.2";
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr hwnd
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr mem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_IDENTITY twidentity
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUSUTF8 twstatusutf8
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_ENTRYPOINT twentrypoint
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_DEVICEEVENT twdeviceevent
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CUSTOMDSDATA twcustomedsdata
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK twcallback
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_USERINTERFACE userinterface
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_EVENT evt
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PENDINGXFERS pendingxfers
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPMEMXFER memxfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPFILEXFER filexfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PASSTHRU passthru
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_FILESYSTEM filesystem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CAPABILITY cap
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY origin, ref TW_IDENTITY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_AUDIOINFO auioinfo
|
||||
);
|
||||
}
|
||||
}
|
172
src/NTwain/DSM/LinuxDSM.cs
Normal file
172
src/NTwain/DSM/LinuxDSM.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NTwain.DSM
|
||||
{
|
||||
/// <summary>
|
||||
/// Low-level pinvoke methods using /usr/local/lib/libtwaindsm.so.
|
||||
/// </summary>
|
||||
public static class LinuxDSM
|
||||
{
|
||||
const string DsmName = "/usr/local/lib/libtwaindsm.so";
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr hwnd
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, IntPtr zero
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref IntPtr mem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUS twstatus
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_STATUSUTF8 twstatusutf8
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, IntPtr dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_ENTRYPOINT twentrypoint
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort 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)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CUSTOMDSDATA twcustomedsdata
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK twcallback
|
||||
);
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_USERINTERFACE userinterface
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_EVENT evt
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PENDINGXFERS pendingxfers
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPMEMXFER memxfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_SETUPFILEXFER filexfer
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_PASSTHRU passthru
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_FILESYSTEM filesystem
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CAPABILITY cap
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
public static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_AUDIOINFO auioinfo
|
||||
);
|
||||
}
|
||||
}
|
@ -3,5 +3,8 @@ This is the lowest API level of the lib and should not
|
||||
be used directly unless you know what you're doing.
|
||||
|
||||
A higher level abstraction such as the ones in the
|
||||
Triplets namespace or the TwainSession object
|
||||
`Triplets` namespace or the `TwainSession` object
|
||||
would be easier to use.
|
||||
|
||||
The individual classes are generated by the
|
||||
`DSMGenerator.tt` file.
|
@ -6,6 +6,6 @@ Version initially used is 2.5.0.0.
|
||||
I just couldn't trust myself with making correct struct definitions
|
||||
so used those instead.
|
||||
|
||||
The TWAINH.cs file are minimally modified so they could be updated
|
||||
The `TWAINH.cs` file are minimally modified so they could be updated
|
||||
easily should I need to. Most modifications are added in
|
||||
TWAINH_EXTRAS.cs.
|
||||
`TWAINH_EXTRAS.cs.`
|
||||
|
Loading…
Reference in New Issue
Block a user