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.

122 lines
6.6 KiB

  1. //+-------------------------------------------------------------------------
  2. // Notify.h
  3. //--------------------------------------------------------------------------
  4. #ifndef __NOTIFY_H
  5. #define __NOTIFY_H
  6. #include <msoeapi.h>
  7. //+-------------------------------------------------------------------------
  8. // Consts
  9. //--------------------------------------------------------------------------
  10. #define CMAX_HWND_NOTIFY 128
  11. #define CMAX_STRUCT_MEMBERS 10
  12. #define MSEC_WAIT_NOTIFY 10000
  13. //+-------------------------------------------------------------------------
  14. // STNOTIFYINFO
  15. //--------------------------------------------------------------------------
  16. #define SNF_POSTMSG 0 // Default: Use a PostMessage Command
  17. #define SNF_SENDMSG 0x00000001 // Use a SendMessage command
  18. #define SNF_CALLBACK 0x00000002 // DoNotify - wParam = callback function, lParam = cookie
  19. #define SNF_CROSSPROCESS 0x00000004 // Do not do any cross-process notifications, data can't be thunked
  20. #define SNF_HASTHUNKINFO 0x00000008 // Can go cross-process and data does not need no thunking (wParam and/or lParam are not pointers)
  21. #define SNF_VALIDPARAM1 0x00000010 // NOTIFYDATA::rParam1 is valid
  22. #define SNF_VALIDPARAM2 0x00000020 // NOTIFYDATA::rParam2 is valid
  23. #define SNR_UNREGISTER 0xfffffff0 // A notified hwnd can return this after a SendMessage to auto-unregister itself
  24. //+-------------------------------------------------------------------------
  25. // NOTIFYWINDOW
  26. //--------------------------------------------------------------------------
  27. typedef struct tagNOTIFYWINDOW const *LPCNOTIFYWINDOW;
  28. typedef struct tagNOTIFYWINDOW {
  29. HWND hwndThunk; // Thunking window for x-process notify
  30. HWND hwndNotify; // Handle of window to notify
  31. BOOL fExternal; // Notification is going to an IStoreNamespace or IStoreFolder user
  32. } NOTIFYWINDOW, *LPNOTIFYWINDOW;
  33. //+-------------------------------------------------------------------------
  34. // NOTIFYWINDOWTABLE
  35. //--------------------------------------------------------------------------
  36. typedef struct tagNOTIFYWINDOWTABLE const *LPCNOTIFYWINDOWTABLE;
  37. typedef struct tagNOTIFYWINDOWTABLE {
  38. DWORD cWindows; // Number of registered windows
  39. NOTIFYWINDOW rgWindow[CMAX_HWND_NOTIFY]; // Array of thunk/notify windows
  40. } NOTIFYWINDOWTABLE, *LPNOTIFYWINDOWTABLE;
  41. //+-------------------------------------------------------------------------
  42. // MEMBERINFO Flags
  43. //--------------------------------------------------------------------------
  44. #define MEMBERINFO_POINTER 0x00000001
  45. #define MEMBERINFO_POINTER_NULL (MEMBERINFO_POINTER | 0x00000002)
  46. //+-------------------------------------------------------------------------
  47. // MEMBERINFO - Used to describe the members of a structure
  48. //--------------------------------------------------------------------------
  49. typedef struct tagMEMBERINFO const *LPCMEMBERINFO;
  50. typedef struct tagMEMBERINFO {
  51. DWORD dwFlags; // MEMBERINFO_xxx Flags
  52. DWORD cbSize; // Size of the member
  53. DWORD cbData; // Size of the data
  54. LPBYTE pbData; // Pointer to the data
  55. } MEMBERINFO, *LPMEMBERINFO;
  56. //+-------------------------------------------------------------------------
  57. // STRUCTINFO Flags
  58. //--------------------------------------------------------------------------
  59. #define STRUCTINFO_VALUEONLY 0x00000001
  60. #define STRUCTINFO_POINTER 0x00000002
  61. //+-------------------------------------------------------------------------
  62. // STRUCTINFO - Used to describe the data in a notification parameter
  63. //--------------------------------------------------------------------------
  64. typedef struct tagSTRUCTINFO const *LPCSTRUCTINFO;
  65. typedef struct tagSTRUCTINFO {
  66. DWORD dwFlags; // STRUCTINFO_xxx Flags
  67. DWORD cbStruct; // Size of the structure that we are defining
  68. LPBYTE pbStruct; // Parameter that can be used inproc
  69. ULONG cMembers; // Number of members in the structure
  70. MEMBERINFO rgMember[CMAX_STRUCT_MEMBERS]; // An array of members
  71. } STRUCTINFO, *LPSTRUCTINFO;
  72. //+-------------------------------------------------------------------------
  73. // NOTIFYDATA
  74. //--------------------------------------------------------------------------
  75. typedef struct tagNOTIFYDATA {
  76. HWND hwndNotify; // Window to notify
  77. UINT msg; // The notification window message to send
  78. WPARAM wParam; // The wParam data
  79. LPARAM lParam; // The lParam data
  80. DWORD dwFlags; // SNF_xxx Flags
  81. STRUCTINFO rParam1; // First parameter (wParam)
  82. STRUCTINFO rParam2; // Second parameter (lParam)
  83. COPYDATASTRUCT rCopyData; // CopyData Struct
  84. } NOTIFYDATA, *LPNOTIFYDATA;
  85. //+-------------------------------------------------------------------------
  86. // A Callback can return
  87. //--------------------------------------------------------------------------
  88. typedef HRESULT (*PFNNOTIFYCALLBACK)(LPARAM lParam, LPNOTIFYDATA pNotify, BOOL fNeedThunk, BOOL fExternal);
  89. //+-------------------------------------------------------------------------
  90. // IStoreNotify
  91. //--------------------------------------------------------------------------
  92. interface INotify : public IUnknown
  93. {
  94. public:
  95. virtual HRESULT STDMETHODCALLTYPE Initialize(LPCSTR pszName) = 0;
  96. virtual HRESULT STDMETHODCALLTYPE Register(HWND hwndNotify, HWND hwndThunk, BOOL fExternal) = 0;
  97. virtual HRESULT STDMETHODCALLTYPE Unregister(HWND hwndNotify) = 0;
  98. virtual HRESULT STDMETHODCALLTYPE Lock(HWND hwnd) = 0;
  99. virtual HRESULT STDMETHODCALLTYPE Unlock(void) = 0;
  100. virtual HRESULT STDMETHODCALLTYPE NotificationNeeded(void) = 0;
  101. virtual HRESULT STDMETHODCALLTYPE DoNotification(UINT uWndMsg, WPARAM wParam, LPARAM lParam, DWORD dwFlags) = 0;
  102. };
  103. //+-------------------------------------------------------------------------
  104. // Prototypes
  105. //--------------------------------------------------------------------------
  106. OESTDAPI_(HRESULT) CreateNotify(INotify **ppNotify);
  107. OESTDAPI_(HRESULT) BuildNotificationPackage(LPNOTIFYDATA pNotify, PCOPYDATASTRUCT pCopyData);
  108. OESTDAPI_(HRESULT) CrackNotificationPackage(PCOPYDATASTRUCT pCopyData, LPNOTIFYDATA pNotify);
  109. #endif // __NOTIFY_H