You are currently offline, waiting for your internet to reconnect

How to modify and rebuild .cab files built with PDW

This article was previously published under Q191212
This article has been archived. It is offered "as is" and will no longer be updated.
When you use the Visual Basic Package and Deployment Wizard (PDW) to create adistribution set for your application, you may need to modify the .cab filecreated by the wizard.

This article describes how to modify the .cab files that the Package andDeployment Wizard creates, how to extract the files from a .cab file, andhow to rebuild the .cab file.
When you create a distribution package with the Package and DeploymentWizard, it creates the .cab file(s) that are used to install yourapplication.

The Contents of a .cab File

A .cab file contains compressed files that are necessary for installingyour application. The Package and Deployment Wizard places an decompressedcopy of each of these files in a folder named "Support," which can be foundin the same location as the .cab file.

In all cases, the Package and Deployment Wizard places at least two files inthe Support folder: a .ddf file and a component file (.exe, .dll, or .ocxfile). If you are creating an Internet download package, the Package andDeployment Wizard also includes an .inf file.
  • .ddf: The ddf file is known as a Diamond Directive File, a text file that you can open in NotePad or any text editor. The .ddf file contains specific information required to compress your files into a cabinet file; the .ddf file itself is not placed in the .cab file.

    NOTE: You should not modify this file unless absolutely necessary.
  • Component File (.exe, .dll, or .ocx): The type of component you create determines the file extension of the file included here. This is the main file you are attempting to install.
  • .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 File

To extract the contents of a cabinet file, you must use the Extractutility. Extract.exe can be found in your Windows folder or on your Windows95, Windows 98, Windows Me, or Windows NT installation disc.

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 *.*

where "" is the name of your cabinet file.

For more information on using the Extract.exe utility, you can 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 File

Once you've extracted the files within a .cab file, you can makemodifications to those files and then proceed to rebuild the .cab filemanually.

To rebuild a .cab file, the Package and Deployment Wizard provides a batch(.bat) file. The batch file will have the same name as your .cab file, butwith a .bat extension. The wizard places this file into the Support folderfor your package. Double-click the .bat file in Windows Explorer or run the.bat file from the MS-DOS prompt to rebuild the .cab file.

The .bat file runs the MakeCab.exe utility that ships with Visual Basic.The MakeCab utility is installed by default in the followingfolder:
C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\

You can also find the MakeCab utility on your Visual Basic installationdisc.

To rebuild the cabinet file without the .bat file, place any modified filesand the original .ddf file into a single folder. Also, make sure theMakeCab.exe utility is in the MS-DOS path or copy it to the same folder asthe .ddf file.

At a command prompt, type the following command where "Project1.ddf" is thename of your .ddf file:
MakeCab /F Project1.ddf

For more information about the MakeCab utility, you can use the "/?"switch, or see the ActiveX SDK documentation as referred to in theREFERENCES section of this article.

Notes on Rebuilding Cabinet Files

Normally, you do not need to modify the files within a cabinet file.However, if you do need to modify cabinet files, please use the followingguidelines 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 Package and Deployment Wizard. If you need to add or remove files from the cabinet file, re-run the wizard. Otherwise, you need to modify the .ddf file, which this article does not discuss.
  • 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 as referred to in the REFERENCES section of this article. Problems with the .inf file can result in undesired behavior when the component attempts to download.
  • You should not modify an ActiveX component (.ocx, .exe, or .dll) in any way. If you need to modify an ActiveX component, rebuild the cabinet file using the Package and Deployment Wizard.
  • If you rebuild the .cab files after updating any of the included files to a newer version, you also need to update the version number and date/time stamp in the Setup.lst file.
  • If you end up with a different number of .cab files after running the .bat file, you need to update the number of .cab files listed in the Setup.lst file. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
    190077 How to set number of .CAB's in Setup.lst after repackaging
For additional information about using Extract.exe, MakeCab.exe, modifying .ddf files or modifying .inf files, click the following article number to view the article in the Microsoft Knowledge Base:
310618 Microsoft Cabinet Software Development Kit
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
176810 How to manually modify and rebuild CAB files
132913 How to use Extract.exe to copy files from the cabinet files

Article ID: 191212 - Last Review: 12/05/2015 09:07:13 - Revision: 2.0

Microsoft Visual Basic 6.0 Professional Edition, Microsoft Visual Basic 6.0 Enterprise Edition

  • kbnosurvey kbarchive kbhowto kbappsetup kbwizard KB191212