Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HKMU-RegistryKey not removed after parallel per-user and per-machine install/uninstall #8007

Closed
1 task done
lilagerd opened this issue Feb 27, 2024 · 3 comments
Closed
1 task done
Labels

Comments

@lilagerd
Copy link

WiX Version

4.0.1

.NET or MSBuild or Visual Studio Version

Microsoft (R)-Buildmodul, Version 14.0.25420.1

HeatWave Version

0

Windows Version

Win10 22H2

Repro Repo

https://github.com/lilagerd/wix-hkmu-uninstall-example/tree/main

Repro Steps

I created two msi with different version numbers based on the attached hth.wxs. Then the following commands were executed:

msiexec /i C:\devel\hth-15.5.4.3.msi /lv C:\devel\hth-15.5.4.3.msi.install.log
-> Computer\HKEY_CURRENT_USER\SOFTWARE\HTH created
msiexec /i C:\devel\hth-15.5.4.4.msi /l
v C:\devel\hth-15.5.4.4.msi.install.log ALLUSERS=1
-> Computer\HKEY_LOCAL_MACHINE\SOFTWARE\HTH created

msiexec /x C:\devel\hth-15.5.4.3.msi /lv C:\devel\hth-15.5.4.3.msi.uninstall.log
-> no registry entries deleted
msiexec /x C:\devel\hth-15.5.4.4.msi /l
v C:\devel\hth-15.5.4.4.msi.uninstall.log
-> Computer\HKEY_LOCAL_MACHINE\SOFTWARE\HTH deleted

In the end, Computer\HKEY_CURRENT_USER\SOFTWARE\HTH remains.

If the uninstall sequence is changed and hth-15.5.4.4.msi is uninstalled after hth-15.5.4.3.msi the entry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\HTH remains.
hth_installer_and_logs.zip

Log file analysis

From the log files ({11153711-E6C8-4063-A488-C05E530BF6C3} is the component with 'RegistryKey Root="HKMU" Key="SOFTWARE\HTH\HTH_PLUGIN"'.)

hth-15.5.4.3.msi.install.log
MSI (s) (08:84) [09:17:27:291]: Executing op: ComponentRegister(ComponentId={11153711-E6C8-4063-A488-C05E530BF6C3},KeyPath=21:\SOFTWARE\HTH\HTH_PLUGIN\test,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=1)
1: {CF4F6489-178D-48D5-B116-FE94B4F2956A} 2: {11153711-E6C8-4063-A488-C05E530BF6C3} 3: 21:\SOFTWARE\HTH\HTH_PLUGIN\test

hth-15.5.4.4.msi.install.log
MSI (s) (08:88) [09:18:12:758]: Executing op: ComponentRegister(ComponentId={11153711-E6C8-4063-A488-C05E530BF6C3},KeyPath=22:\SOFTWARE\HTH\HTH_PLUGIN\test,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=1)
1: {C278A123-681C-4140-AB97-27DADEBC7579} 2: {11153711-E6C8-4063-A488-C05E530BF6C3} 3: 22:\SOFTWARE\HTH\HTH_PLUGIN\test

From hth-15.5.4.3.msi.uninstall.log:
MSI (s) (08:9C) [09:19:31:402]: Disallowing uninstallation of component: {11153711-E6C8-4063-A488-C05E530BF6C3} since another client exists
...
MSI (s) (08:9C) [09:19:31:459]: Executing op: UnregisterSharedComponentProvider(Component={11153711-E6C8-4063-A488-C05E530BF6C3},ProductCode={CF4F6489-178D-48D5-B116-FE94B4F2956A})
MSI (s) (08:9C) [09:19:31:459]: Executing op: ComponentUnregister(ComponentId={11153711-E6C8-4063-A488-C05E530BF6C3},,BinaryType=1,)

From hth-15.5.4.4.msi.uninstall.log:
MSI (s) (08:D0) [09:20:36:446]: Executing op: UnregisterSharedComponentProvider(Component={11153711-E6C8-4063-A488-C05E530BF6C3},ProductCode={C278A123-681C-4140-AB97-27DADEBC7579})
MSI (s) (08:D0) [09:20:36:446]: Executing op: ComponentUnregister(ComponentId={11153711-E6C8-4063-A488-C05E530BF6C3},,BinaryType=1,)
...
MSI (s) (08:D0) [09:20:36:453]: Executing op: RegOpenKey(Root=-1,Key=SOFTWARE\HTH\HTH_PLUGIN,,BinaryType=1,,)
MSI (s) (08:D0) [09:20:36:453]: Executing op: RegRemoveValue(Name=test,Value=#1,)

Actual Result

The RegistryKey of the first uninstalled package is not removed. E.g. if the per-user installation is removed first, the corresponding entry Computer\HKEY_CURRENT_USER\SOFTWARE\HTH remains.

Expected Result

Both Registrykeys removed:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\HTH
Computer\HKEY_CURRENT_USER\SOFTWARE\HTH

It looks to me as if the component is falsely recognized during the first uninstall. The distinction between per-user and per-admin is not made. Relevant log entry:
Disallowing uninstallation of component: {11153711-E6C8-4063-A488-C05E530BF6C3} since another client exists

Acknowledgements

  • I acknowledge that this is a fully completed bug report. It is not a question or attempt to get help debugging my issue (because those should be sent to Discussions).
@barnson
Copy link
Member

barnson commented Feb 27, 2024

This is MSI behavior, not WiX, but you're essentially violating component rules by having the same component installed to two different key paths (HKCU -v- HKLM). MSI does allow that for files that are key paths, but apparently not for registry paths.

@barnson
Copy link
Member

barnson commented Feb 27, 2024

Likely MSI never anticipated the idea of installing the same product in both per-user and per-machine contexts.

See https://robmensching.com/blog/posts/2003/10/18/component-rules-101/ for more about component rules.

@barnson barnson closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
@lilagerd
Copy link
Author

Many thanks for the explanation and quick feedback! The behavior is understandable, on the other hand I had hoped it would work with HKMU. We will prevent a parallel installation in both directions (with the help of a ComponentSearch).

@barnson barnson added external and removed triage labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants