Remove shlwapi dependency.

This commit is contained in:
Frank Richter 2005-09-02 12:29:02 +00:00 committed by Alexandre Julliard
parent b7edbe66cf
commit 064b54a0ad
3 changed files with 68 additions and 13 deletions

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = uxtheme.dll MODULE = uxtheme.dll
IMPORTLIB = libuxtheme.$(IMPLIBEXT) IMPORTLIB = libuxtheme.$(IMPLIBEXT)
IMPORTS = shlwapi user32 gdi32 advapi32 kernel32 ntdll IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = msimg32 DELAYIMPORTS = msimg32
EXTRALIBS = $(LIBUNICODE) EXTRALIBS = $(LIBUNICODE)

View File

@ -25,8 +25,6 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#define NO_SHLWAPI_REG
#include "shlwapi.h"
#include "winnls.h" #include "winnls.h"
#include "wingdi.h" #include "wingdi.h"
#include "uxtheme.h" #include "uxtheme.h"
@ -35,6 +33,7 @@
#include "uxthemedll.h" #include "uxthemedll.h"
#include "msstyles.h" #include "msstyles.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
@ -343,7 +342,7 @@ static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR
*iStateId = 0; *iStateId = 0;
comp = sec; comp = sec;
/* Get the application name */ /* Get the application name */
tmp = StrChrW(comp, ':'); tmp = strchrW(comp, ':');
if(tmp) { if(tmp) {
*tmp++ = 0; *tmp++ = 0;
tmp++; tmp++;
@ -351,19 +350,19 @@ static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR
comp = tmp; comp = tmp;
} }
tmp = StrChrW(comp, '.'); tmp = strchrW(comp, '.');
if(tmp) { if(tmp) {
*tmp++ = 0; *tmp++ = 0;
lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME); lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME);
comp = tmp; comp = tmp;
/* now get the part & state */ /* now get the part & state */
tmp = StrChrW(comp, '('); tmp = strchrW(comp, '(');
if(tmp) { if(tmp) {
*tmp++ = 0; *tmp++ = 0;
lstrcpynW(part, comp, sizeof(part)/sizeof(part[0])); lstrcpynW(part, comp, sizeof(part)/sizeof(part[0]));
comp = tmp; comp = tmp;
/* now get the state */ /* now get the state */
*StrChrW(comp, ')') = 0; *strchrW(comp, ')') = 0;
lstrcpynW(state, comp, sizeof(state)/sizeof(state[0])); lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
} }
else { else {
@ -371,13 +370,13 @@ static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR
} }
} }
else { else {
tmp = StrChrW(comp, '('); tmp = strchrW(comp, '(');
if(tmp) { if(tmp) {
*tmp++ = 0; *tmp++ = 0;
lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME); lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME);
comp = tmp; comp = tmp;
/* now get the state */ /* now get the state */
*StrChrW(comp, ')') = 0; *strchrW(comp, ')') = 0;
lstrcpynW(state, comp, sizeof(state)/sizeof(state[0])); lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
} }
else { else {
@ -805,7 +804,7 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList)
} }
start = pszClassList; start = pszClassList;
while((end = StrChrW(start, ';'))) { while((end = strchrW(start, ';'))) {
len = end-start; len = end-start;
lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0]))); lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0])));
start = end+1; start = end+1;

View File

@ -28,7 +28,6 @@
#include "winuser.h" #include "winuser.h"
#include "wingdi.h" #include "wingdi.h"
#include "winreg.h" #include "winreg.h"
#include "shlwapi.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "tmschema.h" #include "tmschema.h"
@ -93,6 +92,57 @@ static BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg)
return TRUE; 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 * UXTHEME_LoadTheme
* *
@ -123,7 +173,7 @@ static void UXTHEME_LoadTheme(void)
buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]); buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize)) if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
szCurrentSize[0] = '\0'; szCurrentSize[0] = '\0';
if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0)) if (query_reg_path (hKey, szDllName, szCurrentTheme))
szCurrentTheme[0] = '\0'; szCurrentTheme[0] = '\0';
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -850,6 +900,7 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
HANDLE hFind; HANDLE hFind;
WIN32_FIND_DATAW wfd; WIN32_FIND_DATAW wfd;
HRESULT hr; HRESULT hr;
size_t pathLen;
TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData); TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
@ -857,7 +908,12 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
return E_POINTER; return E_POINTER;
lstrcpyW(szDir, pszThemePath); 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); lstrcpyW(szPath, szDir);
lstrcatW(szPath, szStar); lstrcatW(szPath, szStar);