msi [6/10]: pcchValue represents the length of szValue in TCHARS, not bytes

James Hawkins truiken at gmail.com
Fri Jun 29 16:12:55 CDT 2007


Hi,

Changelog:
* pcchValue represents the length of szValue in TCHARS, not bytes.

 dlls/msi/source.c       |    7 ++++++-
 dlls/msi/tests/source.c |    5 +----
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index 74e2881..a76eb7d 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -341,10 +341,15 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWS
     }
     else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0)
     {
+        *pcchValue = *pcchValue * sizeof(WCHAR);
         rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0, 
-                (LPBYTE)szValue, pcchValue);
+                              (LPBYTE)szValue, pcchValue);
         if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA)
             rc = ERROR_SUCCESS;
+        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(vo
     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);
-- 
1.4.1


More information about the wine-patches mailing list