Tech Support > Microsoft Windows > Drivers > How to reference a handle from a 32 bit process in a 64 bit driver
How to reference a handle from a 32 bit process in a 64 bit driver
Posted by kuasha on August 18th, 2007


I want to reference a handle from a 32 bit process using
ObReferenceObjectByHandle from a 64 bit driver. How can I do that without
changing the 32 bit application? The handle is sent to driver through a IOCTL
request.


--
Sincerely,
Maruf Maniruzzaman,
Software Engineer,
KAZ Software Limited,
Dhaka, Bangladesh.
http://www.kaz.com.bd
http://www.kuashaonline.com

Posted by Maxim S. Shatskih on August 18th, 2007


Zero-extend the 32bit handle value to 64bit and pass to
ObReferenceObjectByHandle.

Surely, to do this, you must be sure your app is 32bit - so, use
IoIs32BitProcess.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"kuasha" <kuasha@discussions.microsoft.com> wrote in message
news:17625D59-BAAA-4733-BDA4-4A4B357F0CF2@microsoft.com...

Posted by kuasha on August 18th, 2007


Thanks. The problem was with the size of data type in windows xp x64. In a
structure the offset of a field was wrong while accessing the field in
driver. I wonder how I missed this.

--
Sincerely,
Maruf Maniruzzaman,
Software Engineer,
KAZ Software Limited,
Dhaka, Bangladesh.
http://www.kaz.com.bd
http://www.kuashaonline.com



"Maxim S. Shatskih" wrote:

Posted by Maxim S. Shatskih on August 18th, 2007


Correct, call IoIs32BitProcess and choose among the 2 IOCTL structures -
with 32bit HANDLE values and with 64bit.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"kuasha" <kuasha@discussions.microsoft.com> wrote in message
news:3586DAF3-14E4-4408-A713-C42FB7231F86@microsoft.com...

Posted by Alexander Grigoriev on August 18th, 2007


Should one zero extend or sign extend? If one casts 32 bit pointer to
LONGLONG_PTR, it gets sign extended. Is usermode address range from
0x80000000 (assuming it runs in WoW64) aliased to 0xFFFFFFFF80000000, to
avoid such ambiguity?

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OgbGcGZ4HHA.3400@TK2MSFTNGP03.phx.gbl...


Posted by Thomas F. Divine on August 19th, 2007


See HandleToUlong function, described in the WDK "The New Data Types" topic.

Thomas F. Divine
http://www.pcausa.com

"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:O2ab19d4HHA.5212@TK2MSFTNGP04.phx.gbl...


Similar Posts