Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3406664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:39:20+00:00 2026-05-18T05:39:20+00:00

I was trying to run some drivers coded for 32-bit vista (x86) on 64-bit

  • 0

I was trying to run some drivers coded for 32-bit vista (x86) on 64-bit win7 (amd64) and it was not running. After a lot of debugging, and hit-and-trial, I made it to work on the latter, but I don’t know the reason why it’s working. This is what I did:

At many places, buffer pointers pointed to an array of structures(different at different places), and to increment them, at some places this type of statement was used:

ptr = (PVOID)((PCHAR)ptr + offset);

And at some places:

ptr = (PVOID)((ULONG)ptr + offset);

The 2nd one was returning garbage, so I changed them all to 1st one. But I found many sample drivers on the net following the second one. My questions:

  1. Where are these macros
    defined(google didn’t help much)?
  2. I understand all the P_ macros are
    pointers, why was a pointer casted
    to ULONG? How does this work on
    32-bit?
  3. PCHAR obviously changes the
    width according to the environment. Do you know any place to find documentation for this?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:39:20+00:00Added an answer on May 18, 2026 at 5:39 am
    1. they should be defined in WinNT.h (they are in the SDK; don’t have the DDK at hand)
    2. ULONG is unsigned long; on a 32-bit system, this is the size of a pointer. So a pointer
      can be converted back and forth to ULONG without loss – but not so on a 64-bit system
      (where casting the value will truncate it). People cast to ULONG to get byte-base pointer
      arithmetic (even though this has undefined behavior, as you found out)
    3. Pointer arithmetic always works in units of the underlying type, i.e. in CHARs for PCHAR; this equates to bytes arithmetic
    4. Any C book should elaborate on the precise semantics of pointer arithmetic.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run some queries to get rid of XSS in our database
I'm trying to run some commands in paralel, in background, using bash. Here's what
I am trying to run some unit tests in a C# Windows Forms application
I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
I'm trying to run some statistics over the Stack Overflow data dump, and for
The Problem I am trying to run some ajax on one my pages for
Where would set_include_path(../../); point to? I am trying to run some PHP code on
I've run into some problems when trying to serialize my object to XML. The
I am trying to run PartCover to test the coverage of some tests with
I was trying to run my application and check for some output on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.