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.

218 lines
6.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992-1999.
  5. //
  6. // File: alertapi.h
  7. //
  8. // Contents: Alert system API.
  9. //
  10. // History: 11-Jan-94 MarkBl Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #if !defined( __ALERTAPI_H__ )
  14. #define __ALERTAPI_H__
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. //
  19. // OLE headers don't define these. Use 'LP' vs 'P' to be consistent with OLE.
  20. //
  21. typedef UUID * LPUUID;
  22. typedef DISPID * LPDISPID;
  23. typedef DISPPARAMS * LPDISPPARAMS;
  24. //
  25. // Structure used with ReportAlert.
  26. //
  27. typedef struct _ALERTREPORTRECORD
  28. {
  29. short Category;
  30. short SubCategory;
  31. short Severity;
  32. long TitleMessageNumber;
  33. long cTitleMessageInserts;
  34. PWCHAR * TitleMessageInserts;
  35. PWCHAR TitleText;
  36. long DescrMessageNumber;
  37. long cDescrMessageInserts;
  38. PWCHAR * DescrMessageInserts;
  39. PWCHAR SourceDescription;
  40. LPUUID ComponentID;
  41. LPUUID ReportClassID;
  42. PWCHAR TakeActionDLL;
  43. long cBytesAlertData;
  44. PBYTE AlertData;
  45. long cAdditionalArguments;
  46. LPDISPID AdditionalArgumentNames;
  47. LPVARIANT AdditionalArguments;
  48. } ALERTREPORTRECORD, * PALERTREPORTRECORD;
  49. typedef const ALERTREPORTRECORD * PCALERTREPORTRECORD;
  50. //
  51. // Helper ALERTREPORTRECORD initialization macro.
  52. //
  53. #define INITIALIZE_ALERTREPORTRECORD( \
  54. Record, \
  55. Cat, \
  56. Sev, \
  57. TitleMsg, \
  58. DescrMsg, \
  59. CompID, \
  60. SrcName) \
  61. { \
  62. Record.Category = Cat; \
  63. Record.SubCategory = 0; \
  64. Record.Severity = Sev; \
  65. Record.TitleMessageNumber = TitleMsg; \
  66. Record.cTitleMessageInserts = 0; \
  67. Record.TitleMessageInserts = NULL; \
  68. Record.TitleText = NULL; \
  69. Record.DescrMessageNumber = DescrMsg; \
  70. Record.cDescrMessageInserts = 0; \
  71. Record.DescrMessageInserts = NULL; \
  72. Record.SourceDescription = SrcName; \
  73. Record.ComponentID = CompID; \
  74. Record.ReportClassID = NULL; \
  75. Record.TakeActionDLL = NULL; \
  76. Record.cBytesAlertData = 0; \
  77. Record.AlertData = NULL; \
  78. Record.cAdditionalArguments = 0; \
  79. Record.AdditionalArgumentNames = NULL; \
  80. Record.AdditionalArguments = NULL; \
  81. }
  82. typedef IAlertTarget * LPALERTTARGET;
  83. //
  84. // Public API
  85. //
  86. //+---------------------------------------------------------------------------
  87. //
  88. // API: ReportAlert
  89. //
  90. // Description: Raise an alert to the local computer distributor object
  91. // and/or log the alert in the local system log.
  92. //
  93. // Arguments: [palrepRecord] -- ALERTREPORTRECORD alert data.
  94. // [fdwAction] -- ReportAlert action (defined below).
  95. //
  96. // Returns: S_OK
  97. // HRESULT error
  98. //
  99. //----------------------------------------------------------------------------
  100. //
  101. // ReportAlert modes.
  102. //
  103. #define RA_REPORT 0x00000001
  104. #define RA_LOG 0x00000002
  105. #define RA_REPORT_AND_LOG 0x00000003
  106. STDAPI ReportAlert(
  107. PCALERTREPORTRECORD palrepRecord,
  108. DWORD fdwAction);
  109. //+---------------------------------------------------------------------------
  110. //
  111. // API: ReportAlertToTarget
  112. //
  113. // Description: Raise an alert to the alert target indicated.
  114. //
  115. // Arguments: [patTarget] -- Target instance (must be non-NULL).
  116. // [palrepRecord] -- ALERTREPORTRECORD alert data.
  117. //
  118. // Returns: S_OK
  119. // HRESULT error
  120. //
  121. //----------------------------------------------------------------------------
  122. STDAPI ReportAlertToTarget(
  123. LPALERTTARGET patTarget,
  124. PCALERTREPORTRECORD palrepRecord);
  125. //+---------------------------------------------------------------------------
  126. //
  127. // API: MarshalReport
  128. //
  129. // Description: Marshals the DISPPARAM alert report data into a buffer
  130. // suitable for report delivery via the IAlertTarget interface.
  131. //
  132. // Arguments: [pdparams] -- DISPPARAMS alert data.
  133. // [ppbReport] -- Return marshal buffer.
  134. // [pcbReportSize] -- Return marshal buffer size.
  135. //
  136. // Returns: S_OK
  137. // HRESULT error
  138. //
  139. //----------------------------------------------------------------------------
  140. STDAPI MarshalReport(
  141. const LPDISPPARAMS pdparams,
  142. PBYTE * ppbReport,
  143. PULONG pcbReportSize);
  144. //+---------------------------------------------------------------------------
  145. //
  146. // API: UnMarshalReport
  147. //
  148. // Description: The converse of MarshalReport. Un-marshals the buffer
  149. // (marshalled alert data) into a DISPPARAMS structure.
  150. //
  151. // Arguments: [cbReportSize] -- Marshalled report size.
  152. // [ppbReport] -- Marshalled report.
  153. // [pdparams] -- Returned DISPPARAMS alert data.
  154. //
  155. // Returns: S_OK
  156. // HRESULT error
  157. //
  158. //----------------------------------------------------------------------------
  159. STDAPI UnMarshalReport(
  160. ULONG cbReportSize,
  161. const PBYTE pbReport,
  162. LPDISPPARAMS pdparams);
  163. //
  164. // Non-Public API [as yet]
  165. //
  166. STDAPI CreateAlertDistributorObject(
  167. const PWCHAR pwszAlertDistr);
  168. STDAPI Register(
  169. LPDISPATCH pdispAlertDistr,
  170. LPMONIKER pmkAlertTarget,
  171. SHORT sCategory,
  172. SHORT sSeverity,
  173. PLONG plRegistrationID);
  174. STDAPI RegisterEx(
  175. LPDISPATCH pdispAlertDistr,
  176. LPMONIKER pmkAlertTarget,
  177. SHORT cCount,
  178. SHORT asCategory[],
  179. SHORT asSeverity[],
  180. PLONG plRegistrationID);
  181. STDAPI AsLogAlertInSystemLog(
  182. ULONG cbReportSize,
  183. const PBYTE pbReport);
  184. #endif // __ALERTAPI_H__