James Hawkins : msi: Fix and simplify handling of REG_MULTI_SZ strings in the WriteRegistryValues action .

Alexandre Julliard julliard at winehq.org
Mon Feb 25 06:51:28 CST 2008


Module: wine
Branch: master
Commit: 21b4af1b465f27262ad434d2f8af6f78fa5b25b8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=21b4af1b465f27262ad434d2f8af6f78fa5b25b8

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Sun Feb 24 20:15:31 2008 -0600

msi: Fix and simplify handling of REG_MULTI_SZ strings in the WriteRegistryValues action.

---

 dlls/msi/action.c |   20 ++------------------
 1 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 432496b..7058aa8 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -2322,7 +2322,6 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
     {
         static const WCHAR szMulti[] = {'[','~',']',0};
         LPCWSTR ptr;
-        LPWSTR newdata;
         *type=REG_SZ;
 
         if (value[0]=='#')
@@ -2350,19 +2349,8 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
         /* add double NULL terminator */
         if (*type == REG_MULTI_SZ)
         {
-            *size += sizeof(WCHAR);
-            newdata = msi_alloc(*size);
-            if (!newdata)
-            {
-                msi_free(data);
-                return NULL;
-            }
-
-            memcpy(newdata, data, *size - 1);
-            newdata[*size] = '\0';
-
-            msi_free(data);
-            data = (LPSTR)newdata;
+            *size += 2 * sizeof(WCHAR); /* two NULL terminators */
+            data = msi_realloc_zero(data, *size);
         }
     }
     return data;
@@ -2503,10 +2491,6 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
 
     deformat_string(package, name, &deformated);
 
-    /* get the double nulls to terminate SZ_MULTI */
-    if (type == REG_MULTI_SZ)
-        size +=sizeof(WCHAR);
-
     if (!check_first)
     {
         TRACE("Setting value %s of %s\n",debugstr_w(deformated),




More information about the wine-cvs mailing list