0% found this document useful (0 votes)
2 views5 pages

MemConnecting Method 1

The document outlines a C# program that utilizes a timer to monitor and interact with specific processes, particularly targeting emulators. It includes methods for changing memory values of processes and updating the user interface based on the status of the process detection and memory manipulation. The program employs P/Invoke to access Windows API functions for process management and memory operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

MemConnecting Method 1

The document outlines a C# program that utilizes a timer to monitor and interact with specific processes, particularly targeting emulators. It includes methods for changing memory values of processes and updating the user interface based on the status of the process detection and memory manipulation. The program employs P/Invoke to access Windows API functions for process management and memory operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

---------using namespace----------

using Beyondmem;

----------------Partal Class Form:---------------

private System.Timers.Timer Proctimer;

-----------public initialize-------------

GetProcID(1);
Proctimer = new System.Timers.Timer();
Proctimer.Interval = 15000;
Proctimer.Elapsed += findproc;
Proctimer.AutoReset = true;

//Timer Starter.................

------------Connecting Dll System---------------------------

[DllImport("user32.dll")]
public static extern uint SetWindowDisplayAffinity(IntPtr hwnd, uint dwAffinity);
[DllImport("KERNEL32.DLL")]
public static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processid);
[DllImport("KERNEL32.DLL")]
public static extern int Process32First(IntPtr handle, ref ProcessEntry32 pe);
[DllImport("KERNEL32.DLL")]
public static extern int Process32Next(IntPtr handle, ref ProcessEntry32 pe);
private static string info;
#region Change Mem
public static async Task ChangeMem(string original, string replace, string mode)
{
info = "0";
if (PID == null || Convert.ToInt32(PID) == 0)
{
info = "1";
return;
}

IEnumerable<long> scanmem;
try
{
MemLib.OpenProcess(Convert.ToInt32(PID));
scanmem = await MemLib.AoBScan(0L, 140737488355327L, original, true,
true);
}
catch
{
info = "4";
return;
}

if (scanmem.Count() == 0)
{
info = "3";
return;
}

Parallel.ForEach(scanmem, num =>


{
MemLib.OpenProcess(Convert.ToInt32(PID));
MemLib.ChangeProtection(num.ToString("X"),
MemMirza.MemoryProtection.ReadWrite, out MemMirza.MemoryProtection _);
MemLib.WriteMemory(num.ToString("X"), "bytes", replace);
});

if (mode == "1")
{
info = "2";
}
else if (mode == "0")
{
info = "-2";
}
}
#endregion
public static MemMirza MemLib = new MemMirza();
private async void findproc(Object source, System.Timers.ElapsedEventArgs e)
{
if (Convert.ToInt32(PID) == 0)
{
hook.Text = "Hook : PID - False {" + PID + "}";
GetProcID(1);
}
else
{
hook.Text = "Hook : PID - True {" + PID + "}";
}
GetProcID(1);
}

public static string PID;


public static string GetProcID(int index)
{
string result = "";
checked
{
if (index == 1 || index == 0)
{
IntPtr intPtr = IntPtr.Zero;
uint num = 0U;
IntPtr intPtr2 = CreateToolhelp32Snapshot(2U, 0U);
if ((int)intPtr2 > 0)
{
ProcessEntry32 processEntry = default(ProcessEntry32);
processEntry.dwSize =
(uint)Marshal.SizeOf<ProcessEntry32>(processEntry);
for (int num2 = Process32First(intPtr2, ref processEntry); num2 ==
1; num2 = Process32Next(intPtr2, ref processEntry))
{
IntPtr intPtr3 =
Marshal.AllocHGlobal((int)processEntry.dwSize);
Marshal.StructureToPtr<ProcessEntry32>(processEntry, intPtr3,
true);
object obj = Marshal.PtrToStructure(intPtr3,
typeof(ProcessEntry32));
ProcessEntry32 processEntry2 = (obj != null) ?
((ProcessEntry32)obj) : default(ProcessEntry32);
Marshal.FreeHGlobal(intPtr3);

if (processEntry2.szExeFile.Contains("HD-Player") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}
if (processEntry2.szExeFile.Contains("HD-Player.exe") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}
if (processEntry2.szExeFile.Contains("AndroidProcess") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}

if (processEntry2.szExeFile.Contains("LdVBoxHeadless") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}

if (processEntry2.szExeFile.Contains("MEmuHeadless") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}

if (processEntry2.szExeFile.Contains("NoxVMHandle") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}

if (processEntry2.szExeFile.Contains("aow_exe") &&
processEntry2.cntThreads > num)
{
num = processEntry2.cntThreads;
intPtr = (IntPtr)((long)
(unchecked((ulong)processEntry2.th32ProcessID)));
}
}
}
result = Convert.ToString(intPtr);
PID = Convert.ToString(intPtr);
}
return result;
}
}
public struct ProcessEntry32
{
public uint dwSize;
public uint cntUsage;
public uint th32ProcessID;
public IntPtr th32DefaultHealabel1;
public uint th32ModuleID;
public uint cntThreads;
public uint th32ParentProcessID;
public int pcPriClassBase;
public uint dwFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szExeFile;
}

-----------------Timer Connecting--------------

if (info == "0")
{
status.ForeColor = Color.YellowGreen;
status.Text = "Wait For Apply";
}
else if (info == "1")
{
status.ForeColor = Color.Red;
status.Text = "No Emulator Found";
}
else if (info == "-2")
{
status.Text = "YOUR HACK DEACTIVE!";
}
else if (info == "2")
{
status.Text = "YOUR HACK ACTIVE!";
}
else if (info == "3")
{
status.Text = "Maybe Already Applied Or Nothing Found";
}
else if (info == "4")
{
status.Text = "Wrong PID Please Refresh";
}
--------------------fORM load------------

Proctimer.Enabled = true;

You might also like