#include #include #include unsigned char ORIG[] = "GameOver"; unsigned char PATCH[] = "GameIsOn"; int main(int argc, char **argv) { int mem; char data[8]; int i; mem = open("/dev/kmem", O_RDWR); if (mem<0) { printf("Oops !\n"); return 0; } if (lseek(mem, (off_t)0xC0320B7C, SEEK_SET) != 0xC0320B7C) { perror("lseek"); return 1; } if (read(mem, data, 8) != 8) { perror("read"); for (i=0; i<8; i++) { printf("%.2x ", data[i]); } printf("\n"); printf("Data match ? %d\n", (memcmp(data, ORIG, 8) == 0)); lseek(mem, (off_t)0xC0320B7C, SEEK_SET); if (write(mem, PATCH, 8) != 8) { perror("write"); return 1; } close(mem); return 1; }