Mike McCormack : msi: Features may be published but absent.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 6 10:44:02 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: abfe2486333b0ab541cd7a7c03fcfcfadcf43c34
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=abfe2486333b0ab541cd7a7c03fcfcfadcf43c34
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Jul 6 19:01:50 2006 +0900
msi: Features may be published but absent.
---
dlls/msi/msi.c | 43 +++++++++++++++++++++++++++++++++----------
1 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index a628155..81c531b 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1123,15 +1123,25 @@ end:
/******************************************************************
* MsiQueryFeatureStateW [MSI.@]
*
- * This does not verify that the Feature is functional. So i am only going to
- * check the existence of the key in the registry. This should tell me if it is
- * installed.
+ * Checks the state of a feature
+ *
+ * PARAMS
+ * szProduct [I] Product's GUID string
+ * szFeature [I] Feature's GUID string
+ *
+ * RETURNS
+ * INSTALLSTATE_LOCAL Feature is installed and useable
+ * INSTALLSTATE_ABSENT Feature is absent
+ * INSTALLSTATE_ADVERTISED Feature should be installed on demand
+ * INSTALLSTATE_UNKNOWN An error occured
+ * INSTALLSTATE_INVALIDARG One of the GUIDs was invalid
+ *
*/
INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
{
- WCHAR squishProduct[GUID_SIZE];
+ WCHAR squishProduct[GUID_SIZE], buffer[MAX_FEATURE_CHARS+2];
UINT rc;
- DWORD sz = 0;
+ DWORD sz, type;
HKEY hkey;
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
@@ -1142,17 +1152,30 @@ INSTALLSTATE WINAPI MsiQueryFeatureState
if (!squash_guid( szProduct, squishProduct ))
return INSTALLSTATE_INVALIDARG;
- rc = MSIREG_OpenFeaturesKey(szProduct, &hkey, FALSE);
+ rc = MSIREG_OpenUserFeaturesKey(szProduct, &hkey, FALSE);
if (rc != ERROR_SUCCESS)
return INSTALLSTATE_UNKNOWN;
- rc = RegQueryValueExW( hkey, szFeature, NULL, NULL, NULL, &sz);
+ buffer[0] = 0;
+ sz = sizeof buffer;
+ type = 0;
+ rc = RegQueryValueExW(hkey, szFeature, NULL, &type, (LPBYTE) buffer, &sz);
RegCloseKey(hkey);
- if (rc == ERROR_SUCCESS)
- return INSTALLSTATE_LOCAL;
+ TRACE("rc = %d buffer = %s\n", rc, debugstr_w(buffer));
+
+ if (rc != ERROR_SUCCESS || sz == 0 || type != REG_SZ)
+ return INSTALLSTATE_UNKNOWN;
+
+ if (buffer[0] == 6)
+ return INSTALLSTATE_ABSENT;
+
+ /* FIXME:
+ * Return INSTALLSTATE_ADVERTISED when
+ * the components exist in the registry, but not on the disk.
+ */
- return INSTALLSTATE_UNKNOWN;
+ return INSTALLSTATE_LOCAL;
}
/******************************************************************
More information about the wine-cvs
mailing list