msi: Simplify the MEDIAPACKAGEPATH and DISKPROMPT cases.
This commit is contained in:
parent
fe987103fb
commit
95ef6a1fbc
|
@ -395,9 +395,14 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
|
|||
LPCWSTR szProperty, LPCWSTR szValue)
|
||||
{
|
||||
WCHAR squished_pc[GUID_SIZE];
|
||||
HKEY sourcekey;
|
||||
HKEY sourcekey, media;
|
||||
LPCWSTR property;
|
||||
UINT rc;
|
||||
|
||||
static const WCHAR media_package[] = {
|
||||
'M','e','d','i','a','P','a','c','k','a','g','e',0
|
||||
};
|
||||
|
||||
TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
|
||||
dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
|
||||
|
||||
|
@ -415,40 +420,30 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
|
|||
FIXME("Unhandled options MSICODE_PATCH\n");
|
||||
return ERROR_UNKNOWN_PATCH;
|
||||
}
|
||||
|
||||
|
||||
if (szUserSid)
|
||||
FIXME("Unhandled UserSid %s\n",debugstr_w(szUserSid));
|
||||
|
||||
if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
|
||||
FIXME("Unknown context MSIINSTALLCONTEXT_USERUNMANAGED\n");
|
||||
|
||||
property = szProperty;
|
||||
if (!lstrcmpW(szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW))
|
||||
property = media_package;
|
||||
|
||||
rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
return rc;
|
||||
|
||||
if (strcmpW(szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW) == 0)
|
||||
if (!lstrcmpW(szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW) ||
|
||||
!lstrcmpW(szProperty, INSTALLPROPERTY_DISKPROMPTW))
|
||||
{
|
||||
HKEY key;
|
||||
DWORD size = lstrlenW(szValue)*sizeof(WCHAR);
|
||||
rc = OpenMediaSubkey(sourcekey, &key, FALSE);
|
||||
rc = OpenMediaSubkey(sourcekey, &media, TRUE);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
rc = RegSetValueExW(key, INSTALLPROPERTY_MEDIAPACKAGEPATHW, 0,
|
||||
REG_SZ, (const BYTE *)szValue, size);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
rc = ERROR_UNKNOWN_PROPERTY;
|
||||
RegCloseKey(key);
|
||||
}
|
||||
else if (strcmpW(szProperty, INSTALLPROPERTY_DISKPROMPTW) == 0)
|
||||
{
|
||||
HKEY key;
|
||||
DWORD size = lstrlenW(szValue)*sizeof(WCHAR);
|
||||
rc = OpenMediaSubkey(sourcekey, &key, FALSE);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
rc = RegSetValueExW(key, INSTALLPROPERTY_DISKPROMPTW, 0,
|
||||
REG_SZ, (const BYTE *)szValue, size);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
rc = ERROR_UNKNOWN_PROPERTY;
|
||||
RegCloseKey(key);
|
||||
{
|
||||
rc = msi_reg_set_val_str(media, property, szValue);
|
||||
RegCloseKey(media);
|
||||
}
|
||||
}
|
||||
else if (strcmpW(szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW)==0)
|
||||
{
|
||||
|
|
|
@ -1509,28 +1509,19 @@ static void test_MsiSourceListSetInfo(void)
|
|||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
/* Media key is created by MsiSourceListSetInfo */
|
||||
res = RegOpenKeyA(source, "Media", &media);
|
||||
todo_wine
|
||||
{
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
}
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
|
||||
/* set the info again */
|
||||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path2");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path2");
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path2");
|
||||
|
||||
/* NULL szProperty */
|
||||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
|
@ -1557,11 +1548,8 @@ static void test_MsiSourceListSetInfo(void)
|
|||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_MEDIAPACKAGEPATH, "");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "MediaPackage", "");
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "MediaPackage", "");
|
||||
|
||||
/* INSTALLPROPERTY_MEDIAPACKAGEPATH, MSISOURCETYPE_NETWORK */
|
||||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
|
@ -1589,11 +1577,8 @@ static void test_MsiSourceListSetInfo(void)
|
|||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_DISKPROMPT, "prompt");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "DiskPrompt", "prompt");
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
CHECK_REG_STR(media, "DiskPrompt", "prompt");
|
||||
|
||||
/* INSTALLPROPERTY_DISKPROMPT, MSISOURCETYPE_NETWORK */
|
||||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
|
@ -1750,18 +1735,12 @@ static void test_MsiSourceListSetInfo(void)
|
|||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
/* Media key is created by MsiSourceListSetInfo */
|
||||
res = RegOpenKeyA(source, "Media", &media);
|
||||
todo_wine
|
||||
{
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
}
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
|
||||
RegDeleteValueA(media, "MediaPackage");
|
||||
RegDeleteKeyA(media, "");
|
||||
|
@ -1793,18 +1772,12 @@ static void test_MsiSourceListSetInfo(void)
|
|||
r = MsiSourceListSetInfoA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT,
|
||||
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
|
||||
todo_wine
|
||||
{
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
}
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
/* Media key is created by MsiSourceListSetInfo */
|
||||
res = RegOpenKeyA(source, "Media", &media);
|
||||
todo_wine
|
||||
{
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
}
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
CHECK_REG_STR(media, "MediaPackage", "path");
|
||||
|
||||
/* szUserSid is non-NULL */
|
||||
r = MsiSourceListSetInfoA(prodcode, usersid,
|
||||
|
|
Loading…
Reference in New Issue