Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
4.6 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: Services.h
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // APIs to communicate with the theme service.
  7. //
  8. // History: 2000-08-10 vtan created
  9. // 2000-10-11 vtan rewrite for LPC
  10. // --------------------------------------------------------------------------
  11. #ifndef _UxThemeServices_
  12. #define _UxThemeServices_
  13. #include <LPCThemes.h>
  14. // --------------------------------------------------------------------------
  15. // CThemeServices
  16. //
  17. // Purpose: Class to implement APIs to communicate with the theme service.
  18. //
  19. // History: 2000-08-10 vtan created
  20. // 2000-10-11 vtan rewrite for LPC
  21. // --------------------------------------------------------------------------
  22. class CThemeServices
  23. {
  24. private:
  25. CThemeServices (void);
  26. ~CThemeServices (void);
  27. public:
  28. static void StaticInitialize (void);
  29. static void StaticTerminate (void);
  30. // These are calls to the server.
  31. static HRESULT ThemeHooksOn (HWND hwndTarget);
  32. static HRESULT ThemeHooksOff (void);
  33. static HRESULT GetStatusFlags (DWORD *pdwFlags);
  34. static HRESULT GetCurrentChangeNumber (int *piValue);
  35. static HRESULT SetGlobalTheme (HANDLE hSection);
  36. static HRESULT GetGlobalTheme (HANDLE *phSection);
  37. static HRESULT CheckThemeSignature (const WCHAR *pszThemeName);
  38. static HRESULT ProcessLoadGlobalTheme( const WCHAR *pszThemeName, const WCHAR *pszColor, const WCHAR *pszSize, OUT HANDLE* phSection );
  39. static HRESULT LoadTheme (HANDLE *phSection, const WCHAR *pszThemeName, const WCHAR *pszColor, const WCHAR *pszSize, BOOL fGlobal);
  40. static HRESULT ProcessLoaderEntry(LPWSTR lpwszCmdLine);
  41. static NTSTATUS SendProcessAssignSection( HRESULT hrAssign, HANDLE hSection, DWORD dwHash,
  42. OUT THEMESAPI_PORT_MESSAGE* pPortMsgIn, OUT THEMESAPI_PORT_MESSAGE* pPortMsgOut );
  43. // These are calls implemented on the client side
  44. // that may make calls to the server.
  45. static HRESULT ApplyTheme (CUxThemeFile *pThemeFile, DWORD dwFlags, HWND hwndTarget);
  46. static HRESULT InitUserTheme (BOOL fPolicyCheckOnly = FALSE);
  47. static HRESULT AdjustTheme(BOOL fEnable);
  48. static HRESULT InitUserRegistry (void);
  49. // These are special private APIs
  50. static HRESULT ReestablishServerConnection (void);
  51. static HRESULT ClearStockObjects (HANDLE hSection, BOOL fForce = FALSE);
  52. private:
  53. static void ApplyDefaultMetrics(void);
  54. static void LockAcquire (void);
  55. static void LockRelease (void);
  56. static bool ConnectedToService (void);
  57. static void ReleaseConnection (void);
  58. static void CheckForDisconnectedPort (NTSTATUS status);
  59. static bool CurrentThemeMatch (LPCWSTR pszThemeName, LPCWSTR pszColor, LPCWSTR pszSize, LANGID wLangID, bool fLoadMetricsOnMatch);
  60. static HRESULT LoadCurrentTheme (void);
  61. static int SectionProcessType (const BYTE *pbThemeData, MIXEDPTRS& u);
  62. static void SectionWalkData (const BYTE *pbThemeData, int iIndex);
  63. static bool ThemeSettingsModified (void);
  64. static bool ThemeEnforcedByPolicy (bool fActive);
  65. static HRESULT CheckColorDepth(CUxThemeFile *pThemeFile);
  66. static HRESULT UpdateThemeRegistry(BOOL fNewTheme, LPCWSTR pszThemeFileName,
  67. LPCWSTR pszColorParam, LPCWSTR pszSizeParam, BOOL fJustSetActive, BOOL fJustApplied);
  68. static void SendThemeChangedMsg(BOOL fNewTheme, HWND hwndTarget, DWORD dwFlags,
  69. int iLoadId);
  70. static int GetLoadId(HANDLE hSectionOld);
  71. private:
  72. static CRITICAL_SECTION s_lock;
  73. static HANDLE s_hAPIPort;
  74. static const WCHAR s_szDefault[];
  75. };
  76. #endif /* _UxThemeServices_ */