summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/alertapi.h
blob: 2db4c8868276ccc9375ecd08ed1f00c487d4f3e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1992.
//
//  File:       alertapi.h
//
//  Contents:   Alert system API.
//
//  History:    11-Jan-94   MarkBl  Created
//
//--------------------------------------------------------------------------

#if !defined( __ALERTAPI_H__ )
#define       __ALERTAPI_H__

//
// OLE headers don't define these. Use 'LP' vs 'P' to be consistent with OLE.
//

typedef UUID       *    LPUUID;
typedef DISPID     *    LPDISPID;
typedef DISPPARAMS *    LPDISPPARAMS;


//
// Structure used with ReportAlert.
//

typedef struct _ALERTREPORTRECORD
{
    short       Category;
    short       SubCategory;
    short       Severity;
    long        TitleMessageNumber;
    long        cTitleMessageInserts;
    PWCHAR *    TitleMessageInserts;
    PWCHAR      TitleText;
    long        DescrMessageNumber;
    long        cDescrMessageInserts;
    PWCHAR *    DescrMessageInserts;
    PWCHAR      SourceDescription;
    LPUUID      ComponentID;
    LPUUID      ReportClassID;
    PWCHAR      TakeActionDLL;
    long        cBytesAlertData;
    PBYTE       AlertData;
    long        cAdditionalArguments;
    LPDISPID    AdditionalArgumentNames;
    LPVARIANT   AdditionalArguments;
} ALERTREPORTRECORD, * PALERTREPORTRECORD;

typedef const ALERTREPORTRECORD * PCALERTREPORTRECORD;

//
// Helper ALERTREPORTRECORD initialization macro.
//

#define INITIALIZE_ALERTREPORTRECORD(               \
                                        Record,     \
                                        Cat,        \
                                        Sev,        \
                                        TitleMsg,   \
                                        DescrMsg,   \
                                        CompID,     \
                                        SrcName)    \
{                                                   \
    Record.Category                = Cat;           \
    Record.SubCategory             = 0;             \
    Record.Severity                = Sev;           \
    Record.TitleMessageNumber      = TitleMsg;      \
    Record.cTitleMessageInserts    = 0;             \
    Record.TitleMessageInserts     = NULL;          \
    Record.TitleText               = NULL;          \
    Record.DescrMessageNumber      = DescrMsg;      \
    Record.cDescrMessageInserts    = 0;             \
    Record.DescrMessageInserts     = NULL;          \
    Record.SourceDescription       = SrcName;       \
    Record.ComponentID             = CompID;        \
    Record.ReportClassID           = NULL;          \
    Record.TakeActionDLL           = NULL;          \
    Record.cBytesAlertData         = 0;             \
    Record.AlertData               = NULL;          \
    Record.cAdditionalArguments    = 0;             \
    Record.AdditionalArgumentNames = NULL;          \
    Record.AdditionalArguments     = NULL;          \
}


typedef IAlertTarget *  LPALERTTARGET;


//
// Public API
//

//+---------------------------------------------------------------------------
//
// API:         ReportAlert
//
// Description: Raise an alert to the local computer distributor object
//              and/or log the alert in the local system log.
//
// Arguments:   [palrepRecord] -- ALERTREPORTRECORD alert data.
//              [fdwAction]    -- ReportAlert action (defined below).
//
// Returns:     S_OK
//              HRESULT error
//
//----------------------------------------------------------------------------

//
// ReportAlert modes.
//

#define RA_REPORT                       0x00000001
#define RA_LOG                          0x00000002
#define RA_REPORT_AND_LOG               0x00000003

STDAPI ReportAlert(
                    PCALERTREPORTRECORD palrepRecord,
                    DWORD               fdwAction);


//+---------------------------------------------------------------------------
//
// API:         ReportAlertToTarget
//
// Description: Raise an alert to the alert target indicated.
//
// Arguments:   [patTarget]    -- Target instance (must be non-NULL).
//              [palrepRecord] -- ALERTREPORTRECORD alert data.
//
// Returns:     S_OK
//              HRESULT error
//
//----------------------------------------------------------------------------

STDAPI ReportAlertToTarget(
                    LPALERTTARGET       patTarget,
                    PCALERTREPORTRECORD palrepRecord);


//+---------------------------------------------------------------------------
//
// API:         MarshalReport
//
// Description: Marshals the DISPPARAM alert report data into a buffer
//              suitable for report delivery via the IAlertTarget interface.
//
// Arguments:   [pdparams]      -- DISPPARAMS alert data.
//              [ppbReport]     -- Return marshal buffer.
//              [pcbReportSize] -- Return marshal buffer size.
//
// Returns:     S_OK
//              HRESULT error
//
//----------------------------------------------------------------------------

STDAPI MarshalReport(
                    const LPDISPPARAMS  pdparams,
                    PBYTE *             ppbReport,
                    PULONG              pcbReportSize);


//+---------------------------------------------------------------------------
//
// API:         UnMarshalReport
//
// Description: The converse of MarshalReport. Un-marshals the buffer
//              (marshalled alert data) into a DISPPARAMS structure.
//
// Arguments:   [cbReportSize] -- Marshalled report size.
//              [ppbReport]    -- Marshalled report.
//              [pdparams]     -- Returned DISPPARAMS alert data.
//
// Returns:     S_OK
//              HRESULT error
//
//----------------------------------------------------------------------------

STDAPI UnMarshalReport(
                    ULONG               cbReportSize,
                    const PBYTE         pbReport,
                    LPDISPPARAMS        pdparams);


//
// Non-Public API [as yet]
//

STDAPI CreateAlertDistributorObject(
                    const PWCHAR        pwszAlertDistr);

STDAPI Register(
                    LPDISPATCH          pdispAlertDistr,
                    LPMONIKER           pmkAlertTarget,
                    SHORT               sCategory,
                    SHORT               sSeverity,
                    PLONG               plRegistrationID);

STDAPI RegisterEx(
                    LPDISPATCH          pdispAlertDistr,
                    LPMONIKER           pmkAlertTarget,
                    SHORT               cCount,
                    SHORT               asCategory[],
                    SHORT               asSeverity[],
                    PLONG               plRegistrationID);

STDAPI AsLogAlertInSystemLog(
                    ULONG               cbReportSize,
                    const PBYTE         pbReport);

#endif // __ALERTAPI_H__