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.

79 lines
3.5 KiB

  1. //---------------------------------------------------------------------------
  2. // SetHook.h - Window and DefWindowProc hooking decls.
  3. //---------------------------------------------------------------------------
  4. #pragma once
  5. //---------------------------------------------------------------------------
  6. // Hooked message disposition flags
  7. #define HMD_NIL 0x00000000
  8. #define HMD_THEMEDETACH 0x00000001 // detach: theme removed
  9. #define HMD_WINDOWDESTROY 0x00000002 // detach: window is dying
  10. #define HMD_CHANGETHEME 0x00000004 // theme is changing
  11. #define HMD_REATTACH 0x00000008 // attempt attaching window that was previously rejected.
  12. #define HMD_REVOKE 0x00000010 // theme revoked on non-compliant window.
  13. #define HMD_PROCESSDETACH 0x00000020 // process is dying
  14. #define HMD_BULKDETACH 0x00000040 // context is a DetachAll sequence.
  15. //---------------------------------------------------------------------------
  16. // Query class-specific hooking
  17. BOOL WINAPI FrameHookEnabled();
  18. BOOL WINAPI CtlHooksEnabled();
  19. BOOL WINAPI CompositingEnabled();
  20. //---------------------------------------------------------------------------
  21. // ThemeHookStartup/Shutdown() - invoked from DLL_PROCESS_ATTACH/DETACH, resp.
  22. BOOL WINAPI ThemeHookStartup();
  23. BOOL WINAPI ThemeHookShutdown();
  24. //---------------------------------------------------------------------------
  25. // More helper macros.
  26. #define STRINGIZE_ATOM(a) MAKEINTATOM(a)
  27. #define BOGUS_THEMEID 0
  28. #define IS_THEME_CHANGE_TARGET(lParam) \
  29. ((! g_pAppInfo->CustomAppTheme()) || (lParam & WTC_CUSTOMTHEME))
  30. //---------------------------------------------------------------------------
  31. // Nonclient theming target window classifications [scotthan]:
  32. // NIL: window has not been evaluated
  33. // REJECT: window has been rejected on the basis of current attributes or conditions,
  34. // but may be reconsidered a theming target
  35. // EXILE: window has been permanently rejected for attachment themewnd object because
  36. // it's wndproc has proven itself incompatible with theme protocol(s).
  37. // Helper macros:
  38. #define THEMEWND_NIL ((CThemeWnd*)NULL)
  39. #define THEMEWND_REJECT ((CThemeWnd*)-1)
  40. #define THEMEWND_EXILE ((CThemeWnd*)-2)
  41. #define THEMEWND_FAILURE ((CThemeWnd*)-3)
  42. #define EXILED_THEMEWND(pwnd) ((pwnd)==THEMEWND_EXILE)
  43. #define REJECTED_THEMEWND(pwnd) ((pwnd)==THEMEWND_REJECT)
  44. #define FAILED_THEMEWND(pwnd) ((pwnd)==THEMEWND_FAILURE)
  45. #define VALID_THEMEWND(pwnd) (((pwnd) != THEMEWND_NIL) && !FAILED_THEMEWND(pwnd) &&\
  46. !REJECTED_THEMEWND(pwnd) && !EXILED_THEMEWND(pwnd))
  47. #define ISWINDOW(hwnd) ((hwnd) && (hwnd != INVALID_HANDLE_VALUE) && (IsWindow(hwnd)))
  48. //---------------------------------------------------------------------------
  49. extern "C" BOOL WINAPI ThemeInitApiHook( DWORD dwCmd, void * pvData );
  50. //---- must manually call ProcessStartUp() if needed in ThemeInitApiHook() ----
  51. BOOL ProcessStartUp(HINSTANCE hModule);
  52. //---- avail for calling when tracking down leaks with BoundsChecker() ----
  53. BOOL ProcessShutDown();
  54. //---------------------------------------------------------------------------
  55. inline void ShutDownCheck(HWND hwnd)
  56. {
  57. #ifdef LOGGING
  58. //---- if we just released APP Window, call ProcessShutDown() for best leak detection ----
  59. if (hwnd == g_hwndFirstHooked)
  60. {
  61. if (LogOptionOn(LO_SHUTDOWN)) // "+shutdown" log option selected
  62. ProcessShutDown();
  63. }
  64. #endif
  65. }
  66. //---------------------------------------------------------------------------//