How to reference a handle from a 32 bit process in a 64 bit driver

Discussion in 'Windows Vista Drivers' started by kuasha, Aug 18, 2007.

  1. kuasha

    kuasha Guest

    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
     
    kuasha, Aug 18, 2007
    #1
    1. Advertisements

  2. 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 S. Shatskih, Aug 18, 2007
    #2
    1. Advertisements

  3. kuasha

    kuasha Guest

    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
     
    kuasha, Aug 18, 2007
    #3
  4. Correct, call IoIs32BitProcess and choose among the 2 IOCTL structures -
    with 32bit HANDLE values and with 64bit.
     
    Maxim S. Shatskih, Aug 18, 2007
    #4
  5. 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?
     
    Alexander Grigoriev, Aug 18, 2007
    #5
  6. See HandleToUlong function, described in the WDK "The New Data Types" topic.

    Thomas F. Divine
    http://www.pcausa.com
     
    Thomas F. Divine, Aug 19, 2007
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.