Jump to content
  • Advertisement
Sign in to follow this  
BennettSteele

C++ Win32 Close All Programs Using The .exe File

This topic is 2471 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just finnished coding a installer/updater for my game. I have 1 problem though: i want it to install the game.exe if its not there and re-write it if out-dated. you can run the updater.exe to install the game. when you launch the game.exe, it runs the updater.exe to check for updates... but i cant update the game.exe if its open. what should i do to close all instances of the game.exe file so i can write to it?

Share this post


Link to post
Share on other sites
Advertisement
Make the updater be the program the player launches and not the game. The updater does any necessary updates and then launches the game.

Note that running a program will keep a file handle open to the exe, which will be closed when the program exits.

Share this post


Link to post
Share on other sites
How do you think doing it the other way round will prevent that?

You can't stop users from changing files on their own PC.

Share this post


Link to post
Share on other sites
I shouldnt have posted that, i should of taken responsibility (which i did right after posting) and find out for myself. i think i found a way... i will have to do more testing...

it goes like this:

CreateThread(Updater);
exit();

it works right now, i will need to mess around with it more to make it work.

Share this post


Link to post
Share on other sites

I shouldnt have posted that, i should of taken responsibility (which i did right after posting) and find out for myself. i think i found a way... i will have to do more testing...

it goes like this:

CreateThread(Updater);
exit();

it works right now, i will need to mess around with it more to make it work.


Really. You're creating a worker thread and then exit right away? I'd expect that to end the entire process immediately, including your freshly started worker thread.

Share this post


Link to post
Share on other sites

but i have the version stored in the game.exe (define VERSION "0.01") and i dont want the user to be able to change that.


Version numbers aren't really useful for updating. File should be updatable even if it's corrupted or missing.

Do a SHA or similar checksum. Post that to server. If server recognizes the hash, send the upgrade path (install 0.02, then 0.02b, then 0.03...).

If server doesn't recognize the hash, assume the installation has been corrupted and send full install of latest version.

Upgrades like that can be easily hosted in web-based CDN server where you just lookup the hash (patch.com/title/841fae63ebbc or similar), which download the upgrade from that version to next one. There's also the patch.com/title/latest, which obviously returns latest fill install.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!