Write in the running EXE file
Author |
Message |
Iakovos Karaka #1 / 9
|
 Write in the running EXE file
Hello all, The problem is that I would like to write inside the exe file that I am running in order to change the value at a specific address. I try to open the exe file with Open then Seek the file to the specific address and finally Put a new value in this address. Is it possible to bypass the windows 95 file protection that don't allow me to write to the file I am running. Thanks in advance
|
Tue, 10 Oct 2000 03:00:00 GMT |
|
 |
erussel #2 / 9
|
 Write in the running EXE file
Every OS that I've ever programmed in: DOS, Win 3.1, Win 95/NT, OS/2, Novell Network, etc. will not allow a running executable file to be deleted or written to, at least by default. I believe this is standard practice, and I've never heard of a configuration to enable what you need. If the executable is running only from your local client HD, rather than from the network, then maybe an API function will allow this. Eric
Quote: >Hello all, >The problem is that I would like to write inside the exe file that I am >running in order to change the value at a specific address. >I try to open the exe file with Open then Seek the file to the specific >address and finally Put a new value in this address. >Is it possible to bypass the windows 95 file protection that don't allow me >to write to the file I am running. >Thanks in advance
|
Tue, 10 Oct 2000 03:00:00 GMT |
|
 |
Darin Mille #3 / 9
|
 Write in the running EXE file
It would be much better to have an ini file or save a value in the registry but... You can open the file as binary, which will allow you to read and write at the same time. This will also keep the file from being corrupted when it is saved: Dim mychar As String * 1 Open TempFile For Binary As #1 Get #1, fileposition, mychar$ Put #1, fileposition, mychar$ Close #1 where fileposition is the location to change
Quote: >Hello all, >The problem is that I would like to write inside the exe file that I am >running in order to change the value at a specific address. >I try to open the exe file with Open then Seek the file to the specific >address and finally Put a new value in this address. >Is it possible to bypass the windows 95 file protection that don't allow me >to write to the file I am running. >Thanks in advance
|
Tue, 10 Oct 2000 03:00:00 GMT |
|
 |
Kevin C. Dor #4 / 9
|
 Write in the running EXE file
While I don't think you CAN, I don't think you WANT to. Better way to do it: Spawn a second process, wait for the first process to die, modify the first EXE, spawn the first EXE again and let the 2nd one die. Save some state when you exit the first exe and it re-starts it can go back to where it "was". Kevin
Quote: >Hello all, >The problem is that I would like to write inside the exe file that I am >running in order to change the value at a specific address. >I try to open the exe file with Open then Seek the file to the specific >address and finally Put a new value in this address. >Is it possible to bypass the windows 95 file protection that don't allow me >to write to the file I am running. >Thanks in advance
|
Tue, 10 Oct 2000 03:00:00 GMT |
|
 |
Kevin C. Dor #5 / 9
|
 Write in the running EXE file
Did I mention that you don't WANT to modify EXEs? You would be much better off just writing changing information to the registry (or the old way, an INI file). Kevin
Quote: >Hello all, >The problem is that I would like to write inside the exe file that I am >running in order to change the value at a specific address. >I try to open the exe file with Open then Seek the file to the specific >address and finally Put a new value in this address. >Is it possible to bypass the windows 95 file protection that don't allow me >to write to the file I am running. >Thanks in advance
|
Tue, 10 Oct 2000 03:00:00 GMT |
|
 |
Mark Hise #6 / 9
|
 Write in the running EXE file
Quote:
> Every OS that I've ever programmed in: DOS, Win 3.1, Win 95/NT, OS/2, Novell > Network, etc. will not allow a running executable file to be deleted or > written to, at least by default. I believe this is standard practice, and > I've never heard of a configuration to enable what you need. If the > executable is running only from your local client HD, rather than from the > network, then maybe an API function will allow this. > Eric
I was sucessful with that same crazy scheme, once upon a time in DOS. I stored magic numbers at the end of the .EXE that determined whether it would continue running after a certain number of uses. Worked pretty good, too... course there was no network involved, and I didn't realize at the time that it couldn't be done. :) It was some of my favorite code... took a 'snapshot' of a database and used that as a seed for my little encryption routine. A user could read the generated number to me and I could give them another number that somehow had number of uses in it. Since everybodies data was different, so were the magic numbers. Well... back to work.
|
Fri, 13 Oct 2000 03:00:00 GMT |
|
 |
Darin Mille #7 / 9
|
 Write in the running EXE file
Oops! This is for writing and reading an exe that is NOT running. I don't know that you can or would want to write to an exe that is running. Quote:
>It would be much better to have an ini file or save a value in the registry >but... >You can open the file as binary, which will allow you to read and write at >the same time. This will also keep the file from being corrupted when it is >saved: >Dim mychar As String * 1 >Open TempFile For Binary As #1 > Get #1, fileposition, mychar$ > Put #1, fileposition, mychar$ >Close #1 >where fileposition is the location to change
>>Hello all, >>The problem is that I would like to write inside the exe file that I am >>running in order to change the value at a specific address. >>I try to open the exe file with Open then Seek the file to the specific >>address and finally Put a new value in this address. >>Is it possible to bypass the windows 95 file protection that don't allow me >>to write to the file I am running. >>Thanks in advance
|
Fri, 13 Oct 2000 03:00:00 GMT |
|
 |
Matthew V. Jessic #8 / 9
|
 Write in the running EXE file
Quote:
> > Every OS that I've ever programmed in: DOS, Win 3.1, Win 95/NT, OS/2, Novell > > Network, etc. will not allow a running executable file to be deleted or > > written to, at least by default. I believe this is standard practice, and > > I've never heard of a configuration to enable what you need.
Not too useful, except for grins, but spacecraft computer programs are routinely rewritten while the extremely vital programs onboard continue to run. I presume it's not trivial to do... ;) - Matt
|
Fri, 13 Oct 2000 03:00:00 GMT |
|
 |
Michael D. Lon #9 / 9
|
 Write in the running EXE file
The same technique used to replace a DLL that is in use might work. While you can't overwrite the existing DLL, you can rename it and then copy in a new version with the same name. The next time it is referenced, the new one is loaded. A note of caution - if you replace core system components on NT that are not compatible with your service pack level, then you'll kick yourself when you next restart your machine. If you are running the NTFS file system, you can end up having to rebuild your machine. Michael D. Long
Quote: > Oops! This is for writing and reading an exe that is NOT running. I don't > know that you can or would want to write to an exe that is running.
|
Tue, 24 Oct 2000 03:00:00 GMT |
|
|
|