I have my base memory address "GameAssembly.dll"+00DA5A84
and some offets. Adding this up I got the address I need. (The red rectangle). This one changes every time that the game is reset.
Once I got the memory address I can do the following:
public void isImpostor(IntPtr addrs, int valueToWriteInMemory)
{
using (var sharp = new MemorySharp(Process.GetProcessesByName("Among Us").FirstOrDefault()))
{
sharp[addrs, false].Write(valueToWriteInMemory);
}
}
var addrs = new IntPtr(0x210A83A8);
isImpostor(addrs, 0x0);
nevertheless I'm not sure how I can get that memory address. Not sure how to do:
"GameAssembly.dll" + 0x00DA5A94 + 0x28 + 0x34 + 0x0 + 0x5C
and obtain as a result 0x210A83A8
.
Updated:
In order to know what the AddressBase from GameAssembly.dll is I have this method.
public int GetModuleAddress(String pName, String dllName)
{
Process p = Process.GetProcessesByName(pName).FirstOrDefault();
foreach(ProcessModule pm in p.Modules)
if (pm.ModuleName.Equals(dllName))
return (int)pm.BaseAddress;
return 0;
}
Console.WriteLine(GetModuleAddress("Among Us", "GameAssembly.dll");
Console.WriteLine((IntPtr)GetModuleAddress("Among Us", "GameAssembly.dll"));
Result1 (As integer): 2043150336
Result2 (After Casting to IntPtr): 2043150336 here I can do the addition I mentioned before.
it returns an int
so I can't do the addition of GameAssembly.dll + 0x00DA5A94. Assuming this I cast this result to IntPtr
. once it was cast to IntPtr I can do this.
IntPtr A_ptr =(IntPtr)GetModuleAddress("Among Us", "GameAssembly.dll") + 0x00DA5A94;
But I got this message error:
System.ComponentModel.Win32Exception: 'Couldn't read 4 byte(s) from 0x5C.'
I tried also to cast the address to HEX, with toString("X")
method and I got as result 79C80000
but I can't do neither 79C80000 + 0x00DA5A94
nor 0x79C80000 + 0x00DA5A94
.
looking at values inside of variables I got this.
BaseAdressDLL: 2043150336
A: 0, Aptr: 2057460372 (or 0x00000000 and 0x7aa25a94 respectively)
Bptr: 92 (or 0x0000005c)
What I'm doing wrong? I'm also sorry for my English.
I tried using the BaseAdress that Cheat engines gives me, and it works perfectly so I assume that I don't know how to get the AdressBase properly.
var sharp = new MemorySharp(Process.GetProcessesByName("Among Us").FirstOrDefault());
/* This does`t work
IntPtr GameB = (IntPtr)GetModuleAddress("Among Us", "GameAssembly.dll");
IntPtr GameAssemblyDllBaseAddress = sharp.Read<IntPtr>(GameB, false);
IntPtr A_ptr = GameAssemblyDllBaseAddress + 0x00DA5A94;
IntPtr A = sharp.Read<IntPtr>(A_ptr, false);
*/
// But this does it.
IntPtr A = (IntPtr)0x11F7FC18; // Using AddressBase directly.
// -------------
IntPtr B_ptr = A + 0x5C;
IntPtr B = sharp.Read<IntPtr>(B_ptr, false);
IntPtr C_ptr = B + 0x0;
IntPtr C = sharp.Read<IntPtr>(C_ptr, false);
IntPtr D_ptr = C + 0x34;
IntPtr D = sharp.Read<IntPtr>(D_ptr, false);
IntPtr isImpostor_ptr = D + 0x28;
// read
int isImpostor = sharp.Read<int>(isImpostor_ptr, false);
// write
sharp[isImpostor_ptr, false].Write(0x1);