Skip to content

Commit

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

if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
bool mainBase = (theCode.ToLower().Contains("base") || theCode.ToLower().Contains("main")) && !theCode.ToLower().Contains(".dll") && !theCode.ToLower().Contains(".exe");

if (mainBase)
ReadProcessMemory(mProc.Handle, (UIntPtr)((int)mProc.MainModule.BaseAddress + offsets[0]), memoryAddress, (UIntPtr)size, IntPtr.Zero);
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
else if (!mainBase && theCode.Contains("+"))
{
string[] moduleName = theCode.Split('+');
IntPtr altModule = IntPtr.Zero;
Expand Down Expand Up @@ -465,9 +467,11 @@ 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().Equals("base") || theCode.ToLower().Equals("main"))
bool mainBase = (theCode.ToLower().Contains("base") || theCode.ToLower().Contains("main")) && !theCode.ToLower().Contains(".dll") && !theCode.ToLower().Contains(".exe");

if (mainBase)
altModule = mProc.MainModule.BaseAddress;
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
else if (!mainBase && 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 +571,11 @@ public UIntPtr Get64BitCode(string name, string path = "", int size = 16)
}
Int64[] offsets = offsetsList.ToArray();

if (theCode.ToLower().Equals("base") || theCode.ToLower().Equals("main"))
bool mainBase = (theCode.ToLower().Contains("base") || theCode.ToLower().Contains("main")) && !theCode.ToLower().Contains(".dll") && !theCode.ToLower().Contains(".exe");

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

bool mainBase = (theCode.ToLower().Contains("base") || theCode.ToLower().Contains("main")) && !theCode.ToLower().Contains(".dll") && !theCode.ToLower().Contains(".exe");

if (mainBase)
altModule = mProc.MainModule.BaseAddress;
else if (!theCode.ToLower().Equals("base") && !theCode.ToLower().Equals("main") && theCode.Contains("+"))
else if (!mainBase && 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 fa6187d

Please sign in to comment.