Partager via


Updating Software with New Versions

Version is a 64-bit number that can be broken up into four components, and is specified for Internet Component Download as a,b,c,d, with most significant to least significant listed left to right.

  • a - major version
  • b - minor version
  • c - custom number
  • d - build number

This article contains the following sections.

  • Determining the Local Version Number of a File
  • Including the Version Number in the CODEBASE URL

Determining the Local Version Number of a File

The version of a file that can be downloaded through Internet Component Download is listed in either the CODEBASE attribute of the object element in the referring HTML page or in the corresponding Open Software Description (OSD) or INF files. If a recent enough version of a file is already available on the local computer, no download occurs. When deciding if the version of an available local file is acceptable, the following algorithm is applied:

  • If the file in question has an associated class identifier (CLSID) (either by the CLASSID attribute in the object tag for the main object to be instantiated, or specified by the corresponding OSD or INF file), the following key is looked for on the client registry:

    HKEY_CLASSES_ROOT:\\CLSID\{... clsid ...}\Installed version\
    

    If the default value of this key is of the format a,b,c,d it is assumed to be the available local version of the clsid. This support is for extending version support to non-PE files such as Java class files. To make the version check more robust, the code downloader will also look for an optional named value "path" under the Installed Version key, which, if present, is validated to be present on the file system on the local computer. This is to ensure that a download takes place when the registry information is intact, but the actual file that implements the classid has been removed from the hard disk.

  • The file version number is retrieved from the version resource and checked for sufficiency. If the file version cannot be retrieved, the version of the file is deemed insufficient and a download is initiated for that file.

Including the Version Number in the CODEBASE URL

In addition to the actual code address, the CODEBASE URL can also include an optional version number by using the following syntax:

"CODEBASE=http://www.example.com/example.ocx#Version=a,b,c,d"

The Internet Component Download mechanism downloads and installs the file only if the specified version number is more recent than any existing version of the same file currently installed in the system. If a version number is not specified with a file, it is assumed that any version installed on the system is recent enough.

If the version number specified in the CODEBASE attribute is "-1,-1,-1,-1", Internet Component Download will always try to download the latest version of the desired component. Note that this can be a costly effort involving many network transactions, especially if the Internet search path is searched for the newest version of an object. Note also that because of the Internet search path, it is possible for the Component Download service to try to download code in the absence of a CODEBASE attribute. In fact, if the CODEBASE attribute is the URL fragment "#Version=-1,-1,-1,-1", there is no specific location to download code from, but the Internet search path will still be searched to find the latest version of an object.