On your code you have hooked the Windows function
AddVectoredExceptionHandler
, whose prototype is the following:
PVOID AddVectoredExceptionHandler(
ULONG FirstHandler,
PVECTORED_EXCEPTION_HANDLER VectoredHandler
);
Let's have a look to the function documentation at
AddVectredExceptionHandler Function (Windows)[
^]; the second parameter is not a pointer to an
exception record as you have declared on your function
MyVeh
, but a pointer to a function whose prototype should be as follow:
LONG CALLBACK VectoredHandler(
PEXCEPTION_POINTERS ExceptionInfo
);
By installing a function using
AddVectoredExceptionHandler
, that function is later called each time an exception is generated.
I think you need to clarify what you want to do:
- if you want to access the exception record when an exception is thrown, simly write down your handler and pass it to the
AddVectoredExceptionHandler
function - if you really want to hook the
AddVectoredExceptionHandler
, your code is quite right, but your hook procedure must match the parameter list of the hooked function, then the second parameter is not what you wrote but is a pointer to a function