| 1 |
`**********************************************************************` |
| 2 |
`* This is an include template file for the tracewpp preprocessor. *` |
| 3 |
`* *` |
| 4 |
`* Copyright (c) Microsoft Corporation. All rights reserved. *` |
| 5 |
`**********************************************************************` |
| 6 |
// template `TemplateFile` |
| 7 |
|
| 8 |
// |
| 9 |
// Defines a set of functions that simplifies |
| 10 |
// kernel mode registration for tracing |
| 11 |
// |
| 12 |
|
| 13 |
#ifdef __cplusplus |
| 14 |
extern "C" { |
| 15 |
#endif |
| 16 |
|
| 17 |
#ifndef WPPINIT_EXPORT |
| 18 |
#define WPPINIT_EXPORT |
| 19 |
#endif |
| 20 |
|
| 21 |
#ifndef WppDebug |
| 22 |
#define WppDebug(a,b) |
| 23 |
#endif |
| 24 |
|
| 25 |
WPPINIT_EXPORT |
| 26 |
NTSTATUS |
| 27 |
WppTraceCallback( |
| 28 |
_In_ UCHAR MinorFunction, |
| 29 |
_In_opt_ PVOID DataPath, |
| 30 |
_In_ ULONG BufferLength, |
| 31 |
_Inout_updates_bytes_(BufferLength) PVOID Buffer, |
| 32 |
_Inout_ PVOID Context, |
| 33 |
_Out_ PULONG Size |
| 34 |
); |
| 35 |
|
| 36 |
WPPINIT_EXPORT |
| 37 |
VOID |
| 38 |
WppInitKm( |
| 39 |
_In_opt_ PVOID DriverObject, |
| 40 |
_In_ PVOID InitInfo |
| 41 |
); |
| 42 |
|
| 43 |
#ifdef ALLOC_PRAGMA |
| 44 |
#pragma alloc_text( PAGE, WppTraceCallback) |
| 45 |
#pragma alloc_text( PAGE, WppInitKm) |
| 46 |
#pragma alloc_text( PAGE, WppCleanupKm) |
| 47 |
#endif // ALLOC_PRAGMA |
| 48 |
|
| 49 |
// define annotation record that will carry control information to pdb (in case somebody needs it) |
| 50 |
WPP_FORCEINLINE void WPP_CONTROL_ANNOTATION() { |
| 51 |
#if !defined(WPP_NO_ANNOTATIONS) |
| 52 |
|
| 53 |
#ifndef WPP_TMC_ANNOT_SUFIX |
| 54 |
#ifdef WPP_PUBLIC_TMC |
| 55 |
#define WPP_TMC_ANNOT_SUFIX ,L"PUBLIC_TMF:" |
| 56 |
#else |
| 57 |
#define WPP_TMC_ANNOT_SUFIX |
| 58 |
#endif |
| 59 |
#endif |
| 60 |
|
| 61 |
# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation(L"TMC:", WPP_GUID_WTEXT Guid, _WPPW(WPP_STRINGIZE(Name)) Bits WPP_TMC_ANNOT_SUFIX); |
| 62 |
# define WPP_DEFINE_BIT(Name) , _WPPW(#Name) |
| 63 |
WPP_CONTROL_GUIDS |
| 64 |
# undef WPP_DEFINE_BIT |
| 65 |
# undef WPP_DEFINE_CONTROL_GUID |
| 66 |
#endif |
| 67 |
} |
| 68 |
|
| 69 |
#define WPP_NEXT(Name) ((WPP_TRACE_CONTROL_BLOCK*) \ |
| 70 |
(WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1 == WPP_LAST_CTL ? 0:WPP_MAIN_CB + WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1)) |
| 71 |
|
| 72 |
WPP_CB_TYPE WPP_MAIN_CB[WPP_LAST_CTL]; |
| 73 |
|
| 74 |
__inline void WPP_INIT_CONTROL_ARRAY(WPP_CB_TYPE* Arr) { |
| 75 |
#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ |
| 76 |
Arr->Control.Callback = NULL; \ |
| 77 |
Arr->Control.ControlGuid = WPP_XGLUE4(&WPP_, ThisDir, _CTLGUID_, WPP_EVAL(Name)); \ |
| 78 |
Arr->Control.Next = WPP_NEXT(WPP_EVAL(Name)); \ |
| 79 |
Arr->Control.RegistryPath= NULL; \ |
| 80 |
Arr->Control.FlagsLen = WPP_FLAG_LEN; \ |
| 81 |
Arr->Control.Level = 0; \ |
| 82 |
Arr->Control.Reserved = 0; \ |
| 83 |
Arr->Control.Flags[0] = 0; \ |
| 84 |
++Arr; |
| 85 |
#define WPP_DEFINE_BIT(BitName) L" " L ## #BitName |
| 86 |
WPP_CONTROL_GUIDS |
| 87 |
#undef WPP_DEFINE_BIT |
| 88 |
#undef WPP_DEFINE_CONTROL_GUID |
| 89 |
} |
| 90 |
|
| 91 |
#undef WPP_INIT_STATIC_DATA |
| 92 |
#define WPP_INIT_STATIC_DATA WPP_INIT_CONTROL_ARRAY(WPP_MAIN_CB) |
| 93 |
|
| 94 |
// define WPP_INIT_TRACING. For performance reasons turn off during |
| 95 |
// static analysis compilation with Static Driver Verifier (SDV). |
| 96 |
#ifndef _SDV_ |
| 97 |
#define WPP_INIT_TRACING(DriverObject, RegPath, InitInfo) \ |
| 98 |
{ \ |
| 99 |
WppDebug(0,("WPP_INIT_TRACING: &WPP_CB[0] %p\n", &WPP_MAIN_CB[0])); \ |
| 100 |
WPP_INIT_STATIC_DATA; \ |
| 101 |
( WPP_CONTROL_ANNOTATION(), \ |
| 102 |
WPP_MAIN_CB[0].Control.RegistryPath = NULL, \ |
| 103 |
UNREFERENCED_PARAMETER(RegPath), \ |
| 104 |
WppInitKm( DriverObject, InitInfo ) \ |
| 105 |
); \ |
| 106 |
} |
| 107 |
#else |
| 108 |
#define WPP_INIT_TRACING(DriverObject, RegPath, InitInfo) |
| 109 |
#endif |
| 110 |
|
| 111 |
#define WMIREG_FLAG_CALLBACK 0x80000000 // not exposed in DDK |
| 112 |
|
| 113 |
#ifndef WMIREG_FLAG_TRACE_PROVIDER |
| 114 |
#define WMIREG_FLAG_TRACE_PROVIDER 0x00010000 |
| 115 |
#endif |
| 116 |
|
| 117 |
__inline int WppIsEqualGuid(_In_ const GUID* g1, _In_ const GUID* g2) |
| 118 |
{ |
| 119 |
const ULONG* p1 = (const ULONG*)g1; |
| 120 |
const ULONG* p2 = (const ULONG*)g2; |
| 121 |
return p1[0] == p2[0] && p1[1] == p2[1] && p1[2] == p2[2] && p1[3] == p2[3]; |
| 122 |
} |
| 123 |
|
| 124 |
#define WPP_MAX_COUNT_REGISTRATION_GUID 63 |
| 125 |
|
| 126 |
WPPINIT_EXPORT |
| 127 |
NTSTATUS |
| 128 |
WppTraceCallback( |
| 129 |
_In_ UCHAR MinorFunction, |
| 130 |
_In_opt_ PVOID DataPath, |
| 131 |
_In_ ULONG BufferLength, |
| 132 |
_Inout_updates_bytes_(BufferLength) PVOID Buffer, |
| 133 |
_Inout_ PVOID Context, |
| 134 |
_Out_ PULONG Size |
| 135 |
) |
| 136 |
/*++ |
| 137 |
|
| 138 |
Routine Description: |
| 139 |
|
| 140 |
This function is the callback WMI calls when we register and when our |
| 141 |
events are enabled or disabled. |
| 142 |
|
| 143 |
Arguments: |
| 144 |
|
| 145 |
MinorFunction - specifies the type of callback (register, event enable/disable) |
| 146 |
|
| 147 |
DataPath - varies depending on the ActionCode |
| 148 |
|
| 149 |
BufferLength - size of the Buffer parameter |
| 150 |
|
| 151 |
Buffer - in/out buffer where we read from or write to depending on the type |
| 152 |
of callback |
| 153 |
|
| 154 |
Context - the pointer private struct WPP_TRACE_CONTROL_BLOCK |
| 155 |
|
| 156 |
Size - output parameter to receive the amount of data written into Buffer |
| 157 |
|
| 158 |
Return Value: |
| 159 |
|
| 160 |
NTSTATUS code indicating success/failure |
| 161 |
|
| 162 |
Comments: |
| 163 |
|
| 164 |
if return value is STATUS_BUFFER_TOO_SMALL and BufferLength >= 4, |
| 165 |
then first ulong of buffer contains required size |
| 166 |
|
| 167 |
|
| 168 |
--*/ |
| 169 |
|
| 170 |
{ |
| 171 |
PWPP_TRACE_CONTROL_BLOCK cntl; |
| 172 |
NTSTATUS Status = STATUS_SUCCESS; |
| 173 |
|
| 174 |
UNREFERENCED_PARAMETER(DataPath); |
| 175 |
|
| 176 |
WppDebug(0,("WppTraceCallBack 0x%08X %p\n", MinorFunction, Context)); |
| 177 |
|
| 178 |
*Size = 0; |
| 179 |
|
| 180 |
switch(MinorFunction) |
| 181 |
{ |
| 182 |
case IRP_MN_REGINFO: |
| 183 |
{ |
| 184 |
PWMIREGINFOW WmiRegInfo; |
| 185 |
PCUNICODE_STRING RegPath; |
| 186 |
PWCHAR StringPtr; |
| 187 |
ULONG RegistryPathOffset; |
| 188 |
ULONG BufferNeeded; |
| 189 |
ULONG GuidCount = 0; |
| 190 |
|
| 191 |
// |
| 192 |
// Initialize locals |
| 193 |
// |
| 194 |
|
| 195 |
cntl = (PWPP_TRACE_CONTROL_BLOCK)Context; |
| 196 |
WmiRegInfo = (PWMIREGINFO)Buffer; |
| 197 |
|
| 198 |
RegPath = cntl->RegistryPath; |
| 199 |
|
| 200 |
// |
| 201 |
// Count the number of guid to be identified. |
| 202 |
// |
| 203 |
while(cntl) { GuidCount++; cntl = cntl->Next; } |
| 204 |
|
| 205 |
if (GuidCount > WPP_MAX_COUNT_REGISTRATION_GUID){ |
| 206 |
Status = STATUS_INVALID_PARAMETER; |
| 207 |
break; |
| 208 |
} |
| 209 |
|
| 210 |
WppDebug(0,("WppTraceCallBack: GUID count %d\n", GuidCount)); |
| 211 |
|
| 212 |
// |
| 213 |
// Calculate buffer size need to hold all info. |
| 214 |
// Calculate offset to where RegistryPath parm will be copied. |
| 215 |
// |
| 216 |
|
| 217 |
if (RegPath == NULL) |
| 218 |
{ |
| 219 |
|
| 220 |
RegistryPathOffset = 0; |
| 221 |
|
| 222 |
BufferNeeded = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + |
| 223 |
GuidCount * sizeof(WMIREGGUIDW); |
| 224 |
|
| 225 |
} else { |
| 226 |
|
| 227 |
RegistryPathOffset = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + |
| 228 |
GuidCount * sizeof(WMIREGGUIDW); |
| 229 |
|
| 230 |
BufferNeeded = RegistryPathOffset + |
| 231 |
RegPath->Length + sizeof(USHORT); |
| 232 |
} |
| 233 |
|
| 234 |
// |
| 235 |
// If the provided buffer is large enough, then fill with info. |
| 236 |
// |
| 237 |
|
| 238 |
if (BufferNeeded <= BufferLength) |
| 239 |
{ |
| 240 |
ULONG i; |
| 241 |
|
| 242 |
StorMemSet(Buffer, 0, BufferLength); |
| 243 |
|
| 244 |
// |
| 245 |
// Fill in the WMIREGINFO |
| 246 |
// |
| 247 |
|
| 248 |
WmiRegInfo->BufferSize = BufferNeeded; |
| 249 |
WmiRegInfo->RegistryPath = RegistryPathOffset; |
| 250 |
WmiRegInfo->GuidCount = GuidCount; |
| 251 |
|
| 252 |
if (RegPath != NULL) { |
| 253 |
StringPtr = (PWCHAR)((PUCHAR)Buffer + RegistryPathOffset); |
| 254 |
*StringPtr++ = RegPath->Length; |
| 255 |
|
| 256 |
StorMoveMemory(StringPtr, RegPath->Buffer, RegPath->Length); |
| 257 |
} |
| 258 |
|
| 259 |
// |
| 260 |
// Fill in the WMIREGGUID |
| 261 |
// |
| 262 |
|
| 263 |
cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; |
| 264 |
|
| 265 |
for (i=0; i<GuidCount; i++) { |
| 266 |
|
| 267 |
WmiRegInfo->WmiRegGuid[i].Guid = *cntl->ControlGuid; |
| 268 |
WmiRegInfo->WmiRegGuid[i].Flags = WMIREG_FLAG_TRACE_CONTROL_GUID | |
| 269 |
WMIREG_FLAG_TRACED_GUID; |
| 270 |
cntl->Level = 0; |
| 271 |
cntl->Flags[0] = 0; |
| 272 |
WppDebug(0,("Control GUID::%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", |
| 273 |
cntl->ControlGuid->Data1, |
| 274 |
cntl->ControlGuid->Data2, |
| 275 |
cntl->ControlGuid->Data3, |
| 276 |
cntl->ControlGuid->Data4[0], |
| 277 |
cntl->ControlGuid->Data4[1], |
| 278 |
cntl->ControlGuid->Data4[2], |
| 279 |
cntl->ControlGuid->Data4[3], |
| 280 |
cntl->ControlGuid->Data4[4], |
| 281 |
cntl->ControlGuid->Data4[5], |
| 282 |
cntl->ControlGuid->Data4[6], |
| 283 |
cntl->ControlGuid->Data4[7] |
| 284 |
)); |
| 285 |
|
| 286 |
cntl = cntl->Next; |
| 287 |
} |
| 288 |
|
| 289 |
Status = STATUS_SUCCESS; |
| 290 |
*Size = BufferNeeded; |
| 291 |
|
| 292 |
} else { |
| 293 |
Status = STATUS_BUFFER_TOO_SMALL; |
| 294 |
|
| 295 |
if (BufferLength >= sizeof(ULONG)) { |
| 296 |
*((PULONG)Buffer) = BufferNeeded; |
| 297 |
*Size = sizeof(ULONG); |
| 298 |
} |
| 299 |
} |
| 300 |
|
| 301 |
#ifdef WPP_GLOBALLOGGER |
| 302 |
// Check if Global logger is active |
| 303 |
|
| 304 |
cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; |
| 305 |
while(cntl) { |
| 306 |
StorWppInitGlobalLogger( |
| 307 |
cntl->ControlGuid, |
| 308 |
(PTRACEHANDLE)&cntl->Logger, |
| 309 |
&cntl->Flags[0], |
| 310 |
&cntl->Level); |
| 311 |
cntl = cntl->Next; |
| 312 |
} |
| 313 |
#endif //#ifdef WPP_GLOBALLOGGER |
| 314 |
|
| 315 |
break; |
| 316 |
} |
| 317 |
|
| 318 |
case IRP_MN_ENABLE_EVENTS: |
| 319 |
case IRP_MN_DISABLE_EVENTS: |
| 320 |
{ |
| 321 |
PWNODE_HEADER Wnode; |
| 322 |
ULONG Level; |
| 323 |
ULONG ReturnLength; |
| 324 |
ULONG index; |
| 325 |
|
| 326 |
if (Context == NULL ) { |
| 327 |
Status = STATUS_WMI_GUID_NOT_FOUND; |
| 328 |
break; |
| 329 |
} |
| 330 |
|
| 331 |
if (BufferLength < sizeof(WNODE_HEADER)) { |
| 332 |
Status = STATUS_INVALID_PARAMETER; |
| 333 |
break; |
| 334 |
} |
| 335 |
|
| 336 |
// |
| 337 |
// Initialize locals |
| 338 |
// |
| 339 |
Wnode = (PWNODE_HEADER)Buffer; |
| 340 |
|
| 341 |
// |
| 342 |
// Traverse this ProjectControlBlock's ControlBlock list and |
| 343 |
// find the "cntl" ControlBlock which matches the Wnode GUID. |
| 344 |
// |
| 345 |
cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; |
| 346 |
index = 0; |
| 347 |
while(cntl) { |
| 348 |
if (WppIsEqualGuid(cntl->ControlGuid, &Wnode->Guid )) { |
| 349 |
break; |
| 350 |
} |
| 351 |
index++; |
| 352 |
cntl = cntl->Next; |
| 353 |
} |
| 354 |
|
| 355 |
if (cntl == NULL) { |
| 356 |
Status = STATUS_WMI_GUID_NOT_FOUND; |
| 357 |
break; |
| 358 |
} |
| 359 |
|
| 360 |
// |
| 361 |
// Do the requested event action |
| 362 |
// |
| 363 |
Status = STATUS_SUCCESS; |
| 364 |
|
| 365 |
if (MinorFunction == IRP_MN_DISABLE_EVENTS) { |
| 366 |
|
| 367 |
WppDebug(0,("WppTraceCallBack: DISABLE_EVENTS\n")); |
| 368 |
|
| 369 |
cntl->Level = 0; |
| 370 |
cntl->Flags[0] = 0; |
| 371 |
cntl->Logger = 0; |
| 372 |
|
| 373 |
} else { |
| 374 |
|
| 375 |
TRACEHANDLE lh; |
| 376 |
|
| 377 |
lh = (TRACEHANDLE)( Wnode->HistoricalContext ); |
| 378 |
cntl->Logger = lh; |
| 379 |
|
| 380 |
Status = StorWmiQueryTraceInformation( TraceEnableLevelClass, |
| 381 |
&Level, |
| 382 |
sizeof(Level), |
| 383 |
&ReturnLength, |
| 384 |
(PVOID)Wnode); |
| 385 |
|
| 386 |
if (Status == STATUS_SUCCESS) { |
| 387 |
cntl->Level = (UCHAR)Level; |
| 388 |
} |
| 389 |
|
| 390 |
Status = StorWmiQueryTraceInformation( TraceEnableFlagsClass, |
| 391 |
&cntl->Flags[0], |
| 392 |
sizeof(cntl->Flags[0]), |
| 393 |
&ReturnLength, |
| 394 |
(PVOID) Wnode ); |
| 395 |
|
| 396 |
WppDebug(0,("WppTraceCallBack: ENABLE_EVENTS " |
| 397 |
"LoggerId %d, Flags 0x%08X, Level 0x%02X\n", |
| 398 |
(USHORT) cntl->Logger, |
| 399 |
cntl->Flags[0], |
| 400 |
cntl->Level)); |
| 401 |
|
| 402 |
} |
| 403 |
|
| 404 |
#ifdef WPP_PRIVATE_ENABLE_CALLBACK |
| 405 |
// |
| 406 |
// Notify changes to flags, level for GUID |
| 407 |
// |
| 408 |
WPP_PRIVATE_ENABLE_CALLBACK( cntl->ControlGuid, |
| 409 |
cntl->Logger, |
| 410 |
(MinorFunction != IRP_MN_DISABLE_EVENTS) ? TRUE:FALSE, |
| 411 |
cntl->Flags[0], |
| 412 |
cntl->Level ); |
| 413 |
#endif |
| 414 |
|
| 415 |
break; |
| 416 |
} |
| 417 |
|
| 418 |
case IRP_MN_ENABLE_COLLECTION: |
| 419 |
case IRP_MN_DISABLE_COLLECTION: |
| 420 |
{ |
| 421 |
Status = STATUS_SUCCESS; |
| 422 |
break; |
| 423 |
} |
| 424 |
|
| 425 |
case IRP_MN_QUERY_ALL_DATA: |
| 426 |
case IRP_MN_QUERY_SINGLE_INSTANCE: |
| 427 |
case IRP_MN_CHANGE_SINGLE_INSTANCE: |
| 428 |
case IRP_MN_CHANGE_SINGLE_ITEM: |
| 429 |
case IRP_MN_EXECUTE_METHOD: |
| 430 |
{ |
| 431 |
Status = STATUS_INVALID_DEVICE_REQUEST; |
| 432 |
break; |
| 433 |
} |
| 434 |
|
| 435 |
default: |
| 436 |
{ |
| 437 |
Status = STATUS_INVALID_DEVICE_REQUEST; |
| 438 |
break; |
| 439 |
} |
| 440 |
|
| 441 |
} |
| 442 |
return(Status); |
| 443 |
} |
| 444 |
|
| 445 |
#pragma warning(push) |
| 446 |
#pragma warning(disable:4068) |
| 447 |
WPPINIT_EXPORT |
| 448 |
VOID |
| 449 |
WppInitKm( |
| 450 |
_In_opt_ PVOID DriverObject, |
| 451 |
_In_ PVOID InitInfo |
| 452 |
) |
| 453 |
|
| 454 |
/*++ |
| 455 |
|
| 456 |
Routine Description: |
| 457 |
|
| 458 |
This function registers a driver with ETW as a provider of trace |
| 459 |
events from the defined GUIDs. |
| 460 |
|
| 461 |
Arguments: |
| 462 |
|
| 463 |
DriverObject - Pointer to a driver object. This is required for WppRecorder |
| 464 |
and is optional otherwise (not used unless it's for |
| 465 |
WppRecorder). |
| 466 |
|
| 467 |
InitInfo - Pointer to STORAGE_TRACE_INIT_INFO. |
| 468 |
|
| 469 |
Remarks: |
| 470 |
|
| 471 |
This function is called by the |
| 472 |
WPP_INIT_TRACING(DriverObject, RegPath, InitInfo) macro. |
| 473 |
|
| 474 |
--*/ |
| 475 |
|
| 476 |
{ |
| 477 |
C_ASSERT(WPP_MAX_FLAG_LEN_CHECK); |
| 478 |
|
| 479 |
NTSTATUS Status; |
| 480 |
PWPP_TRACE_CONTROL_BLOCK WppReg = NULL; |
| 481 |
|
| 482 |
UNREFERENCED_PARAMETER(DriverObject); |
| 483 |
|
| 484 |
if (WPP_CB != WPP_MAIN_CB) { |
| 485 |
|
| 486 |
WPP_CB = WPP_MAIN_CB; |
| 487 |
|
| 488 |
} else { |
| 489 |
// |
| 490 |
// WPP_INIT_TRACING already called |
| 491 |
// |
| 492 |
WppDebug(0,("Warning : WPP_INIT_TRACING already called, ignoring this one")); |
| 493 |
return; |
| 494 |
} |
| 495 |
|
| 496 |
WppReg = &WPP_CB[0].Control; |
| 497 |
|
| 498 |
WppDebug(0,("WPP Init.\n")); |
| 499 |
|
| 500 |
|
| 501 |
if (StorInitTracing(InitInfo) == STATUS_SUCCESS) { |
| 502 |
|
| 503 |
WppReg -> Callback = WppTraceCallback; |
| 504 |
|
| 505 |
Status = StorIoWMIRegistrationControl( |
| 506 |
WppReg, |
| 507 |
WMIREG_ACTION_REGISTER | |
| 508 |
WMIREG_FLAG_CALLBACK | |
| 509 |
WMIREG_FLAG_TRACE_PROVIDER |
| 510 |
); |
| 511 |
|
| 512 |
if (!NT_SUCCESS(Status)) { |
| 513 |
WppDebug(0,("StorIoWMIRegistrationControl Status = %08X\n",Status)); |
| 514 |
} |
| 515 |
|
| 516 |
} |
| 517 |
|
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
WPPINIT_EXPORT |
| 522 |
VOID |
| 523 |
WppCleanupKm( |
| 524 |
_In_ PVOID TraceContext |
| 525 |
) |
| 526 |
|
| 527 |
/*++ |
| 528 |
|
| 529 |
Routine Description: |
| 530 |
|
| 531 |
This function deregisters a driver from ETW as provider of trace |
| 532 |
events. |
| 533 |
|
| 534 |
Arguments: |
| 535 |
|
| 536 |
TraceContext - The STORAGE_TRACE_INIT_INFO.TraceContext value. |
| 537 |
|
| 538 |
Remarks: |
| 539 |
|
| 540 |
This function is called by the WPP_CLEANUP(DriverObject, TraceContext) macro. |
| 541 |
|
| 542 |
--*/ |
| 543 |
|
| 544 |
{ |
| 545 |
StorCleanupTracing(TraceContext); |
| 546 |
|
| 547 |
if (WPP_CB == (WPP_CB_TYPE*)&WPP_CB){ |
| 548 |
// |
| 549 |
// WPP_INIT_TRACING macro has not been called |
| 550 |
// |
| 551 |
WppDebug(0,("Warning : WPP_CLEANUP already called, or called with out WPP_INIT_TRACING first")); |
| 552 |
return; |
| 553 |
} |
| 554 |
|
| 555 |
PWPP_TRACE_CONTROL_BLOCK WppReg = &WPP_CB[0].Control; |
| 556 |
|
| 557 |
StorIoWMIRegistrationControl(WppReg, |
| 558 |
WMIREG_ACTION_DEREGISTER | |
| 559 |
WMIREG_FLAG_CALLBACK ); |
| 560 |
|
| 561 |
WPP_CB = (WPP_CB_TYPE*)&WPP_CB; |
| 562 |
} |
| 563 |
|
| 564 |
#pragma warning(pop) |
| 565 |
|
| 566 |
#define WPP_SYSTEMCONTROL(PDO) |
| 567 |
#define WPP_SYSTEMCONTROL2(PDO, offset) |
| 568 |
|
| 569 |
#ifdef __cplusplus |
| 570 |
} // extern "C" |
| 571 |
#endif |