c# - RPM does work and i can't figure out why -
keep searching internet , can't figure out, readprocessmemory returning fine executing. output empty. lenght of array 0 well.
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.runtime.interopservices; using system.diagnostics; namespace memed { class program { static void main(string[] args) { process proc = process.getprocessesbyname("client")[0]; byte[] buff = new byte[]{}; intptr bread; intptr phandle = openprocess(0x0010, false, proc.id); bool check = readprocessmemory(phandle, (intptr)0x5eff75b8, buff, 10, out bread); if (!check) console.writeline("rpm fail"); console.writeline(buff.length); //always returns 0, value string "xyle" console.writeline(encoding.unicode.getstring(buff));//always empty, tryed of encoding types check still blank result. console.readkey(); } [dllimport("kernel32.dll")] public static extern intptr openprocess(int dwdesiredaccess, bool binherithandle, int dwprocessid); [dllimport("kernel32.dll", setlasterror = true)] static extern bool readprocessmemory( intptr hprocess, intptr lpbaseaddress, [out] byte[] lpbuffer, int dwsize, out intptr lpnumberofbytesread); } }
it's because buffer give fill has length of 0 since initialized empty (new byte[] {}). try giving room:
byte[] buff = new byte[1024]; change number based on how memory want read, , use length dwsize parameter:
readprocessmemory(phandle, (intptr)0x5eff75b8, buff, (uint32)buff.length, out bread); also, make sure you've got correct permissions via this answer. you'll need run app elevated permissions.
Comments
Post a Comment