Using 32-bit handles in a 64-bit driver

I don’t have a specific purpose for doing this, it just occurred to me and I’m curious… Suppose I had a 32-bit app that wanted to send a HANDLE into a driver and that driver is 64-bit (say we don’t build the 64-bit user components and just use the 32-bit ones). Given that the app used an IOCTL and effectivelty sent a 32-bit event handle to a driver, is there any way for the driver to use that HANDLE to get it’s hands on the actual event object?

xxxxx@oracle.com wrote:

I don’t have a specific purpose for doing this, it just occurred to me and I’m curious… Suppose I had a 32-bit app that wanted to send a HANDLE into a driver and that driver is 64-bit (say we don’t build the 64-bit user components and just use the 32-bit ones). Given that the app used an IOCTL and effectivelty sent a 32-bit event handle to a driver, is there any way for the driver to use that HANDLE to get it’s hands on the actual event object?

Yes. The APIs that accept handles know the difference. Just zero out
the top 32 bits.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Neat. Thanks Tim.

That will work just fine. Since you have to translate the handle to a KM object in the context of the app to begin with, the translation code knows it is a 32 bit process and how to use the handle for look up

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@oracle.com
Sent: Wednesday, November 10, 2010 12:02 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Using 32-bit handles in a 64-bit driver

I don’t have a specific purpose for doing this, it just occurred to me and I’m curious… Suppose I had a 32-bit app that wanted to send a HANDLE into a driver and that driver is 64-bit (say we don’t build the 64-bit user components and just use the 32-bit ones). Given that the app used an IOCTL and effectivelty sent a 32-bit event handle to a driver, is there any way for the driver to use that HANDLE to get it’s hands on the actual event object?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer