memory - How to modify .exe file in c#? -
i want change 4 bytes @ specific address of .exe. tried this:
string path = @"c:\test\mod.exe"; if (file.exists(path)) { using (binarywriter stream = new binarywriter(file.open(path, filemode.open))) { stream.basestream.position = 0x0032d837; stream.write(stringtobytearray("00050000"), 0, 4); } } stringtobytearray() made this:
public static byte[] stringtobytearray(string hex) { return enumerable.range(0, hex.length) .where(x => x % 2 == 0) .select(x => convert.tobyte(hex.substring(x, 2), 16)) .toarray(); } it finds exe nothing gets changed, whats correct way? want add can change manually in hxd hex editor, wanted program it.
fixed! turns out windows defender causing mess :(
Comments
Post a Comment