Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Development
  New Posts New Posts RSS Feed: Changing page permissions
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Changing page permissions

 Post Reply Post Reply Page  <12
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Online Status: Offline
Posts: 4753
  Quote EP_X0FF Quote  Post ReplyReply Direct Link To This Post Topic: Changing page permissions
    Posted: 29 May 2006 at 9:26pm
for you driver this should work to retrieve info that you want ;)

ZwQueryVirtualMemory retrieves information about virtual memory in the user mode
address range.

NTSYSAPI
NTSTATUS
NTAPI
ZwQueryVirtualMemory(
IN HANDLE ProcessHandle,
IN PVOID BaseAddress,
IN MEMORY_INFORMATION_CLASS MemoryInformationClass,
OUT PVOID MemoryInformation,
IN ULONG MemoryInformationLength,
OUT PULONG ReturnLength OPTIONAL
);

Parameters

ProcessHandle
A handle of a process object, representing the process whose virtual memory information
is queried.The handle must grant PROCESS_QUERY_INFORMATION access.

BaseAddress
The base address of the region of pages to be queried.This value is rounded down to
the next page boundary. If the information class requested does not return information
that is specific to a particular address, this parameter may be zero.

MemoryInformationClass
The type of virtual memory information to be queried.The permitted values are
drawn from the enumeration MEMORY_INFORMATION_CLASS, described in the following
section.

MemoryInformation
Points to a caller-allocated buffer or variable that receives the requested virtual
memory information.

MemoryInformationLength
Specifies the size in bytes of MemoryInformation, which the caller should set according
to the given MemoryInformationClass.

ReturnLength
Optionally points to a variable that receives the number of bytes actually returned to
MemoryInformation if the call was successful. If this information is not needed,
ReturnLength may be a null pointer.

typedef enum _MEMORY_INFORMATION_
MemoryBasicInformation,
MemoryWorkingSetList,
MemorySectionName,
MemoryBasicVlmInformation
} MEMORY_INFORMATION_CLASS;

Gary Nebbett "Windows 2000 Native API Reference"
Ring0 - the source of inspiration
Back to Top
ks2d View Drop Down
Newbie
Newbie


Joined: 23 May 2006
Location: India
Online Status: Offline
Posts: 8
  Quote ks2d Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2006 at 1:58am
Thanks a lot...now could anyone help me in changing the permissions of a given set of pages to READ-WRITE
"not all who wander r lost"
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Online Status: Offline
Posts: 4753
  Quote EP_X0FF Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2006 at 2:03am
VirtualProtect?
VirtualProtectEx?

Edited by EP_X0FF - 30 May 2006 at 2:04am
Ring0 - the source of inspiration
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Online Status: Offline
Posts: 4753
  Quote EP_X0FF Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2006 at 2:36am
here the link to site with huge amount of headers
nt headers

perhaps for somebody it will be useful
Ring0 - the source of inspiration
Back to Top
ks2d View Drop Down
Newbie
Newbie


Joined: 23 May 2006
Location: India
Online Status: Offline
Posts: 8
  Quote ks2d Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2006 at 2:42am

i cant use VirtualProtect()...it could have done the trick at 1 go itself...but it needs da chunk alloted with a single call to VirtualAlloc() that is why i am looking for a workaround...

 

"not all who wander r lost"
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Online Status: Offline
Posts: 4753
  Quote EP_X0FF Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2006 at 3:35am
you got the list
you probably knows how to decode it, so why not use VirtualProtectEx, i'm sorry, but i don't understand

maybe you post sample from your program for better understanding?

regards.
Ring0 - the source of inspiration
Back to Top
greenMind View Drop Down
Newbie
Newbie


Joined: 06 June 2006
Location: Ukraine
Online Status: Offline
Posts: 15
  Quote greenMind Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2006 at 1:36pm
Originally posted by ks2d

I cant directly use VirtualProtect() directly as i would have no way of knowing what chunk was allocated using VirtualAlloc()

You can get allocation base for a given address using VirtualQuery.

Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Online Status: Offline
Posts: 4753
  Quote EP_X0FF Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2006 at 10:24pm
@greenMind: You are too late man NtQueryVirtualMemory
Ring0 - the source of inspiration
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Privacy Statement