James Hawkins : msi: If the UserData product key exists, but the user product key doesn't, the product is absent.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 27 09:11:22 CDT 2007


Module: wine
Branch: master
Commit: 24ede2f9e602b24080f47134055f9a1e540f487c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=24ede2f9e602b24080f47134055f9a1e540f487c

Author: James Hawkins <truiken at gmail.com>
Date:   Tue Jun 26 19:04:08 2007 -0700

msi: If the UserData product key exists, but the user product key doesn't, the product is absent.

---

 dlls/msi/msi.c       |   15 ++++++++++-----
 dlls/msi/tests/msi.c |    5 +----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 497083e..5e20ce2 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -765,6 +765,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
     INSTALLSTATE state = INSTALLSTATE_UNKNOWN;
     HKEY hkey = 0, props = 0;
     DWORD sz;
+    BOOL userkey_exists = FALSE;
 
     static const int GUID_LEN = 38;
     static const WCHAR szInstallProperties[] = {
@@ -780,11 +781,12 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
         return INSTALLSTATE_INVALIDARG;
 
     rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
-    if (rc != ERROR_SUCCESS)
-        goto end;
-
-    state = INSTALLSTATE_ADVERTISED;
-    RegCloseKey(hkey);
+    if (rc == ERROR_SUCCESS)
+    {
+        userkey_exists = TRUE;
+        state = INSTALLSTATE_ADVERTISED;
+        RegCloseKey(hkey);
+    }
 
     rc = MSIREG_OpenUserDataProductKey(szProduct,&hkey,FALSE);
     if (rc != ERROR_SUCCESS)
@@ -804,6 +806,9 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
     else
         state = INSTALLSTATE_UNKNOWN;
 
+    if (state == INSTALLSTATE_DEFAULT && !userkey_exists)
+        state = INSTALLSTATE_ABSENT;
+
 end:
     RegCloseKey(props);
     RegCloseKey(hkey);
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index 810992c..08b6620 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -439,10 +439,7 @@ static void test_MsiQueryProductState(void)
 
     /* user product key does not exist */
     state = MsiQueryProductStateA(prodcode);
-    todo_wine
-    {
-        ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
-    }
+    ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
 
     LocalFree(usersid);
     RegDeleteValueA(props, "WindowsInstaller");




More information about the wine-cvs mailing list