asquared
asquared

Reputation: 370

How to extract, modify and rebuild a Cabinet File?

I can successfully extract Cabinet files (.cab) using the Windows tool Expand.exe.

Expand.exe foo.cab -F:*

I now want to modify some extracted files and rebuild a Cabinet file from the directory structure.

I found MakeCab.exe and CabArc.exe and tried MakeCab.exe but it doesn´t work. (There are several files with the same name in different subdirectories and MakeCab.exe doesn´t like that. But the directory structure and the files come from a Cabinet file, so it has to work somehow.)

For extraction I also tried the Linux tool cabextract, which gave me another output with less files/directories extracted. So I assume there are files in the Cabinet file which also are archived and Expand.exe extracts them too.

So how can i extract, modify and rebuild a Cabinet file?

(The Cabinet files come from WSUS / Windows Update.)

Upvotes: 3

Views: 22983

Answers (5)

Developer63
Developer63

Reputation: 710

See my answer to this question: C#/.NET: Creating a CAB and adding files to it without an external library

However, as BenH points out in his answer, the resulting cab file wouldn't work as a substitute WU cab file. But, if all you want is access to the FILES AND FOLDERS inside the WU cab file, e.g. DLLs or driver files, etc. then the approach I described should get you there.

For the approach in my linked answer, note that the CabMaker app is a GUI wrapper around the the MakeCab program and handles the DDF file creation and the MakeCab command line creation for you. Below is what the CabMaker GUI looks like.

enter image description here

Upvotes: 1

Yahya Akmal
Yahya Akmal

Reputation: 56

You can make cab file by using makecab.exe in cmd, if you have multiple files,then you can use makecab file directives to add files to .cab file.

makecab /f name.ddf

The Directive file (.ddf) is

.Set CabinetNameTemplate=cabName.cab
.Set SourceDir=PathWhereYouWantToMakeCab
.Set Cabinet=on
.Set Compress=on

"file1name.txt"
"file2name.txt"

Upvotes: 3

T.Todua
T.Todua

Reputation: 56371

To my surprise, there seems a software from ACD: ACDzip (now discontinued program) that CAN MODIFY the .CAB files.

Upvotes: 2

Imran Khan Hunzai
Imran Khan Hunzai

Reputation: 310

I suggest MakeCab.exe is best tool to create the cabinet files. You should rename your source files.

Upvotes: 0

Ben H
Ben H

Reputation: 3236

It's not supported to modify a Windows Update (WU) CAB. The CAB files you download from WU are digitally signed by Microsoft and Windows will refuse to install them if the signature is invalidated. Additionally, without special configuration the WSUS server will also realize the CAB files have been modified and re-download fresh copies from the upstream server or MU.

Upvotes: 2

Related Questions