Article ID: 167597
Article Last Modified on 5/11/2006
<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"> ...</OBJECT>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 OBJECT
There 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 through 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.
[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 file
What 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 the file, click Properties, and then 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 Visual C++ 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 as follows:
119591 How to Obtain Microsoft Support Files from Online Services
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;
}
Additional query words: Getvers
Keywords: kbdownload kbfaq kbfile kbinfo kbsample KB167597