Skip to main content
gamedev.net
🔒 Locked

How to patch a patch program?

Started by bakedbeans 5 replies 850+ views
Original Post
bakedbeans
bakedbeans
Right now I have a simple patching program. It just compares files on the webserver with local files and if anything is different the new version is downloaded. However, I would like to build in the functionality where my patch program can update itself (so it can download a new version later that would do binary checking or download through FTP instead of HTTP). Last I tried, you can't open the exe file and rewrite it while you're running it. So how do I download the latest patcher.exe file and overwrite the current one? Also getting it to restart itself with the new copy would be good too. Of course I suppose I could also hack together some batch file that would: -launch when patching is done -wait a few seconds -delete old patcher.exe -rename patcher.exe.new to patcher.exe -launch patcher.exe My best assumption is you should be able to queue up some DOS commands like that which execute after the program officially ends, but that's just a speculation. I'm certain there's gotta be a simpler way to do it. Anyone know how it's done?
Nice Coder
Nice Coder
ok, (having done this before) its a simple process.

Your patcher,(p) downloads new patcher (np).

p opens up the (pre-made and predesignated) data file, in the same directory as np and itself.

it saves a series of numbers in it. and its filename.

it opens np, and it closes itself.

on loading np, scans the data file for the sequence. when it finds it, it removes the file whose filename was appended onto the file. it then renames itself, to take p's place.

Done.

At least, thats how i do mine. (part of, i do a bit extra, like checksum checking, decompression, ect.)

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
oddbot
oddbot
You might also want to check out a tool I found called zsync. Basically it lets you update parts of files from a web server easily, less data transfer means less load on your server and less waiting for the user.

homepage

If you slap a front end on that, let it check for a new version and download it, then run the downloaded patcher. If there was no new version, don't run it.

-oddbot
VincentLascaux
VincentLascaux
Create a batch file called patcher which only purpose is to launch the patcher. It will contain a single line : the name of the patcher executable file, which should contain a version number.
When updating the patcher, you just have to change the batch file to make it launch the new version of the executable.
Empirical
Empirical
My system works like this:

Patcher checks for updates to the patcher, if so, downloads the patcher to a tempory location and runs it, passing the path to the perminant sotrage location of the patcher, then exits.

New patcher waits for write access and copies itself over to the perminant store. Then runs that copy. No batch files etc required.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.