Managed Libraries for Windows Installer

Managed Wrapper Library for Cabinet APIs

This is a managed library that provides the ability to create and extract cabinet files. It uses cabinet.dll (present on all versions of Windows) to do the actual compression/decompression. It provides access to nearly all cabinet capabilities, including spanning of multiple cab files. It even has support for preserving directory structures and UTF8 paths.

There are two ways to use the library. CabinetInfo and CabinetFileInfo (similar to DirectoryInfo and FileInfo respectively) provide high-level object-oriented methods for doing common file-based cabinet creation and extraction tasks. On the other hand, the Cabinet class provides low-level access to all functionality, and operates completely in terms of .NET Streams. The previous two classes use the Cabinet class to do all the actual work.

There are also two ways to build the library. Compiling it normally will produce the fully functional library in the Microsoft.Cab namespace, while compiling it with the /D:CABMINIMAL /D:CABEXTRACTONLY flags will create a compact assembly with only the core extraction functionality, in the Microsoft.Cab.MiniExtract namespace.

The cabinet library interops with native cabinet APIs which use the 'cdecl' calling-convention. When building against .NET Framework versions before 2.0, this library requires a special post-build step to process the UnmanagedFunctionPointerAttribute. If you use this code in another assembly, don't forget to run AugmentIL on it to fix the delegate calling-conventions, otherwise you will encounter a NullReferenceException when attempting to call the cabinet APIs. When building against .NET Framework version 2.0 or later, the UnmanagedFunctionPointerAttribute.cs source file should be omitted.


See also: