Catching the page fault

Hi All,
I’d like to catch the access to an address that happens in an application
.

The application does the following somewhere in its code:
lpvAddr = VirtualAlloc(NULL, dwPageSize,
MEM_RESERVE | MEM_COMMIT,
PAGE_READONLY | PAGE_GUARD);

int a = *(int*)lpvAddr; //Will generate an exception STATUS_GUARD_PAGE (0x80000001)

Can I catch this exception in another thread of the application, given that I cant insert try/catch block around the access call. ?

In general, I need to catch a read access to some memory block in application I dont have the source code for. Can I do at the kernel level, from some generic driver ?

Regards,
Stas.

**************************************************************************************************
The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or the
sender immediately and do not disclose the contents to any one or make copies.

** eSafe scanned this email for viruses, vandals and malicious content **
**************************************************************************************************

You need to use Win32 debug API for this. Check your Win32 API reference.
better yet , use an already written debugger.

Dan

----- Original Message -----
From: “Stass Desyatnikov”
To: “NT Developers Interest List”
Sent: Wednesday, July 10, 2002 8:04 PM
Subject: [ntdev] Catching the page fault

Hi All,
I’d like to catch the access to an address that happens in an application
.

The application does the following somewhere in its code:
lpvAddr = VirtualAlloc(NULL, dwPageSize,
MEM_RESERVE | MEM_COMMIT,
PAGE_READONLY | PAGE_GUARD);

int a = (int)lpvAddr; //Will generate an exception STATUS_GUARD_PAGE
(0x80000001)

Can I catch this exception in another thread of the application, given that
I cant insert try/catch block around the access call. ?

In general, I need to catch a read access to some memory block in
application I dont have the source code for. Can I do at the kernel level,
from some generic driver ?

Regards,
Stas.

******************************************************

The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the
sender immediately and do not disclose the contents to any one or make
copies.

eSafe scanned this email for viruses, vandals and malicious content
******************************************************



You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to %%email.unsub%%