B&C needs auto-updating functionality for its VB6 database interface software, called ES2. Ideally, users will login & the application will check to see if it needs to grab a new binary stored in the DB. The RDBMS is SQL2005+.
Three executable names, but only two should exist at a time; all operations should be local to a given directory.
_new exists, goto 4
- download executable (or exit if no updated version available)
- if exe image is on a UNC share or networked drive, error: "A new version of ES2 is available, but will not be downloaded because you are running ES2 from the network."
- if the CRC doesn't match
- if the executable is the same as the currently executing image, error
- if the executable is the same as
- save as
- tell all
es2_v8.exe instances to exit (and exit current instance)
- launch C program which waits N seconds for all
es2_v8.exe instances to close
- forcibly terminate
es2_v8.exe "stuck" processes that do not have top-level windows open (if this isn't too hard to figure out)
- if all close, delete
_old, and rename
- otherwise, error: "Please close all ES2 windows and then restart it. If this does not work, please restart your machine and then start ES2."
- launch the newly renamed
Detecting when a new version is needed
Call a stored procedure with the following arguments:
@current_version pull from exe properties
@current_crc (or some checksum)
@new_binary to be null
@new_crc OUTPUT null if no new binary available
@new_binary OUTPUT null or contains the new binary
Note that the stored procedure itself will have access to: