27#include "fxsupportpch.hpp"
31#include <telemetry\microsofttelemetry.h>
34#if defined(EVENT_TRACING)
35#include "FxTelemetryKm.tmh"
42 (0xec044b58, 0x3d13, 0x4880, 0x93, 0x6f, 0x7b, 0x67, 0xdf, 0xb3, 0xe0, 0x56),
43 TraceLoggingOptionMicrosoftTelemetry());
79 TraceLoggingRegister(g_TelemetryProvider);
87 TraceLoggingUnregister(g_TelemetryProvider);
156 "lastlogged %I64x, current %I64x, delta %I64x",
177 FxAutoString hardwareIDs, setupClass, busEnum, manufacturer;
252 curr = (
PWCHAR) HardwareIds->Buffer;
253 lengthCch = (HardwareIds->Length)/
sizeof(
WCHAR);
267 HardwareIds->Length = 0;
268 HardwareIds->MaximumLength = HardwareIds->Length +
sizeof(
UNICODE_NULL);
272 for (
int i = 0;
i < lengthCch;
i++, curr++) {
280 HardwareIds->MaximumLength = HardwareIds->Length +
sizeof(
UNICODE_NULL);
307 pnpPkg =
Fdo->m_PkgPnp;
308 devInfo =
Fdo->GetDeviceTelemetryInfoFlags();
311 DriverInfo->bitmap.IsUsingRemoveLockOption =
Fdo->IsRemoveLockEnabledForIo();
345 LastLoggedTime->QuadPart = 0;
353 "Unable to open driver's service key, status %!STATUS!",
status);
363 "Unable to open driver's service parameters key, status %!STATUS!",
369 status = FxRegKey::_QueryQuadWord(
376 LastLoggedTime->QuadPart =
value.QuadPart;
406 "Unable to open driver's service key, status %!STATUS!",
status);
420 "Unable to write Parameters key, status %!STATUS!",
status);
431 "Unable to write Parameters key, status %!STATUS!",
status);
443 &wdfTimeOfLastTelemetryLog,
452 "Failed to record current time for Telemetry log, status %!STATUS!",
473 pdo =
Fdo->GetSafePhysicalDevice();
477 "Could not get PDO from FDO WDFDEVICE 0x%p, %!STATUS!",
485 "Could not retrieve property %d length %d, %!STATUS!",
494 "Could not allocate memory for property %d length %d, %!STATUS!",
502 "Could not query for full buffer, size %d, for "
503 "property %d, %!STATUS!",
563 "Unable to open driver's service key, status %!STATUS!",
status);
573 "Failed to get Image name from service key, status %!STATUS!",
586 if (imageName.
Length == 0x0) {
589 "ERROR: GetNameFromPath could not find a name, status 0x%x\n",
603 "ERROR: size computation failed with Status 0x%x\n",
status);
615 "ERROR: ExAllocatePoolWithTag failed with Status 0x%x\n",
status);
712 if (
info->DataLength == 0 ||
713 (
info->DataLength % 2) != 0 ||
static __inline NTSTATUS _GetDeviceProperty(_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)
BOOLEAN IsSxWakeEnabled(VOID)
BOOLEAN HasMultipleInterrupts(VOID)
BOOLEAN IsS0IdleSystemManaged(VOID)
BOOLEAN IsPowerPolicyOwner(VOID)
BOOLEAN IsDefaultReleaseHardwareOrder(VOID)
BOOLEAN IsS0IdleUsbSSEnabled(VOID)
BOOLEAN IsS0IdleWakeFromS0Enabled(VOID)
static __inline VOID MxFreePool(__in PVOID Ptr)
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
static __inline NTSTATUS MxSetValueKey(_In_ HANDLE KeyHandle, _In_ PUNICODE_STRING ValueName, _In_opt_ ULONG TitleIndex, _In_ ULONG Type, _In_opt_ PVOID Data, _In_ ULONG DataSize)
static __inline NTSTATUS MxQueryValueKey(_In_ HANDLE KeyHandle, _In_ PUNICODE_STRING ValueName, _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, _Out_opt_ PVOID KeyValueInformation, _In_ ULONG Length, _Out_ PULONG ResultLength)
static __inline VOID MxQuerySystemTime(_Out_ PLARGE_INTEGER CurrentTime)
#define NT_SUCCESS(StatCode)
static void cleanup(void)
#define __drv_maxIRQL(irql)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
struct _FX_TELEMETRY_CONTEXT * PFX_TELEMETRY_CONTEXT
#define FLAG_TO_BOOL(_Flags, _FlagMask)
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
#define MIN_HOURS_BEFORE_NEXT_LOG
BOOLEAN __inline IsDeviceInfoFlagSet(_In_ USHORT DeviceInfo, _In_ FxDeviceInfoFlags Flag)
VOID GetNameFromPath(_In_ PCUNICODE_STRING Path, _Out_ PUNICODE_STRING Name)
VOID __inline BuildStringFromPartialInfo(_In_ PKEY_VALUE_PARTIAL_INFORMATION Info, _Out_ PUNICODE_STRING String)
#define WDF_LAST_TELEMETRY_LOG_TIME_VALUE
#define FX_TELEMETRY_ENABLED(TraceHandle, Globals)
@ DeviceInfoHasStaticChildren
@ DeviceInfoLineBasedEdgeTriggeredInterrupt
@ DeviceInfoMsi22MultiMessageInterrupt
@ DeviceInfoMsiXOrSingleMsi22Interrupt
@ DeviceInfoLineBasedLevelTriggeredInterrupt
@ DeviceInfoDmaSystemDuplex
@ DeviceInfoHasDynamicChildren
@ DeviceInfoPassiveLevelInterrupt
#define KMDF_FX_TRACE_LOGGING_PROVIDER_NAME
VOID RegisterTelemetryProvider(VOID)
VOID UnregisterTelemetryProvider(VOID)
VOID LogDeviceStartTelemetryEvent(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ FxDevice *Fdo)
TRACELOGGING_DEFINE_PROVIDER(g_TelemetryProvider, KMDF_FX_TRACE_LOGGING_PROVIDER_NAME,(0xec044b58, 0x3d13, 0x4880, 0x93, 0x6f, 0x7b, 0x67, 0xdf, 0xb3, 0xe0, 0x56), TraceLoggingOptionMicrosoftTelemetry())
VOID GetDriverInfo(_In_ PFX_DRIVER_GLOBALS Globals, _In_opt_ FxDevice *Fdo, _Out_ FxTelemetryDriverInfo *DriverInfo)
VOID RegistryReadLastLoggedTime(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _Out_ PLARGE_INTEGER LastLoggedTime)
_Must_inspect_result_ NTSTATUS GetImageName(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _Out_ PUNICODE_STRING ImageName)
VOID FxGetDevicePropertyString(_In_ FxDevice *Fdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _Out_ PUNICODE_STRING PropertyString)
VOID LogDriverInfoStream(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ FxDevice *Fdo)
VOID AllocAndInitializeTelemetryContext(_In_ PFX_TELEMETRY_CONTEXT *TelemetryContext)
VOID RegistryWriteCurrentTime(_In_ PFX_DRIVER_GLOBALS DriverGlobals)
VOID GetFirstHardwareId(_Inout_ PUNICODE_STRING HardwareIds)
BOOLEAN IsLoggingEnabledAndNeeded(_In_ PFX_DRIVER_GLOBALS DriverGlobals)
_Must_inspect_result_ _In_ PFX_DRIVER_GLOBALS Globals
#define KMDF_CENSUS_EVT_WRITE_DEVICE_START(TraceHandle, Globals, DriverConfig, SetupClass, BusEnum, HwID, Manafacturer)
@ FxEnhancedVerifierFunctionTableHookMask
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define InterlockedBitTestAndSet
NTKERNELAPI NTSTATUS ExUuidCreate(OUT UUID *Uuid)
static const char * ImageName
#define _Must_inspect_result_
DRIVER_INFORMATION DriverInfo
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
#define STATUS_OBJECT_TYPE_MISMATCH
#define STATUS_BUFFER_TOO_SMALL
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
UNICODE_STRING m_UnicodeString
ULONG FxEnhancedVerifierOptions
#define FIELD_OFFSET(t, f)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
FORCEINLINE LONGLONG WDF_ABS_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
@ WdfDriverInitNonPnpDriver
@ WdfDriverInitNoDispatchOverride
_Must_inspect_result_ _In_ WDFDEVICE Fdo
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
@ DevicePropertyEnumeratorName
@ DevicePropertyManufacturer
@ DevicePropertyClassName
@ DevicePropertyHardwareID