Mike McCormack : msi: Make MsiConfigureFeature a bit more robust.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 24 13:15:08 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: bc673bff01b228fc99556dd1319d24a4b6cffc9a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=bc673bff01b228fc99556dd1319d24a4b6cffc9a

Author: Mike McCormack <mike at codeweavers.com>
Date:   Mon Jul 24 20:34:14 2006 +0900

msi: Make MsiConfigureFeature a bit more robust.

---

 dlls/msi/msi.c       |   19 +++++++++++++++----
 dlls/msi/tests/msi.c |   12 ++++++++++++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 70f9c9b..5ef72bd 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1715,6 +1715,21 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR
     if (!szProduct || !szFeature)
         return ERROR_INVALID_PARAMETER;
 
+    switch (eInstallState)
+    {
+    case INSTALLSTATE_DEFAULT:
+        /* FIXME: how do we figure out the default location? */
+        eInstallState = INSTALLSTATE_LOCAL;
+        break;
+    case INSTALLSTATE_LOCAL:
+    case INSTALLSTATE_SOURCE:
+    case INSTALLSTATE_ABSENT:
+    case INSTALLSTATE_ADVERTISED:
+        break;
+    default:
+        return ERROR_INVALID_PARAMETER;
+    }
+
     r = MSI_OpenProductW( szProduct, &package );
     if (r != ERROR_SUCCESS)
         return r;
@@ -1731,10 +1746,6 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR
 
     MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
 
-    /* FIXME: how do we figure out the default location? */
-    if (eInstallState == INSTALLSTATE_DEFAULT)
-        eInstallState = INSTALLSTATE_LOCAL;
-
     r = ACTION_PerformUIAction( package, szCostInit );
     if (r != ERROR_SUCCESS)
         goto end;
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index d6ddf02..3b98d53 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -90,6 +90,18 @@ static void test_null(void)
 
     r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
     ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
+
+    r = MsiConfigureFeatureW(NULL, NULL, 0);
+    ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
+
+    r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL, 0);
+    ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
+
+    r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
+    ok( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
+
+    r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT);
+    ok( r == ERROR_UNKNOWN_PRODUCT, "wrong error %d\n", r);
 }
 
 static void test_getcomponentpath(void)




More information about the wine-cvs mailing list