Writing a value to a executable file



Hello,
I am trying to write a program that will open an executable file and
write a value to it to act as a counter to see how many times the
file has been run. After the file has run a set amount of times, I
want to make the file inoperable. What would be the safest way to
determine where to write that value? Maybe seek to the end of the
file and then step back a few bytes, something like seek(filename,
filesize(filename) -4)? Is there a better/safer way to do that?

thanks.
.



Relevant Pages

  • Re: Fighting Women (For Men)
    ... >You're making arguments on a "and then we square off, ... and typically they learned it from the prev. ... they act it out on either themselves or on the ... I like the idea of chicks being able to fight hard in the ring. ...
    (rec.martial-arts)
  • Re: Writing a value to a executable file
    ... Raymond Holtzfingeru wrote: ... > I am trying to write a program that will open an executable file and ... > write a value to it to act as a counter to see how many times the ... trouble trying to update a counter in your data segment. ...
    (comp.lang.pascal.borland)
  • Re: Anyone watch BBC Countryfile today?
    ... You act like a prick and gripe about being treated like one? ... Prev by Date: ...
    (uk.environment.conservation)
  • Re: How restricting CSS-style?
    ... Any other links will just act like they normally would. ... > Btw - looks like you'd better use: ... > It is after all a list of links, not a paragraph :-) ... Prev by Date: ...
    (alt.html)
  • Tractor trailer a separate category (Legal)
    ... category of "goods carriage" requiring permit under the Motor Vehicles ... Act. ... Prev by Date: ...
    (misc.transport.trucking)

Loading