Domanda

I want to replace or add some bytes in my executable, without using secondary writers after my program is closed. I know, usually this is impossible to do, but if this is needed?

I know a program called Unlocker, which is able to delete files currently in use or even running. It deletes blocking descriptors somehow. I think it injects own DLL into every running process.

So, if it inject own DLL into everything and somehow deletes blocking descriptors, maybe I can do same thing for own executable file? At least, I don't need to inject anything to program, because I developed it.

The solution could be in C / C++ also, I just DLL import needed function from own DLL.

È stato utile?

Soluzione

The easiest way to do something often is not to do it, but just pretend you did it.

For instance, when claiming to delete a file, it is often far easier to just move it to another directory on the same disk. That's just a matter of copying the metadata (directory entry) over.

Use that lesson: to "change" your executable, rename it (allowed while running), copy it back to its original name (officially a new file, not in use), and change the new file with the old name.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top