Module: wine Branch: master Commit: 0cd708e7f5eb91d6ec8c7448180451cf400f062e URL: http://source.winehq.org/git/wine.git/?a=commit;h=0cd708e7f5eb91d6ec8c744818...
Author: James Hawkins truiken@gmail.com Date: Mon Jul 2 20:17:59 2007 -0700
msi: pcchValue represents the length of szValue in TCHARS, not bytes.
---
dlls/msi/source.c | 16 ++++++++++++++-- dlls/msi/tests/source.c | 5 +---- 2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/msi/source.c b/dlls/msi/source.c index 74e2881..6223400 100644 --- a/dlls/msi/source.c +++ b/dlls/msi/source.c @@ -184,6 +184,7 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid, if (!value) return ERROR_OUTOFMEMORY;
+ *value = '\0'; ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions, property, value, &len); if (ret != ERROR_SUCCESS) @@ -341,10 +342,21 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, } else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0) { - rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0, - (LPBYTE)szValue, pcchValue); + *pcchValue = *pcchValue * sizeof(WCHAR); + rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0, + (LPBYTE)szValue, pcchValue); if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA) + { + *pcchValue = 0; rc = ERROR_SUCCESS; + } + else + { + if (*pcchValue) + *pcchValue = (*pcchValue - 1) / sizeof(WCHAR); + if (szValue) + szValue[*pcchValue] = '\0'; + } } else { diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 2c2fe05..58c2e86 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -209,10 +209,7 @@ static void test_MsiSourceListGetInfo(void) r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - todo_wine - { - ok(size == 0, "Expected 0, got %d\n", size); - } + ok(size == 0, "Expected 0, got %d\n", size);
data = "msitest.msi"; res = RegSetValueExA(hkey, "PackageName", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1);