Home › Forums › TWAIN Classic › Failure w/TwainDSM.dll on OPENDSM when ProductName is NULL
- This topic has 1 reply, 2 voices, and was last updated 14 years, 4 months ago by retro.
- AuthorPosts
When loading Twain_32.dll, I was able to pass a TW_IDENTITY structure representing the application (pOrigin) with the bare minimum values. All TW_STR32 values were initialized to NULL. A call to DG_CONTROL, DAT_PARENT, MSG_OPENDSM would succeed.
When loading TwainDSM.dll, passing the same initialized TW_IDENTITY structure representing the application (pOrigin) results in the twain function returning TWRC_FAILURE. If I simply put one character in the ProductName field, then the triplet succeeds.
Is this a bug or by design?
I’m using TWAINDSM.dll – 2.0.9.0
TW_IDENTITY AppID;
ZeroMemory(&AppID, sizeof(TW_IDENTITY));
AppID.Version.MajorNum = 1;
AppID.Version.MinorNum = 0;
AppID.Version.Language = TWLG_ENGLISH_USA;
AppID.Version.Country = TWCY_USA;
AppID.ProtocolMajor = TWON_PROTOCOLMAJOR;
AppID.ProtocolMinor = TWON_PROTOCOLMINOR;
AppID.SupportedGroups = DG_IMAGE | DG_CONTROL;
lstrcpy (AppID.Version.Info, _T("Version 1.0"));
lstrcpy(AppID.Manufacturer, _T("Manufacturer"));
lstrcpy(AppID.ProductFamily, _T("Product Family"));Works:
lstrcpy(AppID.ProductName, "a");
Doesn’t not work:
lstrcpy(AppID.ProductName, "");
Hi,
i am not a designer of twain, but according to the spec, which says:
The application must allocate a structure of type TW_IDENTITY and fill in all fields except
for the Id field. Once the structure is prepared, this
pOrigin parameter should point at that structure.I would asume that it is expected that the Product name is not NULL.
I have seen this behavior myself and have corrected the TW_IDENTITY structure which is given to twain.
Nice regards,
Martin Haimberger- AuthorPosts