If I catch an access violation with SEH, how can I get address of violation ? GetExceptionInformation gives me LPEXCEPTION_POINTERS that contains
- ExceptionRecord – A pointer to an EXCEPTION_RECORD structure that
contains a machine-independent description of the exception. - ContextRecord – A pointer to a CONTEXT structure that contains a
processor-specific description of the state of the processor at the time of the exception.
How can i get this info this without writing a dump?
The memory address as well as type of operation is contained in ExceptionInformation field inside ExceptionRecord structur. From MSDN:
ExceptionInformation
An array of additional arguments that describe the exception. The RaiseException function can specify this array of arguments. For most exception codes, the array elements are undefined. The following table describes the exception codes whose array elements are defined.
Exception code Meaning
EXCEPTION_ACCESS_VIOLATION
The first element of the array contains a read-write flag that indicates the type of operation that caused the access violation. If this value is zero, the thread attempted to read the inaccessible data. If this value is 1, the thread attempted to write to an inaccessible address. If this value is 8, the thread causes a user-mode data execution prevention (DEP) violation.
The second array element specifies the virtual address of the inaccessible data.