|
|
|
@ -7,10 +7,11 @@
|
|
|
|
|
#include "Win32Exception.h"
|
|
|
|
|
#include "eh.h"
|
|
|
|
|
|
|
|
|
|
Win32Exception::Win32Exception(const EXCEPTION_RECORD * info) {
|
|
|
|
|
_location = info->ExceptionAddress;
|
|
|
|
|
_code = info->ExceptionCode;
|
|
|
|
|
switch (info->ExceptionCode) {
|
|
|
|
|
Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) {
|
|
|
|
|
_location = info->ExceptionRecord->ExceptionAddress;
|
|
|
|
|
_code = info->ExceptionRecord->ExceptionCode;
|
|
|
|
|
_info = info;
|
|
|
|
|
switch (_code) {
|
|
|
|
|
case EXCEPTION_ACCESS_VIOLATION:
|
|
|
|
|
_event = "Access violation";
|
|
|
|
|
break;
|
|
|
|
@ -35,14 +36,14 @@ void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS * info) {
|
|
|
|
|
// Windows guarantees that *(info->ExceptionRecord) is valid
|
|
|
|
|
switch (code) {
|
|
|
|
|
case EXCEPTION_ACCESS_VIOLATION:
|
|
|
|
|
throw Win32AccessViolation(info->ExceptionRecord);
|
|
|
|
|
throw Win32AccessViolation(info);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw Win32Exception(info->ExceptionRecord);
|
|
|
|
|
throw Win32Exception(info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Win32AccessViolation::Win32AccessViolation(const EXCEPTION_RECORD * info) : Win32Exception(info) {
|
|
|
|
|
_isWrite = info->ExceptionInformation[0] == 1;
|
|
|
|
|
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionInformation[1]);
|
|
|
|
|
Win32AccessViolation::Win32AccessViolation(EXCEPTION_POINTERS * info) : Win32Exception(info) {
|
|
|
|
|
_isWrite = info->ExceptionRecord->ExceptionInformation[0] == 1;
|
|
|
|
|
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionRecord->ExceptionInformation[1]);
|
|
|
|
|
}
|
|
|
|
|