Search code examples
c++winapicab

How to use Cabinet (CAB) Files to compress/uncompress a single file in Windows XP/Windows 7?


I want to compress/uncompress a single file in my C++ application without using an external library. I have read that Cabinet Files can be used to do this, but I am unable to find any useful examples.

I am not even sure if Cabinet Files can still be used in modern Windows versions, can anyone provide a simple example to do so.


Solution

  • They still work (Windows 2000 - Windows 10, at least).

    See MSDN for the API Documentation and samples of how to decompress a file or create a new cabinet.

    Example implementations for the callbacks are available on their respective pages. Ex: fnMemFree and fnNotify.