I am trying to create an exe file that can write data in itself.
For example i made an exe file by VB6 with name F1.EXE and it's size is 27356 bytes. there is another file including 3 bytes with name 3b.dat .
I joined both files together at by name of previous exe by this method :
copy /b F1.exe + 3b.dat F1.exe
So i have new exe file with size 27359 bytes.in spite of adding these new three bytes at the bottom of F1.exe file , it is working truly in run.
now i am asking can F1.exe change these three bytes at the end of itself after run?
my goal is storing data in that three bytes !!!
of course i know that it is not natural but i need to storing data like this.
Well perhaps the phrasing is wrong in the question but as worded the simple answer is NO. A program can not do anything after it is run. It can only do something while it is running.
Of course I am aware what you're saying about the limitations for an exe file after run in windows.
my final goal is just adding some bytes at the end of file not exactly editing exe table !
and i know this adding action , doesn't causes to destruction the exe file for run! i just wanna add bytes after run!
Now let's examine this issue from two vision.
changing the summary properties of the exe file after the run.
look at this picture:
if you try to edit summary properties of a file after run ,you will see it is quite possible.
Some changes like this is possible after the run. I myself checked it and it was right.
this example shows us there is some locations in exe file that we can change them even after the run!
so I realize that this is quite possible, so why we can not add some byte at the end of file after run?
of course Windows can set or unset the lock for the file !
why we can not change our file at the same time that windows is saving summary information?
It helps when you use the correct words, after and during are two totally different things and imply something much different.
To the best of my knowledge Windows locks program files while they are running making them read only.
This was not the case in DOS which loaded the entire exe into memory and would allow you to write to it or even delete it while running.
I am not aware of anyway to do this under Windows but have never experimented with it as I see no reason to bother doing it.
Maybe if the OP explains well why he needs to write to the exe somebody would help to resolve the problem.
Maybe he need to keep some kind of log; who and when the exe was used, etc.
Maybe he could use the registry instead...
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
I added 8 extra bytes at the end of file deliberately!
and decided to save the password in this area(last 8 bytes)!
i think this is the best way to save and protect the password if windows does not preventing manipulating that last 8 bytes during run!
anyway I was going to use my last 8 bytes at the end of exe file .... perhaps either it is impossible or there is a hack we never seen it yet...