FILE: Specifying FileVersion and #Version for Component DownloadLast reviewed: July 30, 1997Article ID: Q167597 |
The information in this article applies to:
SUMMARYUpdate of components over the Web is usually controlled by the component's file version. This file version can be specified either by the #Version in the CODEBASE attribute of the <OBJECT> tag or the FileVersion keyword in the .inf file. Determining the file version can be confusing, and if not specified correctly, could cause the component to download incorrectly.
MORE INFORMATIONFor the <OBJECT> tag, specify the file version using the CODEBASE attribute in this manner:
<OBJECT ID="BoomButton" WIDTH=225 HEIGHT=35 CLASSID="CLSID:56F1BF40-B2D0-11d0-A6D6-00AA00A70FC2" CODEBASE="http://example.microsoft.com/AControl.cab#Version=1,0,0,1"> ...In pseudo-code, here's how component download is controlled for the <OBJECT> tag:
Check the Registry for CLSID If CLSID of OBJECT is NOT found in the registry Download OBJECT Else If no #Version specified in CODEBASE tag Use OBJECT installed on system Else Check InprocServer32 key for location of installed component If File version of installed component < CODEBASE #Version Tag Download OBJECTThere are a couple of exceptions to the above sequence. If an [AppID] key is found under the CLSID, the component is usually registered to run via DCOM and is not updated. Also, an [Installed Version] key takes precedence over the file version. This is used for Java classes and non PE (portable executable) files. Update of components installed via an .inf file is controlled by the FileVersion keyword in the .inf file. For example, the following syntax controls the installation of mfc42.dll for the VC 4.2b control above:
[mfc42.dll] FileVersion=4,2,0,6256 hook=mfc42installerIn pseudo-code, here's how the Mfc42.dll download is controlled by this .inf file:
Search for mfc42.dll in the system (first looking at the same directory as the previous version of the control being installed; if not found, the file is searched for via the standard search path for DLLs) If mfc42.dll is not found, install mfc42.dll Else Compare the file version of the DLL with the FileVersion keyword specified in the .inf fileWhat is confusing for both the <OBJECT> tag and the .inf file is what to specify for the file version. Unfortunately, the file version reported by the Windows shell (from Windows explorer, right-click on the file, select Properties and click the Version tab) is not always the same as that required for the <OBJECT> tag or an .inf file. For example, these are the reported file versions and correct versions to use for several VC 5.0 DLLs:
Mfc42.dll: reported - 4.21.7022 use - 4,21,0,7022 Msvcrt.dll: reported - 5.00.7022 use - 5,0,0,7022 Olepro32.dll: reported - 5.0.4055 use - 5,0,4055,1If you have access to Microsoft Developer Studio, you can open the resources for a file and obtain the correct version in this manner:
GetVers <filename>The following file is available for download from the Microsoft Software Library:
~ Getvers.exe (size: 40960 bytes)For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591 TITLE : How to Obtain Microsoft Support Files from Online ServicesThis is the source code for the GetVer program:
void reportError() { LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); cout << (char*)lpMsgBuf << "\n"; // Free the buffer. LocalFree( lpMsgBuf ); } void main( int argc, char *argv[ ], char *envp[ ] ) { cout << "\n"; if(2 != argc) { cout << "Syntax: GetVer <File Name>\n"; return; } DWORD dwArg; DWORD dwInfoSize = GetFileVersionInfoSize(argv[1], &dwArg;); if(0 == dwInfoSize) { cout << "No version info available\n"; reportError(); return; } BYTE* lpBuff = new BYTE[dwInfoSize]; if(!lpBuff) { cout << "Out of Memory\n"; return; } if(0 == GetFileVersionInfo(argv[1], 0, dwInfoSize, lpBuff)) { cout << "Error retrieving version info\n"; reportError(); return; } VS_FIXEDFILEINFO *vInfo; UINT uInfoSize; if(0 == VerQueryValue(lpBuff, TEXT("\\"), (LPVOID*)&vInfo, &uInfoSize)) { cout << "Version information not available\n"; delete lpBuff; return; } if(0 == uInfoSize) { cout << "Version information not available\n"; delete lpBuff; return; } cout << argv[1] << " Version: " << HIWORD(vInfo->dwFileVersionMS) << "," << LOWORD(vInfo->dwFileVersionMS) << "," << HIWORD(vInfo->dwFileVersionLS) << "," << LOWORD(vInfo->dwFileVersionLS) << "\n"; delete lpBuff; } Keywords : AXSDKCompDownload Version : 3.0 3.01 3.02 4.0 Platform : WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |