Windows 7 - MsiQueryProductState and INSTALLSTATE_ABSENT
Asked By dtieuf
25-Jan-07 04:11 PM
Hi,
When a call to MsiQueryProductState returns INSTALLSTATE_ABSENT, MSDN
states that
Is there a way to (programmatically) find out for which user it is
installed ?
Thank you
dtieuf
MsiQueryProductState
(1)
INSTALLSTATE_ABSENT
(1)
DtieufMsiGetProductInfoEx
(1)
MsiGetProductInfoEx
(1)
CurrentVersion
(1)
UserData
(1)
DtieufRe
(1)
SID
(1)
Phil Wilson replied...
MsiGetProductInfoEx is probably what you are looking for.
--
Phil Wilson
[Microsoft MVP Windows Installer]
dtieuf replied...
Yes, it does exactly what I need. Unfortunately, I should have added
that I must target MSI v2 and this function requires v3+.
Thanks anyway
dtieuf
Jeff Henkels replied...
Try enumerating the subkeys of
HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData --
per-machine installs are in the S-1-5-18 key, and per-user installs will be
in the subkey corresponding to the user's SID. The Products subkey of each
SID subkey contains product codes in a slightly scrambled format.
of 755 and a condition TARGETDIR<> "". Sequence code 750 is DIRCA_TARGETDIR with a condition TARGETDIR = "". MsiQueryProductState is returning 0xffffffff, which I assume is INSTALLSTATE_UNKNOWN. For diagnostic purposes, I added a call to MsiGetTargetPath as the first thing done in the custom action after calling MsiQueryProductState. MsiGetTargetPath is also returning ERROR_DIRECTORY, so I assume the problem is not caused by the the same condition and sequence. Platform SDK MSI Discussions MsiSetTargetPath (1) MsiGetTargetPath (1) ERROR_DIRECTORY (1) MsiQueryProductState (1) InstallExecuteSequence (1) MsiGetLastErrorRecord (1) INSTALLSTATE_UNKNOWN (1) InstallUISequence (1) The msi file is created by
1 Product :(06 / 02 / 2007 20:12:01.452) Product = {31BB3B1C-5A3D-4E68-82A1-3C166F03C379}, MsiQueryProductState = 5 Product :(06 / 02 / 2007 20:12:01.452) Product = {31BB3B1C-5A3D-4E68-82A1-3C166F03C379 0517 Product :(06 / 02 / 2007 20:12:02.004) Product = {A26D7C8B-875D-48E2-BED1-7168268D022A}, MsiQueryProductState = -1 Product :(06 / 02 / 2007 20:12:02.005) Product = {A26D7C8B-875D-48E2-BED1-7168268D022A 1 Product :(06 / 02 / 2007 20:12:02.297) Product = {31BB3B1C-5A3D-4E68-82A1-3C166F03C379}, MsiQueryProductState = 5 Product :(06 / 02 / 2007 20:12:02.297) Product = {31BB3B1C-5A3D-4E68-82A1-3C166F03C379 0517 Product :(06 / 02 / 2007 20:12:02.601) Product = {A26D7C8B-875D-48E2-BED1-7168268D022A}, MsiQueryProductState = -1 Product :(06 / 02 / 2007 20:12:02.601) Product = {A26D7C8B-875D-48E2-BED1-7168268D022A
not. The same thing happens if I call MsiConfigureFeature from within the app with the INSTALLSTATE_ABSENT option. The folder and files are removed, but not the registry entry. The registry entry as now being absent. I run the app, select the feature, MsiConfigureFeature is called with INSTALLSTATE_ABSENT, and the installer runs, and everything is uninstalled for the feature / component except the registry