Source code of Windows XP (NT5)
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.

76 lines
3.3 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: ThemeServer.h
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // Functions that implement server functionality.
  7. //
  8. // History: 2000-11-11 vtan created
  9. // --------------------------------------------------------------------------
  10. #ifndef _ThemeServer_
  11. #define _ThemeServer_
  12. // --------------------------------------------------------------------------
  13. // CThemeServer
  14. //
  15. // Purpose: Class to implement server related functions. Functions
  16. // declared in this class execute on the server side of themes.
  17. //
  18. // This means they are restricted in what functions they can and
  19. // cannot call on the client's behalf. Any win32k functions that
  20. // are per instance of win32k cannot be called.
  21. //
  22. // History: 2000-11-11 vtan created
  23. // --------------------------------------------------------------------------
  24. class CThemeServer
  25. {
  26. private:
  27. enum
  28. {
  29. FunctionNothing = 0,
  30. FunctionRegisterUserApiHook,
  31. FunctionUnregisterUserApiHook,
  32. FunctionClearStockObjects
  33. };
  34. private:
  35. CThemeServer (void);
  36. public:
  37. CThemeServer (HANDLE hProcessRegisterHook, DWORD dwServerChangeNumber, void *pfnRegister, void *pfnUnregister, void *pfnClearStockObjects, DWORD dwStackSizeReserve, DWORD dwStackSizeCommit);
  38. ~CThemeServer (void);
  39. HRESULT ThemeHooksOn (void);
  40. HRESULT ThemeHooksOff (void);
  41. bool AreThemeHooksActive (void);
  42. int GetCurrentChangeNumber (void);
  43. int GetNewChangeNumber (void);
  44. HRESULT SetGlobalTheme (HANDLE hSection);
  45. HRESULT GetGlobalTheme (HANDLE *phSection);
  46. HRESULT LoadTheme (HANDLE hSection, HANDLE *phSection, LPCWSTR pszName, LPCWSTR pszColor, LPCWSTR pszSize);
  47. static bool IsSystemProcessContext (void);
  48. static DWORD ThemeHooksInstall (void);
  49. static DWORD ThemeHooksRemove (void);
  50. static DWORD ClearStockObjects (HANDLE hSection);
  51. private:
  52. void LockAcquire (void);
  53. void LockRelease (void);
  54. HRESULT InjectClientSessionThread (HANDLE hProcess, int iIndexFunction, void *pvParam);
  55. private:
  56. HANDLE _hProcessRegisterHook;
  57. DWORD _dwServerChangeNumber;
  58. void* _pfnRegister;
  59. void* _pfnUnregister;
  60. void* _pfnClearStockObjects;
  61. DWORD _dwStackSizeReserve;
  62. DWORD _dwStackSizeCommit;
  63. DWORD _dwSessionID;
  64. bool _fHostHooksSet;
  65. HANDLE _hSectionGlobalTheme;
  66. DWORD _dwClientChangeNumber;
  67. CRITICAL_SECTION _lock;
  68. };
  69. #endif /* _ThemeLoader_ */