How To Download Dependent DLLs in Internet Explorer with an .inf File
To add a dependency for an OCX (Simpdll.dll in this example), a sectionsimilar to the section for the control is added to the [AddCode] section ofthe INF file:
[Add.Code] TestDw.ocx=TestDw.ocx simpdll.dll=simpdll.dll
[simpdll.dll] FileVersion=1,0,0,1 file-win32-x86=thiscab
To include the DLL in a separate CAB file, all that is necessary is tochange the location from "thiscab" to the URL at which the dependent CABwill be located:
Multiple DLLs can be added to the INF and CAB files above if necessary.
The third way to package dependent DLLs is to refer to the dependent DLL's CAB file using a hook. With this technique, an INF or EXE file in thedependent CAB can be executed on download.
The following section from an .inf file controls the dependent DLL downloadfor MFC controls:
[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
[yourinstaller] file-win32-x86=http://example.microsoft.com/simpdll.cab InfFile=your.inf
To illustrate, the following is the .inf file used to install the dependentMFC DLLs. You can modify this to install your own DLLs in the same waythat the MFC DLLs are installed.
; ========================= 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 ======================
Beware, however, that running Regsvr32 on the DLL may have undesirableside effects. When DllRegisterServer is called, it makes appropriateregistry entries pointing to the DLL location on the machine. For example,typing the following in an MS-DOS prompt, for test purposes, can causeproblems:
copy mfc42.dll C:\Test run "D:\msdev\bin\REGSVR32.EXE C:\Test\mfc42.dll" delete mfc42.dll
Installing a DLL with a hook and a self extracting EXE is useful for thefollowing reason: If a DLL that needs to be upgraded is already loaded inmemory, the download will fail. This is a known problem, which has beenfixed in Internet Explorer version 4.0. Internet Explorer 4.0 will suggesta reboot and load the new DLL during the reboot.
For more information, see the following Webcast:
Αναγνωριστικό άρθρου: 165075 - Τελευταία αναθεώρηση: 09/28/2011 05:14:00 - Αναθεώρηση: 3.0
- kbcode kbdownload kbfaq kbhowto KB165075