Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 167915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:21:37+00:00 2026-05-11T12:21:37+00:00

I have a Windows application that HAS to run as 32-bits (because of other

  • 0

I have a Windows application that HAS to run as 32-bits (because of other limitations out of my control). However, my application has to call and access a driver which may be 32-bits or 64-bits depending on the system where it is installed.

I access the driver through DeviceIoControl() calls, exchanging data structures declared in an include file. Data structures contains fields declared as ‘DWORD_PTR’ (the include file I don’t control either).

My problem is that on a 64-bits system, the driver expects the structures to contain 64-bits integer (because of DWORD_PTR declaration). However, my 32-bits program sees those DWORD_PTR as 32-bits integers. I then have a data mismatch between my program version of the data structures and the driver understanding of those structures.

DeviceIoControl() ends-up failing with ERROR_INSUFFICIENT_BUFFER (The data area passed to a system call is too small). I confirmed that I don’t get this error if I pass a 64-bits version of the structs to the driver.

I have a few ugly options out of this mess. But I wonder if anyone has some nicer suggestions?


Solution:

  • Declare a new copy of the shared structures with REAL 64-bits data fields (__int64)
  • Dynamically check the OS architecture (32/64)
  • Use the 32-bits or 64-bits version of the structures for the DeviceIoControl() calls.

Drawbacks:

  • I have to maintain an explicit 64-bits copy of the structures declaration manually. It can be a pain over time.

My other solutions are variation of this one, but they ALWAYS involve maintaining some copy of the structures definition (for example in an IDL for COM servers option).

Edit: This is a Microsoft driver and it seems it does not use IoIs32bitsProcess(irp)!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:21:37+00:00Added an answer on May 11, 2026 at 12:21 pm

    You maintain both 32-bit and 64-bit version of structures and implement special handling via IoIs32BitProcess(irp) function in device driver DEVICE_CONTROL handler and convert it to 64-bit structure whenever needed. This is the common way of doing it.

    Here is a good amount of documentation about it on MSDN.

    Since you later mentioned you don’t have control over driver source code, I suggest you to maintain your own variant for 32-bit on 64-bit and send the right one checking the OS architecture. It looks like structure declarations are not done properly for the driver.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET Windows application in the production that has no access to
I have a Windows application that has 2 Forms . From one form I
Scenario I have a C# windows forms application that has a number of processes.
I have an mvc application that has been coded to use Windows authentication and
We have an application that has a primary window, it can launch multiple other
I have a Delphi 2007 application that has a TAnimate control with a FindFile
I have several smart devices that run Windows CE5 with our application written in
I have an application that has a main UI and two modeless windows that
I have an application that has been getting strange errors when canceling out of
Today we have a windows application that, using an OCX, creates a web page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.