HOWTO: Add the MDAC Redistribution Setup to CAB Files

ID: Q185622


The information in this article applies to:


SUMMARY

When developing applications with ActiveX Data Objects (ADO) it may become necessary to distribute the Microsoft Data Access Components (MDAC). You can redistribute the MDAC run-time components via the MDAC redistribution EXE.

For Internet and Intranet environments, installing .ocx(s), .dll(s) and ActiveX document(s) require the use of CAB files. CAB files contain the components of your application and an .inf file that determines when, how and where these components install. In many cases, the CAB file references other CAB files. When distributing MDAC components you should use the Mdacfull.exe file. This file contains the MDAC redistribution setup EXE. You need the Mdacfull.exe file for this article. The file is located at the following URL:


   <LINK TYPE="GENERIC" VALUE="http://www.microsoft.com/data/downloads.htm">http://www.microsoft.com/data/downloads.htm</LINK> 


MORE INFORMATION

The following information references an .ocx file that requires ADO. The .ocx is referred to as msftNexus.ocx. To add the MDAC redistribution setup (CAB) to your application's CAB file for browser installation, please follow these steps

  1. In order to distribute the Mdacfull.exe with your application you must CAB the EXE. You can use the Cabarc.exe utility to make your CAB file. You can find Cabarc.exe and the entire CAB SDK at the following URL: http://www.microsoft.com/workshop/management/cab/cabdl.asp Download the SDK and extract it into a useful directory.


  2. Locate the directory of the Cabarc.exe. Place the Mdacfull.exe file in this directory. From the Command prompt type the following: CABARC n mdacfull.cab mdacfull.exe


  3. Place the newly created Mdacfull.cab file in the download directory for your component. For example: C:\InetPub\wwwroot


  4. Use the Visual Basic Setup Wizard to generate a distribution package for your application. The setup wizard generates a CAB file, which contains an .inf file and the dependent components of your application. If the Setup Wizard asks you to reference the ADO DLL (msado15.dll), clear it as a dependency. The wizard creates a \SUPPORT folder for the setup.


  5. Locate the .inf file in the \SUPPORT folder. This file contains the dependency information for your application and determines how and where to install the components. Under the '[Add.Code]' section of the .inf file add the line: MDACFULL.EXE=MDACFULL.EXE. Here is an example: [Add.Code] Msftnexus.ocx=Msftnexus.ocx Msstkprp.dll=Msstkprp.dll Comctl32.ocx=Comctl32.ocx Asycfilt.dll=Asycfilt.dll Msvbvm50.dll=Msvbvm50.dll Mdacfull.exe=Mdacfull.exe


  6. Add the following code right before the [Setup Hooks] section of your .inf file: [MDACFULL.EXE] FileVersion=4,71,0819,0 Hook=MDAC [MDAC] file-win32-x86=http://yourwebserver/mdacfull.cab run=%EXTRACT_DIR%\Mdacfull.exe /q Be sure to change the address of the CAB file to its appropriate location. You may place the CAB in any Web directory. The /q parameter executes the setup in partial quiet mode. The user sees an extraction screen, however they are not prompted for any input.


  7. Your .inf file should look something like the following: ;INF file for MsftNexus.ocx ;DestDir can be 10 for Windows directory, 11 for Windows\System(32) ;directory, or left blank for the Occache directory. [version] signature="$CHICAGO$" AdvancedINF=2.0 [Add.Code] Msftnexus.ocx=Msftnexus.ocx Msstkprp.dll=Msstkprp.dll Comctl32.ocx=Comctl32.ocx Asycfilt.dll=Asycfilt.dll Msvbvm50.dll=Msvbvm50.dll Mdacfull.exe=Mdacfull.exe [MSFTNEXUS.OCX] file-win32-x86=thiscab RegisterServer=yes clsid={FD2B0C9D-E6B9-11D1-9BE7-00C04FB9D91A} DestDir= FileVersion=1,0,0,0 [MSSTKPRP.DLL] hook=MsStkPrp.cab_Installer FileVersion=5,1,43,19 [MsStkPrp.cab_Installer] file-win32-x86=http://activex.microsoft.com/controls/vb5/MsStkPrp.cab InfFile=MsStkPrp.inf [COMCTL32.OCX] hook=ComCtl32.cab_Installer clsid={9ED94440-E5E8-101B-B9B5-444553540000} FileVersion=5,1,43,19 [ComCtl32.cab_Installer] file-win32-x86=http://activex.microsoft.com/controls/vb5/ComCtl32.cab InfFile=ComCtl32.inf [ASYCFILT.DLL] hook=AsycFilt.cab_Installer FileVersion=2,20,4118,1 [AsycFilt.cab_Installer] file-win32-x86=http://activex.microsoft.com/controls/vb5/AsycFilt.cab InfFile=AsycFilt.inf [MSVBVM50.DLL] hook=MSVBVM50.cab_Installer FileVersion=5,1,43,19 [MSVBVM50.cab_Installer] file-win32-x86=http://activex.microsoft.com/controls/vb5/MSVBVM50.cab InfFile=MSVBVM50.inf [MDACFULL.EXE] FileVersion=4,71,0819,0 Hook=MDAC [MDAC] file-win32-x86=http://yourwebserver/mdacfull.cab run=%EXTRACT_DIR%\MDACFULL.exe /q [Setup Hooks] AddToRegHook=AddToRegHook [AddToRegHook] InfSection=DefaultInstall [DefaultInstall] AddReg=AddToRegistry [AddToRegistry] HKLM,"SOFTWARE\Classes\CLSID\{FD2B0C9D-E6B9-11D1-9BE7- 00C04FB9D91A}\Implemented Categories\{7DD95801-9882-11CF-9FA9- 00AA006C42C4}" HKLM,"SOFTWARE\Classes\CLSID\{FD2B0C9D-E6B9-11D1-9BE7- 00C04FB9D91A}\Implemented Categories\{7DD95802-9882-11CF-9FA9- 00AA006C42C4}"


  8. After editing the .inf file, you need to re-CAB your components. Although the Visual Basic Setup Wizard created a CAB file for your application, you must re-cab your components to reflect the changes in the .inf file. You can use Cabarc.exe to make your CAB file.


  9. Locate the directory of the Cabarc.exe. Add the appropriate files for the project to this directory. Create your new CAB file. From the Command prompt you would type the following: CABARC n nameofyourcab.cab nameoftheocx.ocx nameoftheinf.inf -or- CABARC n msftNexus.cab msftNexus.ocx msftNexus.inf Be sure to include the correct, edited version of the .inf file.


  10. Place this CAB file in the directory that is referenced in the CODEBASE section of your HTML page. For example: <html> <object ID="NexusCtl" WIDTH="381" HEIGHT="590" CLASSID="CLSID:FD2B0C9D-E6B9-11D1-9BE7-00C04FB9D91A" CODEBASE="msftNexus.CAB#version=1,0,0,0"> </object> -or- <object ID="NexusCtl" WIDTH="381" HEIGHT="590" CLASSID="CLSID:FD2B0C9D-E6B9-11D1-9BE7-00C04FB9D91A" CODEBASE="http://MyServer/MySecretCABDirectoty/ msftNexus.CAB#version=1,0,0,0"> </object> <head> <title>My Test Page</title> </head> <body> </body> </html>


  11. When the browser requests this page, it attempts to install the MsftNexus.cab. It first installs Mdacfull.exe through the Mdacfull.cab and then proceeds with the rest of the dependent components. The install runs without the need for user interaction, although they will see a brief setup screen. NOTE: Depending on the versioning of certain OLE automation components and the current services running on the target computer, the setup may require you to reboot. This reboot only occurs once. If you plan to version your components and have constantly changing GUID's, you may want to associate the MDAC install with its own GUID. This would prevent future installs and possible reboots as your component's GUID's change. This would be very effective in environments where you are creating multiple applications that are all dependent on MDAC components.


  12. You must digitally sign your CAB if your users have their security set to HIGH. Otherwise, your component will not download or install. You may find more information on digital signing at the following URL: http://www.verisign.com



