From 3b3ee2c6afbe317453b0b85b012268850cd2bd6d Mon Sep 17 00:00:00 2001 From: windy <19060@qq.com> Date: Mon, 16 Sep 2019 20:23:57 +0800 Subject: [PATCH 1/2] * Fix x64 pointer size --- src/SharpMonoInjector/Injector.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SharpMonoInjector/Injector.cs b/src/SharpMonoInjector/Injector.cs index e780122..c66b7ca 100644 --- a/src/SharpMonoInjector/Injector.cs +++ b/src/SharpMonoInjector/Injector.cs @@ -274,10 +274,12 @@ private void RuntimeInvoke(IntPtr method) method, IntPtr.Zero, IntPtr.Zero, excPtr); IntPtr exc = (IntPtr)_memory.ReadInt(excPtr); + IntPtr exc = (IntPtr)(Is64Bit ? _memory.ReadLong(excPtr) : _memory.ReadInt(excPtr)); if (exc != IntPtr.Zero) { string className = GetClassName(exc); string message = ReadMonoString((IntPtr)_memory.ReadInt(exc + (Is64Bit ? 0x20 : 0x10))); + string message = ReadMonoString((IntPtr)(Is64Bit ? _memory.ReadLong(exc + 0x18) : _memory.ReadInt(exc + 0x10))); throw new InjectorException($"The managed method threw an exception: ({className}) {message}"); } } From d80a5d1255e35722911822cbb290a4b140f690d9 Mon Sep 17 00:00:00 2001 From: windy <19060@qq.com> Date: Mon, 16 Sep 2019 20:29:24 +0800 Subject: [PATCH 2/2] * Fix x64 pointer size --- src/SharpMonoInjector/Injector.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SharpMonoInjector/Injector.cs b/src/SharpMonoInjector/Injector.cs index c66b7ca..6bd62c7 100644 --- a/src/SharpMonoInjector/Injector.cs +++ b/src/SharpMonoInjector/Injector.cs @@ -273,12 +273,10 @@ private void RuntimeInvoke(IntPtr method) IntPtr result = Execute(Exports[mono_runtime_invoke], method, IntPtr.Zero, IntPtr.Zero, excPtr); - IntPtr exc = (IntPtr)_memory.ReadInt(excPtr); IntPtr exc = (IntPtr)(Is64Bit ? _memory.ReadLong(excPtr) : _memory.ReadInt(excPtr)); if (exc != IntPtr.Zero) { string className = GetClassName(exc); - string message = ReadMonoString((IntPtr)_memory.ReadInt(exc + (Is64Bit ? 0x20 : 0x10))); string message = ReadMonoString((IntPtr)(Is64Bit ? _memory.ReadLong(exc + 0x18) : _memory.ReadInt(exc + 0x10))); throw new InjectorException($"The managed method threw an exception: ({className}) {message}"); }