ReactOS  0.4.15-dev-3291-gea4c1a0
vfprivum.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 
5 Module Name:
6 
7  vfpriv.hpp
8 
9 Abstract:
10 
11  common header file for verifier
12 
13 Author:
14 
15 
16 Environment:
17 
18  User mode only
19 
20 Revision History:
21 
22 --*/
23 
24 #pragma once
25 
26 #include "fxmin.hpp"
27 
29 VOID
32  __in WDFREQUEST Handle,
33  __inout FxRequest** ppReq,
34  __inout GUID* pActivityId
35  )
36 {
38  Handle,
40  (PVOID *) ppReq);
41 
42  if ((*ppReq)->GetFxIrp()->GetIoIrp()->IsActivityIdSet() == FALSE) {
44  (*ppReq)->GetFxIrp()->GetIoIrp()->SetActivityId(pActivityId);
45  }
46  else {
47  *pActivityId = *(*ppReq)->GetFxIrp()->GetIoIrp()->GetActivityId();
48  }
49 }
50 
52 BOOLEAN
54  __in WDFREQUEST Handle
55 )
56 {
57  FxRequest* pReq;
58  GUID activityId = { 0 };
60 
64 
65  if(status) {
68  &activityId);
69 
70  UCHAR Type = pReq->GetFxIrp()->GetMajorFunction();
71  WDFDEVICE Device = pReq->GetCurrentQueue()->GetDevice()->GetHandle();
72  EVENT_DATA_DESCRIPTOR EventData[3];
73  EventDataDescCreate(&EventData[0], &Type, sizeof(const UCHAR));
74  EventDataDescCreate(&EventData[1], &pDriverDeviceAdd, sizeof(PVOID));
75  EventDataDescCreate(&EventData[2], &Device, sizeof(PVOID));
76 
77  EventWriteTransfer(Microsoft_Windows_DriverFrameworks_UserMode_PerformanceHandle,
78  &FX_REQUEST_START,
79  &activityId,
80  NULL,
81  3,
82  &EventData[0]);
83  }
84  return status;
85 }
86 
88 BOOLEAN
90  __in WDFREQUEST Handle
91 )
92 {
93  FxRequest* pReq;
94  GUID activityId = { 0 };
96 
100 
101  if(status) {
104  &activityId);
105 
106  UCHAR Type = pReq->GetFxIrp()->GetMajorFunction();
107  WDFDEVICE Device = pReq->GetCurrentQueue()->GetDevice()->GetHandle();
108  EVENT_DATA_DESCRIPTOR EventData[3];
109  EventDataDescCreate(&EventData[0], &Type, sizeof(const UCHAR));
110  EventDataDescCreate(&EventData[1], &pDriverDeviceAdd, sizeof(PVOID));
111  EventDataDescCreate(&EventData[2], &Device, sizeof(PVOID));
112 
113  EventWriteTransfer(Microsoft_Windows_DriverFrameworks_UserMode_PerformanceHandle,
114  &FX_REQUEST_COMPLETE,
115  &activityId,
116  NULL,
117  3,
118  &EventData[0]);
119  }
120  return status;
121 }
122 
123 __inline
124 BOOLEAN
127  __in GUID* pActivityId,
128  __in WDFDEVICE Handle
129 )
130 {
135 
136  if(status) {
138 
139  EVENT_DATA_DESCRIPTOR EventData[2];
140  EventDataDescCreate(&EventData[0], &pDriverDeviceAdd, sizeof(PVOID));
141  EventDataDescCreate(&EventData[1], &Handle, sizeof(PVOID));
142 
143  EventWriteTransfer(Microsoft_Windows_DriverFrameworks_UserMode_PerformanceHandle,
145  pActivityId,
146  NULL,
147  2,
148  &EventData[0]);
149  }
150 
151  return status;
152 }
153 
154 __inline
155 BOOLEAN
157  __in WDFDEVICE Handle,
158  __inout GUID* pActivityId
159 )
160 {
162  return PerformanceAnalysisPowerProcess(&FX_POWER_D0_ENTRY_START, pActivityId, Handle);
163 }
164 
165 __inline
166 VOID
168  __in WDFDEVICE Handle,
169  __in GUID* pActivityId
170 )
171 {
172  PerformanceAnalysisPowerProcess(&FX_POWER_D0_ENTRY_STOP, pActivityId, Handle);
173 }
174 
175 __inline
176 BOOLEAN
178  __in WDFDEVICE Handle,
179  __inout GUID* pActivityId
180 )
181 {
183  return PerformanceAnalysisPowerProcess(&FX_POWER_D0_EXIT_START, pActivityId, Handle);
184 }
185 
186 __inline
187 VOID
189  __in WDFDEVICE Handle,
190  __in GUID* pActivityId
191 )
192 {
193  PerformanceAnalysisPowerProcess(&FX_POWER_D0_EXIT_STOP, pActivityId, Handle);
194 }
195 
196 __inline
197 BOOLEAN
199  __in WDFDEVICE Handle,
200  __inout GUID* pActivityId
201 )
202 {
204  return PerformanceAnalysisPowerProcess(&FX_POWER_HW_PREPARE_START, pActivityId, Handle);
205 }
206 
207 __inline
208 VOID
210  __in WDFDEVICE Handle,
211  __in GUID* pActivityId
212 )
213 {
214  PerformanceAnalysisPowerProcess(&FX_POWER_HW_PREPARE_STOP, pActivityId, Handle);
215 }
216 
217 __inline
218 BOOLEAN
220  __in WDFDEVICE Handle,
221  __inout GUID* pActivityId
222 )
223 {
225  return PerformanceAnalysisPowerProcess(&FX_POWER_HW_RELEASE_START, pActivityId, Handle);
226 }
227 
228 __inline
229 VOID
231  __in WDFDEVICE Handle,
232  __in GUID* pActivityId
233 )
234 {
235  PerformanceAnalysisPowerProcess(&FX_POWER_HW_RELEASE_STOP, pActivityId, Handle);
236 }
237 
238 // EvtIoStop callback started.
239 __inline
240 BOOLEAN
242  __in WDFQUEUE Queue,
243  __inout GUID* pActivityId
244 )
245 {
246  FxIoQueue* pQueue;
248  WDFDEVICE device;
249 
252 
254  Queue,
256  (PVOID*) &pQueue);
257  device = (WDFDEVICE) pQueue->GetDevice()->GetHandle();
258 
260  return PerformanceAnalysisPowerProcess(&FX_EVTIOSTOP_START, pActivityId, device);
261 }
262 
263 // EvtIoStop callback returned.
264 __inline
265 VOID
267  __in WDFQUEUE Queue,
268  __in GUID* pActivityId
269 )
270 {
271  FxIoQueue* pQueue;
273  WDFDEVICE device;
274 
277 
279  Queue,
281  (PVOID*) &pQueue);
282  device = (WDFDEVICE) pQueue->GetDevice()->GetHandle();
283 
284  PerformanceAnalysisPowerProcess(&FX_EVTIOSTOP_STOP, pActivityId, device);
285 }
286 
287 __inline
288 VOID
290  __out KIRQL *Irql
291  )
292 {
293  DO_NOTHING();
294 }
295 
296 __inline
297 VOID
300  __in KIRQL PrevIrql
301  )
302 {
303  DO_NOTHING();
304 }
305 
306 __inline
307 VOID
309  __out BOOLEAN *CritRegion
310  )
311 {
312  DO_NOTHING();
313 }
314 
315 __inline
316 VOID
319  __in BOOLEAN OldCritRegion,
320  __in PVOID Pfn
321  )
322 {
323  DO_NOTHING();
324 }
325 
__inline VOID PerfEvtDeviceD0ExitStop(__in WDFDEVICE Handle, __in GUID *pActivityId)
Definition: vfprivum.hpp:188
FxObject * pObject
__inline BOOLEAN PerfEvtDeviceD0ExitStart(__in WDFDEVICE Handle, __inout GUID *pActivityId)
Definition: vfprivum.hpp:177
FxIoQueue * pQueue
__inline BOOLEAN PerfEvtDeviceD0EntryStart(__in WDFDEVICE Handle, __inout GUID *pActivityId)
Definition: vfprivum.hpp:156
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
__inline VOID PerfEvtDeviceReleaseHardwareStop(__in WDFDEVICE Handle, __in GUID *pActivityId)
Definition: vfprivum.hpp:230
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2221
__inline VOID VerifyIrqlExit(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in KIRQL PrevIrql)
Definition: vfprivum.hpp:298
EVT_WDF_DRIVER_DEVICE_ADD * PFN_WDF_DRIVER_DEVICE_ADD
Definition: wdfdriver.h:78
_Must_inspect_result_ FxIoQueue * GetCurrentQueue(VOID)
Definition: fxrequest.hpp:728
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
DriverGlobals
FORCEINLINE BOOLEAN PerfIoComplete(__in WDFREQUEST Handle)
Definition: vfprivum.hpp:89
#define EVENT_ACTIVITY_CTRL_CREATE_ID
Definition: evntprov.h:44
_Out_ PKIRQL Irql
Definition: csq.h:179
FxDevice * device
__inline VOID PerfEvtIoStopStop(__in WDFQUEUE Queue, __in GUID *pActivityId)
Definition: vfprivum.hpp:266
__inline BOOLEAN PerformanceAnalysisPowerProcess(__in PCEVENT_DESCRIPTOR EventDescriptor, __in GUID *pActivityId, __in WDFDEVICE Handle)
Definition: vfprivum.hpp:125
UCHAR KIRQL
Definition: env_spec_w32.h:591
__inline VOID VerifyCriticalRegionExit(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in BOOLEAN OldCritRegion, __in PVOID Pfn)
Definition: vfprivum.hpp:317
#define FALSE
Definition: types.h:117
Definition: devices.h:37
FxDriver * Driver
Definition: fxglobals.h:374
#define __out
Definition: dbghelp.h:62
unsigned char BOOLEAN
USHORT WDFOBJECT_OFFSET
Definition: fxobject.hpp:80
__inline VOID VerifyCriticalRegionEntry(__out BOOLEAN *CritRegion)
Definition: vfprivum.hpp:308
__inline BOOLEAN PerfEvtDevicePrepareHardwareStart(__in WDFDEVICE Handle, __inout GUID *pActivityId)
Definition: vfprivum.hpp:198
PFX_DRIVER_GLOBALS pFxDriverGlobals
__inline BOOLEAN PerfEvtDeviceReleaseHardwareStart(__in WDFDEVICE Handle, __inout GUID *pActivityId)
Definition: vfprivum.hpp:219
__inline VOID PerfEvtDevicePrepareHardwareStop(__in WDFDEVICE Handle, __in GUID *pActivityId)
Definition: vfprivum.hpp:209
GLintptr offset
Definition: glext.h:5920
Type
Definition: Type.h:6
ULONG EVNTAPI EventActivityIdControl(_In_ ULONG ControlCode, _Inout_ LPGUID ActivityId)
ULONG EVNTAPI EventWriteTransfer(_In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_opt_ LPCGUID ActivityId, _In_opt_ LPCGUID RelatedActivityId, _In_ ULONG UserDataCount, _In_reads_opt_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData)
unsigned char UCHAR
Definition: xmlstorage.h:181
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
#define __inout
Definition: dbghelp.h:50
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
FORCEINLINE VOID PerformanceAnalysisIOProcess(__in PFX_DRIVER_GLOBALS pFxDriverGlobals, __in WDFREQUEST Handle, __inout FxRequest **ppReq, __inout GUID *pActivityId)
Definition: vfprivum.hpp:30
_In_ PCEVENT_DESCRIPTOR EventDescriptor
Definition: wmifuncs.h:93
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
__inline VOID PerfEvtDeviceD0EntryStop(__in WDFDEVICE Handle, __in GUID *pActivityId)
Definition: vfprivum.hpp:167
#define FORCEINLINE
Definition: wdftypes.h:67
#define NULL
Definition: types.h:112
static FxObject * _GetObjectFromHandle(__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
Definition: fxobject.hpp:613
__inline VOID VerifyIrqlEntry(__out KIRQL *Irql)
Definition: vfprivum.hpp:289
__inline CfxDevice * GetDevice(VOID)
Definition: fxioqueue.hpp:773
__inline BOOLEAN PerfEvtIoStopStart(__in WDFQUEUE Queue, __inout GUID *pActivityId)
Definition: vfprivum.hpp:241
_In_ HANDLE Handle
Definition: extypes.h:390
FORCEINLINE BOOLEAN PerfIoStart(__in WDFREQUEST Handle)
Definition: vfprivum.hpp:53
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
#define __in
Definition: dbghelp.h:35
__inline PFN_WDF_DRIVER_DEVICE_ADD GetDriverDeviceAddMethod()
Definition: fxdriver.hpp:362
static SERVICE_STATUS status
Definition: service.c:31
FORCEINLINE VOID EventDataDescCreate(_Out_ PEVENT_DATA_DESCRIPTOR EventDataDescriptor, _In_reads_bytes_(DataSize) const VOID *DataPtr, _In_ ULONG DataSize)
Definition: evntprov.h:180
#define DO_NOTHING()
Definition: mxgeneral.h:32
__inline BOOLEAN IsFxPerformanceAnalysis(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: fxverifier.h:250
Definition: ps.c:97