About Converting/Type casting from USHORT to PVOID.

Discussion in 'Windows Vista Drivers' started by sdr, Jan 29, 2006.

  1. sdr

    sdr Guest

    Respected Sir,


    I have defined variable "myvar" as USHORT myvar[2]; . I have
    a problem in converting the variable "myvar[0]" of type USHORT
    to type-casting of PVOID type. I have tried converting through
    following manner :-

    (PVOID) myvar[0]. But this doesn't work ? So, Now, What I want from you is,
    please some one tell me as to how can I safely convert the variable to type
    PVOID in

    correct and portable manner too ?


    regards,

    sd
     
    sdr, Jan 29, 2006
    #1
    1. Advertisements

  2. why would you want to treat a USHORT as a pointer? is it an io register?

    d
     
    Doron Holan [MS], Jan 29, 2006
    #2
    1. Advertisements

  3. sdr

    sdr Guest

    Yes Sir, It is an io register.

    regards,

    sd

     
    sdr, Jan 29, 2006
    #3
  4. sdr

    440gtx Guest

    UIntToPtr
     
    440gtx, Jan 29, 2006
    #4
  5. sdr

    Tim Roberts Guest

    I suspect what you want is (PVOID)myvar or (PVOID)&myvar[0], which happen
    to be equivalent. However, it's impossible to say whether this is "correct
    and portable" without knowing at least a little bit about what you are
    actually trying to accomplish.
     
    Tim Roberts, Jan 30, 2006
    #5
    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.