Porting 32 application to 64 bit driver in Windows

What is the proper way to port a 32 bit application to a 64 bit driver?  My application needs to pass Structs to the 64 bit driver in order to share allocated memory.  These structures often contain pointers which result in a byte offsets in the kernel driver.

How can I use a 32 bit pointer in the 64 bit kernel?  User code is written in c++ and kernel code is in c.  I am working in VS2010 on a Win7x64 machine.

I would like to keep the user code compatible with both x86 and x64 to make builds/deployments easier in the future.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>How can I use a 32 bit pointer in the 64 bit kernel?

In short: You can't. Unlike during the transistion from 16 to 32bits almost 20 years earlier, MS is not providing any mechanism for 32 and 64bit modules to directly interact. The easiest way is probably to just compile your application as 64bit. This  is quite straightfoward, just add a x64 build target in your configuration manager.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
efryevtAuthor Commented:

Thanks for the info.  The problem is that this application uses DirectX for managed code.  To my understanding, there is no release of DirectX for managed code that supports a x64 build. I will look into this more, though.

I would really like to simply copy my structs from the user mode to the kernel.  I have tried creating "intermediate" structs in the kernel that have the same byte packing (ie.  making pointers Ptr32) and this does allow me to copy the struct.  Then I assign each member independently from the "intermediate" to my kernel struct.  However, the problem still exists of how do I handle the pointers.
Wait a minute, there has to be a DirectX version for x64 - at least I'm at a W7/64 machine now and just run DxDiag to be sure. Not sure waht you mean with "for managed code" (other than some .NET stuff is involved), but you need native code to "talk" to the driver anyway.  Can't that part be built x64 seperately?
efryevtAuthor Commented:
I read (in a forum) that DirectX for managed has been deprecated.  The managed part is for use with .NET framework

The graphics part of the application was obviously written a while ago and could use a rewrite with the DirectX successor, however I am facing a deadline so "quick and dirty" will have to work to begin.

So now it seems my choice is to write a wrapper class for new DirectX and hopefully be able to continue with minimal changes to the code.  *fingers crossed*

I am going to mark your first answer as solution, since you did answer the question.  Even if it wasn't what I wanted to hear :-\  Thanks.
Sorry about that. Unforunatley, I am also not too DX savvy to offer other options :-/
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.