HOWTO: Downloading Dependent DLLs in IE with .inf FileID: Q165075
|
It is often necessary to download dependent DLLs along with an ActiveX Control. MFC and Visual Basic controls have this requirement. This article will explain three ways that you can do this.
There are three ways to include dependent DLLs in the download for a
control. The first way is to include the DLL(s) in the CAB file for the
control along with the OCX and INF files. The downside of this is that the
DLL will be downloaded any time the control is downloaded. In some cases,
this is appropriate. The next way is to package the dependent DLL(s) in a
separate CAB file and refer to that in the INF file for the control. The
third way also packages the DLL in a separate CAB file but the CAB file is
referred to in the control[ASCII 146]s INF file with a hook. Using a hook allows the
download process to execute an INF or EXE file contained in the dependent
CAB file.
To add a dependency for an OCX (Simpdll.dll in this example), a section
similar to the section for the control is added to the [AddCode] section of
the INF file:
[Add.Code]
TestDw.ocx=TestDw.ocx
simpdll.dll=simpdll.dll
A section is then added to the INF file to control the installation of the
DLL:
[simpdll.dll]
FileVersion=1,0,0,1
file-win32-x86=thiscab
This is the first way mentioned to include a DLL dependency in a download.
file-win32-x86=http://example.microsoft.com/simpdll.cabIn this case, Simpdll.cab contains only simpdll.dll.
[Add.Code]
...
msvcrt.dll=msvcrt.dll
mfc42.dll=mfc42.dll
olepro32.dll=olepro32.dll
[msvcrt.dll]
FileVersion=4,20,0,6164
hook=mfc42installer
...
[mfc42installer]
file-win32-x86=http://activex.microsoft.com/controls/vc/mfc42.cab
run=%EXTRACT_DIR%\mfc42.exe
In this case, the MFC DLLs are packaged in a self-extracting .exe file,
which is contained in the .cab file (mfc42.cab). However, tools to make
self-extracting .exe files are not currently available from Microsoft.
Therefore, you will either need to package dependent DLLs with an .inf file
or reference the .inf file in the installation hook:
[yourinstaller]
file-win32-x86=http://example.microsoft.com/simpdll.cab
InfFile=your.inf
Or, you will need to build a self extracting EXE file using third party
tools.
; ========================= Mfc42.inf =========================
; This file will control the download of the MFC 4.2 DLLs
[version]
; version signature (same for both NT and Win95) do not remove
signature="$CHICAGO$"
AdvancedINF=2.0
[SourceDisksNames]
; This section specifies that all sources are in the "default"
; location.
1="default",,1
[DefaultInstall]
; Default section to process and copy all files under the section
; mfcdllsx.files and Register DLLs under the section mfcdllsx.register.
CopyFiles=mfcdllsx.files
RegisterOCXs=mfcdllsx.register
[DestinationDirs]
; Destination Directories for CopyFiles Sections.
; 11 indicates LDID_SYS - system directory
mfcdllsx.files=11
[mfcdllsx.files]
; ,,,32 - Suppress version conflict dialog and don't overwrite newer
; DLLs
msvcrt.dll,,,32
mfc42.dll,,,32
olepro32.dll,,,32
[mfcdllsx.register]
; msvcrt.dll is not self registering
%11%\mfc42.dll
%11%\olepro32.dll
; ====================== Mfc42.inf ======================
A DLL needs to be listed in the .register section if it exports a
DllRegisterServer function. This can be determined by examining the DLL
with the Visual C compiler's Dumpbin.exe utility. You can also run
Regsvr32 on the DLL, which attempts to register the DLL. Regsvr32 loads
the DLL, verifies that DllRegisterServer is properly exported by calling
GetProcAddress() on the DLLRegisterServer function. If it succeeds, the
function DllRegisterServer is exported and is then called.
copy mfc42.dll C:\Test
run "D:\msdev\bin\REGSVR32.EXE C:\Test\mfc42.dll"
delete mfc42.dll
The next time the system tries to look for Mfc42.dll, it looks up the
registry, finds that the file is mapped to C:\Test\Mfc42.dll, and doesn't
find it there. Running Regsvr32 on a file that is already installed on a
machine does not cause problems.
For additional information, please see the following articles in the Microsoft Knowledge Base:
Q167158 How To Package MFC Controls for Use Over the Internet
Q167597 Specifying FileVersion and #Version for Component Download
© Microsoft Corporation 1997, All Rights Reserved.
Contributions by Robert Duke, Microsoft Corporation
Additional query words:
Keywords : kbIE500 InetSDKCAB AXSDKCompDownload
Version : Win:3.0,3.01,3.02,4.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 17, 1999