From 0c5396a7e9e85d5b272a67c4adc820bc1a47909b Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sun, 4 Mar 2018 19:18:47 +0100 Subject: [PATCH 1/8] Fixed output path. --- LoadBinaryPlugin.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LoadBinaryPlugin.csproj b/LoadBinaryPlugin.csproj index 9700b8b..a904a9f 100644 --- a/LoadBinaryPlugin.csproj +++ b/LoadBinaryPlugin.csproj @@ -27,7 +27,7 @@ x86 pdbonly true - ..\bin\Release\x86\ + bin\Release\x86\ TRACE;RECLASSNET32;RELEASE prompt 4 @@ -47,7 +47,7 @@ x64 pdbonly true - ..\bin\Release\x64\ + bin\Release\x64\ TRACE;RECLASSNET64;RELEASE prompt 4 From 2211a7527006d31c977dc622736b3b4bc09624bc Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 7 Dec 2018 18:01:21 +0100 Subject: [PATCH 2/8] Removed DangerousGetHandle call. --- LoadBinaryPluginExt.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index d5773a2..d791260 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -99,7 +99,7 @@ public IntPtr OpenRemoteProcess(IntPtr id, ProcessAccess desiredAccess) { var mappedFile = MemoryMappedFile.CreateFromFile(currentFile); - var handle = mappedFile.SafeMemoryMappedFileHandle.DangerousGetHandle(); + var handle = (IntPtr)mappedFile.SafeMemoryMappedFileHandle.GetHashCode(); openFiles.Add( handle, From aff5f4da3a33c34e3c34aa5946052e4a9af27f88 Mon Sep 17 00:00:00 2001 From: tetyys Date: Fri, 7 Dec 2018 19:06:57 +0200 Subject: [PATCH 3/8] Fix uncaught exception when trying to retrieve negative addresses --- LoadBinaryPluginExt.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index d791260..854b943 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -148,6 +148,10 @@ public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, { lock (sync) { + if (address.ToInt64() < 0) + { + return false; + } var info = GetMappedFileById(process); if (info != null) { From 1cf009705f3feb829524d5f3b34ff126944e1a4d Mon Sep 17 00:00:00 2001 From: tetyys Date: Fri, 7 Dec 2018 21:20:39 +0200 Subject: [PATCH 4/8] Rewrite address to non-negative instead of rejecting it --- LoadBinaryPluginExt.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index 854b943..3ffe416 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -148,15 +148,28 @@ public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, { lock (sync) { - if (address.ToInt64() < 0) - { - return false; - } var info = GetMappedFileById(process); if (info != null) { try { + /* + * This ensures that addresses larger than 0x7FFF_FFFF are not negative after calling + * ToInt64 by removing low side from long address from IntPtr (which seems to be casted + * from int to long non-bitwise). Same problem applies to addresses that are larger than + * 0x7FFF_FFFF_FFFF_FFFF, however CreateViewStream only accepts long parameter. + */ + long addressInt64 = address.ToInt64(); + if (addressInt64 < 0) + { + addressInt64 &= 0xFFFF_FFFF; + } + using (var stream = info.File.CreateViewStream(addressInt64, size)) + { + stream.Read(buffer, 0, size); + + return true; + } using (var stream = info.File.CreateViewStream(address.ToInt64(), size)) { stream.Read(buffer, 0, size); From b461f39a4897dcfe4ff2e044594f346bb8c36e8d Mon Sep 17 00:00:00 2001 From: tetyys Date: Fri, 7 Dec 2018 21:23:29 +0200 Subject: [PATCH 5/8] Fix copy paste mistake --- LoadBinaryPluginExt.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index 3ffe416..737a58e 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -164,12 +164,6 @@ public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, { addressInt64 &= 0xFFFF_FFFF; } - using (var stream = info.File.CreateViewStream(addressInt64, size)) - { - stream.Read(buffer, 0, size); - - return true; - } using (var stream = info.File.CreateViewStream(address.ToInt64(), size)) { stream.Read(buffer, 0, size); From 2761d18d6a58e0a4bf664887ac39418d1af10c36 Mon Sep 17 00:00:00 2001 From: tetyys Date: Fri, 7 Dec 2018 21:43:49 +0200 Subject: [PATCH 6/8] Fix copy paste mistake --- LoadBinaryPluginExt.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index 737a58e..acc2407 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -164,7 +164,7 @@ public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, { addressInt64 &= 0xFFFF_FFFF; } - using (var stream = info.File.CreateViewStream(address.ToInt64(), size)) + using (var stream = info.File.CreateViewStream(addressInt64, size)) { stream.Read(buffer, 0, size); From 62cfa8202390f3a004c1e3ce88fe0b0bdfdd81f4 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 14 Dec 2018 20:42:43 +0100 Subject: [PATCH 7/8] Use IntPtr.ToInt64Bits instead of #3. --- LoadBinaryPluginExt.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/LoadBinaryPluginExt.cs b/LoadBinaryPluginExt.cs index acc2407..26fe506 100644 --- a/LoadBinaryPluginExt.cs +++ b/LoadBinaryPluginExt.cs @@ -7,6 +7,7 @@ using System.Windows.Forms; using ReClassNET.Core; using ReClassNET.Debugger; +using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.Plugins; @@ -153,18 +154,7 @@ public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, { try { - /* - * This ensures that addresses larger than 0x7FFF_FFFF are not negative after calling - * ToInt64 by removing low side from long address from IntPtr (which seems to be casted - * from int to long non-bitwise). Same problem applies to addresses that are larger than - * 0x7FFF_FFFF_FFFF_FFFF, however CreateViewStream only accepts long parameter. - */ - long addressInt64 = address.ToInt64(); - if (addressInt64 < 0) - { - addressInt64 &= 0xFFFF_FFFF; - } - using (var stream = info.File.CreateViewStream(addressInt64, size)) + using (var stream = info.File.CreateViewStream(address.ToInt64Bits(), size)) { stream.Read(buffer, 0, size); From 9c481c5f24243162b8d302dc7e0d7f6780fd8920 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 21 Jun 2019 22:28:51 +0200 Subject: [PATCH 8/8] Sync with latest ReClass.NET source. --- LoadBinaryPlugin.csproj | 3 ++- Properties/Resources.Designer.cs | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/LoadBinaryPlugin.csproj b/LoadBinaryPlugin.csproj index a904a9f..d5caeca 100644 --- a/LoadBinaryPlugin.csproj +++ b/LoadBinaryPlugin.csproj @@ -9,8 +9,9 @@ Properties LoadBinaryPlugin LoadBinaryPlugin - v4.6.1 + v4.7.2 512 + x86 diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index baba42d..481f606 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace LoadBinaryPlugin.Properties { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -33,7 +33,7 @@ internal Resources() { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Resources() { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap icon { get {