James Hawkins : msi: Expand REG_EXPAND_SZ registry values in the RegLocator table.

Alexandre Julliard julliard at winehq.org
Mon Oct 13 06:39:22 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Mon Oct 13 03:57:40 2008 -0500

msi: Expand REG_EXPAND_SZ registry values in the RegLocator table.

---

 dlls/msi/appsearch.c     |    7 +++----
 dlls/msi/tests/package.c |   12 +++---------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index e013b58..ed02f83 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -245,7 +245,6 @@ static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz,
  LPWSTR *appValue)
 {
     static const WCHAR dwordFmt[] = { '#','%','d','\0' };
-    static const WCHAR expandSzFmt[] = { '#','%','%','%','s','\0' };
     static const WCHAR binFmt[] = { '#','x','%','x','\0' };
     DWORD i;
 
@@ -273,9 +272,9 @@ static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz,
             sprintfW(*appValue, dwordFmt, *(const DWORD *)value);
             break;
         case REG_EXPAND_SZ:
-            /* space for extra #% characters in front */
-            *appValue = msi_alloc(sz + 2 * sizeof(WCHAR));
-            sprintfW(*appValue, expandSzFmt, (LPCWSTR)value);
+            sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0);
+            *appValue = msi_alloc(sz * sizeof(WCHAR));
+            ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz);
             break;
         case REG_BINARY:
             /* 3 == length of "#x<nibble>" */
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index b2a3cf4..31f5ad6 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -6318,19 +6318,13 @@ static void test_appsearch_reglocator(void)
     size = MAX_PATH;
     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    todo_wine
-    {
-        ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
-    }
+    ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    todo_wine
-    {
-        ok(!lstrcmpA(prop,
-           "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
-    }
+    ok(!lstrcmpA(prop,
+       "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);




More information about the wine-cvs mailing list