Hello all,

I'm having some trouble understanding why an ACCESS violation isn't caught in my exception handler.

I add the handler with:
--
m_pvExceptionHandle = AddVectoredExceptionHandler( 1, &myExceptionHandler );
LONG CALLBACK myExceptionHandler( PEXCEPTION_POINTERS ExceptionInfo );
--

But, after adding this.. the following code crashes the application(like it normally should):
char* pTest = NULL;
*pTest = 'v';

I understand that a Win32 Exception is not a normal c++ exception... so I could prevent the program crash here by placing the *pTest = 'v'; line in a try/catch block and compiling the code with /EHa.
But I want to be able to catch an access violation from anywhere in the application ( so 3rd party libraries as well ).

If this is possible... is it then also possible to 'resume' execution? (basically returning EXCEPTION_CONTINUE_EXECUTION from myExceptionHandler).

I suspect that it is 'just' a compiler option that will enable me to catch the access violation, rather than crash the application but I have tried what I know about.


If this isn't possible... is there then another way to allow certain pages to be executable, but not read/writeable?

I (sortof) know about PAGE_GUARD... but this will fire even if the access method was execute... and filtering this isn't really acceptable (the pages get executed often).

I thought about setting hardware breakpoints... but this limits to only 4 addresses.

Thank you in advance for the help.