Thread: VirtualQuery- get the access protection

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    7

    VirtualQuery- get the access protection

    hello.
    i want to go over the addresses of a process and get the access protect of the blocks .

    so there are many constants which present the protect:
    PAGE_EXECUTE - 0x10
    PAGE_EXECUTE_READ - 0x20
    PAGE_EXECUTE_READWRITE- 0x40
    PAGE_EXECUTE_WRITECOPY - 0x80
    PAGE_NOACCESS - 0x01
    PAGE_READONLY- 0x02
    PAGE_READWRITE - 0x04
    PAGE_WRITECOPY - 0x08
    PAGE_GUARD - 0x100
    PAGE_NOCACHE - 0x200
    PAGE_WRITECOMBINE - 0x400

    now i can check if MEMORY_BASIC_INFORMATION.protect (of a specific block) is equal to one of the access protects above.

    but what if the access protect is combined with some access protects? (with | ? )

    what is the best solution to solve it?
    thanks!

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    One way is to bitwise AND them together using the & operator.

    ANDing the field with each value will tell you which values are in there. If the value is in there it will return TRUE, if not it will return FALSE.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Order of access labels in class definition
    By Mario F. in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 07:13 AM
  2. ww hosting and SSH access
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 04-07-2005, 08:49 AM
  3. Replies: 3
    Last Post: 09-22-2003, 09:48 PM
  4. Direct disk access in DOS
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-26-2002, 02:52 PM