Skip to content

Commit

Permalink
check for main and base equals instead of contains
Browse files Browse the repository at this point in the history
  • Loading branch information
erfg12 committed Apr 18, 2024
1 parent 8dc786d commit cabec1a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Memory/memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ public UIntPtr GetCode(string name, string path = "", int size = 8)
}
int[] offsets = offsetsList.ToArray();

if (theCode.Contains("base") || theCode.Contains("main"))
if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
ReadProcessMemory(mProc.Handle, (UIntPtr)((int)mProc.MainModule.BaseAddress + offsets[0]), memoryAddress, (UIntPtr)size, IntPtr.Zero);
else if (!theCode.Contains("base") && !theCode.Contains("main") && theCode.Contains("+"))
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
{
string[] moduleName = theCode.Split('+');
IntPtr altModule = IntPtr.Zero;
Expand Down Expand Up @@ -465,9 +465,9 @@ public UIntPtr GetCode(string name, string path = "", int size = 8)
int trueCode = Convert.ToInt32(newOffsets, 16);
IntPtr altModule = IntPtr.Zero;
//Debug.WriteLine("newOffsets=" + newOffsets);
if (theCode.ToLower().Contains("base") || theCode.ToLower().Contains("main"))
if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
altModule = mProc.MainModule.BaseAddress;
else if (!theCode.ToLower().Contains("base") && !theCode.ToLower().Contains("main") && theCode.Contains("+"))
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
{
string[] moduleName = theCode.Split('+');
if (!moduleName[0].ToLower().Contains(".dll") && !moduleName[0].ToLower().Contains(".exe") && !moduleName[0].ToLower().Contains(".bin"))
Expand Down Expand Up @@ -567,9 +567,9 @@ public UIntPtr Get64BitCode(string name, string path = "", int size = 16)
}
Int64[] offsets = offsetsList.ToArray();

if (theCode.Contains("base") || theCode.Contains("main"))
if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
ReadProcessMemory(mProc.Handle, (UIntPtr)((Int64)mProc.MainModule.BaseAddress + offsets[0]), memoryAddress, (UIntPtr)size, IntPtr.Zero);
else if (!theCode.Contains("base") && !theCode.Contains("main") && theCode.Contains("+"))
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
{
string[] moduleName = theCode.Split('+');
IntPtr altModule = IntPtr.Zero;
Expand Down Expand Up @@ -608,9 +608,9 @@ public UIntPtr Get64BitCode(string name, string path = "", int size = 16)
{
Int64 trueCode = Convert.ToInt64(newOffsets, 16);
IntPtr altModule = IntPtr.Zero;
if (theCode.Contains("base") || theCode.Contains("main"))
if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
altModule = mProc.MainModule.BaseAddress;
else if (!theCode.Contains("base") && !theCode.Contains("main") && theCode.Contains("+"))
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
{
string[] moduleName = theCode.Split('+');
if (!moduleName[0].ToLower().Contains(".dll") && !moduleName[0].ToLower().Contains(".exe") && !moduleName[0].ToLower().Contains(".bin"))
Expand Down

0 comments on commit cabec1a

Please sign in to comment.