How To Manually Modify and Rebuild CAB Files
This article was previously published under Q176810
This article has been archived. It is offered "as is" and will no longer be updated.
When using the Visual Basic 5.0 Application Setup Wizard to create anInternet Component Download Setup for your ActiveX control or ActiveXdocument, you may need to modify the CAB file created by the SetupWizard.
This article describes how to modify the CAB files that the Visual BasicSetup Wizard creates and specifically shows how to extract the files from aCAB file and how to rebuild the CAB file.
For distributing ActiveX components, you may choose to build an InternetComponent Download Setup using the Visual Basic 5 Application Setup Wizard.
The wizard creates two key files: an HTM file (Hypertext Markup LanguageFile, also known as HTML file) and a CAB file (Cabinet file, a compressedfile). The HTM file contains the information necessary to extract andinstall the information stored in the CAB file. The CAB file contains theactual components of your OCX, EXE, or DLL.
When you open the HTM file with Internet Explorer (IE), IE executes the<OBJECT> tag within the HTML code. In its simplest terms, an <OBJECT> tagtells Internet Explorer how to install your ActiveX component onto theclient machine.
The following is an example of an <OBJECT> tag;
<OBJECT ID="MyUserDocument" CLSID="CLSID:CB6994D4-2DCA-11D1-A9CB-00AA00B7B36F" CODEBASE="ActiveX.CAB#version=1,0,0,0"> </OBJECT>
In the <OBJECT> tag above, Internet Explorer uses the ID and CLSID to seeif the specified control is already installed on the client computer. If itis not already installed or if it out of date, IE uses the CODEBASEargument to locate the ActiveX.CAB file to install the ActiveX control ordocument.
The Contents of a .CAB FileA CAB file contains compressed files that are crucial for installing yourActiveX components. The Setup Wizard places an uncompressed copy of eachfile it placed into your cabinet file into a directory named "Support,"which can be found in the same location as the CAB and HTM files.
In all cases, the Setup Wizard will place at least three files in theSupport folder: a .DDF file, an ActiveX component file (.EXE, .DLL or .OCXfile), and an .INF file.
- .DDF: The DDF file is known as a Diamond Directive File, a text file that may be opened in Notepad or any text editor. The DDF contains specific information required to compress your files into a cabinet file; the DDF file itself is not placed into the CAB file. NOTE: This file should not be modified unless absolutely necessary.
- Component File (.EXE, .DLL or .OCX): The type of ActiveX component you create determines the file extension of the file included here. All ActiveX controls have a .OCX extension. Other ActiveX components either .EXEs or .DLLs. This file is your ActiveX component being installed.
- .INF: This is the Information file that contains information about what other files your ActiveX component depends on (dependency files), where to get copies of those files, and how to install those files.
Extracting the Contents of a CAB FileIn order to extract what is in a cabinet file, you must use the Extractutility. Extract.Exe can be found in your Windows folder or on your Windows95, Windows 98, Windows NT, or Windows 2000 installation CD-ROM.
Extract.Exe is a command-line utility; therefore it is used from an MS-DOScommand prompt. To extract the files within a cabinet file, be sure theExtract.Exe utility is in the MS-DOS Path or copy the Extract utility tothe same folder as the cabinet file.
From the MS-DOS command prompt, you can run the following command toextract all of the files in a CAB file into the current directory:
Extract ActiveX.CAB *.*where "ActiveX.CAB" is the name of your cabinet file.
For more information on using the Extract.Exe utility, you may type thefollowing command at an MS-DOS command prompt:
Extract /?For even more information on Extract.Exe, please see the ActiveX SDKdocumentation as referred to in the REFERENCES section of this article.
Rebuilding a CAB FileOnce you've extracted the files within a CAB, you can make modificationsand then proceed to rebuild the CAB file manually.
To rebuild a CAB file, you must use the MakeCab.Exe utility that ships withVisual Basic. The MakeCab utility is installed by default in the followingdirectory:
C:\Program Files\DevStudio\Vb\setupkit\kitfil32It may also be found on your Visual Basic 5.0 installation CD-ROM in thefollowing directory:
\VB\Setupkit\Kitfil32To rebuild the cabinet file, place any modified files and the original .DDFfile into a single folder. Also, make sure the MakeCab.Exe utility is inthe MS-DOS path or copy it to the same folder as the .DDF.
From a command prompt, type the following command:
MakeCab /F ActiveX.DDFwhere "ActiveX.DDF" is the name of your .DDF file.
For more information on the MakeCab utility ,you may use the "/?" switch orsee the ActiveX SDK documentation as referred to in the REFERENCES sectionof this article.
Notes on Rebuilding Cabinet FilesUsually, it should not be necessary to modify the files within a cabinetfile. However, situations may arise where you need to do so. When modifyingcabinet files, please use the following guidelines to avoid problems:
- Never add or remove files from a CAB file. The only files that should be in a CAB file are those added by the Application Setup Wizard. If you need to add or remove files from the cabinet file, re-run the Application Setup Wizard. Otherwise, you will need to modify the .DDF file.
- If you modify the INF file, be sure that your changes are syntactically correct and do not contain errors. For more information about modifying INF files, see the ActiveX SDK in the REFERENCES section of this article. Problems with the INF file may result in undesired behavior when the component attempts to download.
- You should not modify the ActiveX component (.OCX, .EXE or .DLL) in any way. If you feel you need to modify the ActiveX component, rebuild the cabinet file using the Application Setup Wizard.
For more information about how to use the Extract.exe and the MakeCab.exe files and how to modify .ddf or .inf files, see the ActiveX Software Development Kit (SDK) documentation.
Article ID: 176810 - Last Review: 12/05/2015 08:10:54 - Revision: 3.2
Microsoft Visual Basic 5.0 Professional Edition, Microsoft Visual Basic 5.0 Enterprise Edition
- kbnosurvey kbarchive kbhowto KB176810