Do not treat access violation addresses as pointers

This commit is contained in:
x1nixmzeng 2018-02-07 23:12:39 +00:00
parent 02e2f6c5c9
commit 9ea851c14d
3 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@ namespace CxbxDebugger
public interface IDebuggerExceptionEvents
{
bool OnAccessViolation(DebuggerThread Thread, uint Code, IntPtr Address);
bool OnAccessViolation(DebuggerThread Thread, uint Code, uint Address);
}
public interface IDebuggerFileEvents

View File

@ -163,7 +163,7 @@ namespace CxbxDebugger
public class ExceptionHandledQuery
{
public IntPtr ReponseAddr { get; set; }
public IntPtr ExceptionAddress { get; set; }
public uint ExceptionAddress { get; set; }
public uint ExceptionCode { get; set; }
public uint ParameterCount { get; set; }
public IntPtr ParameterBase { get; set; }
@ -174,7 +174,7 @@ namespace CxbxDebugger
ExceptionHandledQuery Query = new ExceptionHandledQuery();
Query.ReponseAddr = new IntPtr(Data[0]);
Query.ExceptionAddress = new IntPtr(Data[1]);
Query.ExceptionAddress = Data[1];
Query.ExceptionCode = Data[2];
Query.ParameterCount = Data[3];
Query.ParameterBase = new IntPtr(Data[4]);

View File

@ -371,7 +371,7 @@ namespace CxbxDebugger
public void OnThreadExit(DebuggerThread Thread, uint ExitCode)
{
frm.DebugLog(string.Format("Thread exited {0} ({1})", Thread.ThreadID, PrettyExitCode(ExitCode)));
frm.DebugLog(string.Format("Thread exited {0} ({1})", Thread.ThreadID, NtStatus.PrettyPrint(ExitCode)));
frm.DebugThreads.Remove(Thread);
}
@ -397,18 +397,18 @@ namespace CxbxDebugger
frm.OutputString(Message);
}
public bool OnAccessViolation(DebuggerThread Thread, uint Code, IntPtr Address)
public bool OnAccessViolation(DebuggerThread Thread, uint Code, uint Address)
{
string ProcessName = "??";
var Module = frm.DebuggerInst.ResolveModule((uint)Address);
var Module = frm.DebuggerInst.ResolveModule(Address);
if (Module != null)
{
ProcessName = Path.GetFileName(Module.Path);
}
// TODO Include GetLastError string
string ExceptionMessage = string.Format("Access violation thrown at 0x{0:X8} ({1})", (uint)Address, ProcessName);
string ExceptionMessage = string.Format("Access violation thrown at 0x{0:X8} ({1})", Address, ProcessName);
ExceptionMessage += string.Format("\n\nException code {0:X8}", Code);