By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,965 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,965 IT Pros & Developers. It's quick & easy.

How to force a program to write into his exe

P: n/a
The problem is quite difficult and i'm starting to think that it's
impossible
to accomplish..

Suppose you have C.exe. When you run C.exe, it must change his 0x4e's byte
into 0xff.. Of course, when doing so - exception is raised because file is
in use..

Is there a way to do this without problems?
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Asipu posted:
The problem is quite difficult and i'm starting to think that it's impossible
to accomplish..

Suppose you have C.exe. When you run C.exe, it must change his 0x4e's byte into 0xff.. Of course, when doing so - exception is raised because file is in use..

Is there a way to do this without problems?


Assuming your platform is Windows:

It can't be done by the .exe file. Your options are:

A) Get you .exe file to open another .exe file, then close
itself, the other .exe file with edit the original. The
downside is that you won't be able to delete the second
..exe file.

B) Instead of using another .EXE file to edit the original,
write a batch file. The upside here is that a batch file
*can* delete itself.
-JKop
Jul 22 '05 #2

P: n/a
And the question is :

Why would you even want to do that ? except if you had bad things in mind...
Jul 22 '05 #3

P: n/a
> Why would you even want to do that ?

Well the answer is twofold.. First, understanding security (and possibly
overriding it), and making a program that has output data in his own
exe file thus bypassing the need of second file for data storage
(also registry, DB conn, EventLog, other file, ..anything..)..

I know that to majority it seems like a stupid and unnecessary way to
accomplish simple data transfer, but with understranding those
"unusual" hidden procedures, i gain more insight into the broad
spectrum of the problem.
Jul 22 '05 #4

P: n/a
> Assuming your platform is Windows:

It can't be done by the .exe file. Your options are:

A) Get you .exe file to open another .exe file, then close
itself, the other .exe file with edit the original. The
downside is that you won't be able to delete the second
.exe file.

B) Instead of using another .EXE file to edit the original,
write a batch file. The upside here is that a batch file
*can* delete itself.


On Linux you can even delete a running executable, thus this seems to
be windows. If you run a batch file that will delete itself, there's 2
ways of deleting it. Depending on Win9x /NT kernel. The exe could
write a copy of itself, change it, write a batch file, close itself
and run the batch file.
If you're planning on writing a virus that mutates, you'd better
reconsider writing it and code something that is useful to people.
There's a lot of viruses already, we don't need new ones. More,
writing viruses always indicates failure in social life.
-Gernot
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.