ReactOS  0.4.14-dev-49-gfb4591c
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
20 typedef struct _WMIP_REGISTER_GUIDS
21 {
28 
31 
32 typedef struct _WMIP_RESULT
33 {
39 
40 typedef struct _WMI_UNREGISTER_GUID
41 {
48 
49 typedef struct _WMI_GUID_OBJECT_ENTRY
50 {
54 
55 typedef struct _WMI_NOTIFICATION
56 {
65 
66 typedef struct _WMI_SET_MARK
67 {
69  WCHAR Mark[1];
71 
75 
76 
77 /* FUNCTIONS *****************************************************************/
78 
83 
85 NTAPI
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 
99 static
100 NTSTATUS
104 {
106  return STATUS_SUCCESS;
107 }
108 
109 static
110 NTSTATUS
114 {
116  return STATUS_SUCCESS;
117 }
118 
119 static
120 NTSTATUS
122  _In_ POBJECT_ATTRIBUTES GuidObjectAttributes,
123  _Out_ POBJECT_ATTRIBUTES CapuredObjectAttributes,
124  _Out_ PUNICODE_STRING CapturedObjectName,
127 {
129 
130  _SEH2_TRY
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 
172 static
173 NTSTATUS
176  _In_ PVOID Buffer,
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,
211  PreviousMode);
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,
221  PreviousMode,
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 
242 static
243 NTSTATUS
245  _In_ PVOID Buffer,
246  _In_ ULONG InputLength,
247  _Inout_ PULONG OutputLength)
248 {
249  /* For now we have nothing to do */
250  return STATUS_SUCCESS;
251 }
252 
253 VOID
254 NTAPI
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 
282 VOID
283 NTAPI
286  _Inout_ PIRP Irp)
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 
300 static
301 VOID
303  PWMIP_IRP_CONTEXT IrpContext)
304 {
305  /* Initialize the list head for GUID objects */
307 }
308 
309 static
310 NTSTATUS
312  _Inout_ PIRP Irp,
313  _In_ PVOID Buffer,
314  _In_ ULONG InputLength,
315  _Inout_ PULONG OutputLength)
316 {
317  PWMI_NOTIFICATION Notification;
318  PWMIP_IRP_CONTEXT IrpContext;
320 
321  //__debugbreak();
322  if ((InputLength < sizeof(WMI_NOTIFICATION)) || (*OutputLength < 0x38))
323  {
325  }
326 
329  Notification = (PWMI_NOTIFICATION)Buffer;
330  DBG_UNREFERENCED_LOCAL_VARIABLE(Notification);
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 
373 typedef struct _WMIP_RESULT2
374 {
380 
381 static
382 NTSTATUS
384  PVOID Buffer,
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,
410  PreviousMode);
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,
420  PreviousMode,
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 
436 static
437 NTSTATUS
440  ULONG Length)
441 {
443  return STATUS_SUCCESS;
444 }
445 
446 NTSTATUS
447 NTAPI
450  _Inout_ PIRP Irp)
451 {
452  PIO_STACK_LOCATION IoStackLocation;
454  PVOID Buffer;
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 
510  case IOCTL_WMI_SET_MARK:
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 
539 NTSTATUS
540 NTAPI
543  _Inout_ PIRP Irp)
544 {
546  return STATUS_NOT_IMPLEMENTED;
547 }
548 
549 NTSTATUS
550 NTAPI
553  _Inout_ PIRP Irp)
554 {
555  Irp->IoStatus.Status = STATUS_SUCCESS;
557  return STATUS_SUCCESS;
558 }
559 
560 _Function_class_(FAST_IO_DEVICE_CONTROL)
562 BOOLEAN
563 NTAPI
564 WmipFastIoDeviceControl(
566  _In_ BOOLEAN Wait,
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 
604 NTSTATUS
605 NTAPI
609 {
611  return STATUS_NOT_IMPLEMENTED;
612 }
613 
614 _Function_class_(DRIVER_INITIALIZE)
616 NTSTATUS
617 NTAPI
618 WmipDriverEntry(
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 */
686 
687  /* Initialize fast dispatch */
690  WmipFastIoDispatch.FastIoDeviceControl = WmipFastIoDeviceControl;
692 
693  /* Register the WMI service device */
695 
696  /* Register a shutdown notification */
698 
699  /* Initialization is done */
702 
703  return STATUS_SUCCESS;
704 }
705 
706 
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1203
struct _WMIP_RESULT2 WMIP_RESULT2
static NTSTATUS WmipReceiveNotifications(_Inout_ PIRP Irp, _In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:311
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
#define IOCTL_WMI_RECEIVE_NOTIFICATIONS
Definition: wmiioctl.h:28
#define _IRQL_requires_same_
Definition: no_sal2.h:652
struct _WMI_OPEN_GUID_FOR_EVENTS WMI_OPEN_GUID_FOR_EVENTS
struct _WMIP_RESULT WMIP_RESULT
HANDLE Handle
Definition: wmidrv.c:34
ULONG Unknown04
Definition: wmidrv.c:52
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
ULONG64 TRACEHANDLE
Definition: evntrace.h:40
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
struct _WMI_NOTIFICATION * PWMI_NOTIFICATION
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: wmidrv.c:49
uint16_t * PWSTR
Definition: typedefs.h:54
struct _WMI_UNREGISTER_GUID * PWMI_UNREGISTER_GUID
LIST_ENTRY GuidObjectListHead
Definition: wmip.h:10
LONG NTSTATUS
Definition: precomp.h:26
struct _WMI_GUID_OBJECT_ENTRY WMI_GUID_OBJECT_ENTRY
ULONG Unknown10
Definition: wmidrv.c:61
PDEVICE_OBJECT WmipServiceDeviceObject
Definition: wmidrv.c:72
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
POBJECT_ATTRIBUTES ObjectAttributes
Definition: wmidrv.c:22
WMIREGINFOW RegInfo
Definition: wmidrv.c:29
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
struct _WMI_GUID_OBJECT_ENTRY * PWMI_GUID_OBJECT_ENTRY
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
IoSetCancelRoutine(Irp, CancelRoutine)
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
#define PAGED_CODE()
Definition: video.h:57
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define IOCTL_WMI_TRACE_EVENT
Definition: wmiioctl.h:12
#define _In_opt_
Definition: no_sal2.h:213
struct _WMI_OPEN_GUID_FOR_EVENTS * PWMI_OPEN_GUID_FOR_EVENTS
struct _WMI_SET_MARK * PWMI_SET_MARK
_SEH2_TRY
Definition: create.c:4250
struct _WMIP_IRP_CONTEXT * PWMIP_IRP_CONTEXT
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
struct _WMIP_RESULT * PWMIP_RESULT
ULONG GuidCount
Definition: wmistr.h:97
#define IOCTL_WMI_UNREGISTER_GUIDS
Definition: wmiioctl.h:34
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
HANDLE Handle
Definition: wmidrv.c:51
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
_In_z_ PCCHAR ObjectNameBuffer
Definition: classpnp.h:789
smooth NULL
Definition: ftsmooth.c:416
_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:426
struct _WMI_SET_MARK WMI_SET_MARK
#define _Out_
Definition: no_sal2.h:323
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
static NTSTATUS WmipOpenGuidForEvents(PVOID Buffer, ULONG InputLength, PULONG OutputLength)
Definition: wmidrv.c:383
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ULONG Unknown14
Definition: wmidrv.c:62
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
ULONG Unknown04
Definition: wmidrv.c:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG Unknown0C
Definition: wmidrv.c:378
NTSTATUS NTAPI IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG Action)
Definition: wmi.c:68
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:326
#define _Out_opt_
Definition: no_sal2.h:339
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define WMIREG_ACTION_REGISTER
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
PDEVICE_OBJECT WmipAdminDeviceObject
Definition: wmidrv.c:73
BOOLEAN Unknown10
Definition: wmidrv.c:37
static VOID Mark(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:289
DRIVER_DISPATCH WmipIoControl
Definition: wmidrv.c:80
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
NTSTATUS NTAPI WmipOpenGuidObjectByName(_In_ POBJECT_ATTRIBUTES ObjectAttributes, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
Definition: guidobj.c:261
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IOCTL_WMI_OPEN_GUID_FOR_EVENTS
Definition: wmiioctl.h:27
struct _WMIP_REGISTER_GUIDS * PWMIP_REGISTER_GUIDS
_Function_class_(FAST_IO_DEVICE_CONTROL)
Definition: wmidrv.c:560
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
ULONG NumberOfGuidObjects
Definition: wmidrv.c:57
TRACEHANDLE TraceHandle
Definition: wmidrv.c:36
#define for
Definition: utility.h:88
#define SPECIFIC_RIGHTS_ALL
Definition: nt_native.h:71
#define _Inout_
Definition: no_sal2.h:244
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
* PFILE_OBJECT
Definition: iotypes.h:1955
#define IOCTL_WMI_REGISTER_GUIDS
Definition: wmiioctl.h:30
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
DRIVER_DISPATCH WmipOpenCloseCleanup
Definition: wmidrv.c:79
WMI_GUID_OBJECT_ENTRY GuidObjects[0]
Definition: wmidrv.c:63
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
ACCESS_MASK DesiredAccess
Definition: wmidrv.c:368
static const WCHAR L[]
Definition: oid.c:1250
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl
Definition: iotypes.h:1700
struct _WMIP_REGISTER_GUIDS WMIP_REGISTER_GUIDS
static NTSTATUS WmiSetMark(PWMI_SET_MARK Buffer, ULONG Length)
Definition: wmidrv.c:438
Definition: typedefs.h:117
DRIVER_DISPATCH(nfs41_FsdDispatch)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
#define IRP_MJ_SYSTEM_CONTROL
ULONG Unknown04
Definition: wmidrv.c:58
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
WCHAR Mark[1]
Definition: wmidrv.c:69
Status
Definition: gdiplustypes.h:24
ULONG Unknown08
Definition: wmidrv.c:59
#define _In_
Definition: no_sal2.h:204
ULONG Flags
Definition: wmidrv.c:68
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
DRIVER_DISPATCH WmipSystemControl
Definition: wmidrv.c:81
_SEH2_END
Definition: create.c:4424
ULONG BufferSize
Definition: wmistr.h:93
static NTSTATUS WmiTraceEvent(PVOID InputBuffer, KPROCESSOR_MODE PreviousMode)
Definition: wmidrv.c:101
ULONG Unknown00
Definition: wmidrv.c:375
FAST_IO_DISPATCH WmipFastIoDispatch
Definition: wmidrv.c:74
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int * PULONG
Definition: retypes.h:1
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:139
static VOID WmipInitializeIrpContext(PWMIP_IRP_CONTEXT IrpContext)
Definition: wmidrv.c:302
POBJECT_ATTRIBUTES ObjectAttributes
Definition: wmidrv.c:367
HANDLE Handle
Definition: wmidrv.c:377
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1694
struct _FAST_IO_DISPATCH * FastIoDispatch
Definition: iotypes.h:2177
DRIVER_DISPATCH WmipShutdown
Definition: wmidrv.c:82
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
ULONG Unknown04
Definition: wmidrv.c:376
struct _WMI_UNREGISTER_GUID WMI_UNREGISTER_GUID
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
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
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static NTSTATUS WmipRegisterGuids(_In_ PDEVICE_OBJECT DeviceObject, _In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:174
NTSTATUS NTAPI WmipDockUndockEventCallback(_In_ PVOID NotificationStructure, _Inout_opt_ PVOID Context)
Definition: wmidrv.c:606
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
ULONG Unknown0C
Definition: wmidrv.c:60
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
VOID NTAPI WmipClearIrpObjectList(_In_ PIRP Irp)
Definition: wmidrv.c:255
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
IoMarkIrpPending(Irp)
static NTSTATUS WmiTraceUserMessage(PVOID InputBuffer, ULONG InputBufferLength)
Definition: wmidrv.c:111
struct _WMI_NOTIFICATION WMI_NOTIFICATION
VOID NTAPI WmipNotificationIrpCancel(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: wmidrv.c:284
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define IOCTL_WMI_TRACE_USER_MESSAGE
Definition: wmiioctl.h:15
struct _WMIP_RESULT2 * PWMIP_RESULT2
#define _Inout_opt_
Definition: no_sal2.h:258
#define IOCTL_WMI_SET_MARK
Definition: wmiioctl.h:16
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1690
static NTSTATUS WmipUnregisterGuids(_In_ PVOID Buffer, _In_ ULONG InputLength, _Inout_ PULONG OutputLength)
Definition: wmidrv.c:244
IN BOOLEAN Wait
Definition: fatprocs.h:1529
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14