Skip to content

Commit

Permalink
StartVal changed to CreateIntPtr
Browse files Browse the repository at this point in the history
  • Loading branch information
erfg12 committed May 29, 2018
1 parent f66db37 commit 9e89745
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Memory/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ public IntPtr CreateCodeCave(string code, byte[] newBytes, int replaceCount, int

UIntPtr theCode;
theCode = getCode(code, file);
IntPtr address = startVal((long)theCode);
IntPtr address = CreateIntPtr((long)theCode);

// if x64 we need to try to allocate near the address so we dont run into the +-2GB limit of the 0xE9 jmp

Expand Down Expand Up @@ -1621,7 +1621,7 @@ public bool DumpMemory(string file = "dump.dmp")
//arrLength += buffer.Length;

proc_min_address_l += (Int64)memInfo.RegionSize;
proc_min_address = startVal(proc_min_address_l);
proc_min_address = CreateIntPtr(proc_min_address_l);
}


Expand All @@ -1642,7 +1642,7 @@ public async Task<IEnumerable<long>> AoBScan(string search, bool writable = fals
return await AoBScan(0, long.MaxValue, search, writable, executable, file);
}

public IntPtr startVal(long value)
public IntPtr CreateIntPtr(long value)
{
IntPtr m_value;
#if WIN32
Expand Down Expand Up @@ -1709,7 +1709,7 @@ public async Task<IEnumerable<long>> AoBScan(long start, long end, string search

Debug.Write("[DEBUG] memory scan starting... (min:0x" + proc_min_address.ToInt64().ToString(mSize()) + " max:0x" + proc_max_address.ToInt64().ToString(mSize()) + " time:" + DateTime.Now.ToString("h:mm:ss tt") + ")" + Environment.NewLine);

IntPtr currentBaseAddress = startVal(start);
IntPtr currentBaseAddress = CreateIntPtr(start);

MEMORY_BASIC_INFORMATION memInfo = new MEMORY_BASIC_INFORMATION();
while (VirtualQueryEx(pHandle, currentBaseAddress, out memInfo).ToUInt64() != 0 &&
Expand Down Expand Up @@ -1744,7 +1744,7 @@ public async Task<IEnumerable<long>> AoBScan(long start, long end, string search

if (!isValid)
{
currentBaseAddress = startVal(memInfo.BaseAddress.ToInt64() + memInfo.RegionSize);
currentBaseAddress = CreateIntPtr(memInfo.BaseAddress.ToInt64() + memInfo.RegionSize);
continue;
}

Expand All @@ -1756,7 +1756,7 @@ public async Task<IEnumerable<long>> AoBScan(long start, long end, string search
RegionBase = memInfo.BaseAddress
};

currentBaseAddress = startVal(memInfo.BaseAddress.ToInt64() + memInfo.RegionSize);
currentBaseAddress = CreateIntPtr(memInfo.BaseAddress.ToInt64() + memInfo.RegionSize);

if (memRegionList.Count > 0)
{
Expand Down

0 comments on commit 9e89745

Please sign in to comment.