Commit 14d439c8 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Handle the MSIINSTALLCONTEXT_USERMANAGED context.

parent 3d5b3ef9
......@@ -52,20 +52,28 @@ typedef struct tagMediaInfo
DWORD index;
} media_info;
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions, BOOL user, BOOL create)
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions,
MSIINSTALLCONTEXT context, BOOL create)
{
HKEY rootkey = 0;
UINT rc;
UINT rc = ERROR_FUNCTION_FAILED;
static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
if (user)
if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
{
if (dwOptions == MSICODE_PATCH)
rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
else
rc = MSIREG_OpenUserProductsKey(szProduct, &rootkey, create);
}
else
else if (context == MSIINSTALLCONTEXT_USERMANAGED)
{
if (dwOptions == MSICODE_PATCH)
rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
else
rc = MSIREG_OpenLocalManagedProductKey(szProduct, &rootkey, create);
}
else if (context == MSIINSTALLCONTEXT_MACHINE)
{
if (dwOptions == MSICODE_PATCH)
rc = MSIREG_OpenPatchesKey(szProduct, &rootkey, create);
......@@ -235,11 +243,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
FIXME("Unknown context MSIINSTALLCONTEXT_USERUNMANAGED\n");
if (dwContext == MSIINSTALLCONTEXT_MACHINE)
rc = OpenSourceKey(szProduct, &sourcekey, dwOptions, FALSE, FALSE);
else
rc = OpenSourceKey(szProduct, &sourcekey, dwOptions, TRUE, FALSE);
rc = OpenSourceKey(szProduct, &sourcekey, dwOptions, dwContext, FALSE);
if (rc != ERROR_SUCCESS)
return rc;
......@@ -382,11 +386,7 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
FIXME("Unknown context MSIINSTALLCONTEXT_USERUNMANAGED\n");
if (dwContext == MSIINSTALLCONTEXT_MACHINE)
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, FALSE, TRUE);
else
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, TRUE, TRUE);
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, TRUE);
if (rc != ERROR_SUCCESS)
return ERROR_UNKNOWN_PRODUCT;
......@@ -670,14 +670,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
if (szUserSid)
FIXME("Unhandled UserSid %s\n",debugstr_w(szUserSid));
if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
FIXME("Unknown context MSIINSTALLCONTEXT_USERUNMANAGED\n");
if (dwContext == MSIINSTALLCONTEXT_MACHINE)
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, FALSE, FALSE);
else
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, TRUE, FALSE);
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
if (rc != ERROR_SUCCESS)
return rc;
......@@ -797,11 +790,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
FIXME("Unknown context MSIINSTALLCONTEXT_USERUNMANAGED\n");
if (dwContext == MSIINSTALLCONTEXT_MACHINE)
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, FALSE, TRUE);
else
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, TRUE, TRUE);
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, TRUE);
if (rc != ERROR_SUCCESS)
return ERROR_UNKNOWN_PRODUCT;
......
......@@ -2345,9 +2345,12 @@ static void test_publishsourcelist(void)
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
}
/* complete uninstall */
r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
......
......@@ -591,10 +591,7 @@ static void test_MsiSourceListAddSourceEx(void)
r = pMsiSourceListAddSourceExA(prodcode, usersid,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
todo_wine
{
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
}
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
lstrcatA(keypath, usersid);
......@@ -608,10 +605,7 @@ static void test_MsiSourceListAddSourceEx(void)
r = pMsiSourceListAddSourceExA(prodcode, usersid,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
todo_wine
{
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
}
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
......@@ -624,19 +618,13 @@ static void test_MsiSourceListAddSourceEx(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
RegCloseKey(url);
......@@ -648,28 +636,19 @@ static void test_MsiSourceListAddSourceEx(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
ok(size == 11, "Expected 11, got %d\n", size);
size = MAX_PATH;
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
ok(size == 9, "Expected 9, got %d\n", size);
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
ok(size == 9, "Expected 9, got %d\n", size);
RegCloseKey(url);
RegCloseKey(prodkey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment