While working on my conversion of DigitalOcean droplets to Windows, I came across the need to either extract or add files to the Windows WIM files. The WIM file (Windows imaging format) is an achive of the Windows files that is used in many places, notibly as a ramdisk for the Windows installation environmemt and as the source for the Windows files installed to the disk.

As mentioned, when preparing images to install on the DigitalOcean droplet, I needed a way to add 3rd party drivers to the images. These driver could not be added after the installation since some of the drivers are needed at boot time to communicate properly with the hard drive. In order to install the drivers into the image file, the driver files must be added to the WIM image and a registry hive that resides inside he WIM file must be edited.

One way to get around the problem is to use Microsofts tool name dism.exe that has the ability to install driver directly to the image. The downside of the is that the tool is propiatary and can only be run on Windows machines. Thnaksully, there is an excellent library named wimlib that is capable enough to manipulate the WIM files. unfortunatly, this library does not provide all the functionality that dism.exe does and cannot install drivers directly, but this can be a project for a diffrent time.

Downloading an compiling the wimlib results in a shared library named libwim.so and a executable tool wimlib-imagex. The wimlib-imagex tool is excellent and provides all of the needed tools to manupulate WIM files.In order to automate the process, I would like to be able to script the process in Python. Thus, python-wimlib was born.The project is not complete, but the core functionality is there.