Sync to Wine-20050930:
Alexandre Julliard <julliard@winehq.org>
- Specify 64-bit integers as double instead of long long in spec files
  so that we get the correct number of arguments.
- We are no longer generating .dbg.c files.
Mike McCormack <mike@codeweavers.com>
- Fix gcc 4.0 warnings.
Gerald Pfeifer <gerald@pfeifer.com>
- #include <stdlib.h> to get abs() prototype.
Frank Richter <frank.richter@gmail.com>
- Remove shlwapi dependency.
Modified: trunk/reactos/lib/uxtheme/msstyles.c
Modified: trunk/reactos/lib/uxtheme/system.c
Modified: trunk/reactos/lib/uxtheme/uxtheme.spec

Modified: trunk/reactos/lib/uxtheme/msstyles.c
--- trunk/reactos/lib/uxtheme/msstyles.c	2005-10-08 19:43:11 UTC (rev 18357)
+++ trunk/reactos/lib/uxtheme/msstyles.c	2005-10-08 19:49:47 UTC (rev 18358)
@@ -21,12 +21,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#include <stdlib.h>
 
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
-#define NO_SHLWAPI_REG
-#include "shlwapi.h"
 #include "winnls.h"
 #include "wingdi.h"
 #include "uxtheme.h"
@@ -35,6 +34,7 @@
 #include "uxthemedll.h"
 #include "msstyles.h"
 
+#include "wine/unicode.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
@@ -343,7 +343,7 @@
     *iStateId = 0;
     comp = sec;
     /* Get the application name */
-    tmp = StrChrW(comp, ':');
+    tmp = strchrW(comp, ':');
     if(tmp) {
         *tmp++ = 0;
         tmp++;
@@ -351,19 +351,19 @@
         comp = tmp;
     }
 
-    tmp = StrChrW(comp, '.');
+    tmp = strchrW(comp, '.');
     if(tmp) {
         *tmp++ = 0;
         lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME);
         comp = tmp;
         /* now get the part & state */
-        tmp = StrChrW(comp, '(');
+        tmp = strchrW(comp, '(');
         if(tmp) {
             *tmp++ = 0;
             lstrcpynW(part, comp, sizeof(part)/sizeof(part[0]));
             comp = tmp;
             /* now get the state */
-            *StrChrW(comp, ')') = 0;
+            *strchrW(comp, ')') = 0;
             lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
         }
         else {
@@ -371,13 +371,13 @@
         }
     }
     else {
-        tmp = StrChrW(comp, '(');
+        tmp = strchrW(comp, '(');
         if(tmp) {
             *tmp++ = 0;
             lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME);
             comp = tmp;
             /* now get the state */
-            *StrChrW(comp, ')') = 0;
+            *strchrW(comp, ')') = 0;
             lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
         }
         else {
@@ -805,7 +805,7 @@
     }
 
     start = pszClassList;
-    while((end = StrChrW(start, ';'))) {
+    while((end = strchrW(start, ';'))) {
         len = end-start;
         lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0])));
         start = end+1;

Modified: trunk/reactos/lib/uxtheme/system.c
--- trunk/reactos/lib/uxtheme/system.c	2005-10-08 19:43:11 UTC (rev 18357)
+++ trunk/reactos/lib/uxtheme/system.c	2005-10-08 19:49:47 UTC (rev 18358)
@@ -28,7 +28,6 @@
 #include "winuser.h"
 #include "wingdi.h"
 #include "winreg.h"
-#include "shlwapi.h"
 #include "uxtheme.h"
 #include "tmschema.h"
 
@@ -93,6 +92,57 @@
     return TRUE;
 }
 
+/* At the end of the day this is a subset of what SHRegGetPath() does - copied
+ * here to avoid linking against shlwapi. */
+static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue,
+                             LPVOID pvData)
+{
+  DWORD dwRet, dwType, dwUnExpDataLen = MAX_PATH, dwExpDataLen;
+
+  TRACE("(hkey=%p,%s,%p)\n", hKey, debugstr_w(lpszValue),
+        pvData);
+
+  dwRet = RegQueryValueExW(hKey, lpszValue, 0, &dwType, pvData, &dwUnExpDataLen);
+  if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
+      return dwRet;
+
+  if (dwType == REG_EXPAND_SZ)
+  {
+    DWORD nBytesToAlloc;
+
+    /* Expand type REG_EXPAND_SZ into REG_SZ */
+    LPWSTR szData;
+
+    /* If the caller didn't supply a buffer or the buffer is too small we have
+     * to allocate our own
+     */
+    if (dwRet == ERROR_MORE_DATA)
+    {
+      WCHAR cNull = '\0';
+      nBytesToAlloc = dwUnExpDataLen;
+
+      szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
+      RegQueryValueExW (hKey, lpszValue, 0, NULL, (LPBYTE)szData, &nBytesToAlloc);
+      dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+    else
+    {
+      nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
+      szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
+      lstrcpyW(szData, pvData);
+      dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, MAX_PATH );
+      if (dwExpDataLen > MAX_PATH) dwRet = ERROR_MORE_DATA;
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+  }
+
+  RegCloseKey(hKey);
+  return dwRet;
+}
+
 /***********************************************************************
  *      UXTHEME_LoadTheme
  *
@@ -123,7 +173,7 @@
         buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
         if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
             szCurrentSize[0] = '\0';
-        if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0))
+        if (query_reg_path (hKey, szDllName, szCurrentTheme))
             szCurrentTheme[0] = '\0';
         RegCloseKey(hKey);
     }
@@ -292,7 +342,7 @@
                 DWORD count = sizeof(colorStr);
             
                 if (RegQueryValueExA (colorKey, SysColorsNames[i], 0,
-                    &type, colorStr, &count) == ERROR_SUCCESS)
+                    &type, (LPBYTE) colorStr, &count) == ERROR_SUCCESS)
                 {
                     int r, g, b;
                     if (sscanf (colorStr, "%d %d %d", &r, &g, &b) == 3)
@@ -850,6 +900,7 @@
     HANDLE hFind;
     WIN32_FIND_DATAW wfd;
     HRESULT hr;
+    size_t pathLen;
 
     TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
 
@@ -857,7 +908,12 @@
         return E_POINTER;
 
     lstrcpyW(szDir, pszThemePath);
-    PathAddBackslashW(szDir);
+    pathLen = lstrlenW (szDir);
+    if ((pathLen > 0) && (pathLen < MAX_PATH-1) && (szDir[pathLen - 1] != '\\'))
+    {
+        szDir[pathLen] = '\\';
+        szDir[pathLen+1] = 0;
+    }
 
     lstrcpyW(szPath, szDir);
     lstrcatW(szPath, szStar);

Modified: trunk/reactos/lib/uxtheme/uxtheme.spec
--- trunk/reactos/lib/uxtheme/uxtheme.spec	2005-10-08 19:43:11 UTC (rev 18357)
+++ trunk/reactos/lib/uxtheme/uxtheme.spec	2005-10-08 19:49:47 UTC (rev 18358)
@@ -82,7 +82,7 @@
 @ stdcall GetThemeTextExtent(ptr ptr long long wstr long long ptr ptr)
 @ stdcall GetThemeTextMetrics(ptr ptr long long ptr)
 @ stdcall GetWindowTheme(ptr)
-@ stdcall HitTestThemeBackground(ptr long long long long ptr long long long ptr)
+@ stdcall HitTestThemeBackground(ptr long long long long ptr long double ptr)
 @ stdcall IsAppThemed()
 @ stdcall IsThemeActive()
 @ stdcall IsThemeBackgroundPartiallyTransparent(ptr long long)