How to compress files the same way they are compressed in WinSxS folder in Windows

Cameron 20 Reputation points
2023-08-08T22:45:36.6833333+00:00

We use a custom windows image.wim for servers.

The image is a windows 2016 server image

The only issue we are currently having is when trying to repair the image using: DISM /Online /Cleanup-Image /RestoreHealth /Source:SOURCEIMAGE

We have replaced the .jpg files for the wallpapers to use our own, these files are identified as corrupted when trying to repair:

2023-05-18 09:09:54, Info CSI 00000007 Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-s..l-wallpaper-windows_31bf3856ad364e35_10.0.14393.0_none_088691afc7246346\img0_1600x2560.jpg do not match actual file [l:18]'img0_1600x2560.jpg' :
Found: {l:32 WACb1nWSwBIC0dlpqpEUi1RTXf0djFY/qBYZOISI6ao=} Expected: {l:32 AFM9FRgYA0A9As3noSfaG1YrhSHXnCTHFqHnAaIBf7I=}

This issue is that the manifest file has a different Hash value than what is in there.

The manifest files are stored in: C:\Windows\WinSxS\Manifests
and they are compress.

I have found an article on how to decompress them, which I have done and edited the has values:

https://forum.xda-developers.com/t/decompress-manifests-files-found-in-the-winsxs-folder.3367399/

The issue I am now having is recompressing the files so I can replace them in that folder.

How do I compress a file the same way that the files are compress in the WinSxS/Manifest folder?

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,766 Reputation points
    2023-08-09T08:29:18.6+00:00

    Hello,

    Compressing files in a manner identical to the compression used in the WinSxS (Windows Side by Side) folder can be challenging because it involves a specific compression algorithm and file structure used by Windows. The WinSxS folder is a system directory where Windows stores various components, manifest files, and resources. The compression used is typically the LZ77-based compression algorithm.

    If you need to replace or modify files within the WinSxS folder, it's recommended to use the Windows built-in tools and utilities to ensure proper handling of system files and maintain system integrity. Attempting to manually compress and replace files using third-party compression tools or custom approaches could lead to compatibility issues or system instability.

    In your case, it seems you're modifying files within the WinSxS folder to customize a Windows image. Here's a safer and more standard approach to achieve your goal:

    Mount the Windows Image:

    Instead of directly modifying files within the WinSxS folder, you should mount the Windows image (WIM) using the Deployment Imaging Servicing and Management (DISM) tool. This allows you to access and modify the image without affecting your running system.

    Replace Files in the Mounted Image:

    Once the image is mounted, you can navigate to the corresponding WinSxS folder within the mounted image and replace the necessary files with your customized versions. This ensures that you are modifying the image in a controlled and consistent manner.

    Unmount and Save Changes:

    After you've made the necessary modifications, unmount the image and save the changes. The DISM tool will handle the compression and packaging of the modified files back into the image.

    Here's a general outline of the steps:

    Mount the Windows image (replace INDEX with the appropriate image index)

    dism /Mount-Wim /WimFile:C:\path\to\image.wim /Index:INDEX /MountDir:C:\Mount

    Navigate to the WinSxS folder within the mounted image (adjust paths)

    cd C:\Mount\Windows\WinSxS

    Replace the necessary files with your customized versions

    Unmount and save changes

    dism /Unmount-Wim /MountDir:C:\Mount /Commit

    Keep in mind that modifying system files should be done carefully, and you should always keep backup copies of the original image. Also, ensure that you have the appropriate rights and permissions to modify system files.

    Using the standard Windows deployment tools like DISM ensures that your modifications are done correctly and that the compression and file integrity are maintained according to Windows standards.

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.