Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how to write C program that copy's it's self onto the hard drive, while its running?

Reply
Thread Tools

how to write C program that copy's it's self onto the hard drive, while its running?

 
 
Gordon Burditt
Guest
Posts: n/a
 
      09-07-2006
>> Indeed, if I recall correctly, there is specific USG (Unix Systems Group --
>> i.e., the official Unix specification) language about this situation,
>> dealing with which version of a swapped-out page that is to be read in
>> if the binary is rewritten underneath it (oddly, the requirement
>> is that it is the -new- version of the page that must be swapped in.)


You're talking about different situations. The above assumes
you opened a running executable for write (some systems prohibit this)
and write new data on it (e.g. apply patch or copy whole new executable
over the old one.

><OT> They don't actually work like that. Removing a link to a
>file (filename) still leaves the data happily on disk. Once
>the last process (that has an open handle on the file)
>closes the file *then* the data space is marked as free.
></OT>


This situation assumes you *delete* the file (under one of its
names, at least), then re-create the file under the same name. This
is a very different situation.

Some systems consider *any* writing on executable code to be symptomatic
of a virus and don't allow it. That would include all compilers and
linkers. Some systems require executable code to be "blessed" before
it's usable as executable code (a weak example here is the "executable"
bit in UNIX. A stronger example would be that executables that aren't
already signed by the vendor can only be created by a compiler signed
by the vendor. In these situations, the answer could be that you
can't portably copy an executable and still use it as an executable.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code) Ralf W. Grosse-Kunstleve Python 2 07-12-2005 03:20 AM
Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code Ralf W. Grosse-Kunstleve Python 16 07-11-2005 09:28 PM
__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code) Ralf W. Grosse-Kunstleve Python 18 07-11-2005 04:01 PM



Advertisments