-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace StuntBonusV | ||
{ | ||
static internal class MemoryAccess | ||
{ | ||
public unsafe static byte* FindPattern(string pattern, string mask) | ||
{ | ||
ProcessModule module = Process.GetCurrentProcess().MainModule; | ||
|
||
ulong address = (ulong)module.BaseAddress.ToInt64(); | ||
ulong endAddress = address + (ulong)module.ModuleMemorySize; | ||
|
||
for (; address < endAddress; address++) | ||
{ | ||
for (int i = 0; i < pattern.Length; i++) | ||
{ | ||
if (mask[i] != '?' && ((byte*)address)[i] != pattern[i]) | ||
{ | ||
break; | ||
} | ||
else if (i + 1 == pattern.Length) | ||
{ | ||
return (byte*)address; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters