automatic software update

Posted on 1998-07-31
Last Modified: 2013-11-19
I need to implement automatic software update feature. I want to place INF file, containing information for all up to date version of all client components. Client application would connect to the server and based on INF file will download, decompress and update file on the client. For OLE components solution already exists. It is CoGetClassObjectFromURL that does all these tasks. The problem is that I have to update non-OLE component the same way. I looked at Setup API and found that in general these functions provide me with everything except installing from remote site only from local disk. Is there a link on the Internet with example or could some one give me useful tip how to implement this feature. I want to utilize INF file rather then develop my own protocol.
Question by:galkin

Author Comment

ID: 1320030
Edited text of question

Expert Comment

ID: 1320031
You can have a simple GetHttpFile() function get a data file (INF) from your website, the data file would contain information about the lastest upgrade. The program would compare its upgrade and if doesn't have the latest it will download it.

-----MY.INF on site
Version 1.112
File /upgrades/

-----MY.INF on localhost
Version 1.111

if the client does not have version 1.112 it will download and do something depending on what you have in the zip file. All you need to do is use a GetHttpFile function (which I can give you if you need it) to get the INF and then get again if you need the zip file.

Is this what you want to do?

Author Comment

ID: 1320032
I need example of how to parse INF file and decompress updated files. The most important part is how to specify dependency files in INF file and how to handle locked files.

Expert Comment

ID: 1320033
OK, you can read a line at a time from the .inf file. then use strtok() to get the first token in the inf file... make sure you specify terminating characters. As far as the update file goes you would be better off using .CAB files. The CABSDK is on the microsoft site, and I have some source somewhere to use them. Works just like a zip but has c++ implementation (zip you would have to call to DOS or something).

What kind of inf file are you using. the INF file is just a regular text file, if you don't know how to parse a text file RTFM! If you want some source to parse it you better post it up here.
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.


Author Comment

ID: 1320034
Parsing INF file is only one task. Of cause I can write parser myself but this parser will be custom. Any change in INF file format will affect my parser. I would prefer reuse existing technologies, i.e. use setup API as parser. Also I need clear solution about how to download and replace files. I could download them into temporary files and then replace them but i am not sure this is the most efficient way of doing this. I would like to know what way GoGetClassObjectFromURL does updating OLE server. Ideally I need its functionality execpt I don't need to create object from updated file.

Expert Comment

ID: 1320035
First, the less relevant comment: zip decompression doesn't require a call to DOS. There are free, cross-platform libraries for reading ZIP files. The Info-Zip unzip package comes with complete source code. Much of the code is copyrighted, but you're still free to use it, even within commercial projects. Check for more information.

As far as the INF format, you don't need to parse it. Call SetupOpenInfFile (if you don't know the name of the .inf file, only the directory it's in--e.g. because you just expanded a random .zip archive--start with SetupGetInfFileList), then use the various Setup functions after that (either SetupInstallFileEx, one by one, or SetupInstallFromInfSection, section by section). That's the easy part.

So here's what you do: You get the file from a URL. That's easy. If it's a CAB you use Microsoft's APIs to go through it; if it's a ZIP you use Info-ZIP; if you want to use .tgz that's just as easy. Once you've gotten your .inf file and all the other files it needs, just use the standard Setup API calls to do your setup.

By the way, I've built the same solution myself a few times, and I've avoided using .cab and .inf because "standards" which change all the time and which are dependent on Microsoft's APIs really aren't of much use to me, unless they make my life much easier. I find it much simpler to FTP a .zip file into a subdirectory of the program's directory (or the Common Files directory or whatever) and expand it... Or to build a real installer program (e.g. using InstallShield) and just have my program download and run it.


Accepted Solution

Answers2000 earned 200 total points
ID: 1320036
This may not be what you're looking for...but you said "I would prefer reuse existing technologies"

Why don't you use Microsoft SMS (part of back office) to do the distribution ?  It can do what you want out the box and then some.
LVL 13

Expert Comment

ID: 1320037
Bought This Question.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now