ReactOS 0.4.16-dev-88-ga65b6ae
wmidrv.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/wmi/wmidrv.c
5 * PURPOSE: I/O Windows Management Instrumentation (WMI) Support
6 * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include <ntoskrnl.h>
12#include <wmistr.h>
13#include <wmiioctl.h>
14#include "wmip.h"
15
16#define NDEBUG
17#include <debug.h>
18
19// FIXME: these should go to a shared header
21{
28
31
32typedef struct _WMIP_RESULT
33{
39
41{
48
50{
54
55typedef struct _WMI_NOTIFICATION
56{
65
66typedef struct _WMI_SET_MARK
67{
71
75
76
77/* FUNCTIONS *****************************************************************/
78
83
89{
90 PAGED_CODE();
91
92 /* No work to do, just return success */
93 Irp->IoStatus.Status = STATUS_SUCCESS;
94 Irp->IoStatus.Information = 0;
96 return STATUS_SUCCESS;
97}
98
99static
104{
106 return STATUS_SUCCESS;
107}
108
109static
114{
116 return STATUS_SUCCESS;
117}
118
119static
122 _In_ POBJECT_ATTRIBUTES GuidObjectAttributes,
123 _Out_ POBJECT_ATTRIBUTES CapuredObjectAttributes,
124 _Out_ PUNICODE_STRING CapturedObjectName,
127{
129
131 {
132 /* Probe and copy the object attributes structure */
133 ProbeForRead(GuidObjectAttributes,
134 sizeof(OBJECT_ATTRIBUTES),
135 sizeof(PVOID));
136 *CapuredObjectAttributes = *GuidObjectAttributes;
137
138 /* Probe and copy the object name UNICODE_STRING */
139 ProbeForRead(CapuredObjectAttributes->ObjectName,
140 sizeof(UNICODE_STRING),
141 sizeof(PVOID));
142 *CapturedObjectName = *CapuredObjectAttributes->ObjectName;
143
144 /* Check if the object name has the expected length */
145 if (CapturedObjectName->Length != 45 * sizeof(WCHAR))
146 {
148 }
149
150 /* Probe and copy the object name buffer */
151 ProbeForRead(CapturedObjectName->Buffer,
152 CapturedObjectName->Length,
153 sizeof(WCHAR));
155 CapturedObjectName->Buffer,
156 CapturedObjectName->Length);
157
158 /* Fix pointers */
159 CapturedObjectName->Buffer = ObjectNameBuffer;
160 GuidObjectAttributes->ObjectName = CapturedObjectName;
161 }
163 {
164 DPRINT1("Got exception!\n");
166 }
167 _SEH2_END;
168
169 return STATUS_SUCCESS;
170}
171
172static
177 _In_ ULONG InputLength,
178 _Inout_ PULONG OutputLength)
179{
182 OBJECT_ATTRIBUTES LocalObjectAttributes;
183 UNICODE_STRING LocalObjectName;
184 WCHAR LocalObjectNameBuffer[45 + 1];
186 HANDLE GuidObjectHandle;
187 PVOID GuidObject;
189
190 /* Make sure the input buffer is large enough */
191 if ((InputLength < sizeof(WMIP_REGISTER_GUIDS)) ||
192 (RegisterGuids->RegInfo.BufferSize >
193 (InputLength - FIELD_OFFSET(WMIP_REGISTER_GUIDS, RegInfo))))
194 {
195 return STATUS_UNSUCCESSFUL;
196 }
197
198 /* Make sure we have a resonable GUID count */
199 if ((RegisterGuids->RegInfo.GuidCount == 0) ||
200 (RegisterGuids->RegInfo.GuidCount > 0x10000))
201 {
202 return STATUS_UNSUCCESSFUL;
203 }
204
205 /* Capture object attributes */
208 &LocalObjectAttributes,
209 &LocalObjectName,
210 LocalObjectNameBuffer,
212 if (!NT_SUCCESS(Status))
213 {
214 DPRINT1("WmipCaptureGuidObjectAttributes failed: 0x%lx\n", Status);
215 return Status;
216 }
217
218 /* Open a new GUID object */
219 Status = WmipOpenGuidObjectByName(&LocalObjectAttributes,
222 &GuidObjectHandle,
223 &GuidObject);
224 if (!NT_SUCCESS(Status))
225 {
226 DPRINT1("WmipOpenGuidObjectByName failed: 0x%lx\n", Status);
227 return Status;
228 }
229
230 /* Dereference the GUID object */
231 ObDereferenceObject(GuidObject);
232
233 /* Return the handle (user mode will close it) */
234 Result->Handle = GuidObjectHandle;
235 Result->TraceHandle = 0;
236 *OutputLength = 24;
237
238 return STATUS_SUCCESS;
239}
240
241
242static
246 _In_ ULONG InputLength,
247 _Inout_ PULONG OutputLength)
248{
249 /* For now we have nothing to do */
250 return STATUS_SUCCESS;
251}
252
253VOID
254NTAPI
256 _In_ PIRP Irp)
257{
258 PWMIP_IRP_CONTEXT IrpContext;
259 PLIST_ENTRY ListEntry;
260 PWMIP_GUID_OBJECT GuidObject;
261
262 /* Get the IRP context */
263 IrpContext = (PWMIP_IRP_CONTEXT)Irp->Tail.Overlay.DriverContext;
264
265 /* Loop all GUID objects attached to this IRP */
266 for (ListEntry = IrpContext->GuidObjectListHead.Flink;
267 ListEntry != &IrpContext->GuidObjectListHead;
268 ListEntry = ListEntry->Flink)
269 {
270 /* Get the GUID object */
271 GuidObject = CONTAINING_RECORD(ListEntry, WMIP_GUID_OBJECT, IrpLink);
272
273 /* Make sure the IRP matches and clear it */
274 ASSERT(GuidObject->Irp == Irp);
275 GuidObject->Irp = NULL;
276
277 /* Remove the entry */
278 RemoveEntryList(ListEntry);
279 }
280}
281
282VOID
283NTAPI
287{
288 /* Clear the list */
290
291 /* Release the cancel spin lock */
292 IoReleaseCancelSpinLock(Irp->CancelIrql);
293
294 /* Set the status to cancelled and complete the IRP */
295 Irp->IoStatus.Status = STATUS_CANCELLED;
296 Irp->IoStatus.Information = 0;
298}
299
300static
301VOID
303 PWMIP_IRP_CONTEXT IrpContext)
304{
305 /* Initialize the list head for GUID objects */
307}
308
309static
314 _In_ ULONG InputLength,
315 _Inout_ PULONG OutputLength)
316{
318 PWMIP_IRP_CONTEXT IrpContext;
320
321 //__debugbreak();
322 if ((InputLength < sizeof(WMI_NOTIFICATION)) || (*OutputLength < 0x38))
323 {
325 }
326
331
332 // loop all objects
333 // reference the object
334 // on failure, fail the whole request
335
336 // loop all objects
337 // update the irp (synchronization!)
338 // if we had one before complete the old irp with an error
339
340 /* Get the IRP context and initialize it */
341 IrpContext = (PWMIP_IRP_CONTEXT)Irp->Tail.Overlay.DriverContext;
342 WmipInitializeIrpContext(IrpContext);
343
344 // loop all objects
345 // insert the objects into the IRP list
346
347 /* Set our cancel routine for cleanup */
349
350 /* Check if the IRP is already being cancelled */
351 if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
352 {
354 }
355 else
356 {
357 /* Mark the IRP as pending */
360 }
361
362 return Status;
363}
364
366{
372
373typedef struct _WMIP_RESULT2
374{
380
381static
385 ULONG InputLength,
386 PULONG OutputLength)
387{
388 PWMI_OPEN_GUID_FOR_EVENTS OpenGuidForEvents = Buffer;
390 OBJECT_ATTRIBUTES LocalObjectAttributes;
391 UNICODE_STRING LocalObjectName;
392 WCHAR LocalObjectNameBuffer[45 + 1];
394 HANDLE GuidObjectHandle;
395 PVOID GuidObject;
397
398 if ((InputLength != sizeof(WMI_OPEN_GUID_FOR_EVENTS)) ||
399 (*OutputLength != sizeof(WMIP_RESULT2)))
400 {
401 return STATUS_UNSUCCESSFUL;
402 }
403
404 /* Capture object attributes */
407 &LocalObjectAttributes,
408 &LocalObjectName,
409 LocalObjectNameBuffer,
411 if (!NT_SUCCESS(Status))
412 {
413 DPRINT1("ProbeAndCaptureGuidObjectAttributes failed: 0x%lx\n", Status);
414 return Status;
415 }
416
417 /* Open a new GUID object */
418 Status = WmipOpenGuidObjectByName(&LocalObjectAttributes,
419 OpenGuidForEvents->DesiredAccess,
421 &GuidObjectHandle,
422 &GuidObject);
423 if (!NT_SUCCESS(Status))
424 {
425 DPRINT1("WmipOpenGuidObjectByName failed: 0x%lx\n", Status);
426 return Status;
427 }
428
429 Result->Handle = GuidObjectHandle;
430
431 ObDereferenceObject(GuidObject);
432
433 return STATUS_SUCCESS;
434}
435
436static
441{
443 return STATUS_SUCCESS;
444}
445
447NTAPI
451{
452 PIO_STACK_LOCATION IoStackLocation;
455 ULONG InputLength, OutputLength;
457 PAGED_CODE();
458
459 /* Get the current stack location */
460 IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
461
462 /* Get the io control parameters */
463 IoControlCode = IoStackLocation->Parameters.DeviceIoControl.IoControlCode;
464 Buffer = Irp->AssociatedIrp.SystemBuffer;
465 InputLength = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength;
466 OutputLength = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength;
467
468 switch (IoControlCode)
469 {
470
472 {
474 Buffer,
475 InputLength,
476 &OutputLength);
477 break;
478 }
479
481 {
483 InputLength,
484 &OutputLength);
485 break;
486 }
487
489 {
491 Buffer,
492 InputLength,
493 &OutputLength);
494 break;
495 }
496
497 case 0x228168:
498 {
499 DPRINT1("IOCTL 0x228168 is unimplemented, ignoring\n");
501 break;
502 }
503
505 {
506 Status = WmipOpenGuidForEvents(Buffer, InputLength, &OutputLength);
507 break;
508 }
509
511 {
512 if (InputLength < FIELD_OFFSET(WMI_SET_MARK, Mark))
513 {
515 break;
516 }
517
518 Status = WmiSetMark(Buffer, InputLength);
519 break;
520 }
521
522 default:
523 DPRINT1("Unsupported yet IOCTL: 0x%lx\n", IoControlCode);
525 __debugbreak();
526 break;
527 }
528
529 if (Status == STATUS_PENDING)
530 return Status;
531
532 Irp->IoStatus.Status = Status;
533 Irp->IoStatus.Information = NT_SUCCESS(Status) ? OutputLength : 0;
534
536 return Status;
537}
538
540NTAPI
544{
547}
548
550NTAPI
554{
555 Irp->IoStatus.Status = STATUS_SUCCESS;
557 return STATUS_SUCCESS;
558}
559
560_Function_class_(FAST_IO_DEVICE_CONTROL)
563NTAPI
564WmipFastIoDeviceControl(
574{
575 PAGED_CODE();
576
578 {
579 if (InputBufferLength < 0x30)
580 {
581 DPRINT1("Buffer too small\n");
582 return FALSE;
583 }
584
586 return TRUE;
587 }
589 {
590 if (InputBufferLength < 0x30)
591 {
592 DPRINT1("Buffer too small\n");
593 return FALSE;
594 }
595
597 return TRUE;
598 }
599
600 DPRINT1("Invalid io control code for fast dispatch: 0x%lx\n", IoControlCode);
601 return FALSE;
602}
603
605NTAPI
609{
612}
613
614_Function_class_(DRIVER_INITIALIZE)
617NTAPI
618WmipDriverEntry(
621{
622 static UNICODE_STRING ServiceDeviceName = RTL_CONSTANT_STRING(L"\\Device\\WMIDataDevice");
623 static UNICODE_STRING ServiceDosDeviceName = RTL_CONSTANT_STRING(L"\\DosDevices\\WMIDataDevice");
624 static UNICODE_STRING AdminDeviceName = RTL_CONSTANT_STRING(L"\\Device\\WMIAdminDevice");
625 static UNICODE_STRING AdminDosDeviceName = RTL_CONSTANT_STRING(L"\\DosDevices\\WMIAdminDevice");
627 PAGED_CODE();
628
629 /* Create the service device object */
631 0,
632 &ServiceDeviceName,
635 0,
637 if (!NT_SUCCESS(Status))
638 {
639 DPRINT1("Failed to create service device: 0x%lx\n", Status);
640 return Status;
641 }
642
643 /* Create a symbolic link for the service device */
644 Status = IoCreateSymbolicLink(&ServiceDosDeviceName, &ServiceDeviceName);
645 if (!NT_SUCCESS(Status))
646 {
647 DPRINT1("IoCreateSymbolicLink() failed: 0x%lx\n", Status);
649 return Status;
650 }
651
652 /* Create the admin device object */
654 0,
655 &AdminDeviceName,
658 0,
660 if (!NT_SUCCESS(Status))
661 {
662 DPRINT1("Failed to create admin device: 0x%lx\n", Status);
664 IoDeleteSymbolicLink(&ServiceDosDeviceName);
665 return Status;
666 }
667
668 /* Create a symbolic link for the admin device */
669 Status = IoCreateSymbolicLink(&AdminDosDeviceName, &AdminDeviceName);
670 if (!NT_SUCCESS(Status))
671 {
672 DPRINT1("IoCreateSymbolicLink() failed: 0x%lx\n", Status);
673 IoDeleteSymbolicLink(&ServiceDosDeviceName);
676 return Status;
677 }
678
679 /* Initialize dispatch routines */
685 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = WmipShutdown;
686
687 /* Initialize fast dispatch */
690 WmipFastIoDispatch.FastIoDeviceControl = WmipFastIoDeviceControl;
691 DriverObject->FastIoDispatch = &WmipFastIoDispatch;
692
693 /* Register the WMI service device */
695
696 /* Register a shutdown notification */
698
699 /* Initialization is done */
700 WmipServiceDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
701 WmipAdminDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
702
703 return STATUS_SUCCESS;
704}
705
706
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:118
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
Definition: bufpool.h:45
_In_z_ PCCHAR ObjectNameBuffer
Definition: classpnp.h:982
static VOID Mark(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:300
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define _IRQL_requires_same_
Definition: driverspecs.h:232
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
ULONG64 TRACEHANDLE
Definition: evntrace.h:40
#define ExGetPreviousMode
Definition: ex.h:140
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI WmipOpenGuidObjectByName(_In_ POBJECT_ATTRIBUTES ObjectAttributes, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
Definition: guidobj.c:262
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
IoMarkIrpPending(Irp)
IoSetCancelRoutine(Irp, CancelRoutine)
#define ASSERT(a)
Definition: mode.c:44
#define for
Definition: utility.h:88
#define _Function_class_(x)
Definition: ms_sal.h:2946
#define _Out_opt_
Definition: ms_sal.h:346
#define _Inout_
Definition: ms_sal.h:378
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:34
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define SPECIFIC_RIGHTS_ALL
Definition: nt_native.h:71
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSTATUS NTAPI IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1694
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
NTSTATUS NTAPI IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG Action)
Definition: wmi.c:68
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:79
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG BufferSize
Definition: wmistr.h:93
ULONG GuidCount
Definition: wmistr.h:97
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1733
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl
Definition: iotypes.h:1743
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
union _IO_STACK_LOCATION::@1575 Parameters
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY GuidObjectListHead
Definition: wmip.h:10
WMIREGINFOW RegInfo
Definition: wmidrv.c:29
POBJECT_ATTRIBUTES ObjectAttributes
Definition: wmidrv.c:22
ULONG Unknown00
Definition: wmidrv.c:375
ULONG Unknown0C
Definition: wmidrv.c:378
HANDLE Handle
Definition: wmidrv.c:377
ULONG Unknown04
Definition: wmidrv.c:376
ULONG Unknown04
Definition: wmidrv.c:35
BOOLEAN Unknown10
Definition: wmidrv.c:37
TRACEHANDLE TraceHandle
Definition: wmidrv.c:36
HANDLE Handle
Definition: wmidrv.c:34
Definition: wmidrv.c:50
HANDLE Handle
Definition: wmidrv.c:51
ULONG Unknown04
Definition: wmidrv.c:52
WMI_GUID_OBJECT_ENTRY GuidObjects[0]
Definition: wmidrv.c:63
ULONG NumberOfGuidObjects
Definition: wmidrv.c:57
ULONG Unknown0C
Definition: wmidrv.c:60
ULONG Unknown04
Definition: wmidrv.c:58
ULONG Unknown14
Definition: wmidrv.c:62
ULONG Unknown10
Definition: wmidrv.c:61
ULONG Unknown08
Definition: wmidrv.c:59
POBJECT_ATTRIBUTES ObjectAttributes
Definition: wmidrv.c:367
ACCESS_MASK DesiredAccess
Definition: wmidrv.c:368
ULONG Flags
Definition: wmidrv.c:68
WCHAR Mark[1]
Definition: wmidrv.c:69
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
NTSTATUS NTAPI WmipDockUndockEventCallback(_In_ PVOID NotificationStructure, _Inout_opt_ PVOID Context)
Definition: wmidrv.c:606
struct _WMIP_RESULT2 WMIP_RESULT2
DRIVER_DISPATCH WmipIoControl
Definition: wmidrv.c:80
static NTSTATUS WmiSetMark(PWMI_SET_MARK Buffer, ULONG Length)
Definition: wmidrv.c:438
DRIVER_DISPATCH WmipSystemControl
Definition: wmidrv.c:81
DRIVER_DISPATCH WmipOpenCloseCleanup
Definition: wmidrv.c:79
static NTSTATUS WmipCaptureGuidObjectAttributes(_In_ POBJECT_ATTRIBUTES GuidObjectAttributes, _Out_ POBJECT_ATTRIBUTES CapuredObjectAttributes, _Out_ PUNICODE_STRING CapturedObjectName, _Out_ PWSTR ObjectNameBuffer, _In_ KPROCESSOR_MODE AccessMode)
Definition: wmidrv.c:121
static NTSTATUS WmiTraceEvent(PVOID InputBuffer, KPROCESSOR_MODE PreviousMode)
Definition: wmidrv.c:101
PDEVICE_OBJECT WmipServiceDeviceObject
Definition: wmidrv.c:72
FAST_IO_DISPATCH WmipFastIoDispatch
Definition: wmidrv.c:74
struct _WMI_NOTIFICATION * PWMI_NOTIFICATION
static NTSTATUS WmipRegisterGuids(_In_ PDEVICE_OBJECT DeviceObject, _In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:174
static NTSTATUS WmipReceiveNotifications(_Inout_ PIRP Irp, _In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:311
struct _WMIP_RESULT WMIP_RESULT
struct _WMIP_RESULT * PWMIP_RESULT
static VOID WmipInitializeIrpContext(PWMIP_IRP_CONTEXT IrpContext)
Definition: wmidrv.c:302
struct _WMI_NOTIFICATION WMI_NOTIFICATION
VOID NTAPI WmipClearIrpObjectList(_In_ PIRP Irp)
Definition: wmidrv.c:255
static NTSTATUS WmiTraceUserMessage(PVOID InputBuffer, ULONG InputBufferLength)
Definition: wmidrv.c:111
struct _WMI_UNREGISTER_GUID WMI_UNREGISTER_GUID
PDEVICE_OBJECT WmipAdminDeviceObject
Definition: wmidrv.c:73
struct _WMIP_RESULT2 * PWMIP_RESULT2
struct _WMI_SET_MARK * PWMI_SET_MARK
struct _WMI_OPEN_GUID_FOR_EVENTS * PWMI_OPEN_GUID_FOR_EVENTS
VOID NTAPI WmipNotificationIrpCancel(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: wmidrv.c:284
DRIVER_DISPATCH WmipShutdown
Definition: wmidrv.c:82
static NTSTATUS WmipUnregisterGuids(_In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:244
struct _WMI_SET_MARK WMI_SET_MARK
struct _WMI_OPEN_GUID_FOR_EVENTS WMI_OPEN_GUID_FOR_EVENTS
struct _WMI_UNREGISTER_GUID * PWMI_UNREGISTER_GUID
static NTSTATUS WmipOpenGuidForEvents(PVOID Buffer, ULONG InputLength, PULONG OutputLength)
Definition: wmidrv.c:383
struct _WMI_GUID_OBJECT_ENTRY * PWMI_GUID_OBJECT_ENTRY
struct _WMIP_REGISTER_GUIDS * PWMIP_REGISTER_GUIDS
struct _WMIP_REGISTER_GUIDS WMIP_REGISTER_GUIDS
struct _WMI_GUID_OBJECT_ENTRY WMI_GUID_OBJECT_ENTRY
#define IOCTL_WMI_TRACE_EVENT
Definition: wmiioctl.h:12
#define IOCTL_WMI_SET_MARK
Definition: wmiioctl.h:16
#define IOCTL_WMI_REGISTER_GUIDS
Definition: wmiioctl.h:30
#define IOCTL_WMI_TRACE_USER_MESSAGE
Definition: wmiioctl.h:15
#define IOCTL_WMI_UNREGISTER_GUIDS
Definition: wmiioctl.h:34
#define IOCTL_WMI_OPEN_GUID_FOR_EVENTS
Definition: wmiioctl.h:27
#define IOCTL_WMI_RECEIVE_NOTIFICATIONS
Definition: wmiioctl.h:28
struct _WMIP_IRP_CONTEXT * PWMIP_IRP_CONTEXT
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1206
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define WMIREG_ACTION_REGISTER
#define IRP_MJ_SYSTEM_CONTROL
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
#define ObDereferenceObject
Definition: obfuncs.h:203
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
__wchar_t WCHAR
Definition: xmlstorage.h:180