REFERENCES

This article is one of a series dealing with redistribution of MDAC components; ODBC, OLE DB, ADO, RDS, the MDAC Standalone, MDAC Redistribution and the Data Access SDK. The whitepaper "Redistributing Microsoft Data Access Components" presents a comprehensive overview of this subject, including referencing the content in this Knowledge Base article. The whitepaper is located at the following URL:


   <LINK TYPE="GENERIC" VALUE="http://www.microsoft.com/msdn/news/feature/datajul98/redistmdac.htm">http://www.microsoft.com/msdn/news/feature/datajul98/redistmdac.htm</LINK> 


For additional information, please see the following article(s) in the Microsoft Knowledge Base:


   ARTICLE-ID: <LINK TYPE="ARTICLE" VALUE="Q167158">Q167158</LINK> 

   TITLE     : HOWTO: Package MFC Controls for Use Over the Internet 



   ARTICLE-ID: <LINK TYPE="ARTICLE" VALUE="Q165075">Q165075</LINK> 

   TITLE     : HOWTO: Downloading Dependent DLLs in IE with .inf File 

Additional query words: kbDSupport kbdse kbMDAC


Keywords          : 
Version           : WINDOWS:1.0,1.5; winnt:1.0,2.0
Platform          : WINDOWS winnt 
Issue type        : kbhowto 

Last Reviewed: May 20, 1999