Module: wine Branch: master Commit: ff0dc44f2dd3c48bf47b9b20be913cc2b97d56cb URL: http://source.winehq.org/git/wine.git/?a=commit;h=ff0dc44f2dd3c48bf47b9b20be...
Author: James Hawkins truiken@gmail.com Date: Mon Feb 11 01:16:49 2008 -0600
msi: Return ERROR_INVALID_PARAMETER if szProduct is invalid.
---
dlls/msi/msi.c | 6 +++++- dlls/msi/tests/msi.c | 21 ++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 643f9cc..93a4e0f 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -567,6 +567,7 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, UINT r; HKEY hkey; LPWSTR val = NULL; + WCHAR squished_pc[GUID_SIZE];
TRACE("%s %s %p %p\n", debugstr_w(szProduct), debugstr_w(szAttribute), szValue, pcchValueBuf); @@ -575,7 +576,10 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, * FIXME: Values seem scattered/duplicated in the registry. Is there a system? */
- if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szProduct[0] || !szAttribute) + if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute) + return ERROR_INVALID_PARAMETER; + + if (!squash_guid(szProduct, squished_pc)) return ERROR_INVALID_PARAMETER;
/* check for special properties */ diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index d64f35e..71461a4 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -2080,11 +2080,8 @@ static void test_MsiGetProductInfo(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); r = MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK, buf, &sz); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
@@ -2093,11 +2090,8 @@ static void test_MsiGetProductInfo(void) lstrcpyA(buf, "apple"); r = MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", INSTALLPROPERTY_HELPLINK, buf, &sz); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
@@ -2116,11 +2110,8 @@ static void test_MsiGetProductInfo(void) lstrcpyA(buf, "apple"); r = MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", INSTALLPROPERTY_HELPLINK, buf, &sz); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);