TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

How to detect DF_DSM2 flag correctly?

Forums › TWAIN Classic › How to detect DF_DSM2 flag correctly?

  • This topic has 1 reply, 1 voice, and was last updated 6 years, 7 months ago by Michael.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • August 21, 2014 at 6:26 am #22966 Reply
    Michael
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Hi, everyone!

    I defined DF_ flags in accordance with “twain.h” file:

    #define DF_DSM2 0x10000000L
    #define DF_APP2 0x20000000L
    #define DF_DS2 0x40000000L

    It means that all these flas reside in the high byte of 32bit TW_IDENTITY.SupportedGroups field.

    Then I initialized TW_IDENTITY.SupportedGroups as “DF_APP2 | DG_CONTROL | DG_IMAGE” which in binary is “0010 0000 0000 0000 0000 0000 0000 0011”. That’s OK so far.

    After executing of “DG_CONTROL, DAT_PARENT, MSG_OPENDSM” the TW_IDENTITY.SupportedGroups is “0010 0000 0000 0001 0000 0000 0000 0011”.

    That is DSM set a bit but it doesn’t look like DF_DSM2. What’s wrong? Is something wrong with data alignment in my TW_IDENTITY structure? Or DSM allways
    set bit in a middle of 32bit value?

    I would appreciate any help.

    August 21, 2014 at 7:39 am #26182 Reply
    Michael
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Yes! It was C++ structure data alignment!

    I used “#pragma pack(push, 2)” and found DF_DSM2 flag in its correct place.

    But i’m stilll confused. Does DSM receive pointer to application’s TW_IDENTITY structure and then use fixed byte offset to find SupportedGroups field? Weird…

    Anyway, “all-clear”! Thanks.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How to detect DF_DSM2 flag correctly?
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • PDF/R For who and where?
  • Making searchable PDF with PDF/R
  • Backward compatibility with PDF/A and traditional PDF
  • could not open the twain source. Make sure there is a valid source for your sca
  • Changing TWAIN driver defaults
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.