[UXTHEME] -Rename ActiveThemeFile to g_ActiveThemeFile, user32ApiHook to g_user32ApiH...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 7 Jun 2017 08:28:14 +0000 (08:28 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 7 Jun 2017 08:28:14 +0000 (08:28 +0000)
svn path=/trunk/; revision=74934

reactos/dll/win32/uxtheme/msstyles.c
reactos/dll/win32/uxtheme/system.c
reactos/dll/win32/uxtheme/themehooks.c
reactos/dll/win32/uxtheme/uxthemep.h

index e183c5f..cca77ee 100644 (file)
  * Defines and global variables
  */
 
-static BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value);
-static BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize);
-static HRESULT MSSTYLES_GetFont (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LOGFONTW* logfont);
-
 extern int alphaBlendMode;
 
 #define MSSTYLES_VERSION 0x0003
index 838c01a..fce5904 100644 (file)
@@ -51,7 +51,7 @@ static ATOM atSubAppName;
 static ATOM atSubIdList;
 ATOM atWndContext;
 
-PTHEME_FILE ActiveThemeFile;
+PTHEME_FILE g_ActiveThemeFile;
 
 RTL_HANDLE_TABLE g_UxThemeHandleTable;
 int g_cHandles;
@@ -131,44 +131,44 @@ static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue,
 
 static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
 {
-    if(ActiveThemeFile)
-        MSSTYLES_CloseThemeFile(ActiveThemeFile);
-    ActiveThemeFile = tf;
-    if (ActiveThemeFile)
+    if(g_ActiveThemeFile)
+        MSSTYLES_CloseThemeFile(g_ActiveThemeFile);
+    g_ActiveThemeFile = tf;
+    if (g_ActiveThemeFile)
     {
-        MSSTYLES_ReferenceTheme(ActiveThemeFile);
-        MSSTYLES_ParseThemeIni(ActiveThemeFile);
+        MSSTYLES_ReferenceTheme(g_ActiveThemeFile);
+        MSSTYLES_ParseThemeIni(g_ActiveThemeFile);
     }
     return S_OK;
 }
 
 static BOOL bIsThemeActive(LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
 {
-    if (ActiveThemeFile == NULL)
+    if (g_ActiveThemeFile == NULL)
         return FALSE;
 
-    if (wcscmp(pszTheme, ActiveThemeFile->szThemeFile) != 0)
+    if (wcscmp(pszTheme, g_ActiveThemeFile->szThemeFile) != 0)
         return FALSE;
 
     if (!pszColor[0])
     {
-        if (ActiveThemeFile->pszAvailColors != ActiveThemeFile->pszSelectedColor)
+        if (g_ActiveThemeFile->pszAvailColors != g_ActiveThemeFile->pszSelectedColor)
             return FALSE;
     }
     else
     {
-        if (wcscmp(pszColor, ActiveThemeFile->pszSelectedColor) != 0)
+        if (wcscmp(pszColor, g_ActiveThemeFile->pszSelectedColor) != 0)
             return FALSE;
     }
 
     if (!pszSize[0])
     {
-        if (ActiveThemeFile->pszAvailSizes != ActiveThemeFile->pszSelectedSize)
+        if (g_ActiveThemeFile->pszAvailSizes != g_ActiveThemeFile->pszSelectedSize)
             return FALSE;
     }
     else
     {
-        if (wcscmp(pszSize, ActiveThemeFile->pszSelectedSize) != 0)
+        if (wcscmp(pszSize, g_ActiveThemeFile->pszSelectedSize) != 0)
             return FALSE;
     }
 
@@ -192,7 +192,7 @@ void UXTHEME_LoadTheme(BOOL bLoad)
     WCHAR szCurrentSize[64];
     BOOL bThemeActive = FALSE;
 
-    if(bLoad == TRUE && gbThemeHooksActive) 
+    if(bLoad == TRUE && g_bThemeHooksActive) 
     {
         /* Get current theme configuration */
         if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
@@ -517,7 +517,7 @@ static HRESULT UXTHEME_ApplyTheme(PTHEME_FILE tf)
 
     TRACE("UXTHEME_ApplyTheme\n");
 
-    if (tf && !ActiveThemeFile)
+    if (tf && !g_ActiveThemeFile)
     {
         UXTHEME_BackupSystemMetrics();
     }
@@ -533,10 +533,10 @@ static HRESULT UXTHEME_ApplyTheme(PTHEME_FILE tf)
 
     TRACE("Writing theme config to registry\n");
     if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
-        tmp[0] = ActiveThemeFile?'1':'0';
+        tmp[0] = g_ActiveThemeFile ? '1' : '0';
         tmp[1] = '\0';
         RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
-        if (ActiveThemeFile) {
+        if (g_ActiveThemeFile) {
             RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)tf->pszSelectedColor, 
                (lstrlenW(tf->pszSelectedColor)+1)*sizeof(WCHAR));
             RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)tf->pszSelectedSize, 
@@ -597,7 +597,7 @@ BOOL WINAPI IsAppThemed(void)
 {
     TRACE("\n");
     SetLastError(ERROR_SUCCESS);
-    return (ActiveThemeFile != NULL);
+    return (g_ActiveThemeFile != NULL);
 }
 
 /***********************************************************************
@@ -614,10 +614,10 @@ BOOL WINAPI IsThemeActive(void)
     TRACE("IsThemeActive\n");
     SetLastError(ERROR_SUCCESS);
 
-    if (ActiveThemeFile) 
+    if (g_ActiveThemeFile) 
         return TRUE;
 
-    if (gbThemeHooksActive)
+    if (g_bThemeHooksActive)
         return FALSE;
 
     bActive = FALSE;
@@ -646,7 +646,7 @@ HRESULT WINAPI EnableTheming(BOOL fEnable)
 
     TRACE("(%d)\n", fEnable);
 
-    if (fEnable != (ActiveThemeFile != NULL)) {
+    if (fEnable != (g_ActiveThemeFile != NULL)) {
         if(fEnable) 
             UXTHEME_BackupSystemMetrics();
         else
@@ -718,7 +718,7 @@ PTHEME_CLASS ValidateHandle(HTHEME hTheme)
 {
     PUXTHEME_HANDLE pHandle;
 
-    if (!gbThemeHooksActive || !hTheme || hTheme == INVALID_HANDLE_VALUE)
+    if (!g_bThemeHooksActive || !hTheme || hTheme == INVALID_HANDLE_VALUE)
         return NULL;
 
     if (!RtlIsValidHandle(&g_UxThemeHandleTable, (PRTL_HANDLE_TABLE_ENTRY)hTheme))
@@ -806,7 +806,7 @@ OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DW
  */
 HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
 {
-    return OpenThemeDataInternal(ActiveThemeFile, hwnd, pszClassList, flags);
+    return OpenThemeDataInternal(g_ActiveThemeFile, hwnd, pszClassList, flags);
 }
 
 /***********************************************************************
@@ -822,7 +822,7 @@ HTHEME WINAPI OpenThemeDataFromFile(HTHEMEFILE hThemeFile, HWND hwnd, LPCWSTR ps
  */
 HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
 {
-    return OpenThemeDataInternal(ActiveThemeFile, hwnd, classlist, 0);
+    return OpenThemeDataInternal(g_ActiveThemeFile, hwnd, classlist, 0);
 }
 
 /***********************************************************************
@@ -885,31 +885,31 @@ HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
 {
     int cchar;
 
-    if(ActiveThemeFile == NULL)
+    if(g_ActiveThemeFile == NULL)
          return E_PROP_ID_UNSUPPORTED;
 
     if (pszThemeFileName && dwMaxNameChars) 
     {
-        cchar = lstrlenW(ActiveThemeFile->szThemeFile) + 1;
+        cchar = lstrlenW(g_ActiveThemeFile->szThemeFile) + 1;
         if(cchar > dwMaxNameChars)
            return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-        lstrcpynW(pszThemeFileName, ActiveThemeFile->szThemeFile, cchar);
+        lstrcpynW(pszThemeFileName, g_ActiveThemeFile->szThemeFile, cchar);
     }
 
     if (pszColorBuff && cchMaxColorChars) 
     {
-        cchar = lstrlenW(ActiveThemeFile->pszSelectedColor) + 1;
+        cchar = lstrlenW(g_ActiveThemeFile->pszSelectedColor) + 1;
         if(cchar > cchMaxColorChars)
             return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-        lstrcpynW(pszColorBuff, ActiveThemeFile->pszSelectedColor, cchar);
+        lstrcpynW(pszColorBuff, g_ActiveThemeFile->pszSelectedColor, cchar);
     }
 
    if (pszSizeBuff && cchMaxSizeChars) 
     {
-        cchar = lstrlenW(ActiveThemeFile->pszSelectedSize) + 1;
+        cchar = lstrlenW(g_ActiveThemeFile->pszSelectedSize) + 1;
         if(cchar > cchMaxSizeChars)
             return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-        lstrcpynW(pszSizeBuff, ActiveThemeFile->pszSelectedSize, cchar);
+        lstrcpynW(pszSizeBuff, g_ActiveThemeFile->pszSelectedSize, cchar);
     }
 
     return S_OK;
@@ -1018,7 +1018,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
     TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
           pszValueBuff, cchMaxValChars);
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt);
@@ -1094,7 +1094,7 @@ HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
           debugstr_w(pszColorName), debugstr_w(pszSizeName),
           hThemeFile, unknown);
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
@@ -1178,7 +1178,7 @@ HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
           pszColorName, dwColorNameLen,
           pszSizeName, dwSizeNameLen);
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
@@ -1299,7 +1299,7 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
     TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName),
           debugstr_w(pszSizeName), dwColorNum);
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt);
@@ -1362,7 +1362,7 @@ HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
     TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName),
           debugstr_w(pszColorName), dwSizeNum);
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt);
@@ -1434,7 +1434,7 @@ HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName)
     HRESULT hr;
     TRACE("(%s)\n", debugstr_w(pszThemeFileName));
 
-    if (!gbThemeHooksActive)
+    if (!g_bThemeHooksActive)
         return E_FAIL;
 
     hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
index a7b4469..c6d650d 100644 (file)
@@ -8,11 +8,11 @@
  
 #include "uxthemep.h"
 
-USERAPIHOOK user32ApiHook;
+USERAPIHOOK g_user32ApiHook;
 BYTE gabDWPmessages[UAHOWP_MAX_SIZE];
 BYTE gabMSGPmessages[UAHOWP_MAX_SIZE];
 BYTE gabDLGPmessages[UAHOWP_MAX_SIZE];
-BOOL gbThemeHooksActive = FALSE;
+BOOL g_bThemeHooksActive = FALSE;
 
 PWND_DATA ThemeGetWndData(HWND hWnd)
 {
@@ -55,7 +55,7 @@ void ThemeDestroyWndData(HWND hWnd)
 
     if(pwndData->HasThemeRgn)
     {
-        user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
+        g_user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
     }
 
     if (pwndData->hTabBackgroundBrush != NULL)
@@ -192,7 +192,7 @@ void SetThemeRegion(HWND hWnd)
 
     DeleteObject(hrgn1);
 
-    user32ApiHook.SetWindowRgn(hWnd, hrgn, TRUE);
+    g_user32ApiHook.SetWindowRgn(hWnd, hrgn, TRUE);
 }
 
 int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
@@ -227,7 +227,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
         if(pwndData->HasThemeRgn)
         {
             pwndData->HasThemeRgn = FALSE;
-            user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
+            g_user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
         }
         return 0;
     }
@@ -250,7 +250,7 @@ ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {      
     if(!IsAppThemed())
     {
-        return user32ApiHook.DefWindowProcW(hWnd, 
+        return g_user32ApiHook.DefWindowProcW(hWnd, 
                                             Msg, 
                                             wParam, 
                                             lParam);
@@ -260,7 +260,7 @@ ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                         Msg, 
                         wParam, 
                         lParam, 
-                        user32ApiHook.DefWindowProcW);
+                        g_user32ApiHook.DefWindowProcW);
 }
 
 static LRESULT CALLBACK
@@ -268,7 +268,7 @@ ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
     if(!IsAppThemed())
     {
-        return user32ApiHook.DefWindowProcA(hWnd, 
+        return g_user32ApiHook.DefWindowProcA(hWnd, 
                                             Msg, 
                                             wParam, 
                                             lParam);
@@ -278,7 +278,7 @@ ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                         Msg, 
                         wParam, 
                         lParam, 
-                        user32ApiHook.DefWindowProcA);
+                        g_user32ApiHook.DefWindowProcA);
 }
 
 static LRESULT CALLBACK
@@ -487,7 +487,7 @@ int WINAPI ThemeSetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
         pwndData->HasThemeRgn = FALSE;
     }
 
-    return user32ApiHook.SetWindowRgn(hWnd, hRgn, bRedraw);
+    return g_user32ApiHook.SetWindowRgn(hWnd, hRgn, bRedraw);
 }
 
 BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
@@ -514,7 +514,7 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
      * with GetScrollInfo, it will get wrong data. So uxtheme needs to
      * hook it and set the correct tracking position itself
      */
-    ret = user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
+    ret = g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
     if ( lpsi && 
         (lpsi->fMask & SIF_TRACKPOS) &&
          pwndData->SCROLL_TrackingWin == hwnd && 
@@ -525,7 +525,7 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
     return ret;
 
 dodefault:
-    return user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
+    return g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
 }
 
 /**********************************************************************
@@ -539,14 +539,14 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
     {
         UXTHEME_LoadTheme(FALSE);
         ThemeCleanupWndContext(NULL, 0);
-        gbThemeHooksActive = FALSE;
+        g_bThemeHooksActive = FALSE;
         return TRUE;
     }
 
-    gbThemeHooksActive = TRUE;
+    g_bThemeHooksActive = TRUE;
 
     /* Store the original functions from user32 */
-    user32ApiHook = *puah;
+    g_user32ApiHook = *puah;
     
     puah->DefWindowProcA = ThemeDefWindowProcA;
     puah->DefWindowProcW = ThemeDefWindowProcW;
@@ -673,9 +673,9 @@ ThemeHooksRemove()
 
 INT WINAPI ClassicSystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 {
-    if (gbThemeHooksActive)
+    if (g_bThemeHooksActive)
     {
-        return user32ApiHook.SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
+        return g_user32ApiHook.SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
     }
 
     return SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
@@ -683,9 +683,9 @@ INT WINAPI ClassicSystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvPar
 
 INT WINAPI ClassicSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 {
-    if (gbThemeHooksActive)
+    if (g_bThemeHooksActive)
     {
-        return user32ApiHook.SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
+        return g_user32ApiHook.SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
     }
 
     return SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
@@ -693,9 +693,9 @@ INT WINAPI ClassicSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvPar
 
 INT WINAPI ClassicGetSystemMetrics(int nIndex)
 {
-    if (gbThemeHooksActive)
+    if (g_bThemeHooksActive)
     {
-        return user32ApiHook.GetSystemMetrics(nIndex);
+        return g_user32ApiHook.GetSystemMetrics(nIndex);
     }
 
     return GetSystemMetrics(nIndex);
@@ -703,9 +703,9 @@ INT WINAPI ClassicGetSystemMetrics(int nIndex)
 
 BOOL WINAPI ClassicAdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
 {
-    if (gbThemeHooksActive)
+    if (g_bThemeHooksActive)
     {
-        return user32ApiHook.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+        return g_user32ApiHook.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
     }
 
     return AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
index dc28f56..c525144 100644 (file)
@@ -250,8 +250,7 @@ HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style);
 extern HINSTANCE hDllInst;
 extern ATOM atWindowTheme;
 extern ATOM atWndContext;
-extern BOOL gbThemeHooksActive;
-extern PTHEME_FILE ActiveThemeFile;
+extern BOOL g_bThemeHooksActive;
 
 void UXTHEME_InitSystem(HINSTANCE hInst);
 void UXTHEME_LoadTheme(BOOL bLoad);