Can a C program modify its executable file?

后端 未结 9 1972
情歌与酒
情歌与酒 2020-12-29 04:35

I had a little too much time on my hands and started wondering if I could write a self-modifying program. To that end, I wrote a \"Hello World\" in C, then used a hex editor

9条回答
  •  孤城傲影
    2020-12-29 04:59

    If you operating on Windows, I believe it locks the file to prevent it from being modified while its being run. Thats why you often needs to exit a program in order to install an update. The same is not true on a linux system.

提交回复
热议问题