-
January 24th, 2013, 07:11 AM
#1
How a file can edit itself after the run?
Hi all.
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.
any solution?
thanks everybody.
-
January 24th, 2013, 12:06 PM
#2
Re: How a file can edit itself after the run?
You'd have to open as BINARY, but what your are doing will hide the files from other processes and the OS in some instances.
-
January 24th, 2013, 03:07 PM
#3
Re: How a file can edit itself after the run?
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.
Always use [code][/code] tags when posting code.
-
January 25th, 2013, 06:14 AM
#4
Re: How a file can edit itself after the run?
other problem is that you cannot edit the EXE while it is running... (windows Locks file access to Special access read only)..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
January 25th, 2013, 02:38 PM
#5
Re: How a file can edit itself after the run?
![Quote](images/misc/quote_icon.png) Originally Posted by DataMiser
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.
1)
changing the summary properties of the exe file after the run.
look at this picture:
![](http://upcity.ir/images/71535391336539440004.jpg)
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?
2)
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?
-
January 25th, 2013, 04:38 PM
#6
Re: How a file can edit itself after the run?
I assume that when you keep saying after run you actually mean during run. Clearly no program can do anything if it is not running.
If you really mean after it has ran then of course you can do anything you want to it from an external source because it is not running. The program however can not do anything unless it is running.
As for the second question.. umm because Windows has the file open and locked.
Always use [code][/code] tags when posting code.
-
January 26th, 2013, 02:01 AM
#7
Re: How a file can edit itself after the run?
![Quote](images/misc/quote_icon.png) Originally Posted by DataMiser
I assume that when you keep saying after run you actually mean during run. Clearly no program can do anything if it is not running.
If you really mean after it has ran then of course you can do anything you want to it from an external source because it is not running. The program however can not do anything unless it is running.
As for the second question.. umm because Windows has the file open and locked.
Yes of course i mean during run.
so as the result ,all of this topic users believe that exe file during run could not be change ever?
-
January 26th, 2013, 10:50 AM
#8
Re: How a file can edit itself after the run?
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.
Always use [code][/code] tags when posting code.
-
January 26th, 2013, 05:46 PM
#9
Re: How a file can edit itself after the run?
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...
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
January 28th, 2013, 02:09 AM
#10
Re: How a file can edit itself after the run?
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...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|