Expand the value if we have a REG_EXPAND_SZ entry
Modified: trunk/reactos/subsys/system/services/config.c

Modified: trunk/reactos/subsys/system/services/config.c
--- trunk/reactos/subsys/system/services/config.c	2005-12-22 11:50:12 UTC (rev 20298)
+++ trunk/reactos/subsys/system/services/config.c	2005-12-22 13:54:07 UTC (rev 20299)
@@ -231,6 +231,8 @@
     DWORD dwError;
     DWORD dwSize;
     DWORD dwType;
+    DWORD dwSizeNeeded;
+    LPWSTR expanded = NULL;
     LPBYTE ptr = NULL;
 
     *lpValue = NULL;
@@ -260,9 +262,22 @@
 
     if (dwType == REG_EXPAND_SZ)
     {
-        /* FIXME: ... */
-        DPRINT1("Expand me!\n");
-        *lpValue = (LPWSTR)ptr;
+        /* Expand the value... */
+        dwSizeNeeded = ExpandEnvironmentStringsW((LPCWSTR)ptr, NULL, 0);
+        if (dwSizeNeeded == 0)
+        {
+            dwError = GetLastError();
+            goto done;
+        }
+        expanded = HeapAlloc(GetProcessHeap(), 0, dwSizeNeeded);
+        if (dwSizeNeeded < ExpandEnvironmentStringsW((LPCWSTR)ptr, expanded, dwSizeNeeded))
+        {
+            dwError = GetLastError();
+            goto done;
+        }
+        *lpValue = expanded;
+        HeapFree(GetProcessHeap(), 0, ptr);
+        dwError = ERROR_SUCCESS;
     }
     else
     {
@@ -271,7 +286,10 @@
 
 done:;
     if (dwError != ERROR_SUCCESS)
+    {
         HeapFree(GetProcessHeap(), 0, ptr);
+        HeapFree(GetProcessHeap(), 0, expanded);
+    }
 
     return dwError;
 }