Editing Hex with C ++

Suppose I want to change something in the address 000F5344 of an executable file. How should I do it?

+3
source share
2 answers

@Pablo Santa Cruz offers a great way, but in C. If you prefer pure C ++, here's how:

  • Open file: fstream :: open (do not forget to use the binary flag)
  • Set the position of the put pointer: fstream :: seekp
  • Write the data to the pointer position: fstream :: put
  • Close file: fstream :: close

This is by no means better than version C.

+13
source

The following solution consists of four steps:

  • ( fopen).
  • (offset) ( fseek).
  • ( fwrite).
  • ( fclose).

Google . C.

+11

Source: https://habr.com/ru/post/1759229/


All Articles