Issues with Patchwiz.dll v4.0

Issue Description

Performing any of the following operations using patchwiz.dll v4.0 could result in data loss in the root directory:

1. UiCreatePatchPackage is called with the hwndStatus parameter set to NULL OR

2. UiCreatePatchPackageEx is called with the hwndStatus parameter set to NULL and dwFlags set to 0x8000 OR

3. Using msimsp.exe v3.0 to create Windows Installer patches while using patchwiz.dll v4.0.

Cause

When invalid parameters are supplied to UiCreatePatchPackageEx API, it bails out with an error code. However, while returning, the API erroneously uses partially initialized data to clean up the temporary directory. This partially initialized data results in deleting the writeable data in the root drive.

Resolutions

There are four resolutions for this issue currently:

1. Do not use patchwiz.dll v4.0 to call UiCreatePatchPackage and UiCreatePatchPackageEx with these parameters.

2. Get the latest patchwiz.dll v4.5 from the Windows Installer 4.5 Beta program. The latest version of patchwiz.dll there fixes the data loss issue mentioned in this blog. However, the call to UiCreatePatchPackage with hwndStatus parameter set to NULL will fail to create a patch. We understand that this is a regression. It will be fixed in Windows Installer 4.5 RTM.

3. Use patchwiz.dll v3.1.

4. Use msimsp.exe v4.0 to create Windows Installer patches while using patchwiz.dll v4.0 or higher.

[Author: Hemchander Sannidhanam]
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.