Article ID: 165075
Article Last Modified on 12/21/2006
[Add.Code] TestDw.ocx=TestDw.ocx simpdll.dll=simpdll.dllA 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=thiscabThis is the first way mentioned to include a DLL dependency in a download.
file-win32-x86=DS V - Internet Client (for DEVELOPER issues only)
[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.exeIn 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.infOr, 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.dllThe 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.
167158 How To Package MFC Controls for Use Over the Internet
167597 Specifying FileVersion and #Version for Component Download
Keywords: kbcode kbdownload kbfaq kbhowto KB165075