ReactOS  0.4.15-dev-3187-ge372f2b
fxtelemetrykm.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxTelemetryKm.hpp
8 
9 Abstract:
10 
11  This is header file for telemetry methods.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Kernel mode only
20 
21 Revision History:
22 
23 Notes:
24 
25 --*/
26 
27 #pragma once
28 
29 #include "fxldr.h"
30 
31 #if defined(__cplusplus)
32 extern "C" {
33 #endif
34 
35 //
36 // Event name: KmdfCensusEvtDeviceStart
37 //
38 // Source: KMDF only
39 //
40 // Description: Written when a FDO completes start successfully.
41 //
42 // Frequency: If FX_TELEMETRY_ENABLED, once per driver session. This is tracked using the
43 // DoOnceFlag in the telemetry context. Also not to exceed
44 // once in 24 hours (last write time stored in registry).
45 //
46 //
47 #define KMDF_CENSUS_EVT_WRITE_DEVICE_START(TraceHandle , Globals, DriverConfig, SetupClass, BusEnum, HwID, Manafacturer) \
48  TraceLoggingWrite(TraceHandle, \
49  "KmdfCensusEvtDeviceStart", \
50  WDF_TELEMETRY_EVT_KEYWORDS, \
51  WDF_CENSUS_EVT_DATA_COMMON(Globals), \
52  TraceLoggingString((Globals)->Public.DriverName, "DriverServiceName"), \
53  TraceLoggingKmdfDriverConfigInfo(DriverConfig, "DriverConfigInfo"), \
54  TraceLoggingWideString(SetupClass.m_UnicodeString.Buffer, "SetupClass"), \
55  TraceLoggingWideString(BusEnum.m_UnicodeString.Buffer, "BusEnumerator"), \
56  TraceLoggingWideString(HwID.m_UnicodeString.Buffer, "HardwareId"), \
57  TraceLoggingWideString(Manafacturer.m_UnicodeString.Buffer, "ManufacturerString") \
58  );
59 
60 //
61 // This is part of the data for KmdfCensusEvtDeviceStart event.
62 //
63 #define TraceLoggingKmdfDriverConfigInfo(info, fieldName) \
64  \
65  TraceLoggingStruct(23, fieldName), \
66  \
67  TraceLoggingUInt8(info.bitmap.IsNonPnpDriver, "IsNonPnpDriver" ), \
68  TraceLoggingUInt8(info.bitmap.IsNoDispatchOverride, "IsNoDispatchOverride" ), \
69  TraceLoggingUInt8(info.bitmap.IsVerifierOn, "IsVerifierOn" ), \
70  TraceLoggingUInt8(info.bitmap.IsEnhancedVerifierOn, "IsEnhancedVerifierOn" ), \
71  TraceLoggingUInt8(info.bitmap.IsFilter, "IsFilter" ), \
72  \
73  TraceLoggingUInt8(info.bitmap.IsUsingRemoveLockOption, "IsUsingRemoveLockOption" ), \
74  TraceLoggingUInt8(info.bitmap.IsUsingNonDefaultHardwareReleaseOrder, "IsUsingNonDefaultHardwareReleaseOrder" ), \
75  TraceLoggingUInt8(info.bitmap.IsPowerPolicyOwner, "IsPowerPolicyOwner" ), \
76  TraceLoggingUInt8(info.bitmap.IsS0IdleWakeFromS0Enabled, "IsS0IdleWakeFromS0Enabled" ), \
77  TraceLoggingUInt8(info.bitmap.IsS0IdleUsbSSEnabled, "IsS0IdleUsbSSEnabled" ), \
78  \
79  TraceLoggingUInt8(info.bitmap.IsS0IdleSystemManaged, "IsS0IdleSystemManaged" ), \
80  TraceLoggingUInt8(info.bitmap.IsSxWakeEnabled, "IsSxWakeEnabled" ), \
81  TraceLoggingUInt8(info.bitmap.IsUsingLevelTriggeredLineInterrupt, "IsUsingLevelTriggeredLineInterrupt" ), \
82  TraceLoggingUInt8(info.bitmap.IsUsingEdgeTriggeredLineInterrupt, "IsUsingEdgeTriggeredLineInterrupt" ), \
83  TraceLoggingUInt8(info.bitmap.IsUsingMsiXOrSingleMsi22Interrupt, "IsUsingMsiXOrSingleMsi22Interrupt" ), \
84  \
85  TraceLoggingUInt8(info.bitmap.IsUsingMsi22MultiMessageInterrupt, "IsUsingMsi22MultiMessageInterrupt" ), \
86  TraceLoggingUInt8(info.bitmap.IsUsingMultipleInterrupt, "IsUsingMultipleInterrupt" ), \
87  TraceLoggingUInt8(info.bitmap.IsUsingPassiveLevelInterrupt, "IsUsingPassiveLevelInterrupt" ), \
88  TraceLoggingUInt8(info.bitmap.IsUsingBusMasterDma, "IsUsingBusMasterDma" ), \
89  TraceLoggingUInt8(info.bitmap.IsUsingSystemDma, "IsUsingSystemDma" ), \
90  \
91  TraceLoggingUInt8(info.bitmap.IsUsingSystemDmaDuplex, "IsUsingSystemDmaDuplex" ), \
92  TraceLoggingUInt8(info.bitmap.IsUsingStaticBusEnumration, "IsUsingStaticBusEnumration" ), \
93  TraceLoggingUInt8(info.bitmap.IsUsingDynamicBusEnumeration, "IsUsingDynamicBusEnumeration" ) \
94 
95 //
96 // When changing the structure, do update TraceLoggingKmdfDriverConfigInfo
97 // for fields name and TraceLoggingStruct(count) as well. It is good to keep
98 // fields order the same but it is not required.
99 //
101  struct {
125  } bitmap;
127 };
128 
129 
130 VOID
133  );
134 
135 VOID
138  _Out_ PLARGE_INTEGER CurrentTime
139  );
140 
141 NTSTATUS
143  _In_ FxDevice* Fdo,
144  _Out_ PUNICODE_STRING HwIds,
145  _Out_ PUNICODE_STRING SetupClass
146  );
147 
148 BOOLEAN
151  );
152 
154 NTSTATUS
157  _In_ HANDLE Key,
159  _In_ ULONG Tag,
161  );
162 
163 VOID
168  );
169 
170 VOID
172  _In_ FxDevice* Fdo,
174  _Out_ PUNICODE_STRING PropertyString
175  );
176 
177 VOID
179  _Inout_ PUNICODE_STRING HardwareIds
180  );
181 
184 NTSTATUS
185 QueryAndAllocString(
186  _In_ HANDLE Key,
190  );
191 
192 
193 #if defined(__cplusplus)
194 }
195 #endif
196 
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
DWORD IsUsingNonDefaultHardwareReleaseOrder
#define _In_opt_
Definition: ms_sal.h:309
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
VOID RegistryReadLastLoggedTime(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _Out_ PLARGE_INTEGER CurrentTime)
LONG NTSTATUS
Definition: precomp.h:26
VOID RegistryWriteCurrentTime(_In_ PFX_DRIVER_GLOBALS DriverGlobals)
DriverGlobals
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
DWORD IsUsingLevelTriggeredLineInterrupt
NTSTATUS GetHardwareIdAndSetupclassFromRegistry(_In_ FxDevice *Fdo, _Out_ PUNICODE_STRING HwIds, _Out_ PUNICODE_STRING SetupClass)
unsigned char BOOLEAN
VOID GetFirstHardwareId(_Inout_ PUNICODE_STRING HardwareIds)
#define _In_
Definition: ms_sal.h:308
_Must_inspect_result_ __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS QueryAndAllocString(_In_ HANDLE Key
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOLEAN IsLoggingEnabledAndNeeded(_In_ PFX_DRIVER_GLOBALS DriverGlobals)
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
struct FxTelemetryDriverInfo::@4586 bitmap
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
_Must_inspect_result_ NTSTATUS FxQueryData(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ HANDLE Key, _In_ PCUNICODE_STRING ValueName, _In_ ULONG Tag, _Out_ PKEY_VALUE_PARTIAL_INFORMATION *Info)
VOID FxGetDevicePropertyString(_In_ FxDevice *Fdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _Out_ PUNICODE_STRING PropertyString)
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ PFX_DRIVER_GLOBALS Globals
VOID GetDriverInfo(_In_ PFX_DRIVER_GLOBALS Globals, _In_opt_ FxDevice *Fdo, _Out_ FxTelemetryDriverInfo *DriverInfo)