diff --git a/src/NTwain/Triplets/Control/SetupFileXfer.cs b/src/NTwain/Triplets/Control/SetupFileXfer.cs
new file mode 100644
index 0000000..1e713a9
--- /dev/null
+++ b/src/NTwain/Triplets/Control/SetupFileXfer.cs
@@ -0,0 +1,88 @@
+using NTwain.Data;
+using NTwain.Internals;
+
+namespace NTwain.Triplets.Control
+{
+ ///
+ /// Represents .
+ ///
+ public sealed class SetupFileXfer : BaseTriplet
+ {
+ internal SetupFileXfer(TwainSession session) : base(session) { }
+
+ ReturnCode DoIt(Message msg, ref TW_SETUPFILEXFER xfer)
+ {
+ if (Is32Bit)
+ {
+ if (IsWin)
+ return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+ if (IsLinux)
+ return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+ if (IsMac)
+ return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+ }
+
+ if (IsWin)
+ return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+ if (IsLinux)
+ return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+ if (IsMac)
+ return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.SetupFileXfer, msg, ref xfer);
+
+ return ReturnCode.Failure;
+ }
+
+ ///
+ /// Returns information about the file into which the Source has or will put the acquired image
+ /// or audio data.
+ ///
+ /// The setup file xfer.
+ ///
+ public ReturnCode Get(ref TW_SETUPFILEXFER setupFileXfer)
+ {
+ return DoIt(Message.Get, ref setupFileXfer);
+ }
+
+ ///
+ /// Returns information for the default image or audio file.
+ ///
+ /// The setup file xfer.
+ ///
+ public ReturnCode GetDefault(ref TW_SETUPFILEXFER setupFileXfer)
+ {
+ return DoIt(Message.GetDefault, ref setupFileXfer);
+ }
+
+ ///
+ /// Resets the current file information to the image or audio default file information and
+ /// returns that default information.
+ ///
+ /// The setup file xfer.
+ ///
+ public ReturnCode Reset(ref TW_SETUPFILEXFER setupFileXfer)
+ {
+ return DoIt(Message.Reset, ref setupFileXfer);
+ }
+
+ ///
+ /// Sets the file transfer information for the next file transfer. The application is responsible for
+ /// verifying that the specified file name is valid and that the file either does not currently exist (in
+ /// which case, the Source is to create the file), or that the existing file is available for opening and
+ /// read/write operations. The application should also assure that the file format it is requesting
+ /// can be provided by the Source
+ ///
+ /// The setup file xfer.
+ ///
+ public ReturnCode Set(ref TW_SETUPFILEXFER setupFileXfer)
+ {
+ return DoIt(Message.Set, ref setupFileXfer);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/NTwain/Triplets/DGControl.cs b/src/NTwain/Triplets/DGControl.cs
index 4c38499..fbd9b1a 100644
--- a/src/NTwain/Triplets/DGControl.cs
+++ b/src/NTwain/Triplets/DGControl.cs
@@ -63,6 +63,12 @@ namespace NTwain.Triplets
///
public SetupMemXfer SetupMemXfer => _memXfer ?? (_memXfer = new SetupMemXfer(Session));
+ SetupFileXfer _fileXfer;
+ ///
+ /// Gets the operations defined for DAT_SETUPFILEXFER.
+ ///
+ public SetupFileXfer SetupFileXfer => _fileXfer ?? (_fileXfer = new SetupFileXfer(Session));
+
FileSystem _fs;
///
/// Gets the operations defined for DAT_FILESYSTEM.
diff --git a/src/NTwain/TwainSession.MsgHandling.cs b/src/NTwain/TwainSession.MsgHandling.cs
index eb4610b..6072eb6 100644
--- a/src/NTwain/TwainSession.MsgHandling.cs
+++ b/src/NTwain/TwainSession.MsgHandling.cs
@@ -106,7 +106,7 @@ namespace NTwain
var xMech = GetTransferMechs();
TW_PENDINGXFERS pending = default;
- var rc = DGControl.PendingXfers.Get(pending);
+ var rc = DGControl.PendingXfers.Get(ref pending);
if (rc == ReturnCode.Success)
{
do
@@ -122,7 +122,7 @@ namespace NTwain
if (readyArgs.CancelAll || _disableDSNow)
{
- rc = DGControl.PendingXfers.Reset(pending);
+ rc = DGControl.PendingXfers.Reset(ref pending);
}
else
{
@@ -165,11 +165,11 @@ namespace NTwain
if (rc != ReturnCode.Success)// && StopOnTransferError)
{
// end xfer without setting rc to exit (good/bad?)
- DGControl.PendingXfers.Reset(pending);
+ DGControl.PendingXfers.Reset(ref pending);
}
else
{
- rc = DGControl.PendingXfers.EndXfer(pending);
+ rc = DGControl.PendingXfers.EndXfer(ref pending);
}
}
#endregion