James Hawkins : msi: Fix the INSTALLPROPERTY_LASTUSEDTYPE case.
Alexandre Julliard
julliard at winehq.org
Mon Feb 25 06:51:18 CST 2008
Module: wine
Branch: master
Commit: 8b540d2670afe2c7c75c51b0cb6ae97169444323
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b540d2670afe2c7c75c51b0cb6ae97169444323
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Sun Feb 24 20:05:45 2008 -0600
msi: Fix the INSTALLPROPERTY_LASTUSEDTYPE case.
---
dlls/msi/source.c | 51 +++++++++++++++++--------------------------
dlls/msi/tests/install.c | 9 ++-----
dlls/msi/tests/source.c | 54 +++++++++++++++------------------------------
3 files changed, 41 insertions(+), 73 deletions(-)
diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index 16e247c..184ea2b 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -402,7 +402,8 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
RegQueryValueExW(media, szProperty, 0, 0, (LPBYTE)szValue, pcchValue);
RegCloseKey(media);
}
- else if (!lstrcmpW(szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW))
+ else if (!lstrcmpW(szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW) ||
+ !lstrcmpW(szProperty, INSTALLPROPERTY_LASTUSEDTYPEW))
{
rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW,
0, 0, NULL, &size);
@@ -423,11 +424,26 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
return ERROR_SUCCESS;
}
- ptr = strrchrW(source, ';');
- if (!ptr)
+ if (!lstrcmpW(szProperty, INSTALLPROPERTY_LASTUSEDTYPEW))
+ {
+ if (*source != 'n' && *source != 'u' && *source != 'm')
+ {
+ msi_free(source);
+ RegCloseKey(sourcekey);
+ return ERROR_SUCCESS;
+ }
+
ptr = source;
+ source[1] = '\0';
+ }
else
- ptr++;
+ {
+ ptr = strrchrW(source, ';');
+ if (!ptr)
+ ptr = source;
+ else
+ ptr++;
+ }
if (szValue)
{
@@ -440,33 +456,6 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
*pcchValue = lstrlenW(ptr);
msi_free(source);
}
- else if (strcmpW(INSTALLPROPERTY_LASTUSEDTYPEW, szProperty)==0)
- {
- LPWSTR buffer;
- DWORD size = 0;
-
- RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, 0,
- NULL, &size);
- if (size == 0)
- rc = ERROR_UNKNOWN_PROPERTY;
- else
- {
- buffer = msi_alloc(size);
- rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW,
- 0, 0, (LPBYTE)buffer,&size);
- if (*pcchValue < 1)
- {
- rc = ERROR_MORE_DATA;
- *pcchValue = 1;
- }
- else
- {
- szValue[0] = buffer[0];
- rc = ERROR_SUCCESS;
- }
- msi_free(buffer);
- }
- }
else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0)
{
*pcchValue = *pcchValue * sizeof(WCHAR);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index b62e625..5be95db 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -3025,12 +3025,9 @@ static void test_publishsourcelist(void)
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
- ok(size == 1, "Expected 1, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
+ ok(size == 1, "Expected 1, got %d\n", size);
size = MAX_PATH;
lstrcpyA(value, "aaa");
diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c
index 76720da..7c8b4d7 100644
--- a/dlls/msi/tests/source.c
+++ b/dlls/msi/tests/source.c
@@ -454,12 +454,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
- ok(size == 0, "Expected 0, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
+ ok(size == 0, "Expected 0, got %d\n", size);
data = "x;y;z";
res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
@@ -471,12 +468,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
- ok(size == 0, "Expected 0, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
+ ok(size == 0, "Expected 0, got %d\n", size);
data = "n;y;z";
res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
@@ -488,12 +482,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
- ok(size == 1, "Expected 1, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
+ ok(size == 1, "Expected 1, got %d\n", size);
data = "negatory";
res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
@@ -505,12 +496,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
- ok(size == 1, "Expected 1, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
+ ok(size == 1, "Expected 1, got %d\n", size);
data = "megatron";
res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
@@ -522,12 +510,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, "m"), "Expected \"m\", got \"%s\"\n", value);
- ok(size == 1, "Expected 1, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, "m"), "Expected \"m\", got \"%s\"\n", value);
+ ok(size == 1, "Expected 1, got %d\n", size);
data = "useless";
res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
@@ -539,12 +524,9 @@ static void test_MsiSourceListGetInfo(void)
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE,
value, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpA(value, "u"), "Expected \"u\", got \"%s\"\n", value);
- ok(size == 1, "Expected 1, got %d\n", size);
- }
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(value, "u"), "Expected \"u\", got \"%s\"\n", value);
+ ok(size == 1, "Expected 1, got %d\n", size);
RegDeleteValueA(media, "MediaPackage");
RegDeleteValueA(media, "DiskPrompt");
More information about the wine-cvs
mailing list