ReactOS  0.4.15-dev-2993-g14fbe80
plugplay.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * COPYRIGHT: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/io/pnpmgr/plugplay.c
5  * PURPOSE: Plug-and-play interface routines
6  * PROGRAMMERS: Eric Kohl <eric.kohl@t-online.de>
7  */
8 
9 /* INCLUDES *****************************************************************/
10 
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 typedef struct _PNP_EVENT_ENTRY
16 {
20 
21 
22 /* GLOBALS *******************************************************************/
23 
26 
27 /* FUNCTIONS *****************************************************************/
28 
31 {
33 
36  FALSE);
37 
38  return STATUS_SUCCESS;
39 }
40 
43  PUNICODE_STRING DeviceIds)
44 {
45  PPNP_EVENT_ENTRY EventEntry;
47  ULONG TotalSize;
49 
50  ASSERT(DeviceIds);
51 
52  /* Allocate a big enough buffer */
53  Copy.Length = 0;
54  Copy.MaximumLength = DeviceIds->Length + sizeof(UNICODE_NULL);
55  TotalSize =
57  Copy.MaximumLength;
58 
59  EventEntry = ExAllocatePool(NonPagedPool,
60  TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
61  if (!EventEntry)
63  RtlZeroMemory(EventEntry, TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
64 
65  /* Fill the buffer with the event GUID */
66  RtlCopyMemory(&EventEntry->Event.EventGuid,
67  Guid,
68  sizeof(GUID));
70  EventEntry->Event.TotalSize = TotalSize;
71 
72  /* Fill the device id */
73  Copy.Buffer = EventEntry->Event.TargetDevice.DeviceIds;
75  if (!NT_SUCCESS(Status))
76  {
77  ExFreePool(EventEntry);
78  return Status;
79  }
80 
82  &EventEntry->ListEntry);
84  0,
85  FALSE);
86 
87  return STATUS_SUCCESS;
88 }
89 
90 
91 static PDEVICE_OBJECT
93 {
95  PDEVICE_NODE ChildNode;
96 
97  if (RtlEqualUnicodeString(&Node->InstancePath,
99  {
100  ObReferenceObject(Node->PhysicalDeviceObject);
101  return Node->PhysicalDeviceObject;
102  }
103 
104  /* Traversal of all children nodes */
105  for (ChildNode = Node->Child;
106  ChildNode != NULL;
107  ChildNode = ChildNode->Sibling)
108  {
110  if (DeviceObject != NULL)
111  {
112  return DeviceObject;
113  }
114  }
115 
116  return NULL;
117 }
118 
119 
122 {
123  if (IopRootDeviceNode == NULL)
124  return NULL;
125 
126  if (DeviceInstance == NULL ||
127  DeviceInstance->Length == 0)
128  {
130  {
133  }
134  else
135  return NULL;
136  }
137 
139 }
140 
141 static NTSTATUS
143 {
145  volatile UNICODE_STRING Name;
146 
147  Name.Buffer = NULL;
148  _SEH2_TRY
149  {
150  Name.Length = SrcName->Length;
151  Name.MaximumLength = SrcName->MaximumLength;
152  if (Name.Length > Name.MaximumLength)
153  {
155  _SEH2_LEAVE;
156  }
157 
158  if (Name.MaximumLength)
159  {
160  ProbeForRead(SrcName->Buffer,
161  Name.MaximumLength,
162  sizeof(WCHAR));
163  Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
164  if (Name.Buffer == NULL)
165  {
167  _SEH2_LEAVE;
168  }
169 
170  memcpy(Name.Buffer, SrcName->Buffer, Name.MaximumLength);
171  }
172 
173  *DstName = Name;
174  }
176  {
177  if (Name.Buffer)
178  {
179  ExFreePool(Name.Buffer);
180  }
182  }
183  _SEH2_END;
184 
185  return Status;
186 }
187 
188 /*
189  * Remove the current PnP event from the tail of the event queue
190  * and signal IopPnpNotifyEvent if there is yet another event in the queue.
191  */
192 static
193 NTSTATUS
196 {
197  /* Remove a pnp event entry from the tail of the queue */
199  {
201  }
202 
203  /* Signal the next pnp event in the queue */
205  {
207  0,
208  FALSE);
209  }
210 
211  return STATUS_SUCCESS;
212 }
213 
214 
215 static NTSTATUS
217 {
222  GUID FilterGuid;
223  PZZWSTR SymbolicLinkList = NULL, LinkList;
225 
226  _SEH2_TRY
227  {
229 
230  ProbeForRead(StackList.FilterGuid, sizeof(GUID), sizeof(UCHAR));
231  RtlCopyMemory(&FilterGuid, StackList.FilterGuid, sizeof(GUID));
232 
233  if (StackList.Buffer != NULL && StackList.BufferSize != 0)
234  {
235  ProbeForWrite(StackList.Buffer, StackList.BufferSize, sizeof(UCHAR));
236  }
237  }
239  {
241  }
242  _SEH2_END;
243 
245  if (NT_SUCCESS(Status))
246  {
247  /* Get the device object */
249  if (DeviceInstance.Buffer != NULL)
250  {
252  }
253  }
254 
255  Status = IoGetDeviceInterfaces(&FilterGuid, DeviceObject, StackList.Flags, &SymbolicLinkList);
257 
258  if (!NT_SUCCESS(Status))
259  {
260  /* failed */
261  return Status;
262  }
263 
264  LinkList = SymbolicLinkList;
265  while (*SymbolicLinkList != UNICODE_NULL)
266  {
267  SymbolicLinkList += wcslen(SymbolicLinkList) + (sizeof(UNICODE_NULL) / sizeof(WCHAR));
268  }
269  TotalLength = ((SymbolicLinkList - LinkList + 1) * sizeof(WCHAR));
270 
271  _SEH2_TRY
272  {
273  if (StackList.Buffer != NULL &&
274  StackList.BufferSize >= TotalLength)
275  {
276  // We've already probed the buffer for writing above.
277  RtlCopyMemory(StackList.Buffer, LinkList, TotalLength);
278  }
279 
280  DeviceList->BufferSize = TotalLength;
281  }
283  {
284  ExFreePool(LinkList);
286  }
287  _SEH2_END;
288 
289  ExFreePool(LinkList);
290  return STATUS_SUCCESS;
291 }
292 
293 static NTSTATUS
295 {
300  ULONG Property;
302  PVOID Buffer;
304 
305  DPRINT("IopGetDeviceProperty() called\n");
306  DPRINT("Device name: %wZ\n", &PropertyData->DeviceInstance);
307 
309  if (!NT_SUCCESS(Status))
310  {
311  return Status;
312  }
313 
314  _SEH2_TRY
315  {
316  Property = PropertyData->Property;
317  BufferSize = PropertyData->BufferSize;
318  ProbeForWrite(PropertyData->Buffer,
319  BufferSize,
320  sizeof(UCHAR));
321  }
323  {
324  if (DeviceInstance.Buffer != NULL)
325  {
327  }
329  }
330  _SEH2_END;
331 
332  /* Get the device object */
334  if (DeviceInstance.Buffer != NULL)
335  {
337  }
338  if (DeviceObject == NULL)
339  {
340  return STATUS_NO_SUCH_DEVICE;
341  }
342 
344  if (Buffer == NULL)
345  {
348  }
349 
350 
351  DeviceNode = ((PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension)->DeviceNode;
352 
354  {
355  if (BufferSize < sizeof(CM_POWER_DATA))
356  {
357  BufferSize = 0;
359  }
360  else
361  {
363  PCM_POWER_DATA PowerData;
366 
367  PowerData = (PCM_POWER_DATA)Buffer;
368  RtlZeroMemory(PowerData, sizeof(CM_POWER_DATA));
369  PowerData->PD_Size = sizeof(CM_POWER_DATA);
370 
373  DeviceCapabilities.Version = 1;
374  DeviceCapabilities.Address = -1;
375  DeviceCapabilities.UINumber = -1;
376 
377  Stack.Parameters.DeviceCapabilities.Capabilities = &DeviceCapabilities;
378 
380  &IoStatusBlock,
382  &Stack);
383  if (NT_SUCCESS(Status))
384  {
385  DPRINT("Got device capabiliities\n");
386 
387  PowerData->PD_MostRecentPowerState = PowerDeviceD0; // FIXME
388  if (DeviceCapabilities.DeviceD1)
389  PowerData->PD_Capabilities |= PDCAP_D1_SUPPORTED;
390  if (DeviceCapabilities.DeviceD2)
391  PowerData->PD_Capabilities |= PDCAP_D2_SUPPORTED;
392  if (DeviceCapabilities.WakeFromD0)
394  if (DeviceCapabilities.WakeFromD1)
396  if (DeviceCapabilities.WakeFromD2)
398  if (DeviceCapabilities.WakeFromD3)
400  if (DeviceCapabilities.WarmEjectSupported)
402  PowerData->PD_D1Latency = DeviceCapabilities.D1Latency;
403  PowerData->PD_D2Latency = DeviceCapabilities.D2Latency;
404  PowerData->PD_D3Latency = DeviceCapabilities.D3Latency;
406  &DeviceCapabilities.DeviceState,
407  sizeof(DeviceCapabilities.DeviceState));
408  PowerData->PD_DeepestSystemWake = DeviceCapabilities.SystemWake;
409  }
410  else
411  {
412  DPRINT("IRP_MN_QUERY_CAPABILITIES failed (Status 0x%08lx)\n", Status);
413 
416  }
417  }
418  }
420  {
422  BufferSize = 0;
424  }
426  {
427  if (BufferSize < sizeof(DeviceNode->HardwareRemovalPolicy))
428  {
429  BufferSize = 0;
431  }
432  else
433  {
434  BufferSize = sizeof(DeviceNode->HardwareRemovalPolicy);
436  &DeviceNode->HardwareRemovalPolicy,
437  BufferSize);
438  }
439  }
440  else
441  {
442  switch (Property)
443  {
446  break;
447 
450  break;
451 
454  break;
455 
458  break;
459 
462  break;
463 
466  break;
467 
470  break;
471 
474  break;
475 
478  break;
479 
480 #if (WINVER >= _WIN32_WINNT_WS03)
483  BufferSize = 0;
485  break;
486 #endif
487 
488 #if (WINVER >= _WIN32_WINNT_WIN7)
491  break;
492 #endif
493 
494  default:
495  BufferSize = 0;
497  break;
498  }
499 
500  if (Status == STATUS_SUCCESS)
501  {
504  BufferSize,
505  Buffer,
506  &BufferSize);
507  }
508  }
509 
511 
512  if (NT_SUCCESS(Status))
513  {
514  _SEH2_TRY
515  {
517  PropertyData->BufferSize = BufferSize;
518  }
520  {
522  }
523  _SEH2_END;
524  }
525 
527  return Status;
528 }
529 
530 
531 static NTSTATUS
533 {
534  UNICODE_STRING RootDeviceName;
537  PDEVICE_NODE RelatedDeviceNode;
538  UNICODE_STRING TargetDeviceInstance;
540  ULONG Relation = 0;
541  ULONG MaximumLength = 0;
542 
543  DPRINT("IopGetRelatedDevice() called\n");
544  DPRINT("Device name: %wZ\n", &RelatedDeviceData->TargetDeviceInstance);
545 
546  Status = IopCaptureUnicodeString(&TargetDeviceInstance, &RelatedDeviceData->TargetDeviceInstance);
547  if (!NT_SUCCESS(Status))
548  {
549  return Status;
550  }
551 
552  _SEH2_TRY
553  {
554  Relation = RelatedDeviceData->Relation;
555  MaximumLength = RelatedDeviceData->RelatedDeviceInstanceLength;
556  ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance,
558  sizeof(WCHAR));
559  }
561  {
562  if (TargetDeviceInstance.Buffer != NULL)
563  {
564  ExFreePool(TargetDeviceInstance.Buffer);
565  }
567  }
568  _SEH2_END;
569 
570  RtlInitUnicodeString(&RootDeviceName,
571  L"HTREE\\ROOT\\0");
572  if (RtlEqualUnicodeString(&TargetDeviceInstance,
573  &RootDeviceName,
574  TRUE))
575  {
577  if (TargetDeviceInstance.Buffer != NULL)
578  {
579  ExFreePool(TargetDeviceInstance.Buffer);
580  }
581  }
582  else
583  {
584  /* Get the device object */
585  DeviceObject = IopGetDeviceObjectFromDeviceInstance(&TargetDeviceInstance);
586  if (TargetDeviceInstance.Buffer != NULL)
587  {
588  ExFreePool(TargetDeviceInstance.Buffer);
589  }
590  if (DeviceObject == NULL)
591  return STATUS_NO_SUCH_DEVICE;
592 
593  DeviceNode = ((PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension)->DeviceNode;
594  }
595 
596  switch (Relation)
597  {
599  RelatedDeviceNode = DeviceNode->Parent;
600  break;
601 
603  RelatedDeviceNode = DeviceNode->Child;
604  break;
605 
607  RelatedDeviceNode = DeviceNode->Sibling;
608  break;
609 
610  default:
611  if (DeviceObject != NULL)
612  {
614  }
615 
617  }
618 
619  if (RelatedDeviceNode == NULL)
620  {
621  if (DeviceObject)
622  {
624  }
625 
626  return STATUS_NO_SUCH_DEVICE;
627  }
628 
629  if (RelatedDeviceNode->InstancePath.Length > MaximumLength)
630  {
631  if (DeviceObject)
632  {
634  }
635 
637  }
638 
639  /* Copy related device instance name */
640  _SEH2_TRY
641  {
642  RtlCopyMemory(RelatedDeviceData->RelatedDeviceInstance,
643  RelatedDeviceNode->InstancePath.Buffer,
644  RelatedDeviceNode->InstancePath.Length);
645  RelatedDeviceData->RelatedDeviceInstanceLength = RelatedDeviceNode->InstancePath.Length;
646  }
648  {
650  }
651  _SEH2_END;
652 
653  if (DeviceObject != NULL)
654  {
656  }
657 
658  DPRINT("IopGetRelatedDevice() done\n");
659 
660  return Status;
661 }
662 
663 static
664 BOOLEAN
667 {
668  return (DeviceNode->State == DeviceNodeStartPending ||
671  DeviceNode->State == DeviceNodeStarted ||
675  DeviceNode->State == DeviceNodeStopped ||
677 }
678 
679 static ULONG
681 {
683 
684  if (DeviceNode->Parent == IopRootDeviceNode)
686 
687  // FIXME: review for deleted and removed states
688  if (DeviceNode->State >= DeviceNodeDriversAdded)
690 
692  Output |= DN_STARTED;
693 
694  if (DeviceNode->UserFlags & DNUF_WILL_BE_REMOVED)
696 
697  if (DeviceNode->Flags & DNF_HAS_PROBLEM)
699 
700  if (DeviceNode->Flags & DNF_HAS_PRIVATE_PROBLEM)
702 
703  if (DeviceNode->Flags & DNF_DRIVER_BLOCKED)
705 
708 
709  if (DeviceNode->Flags & DNF_HAS_PRIVATE_PROBLEM)
711 
712  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
714 
715  if (DeviceNode->UserFlags & DNUF_DONT_SHOW_IN_UI)
717 
718  if (!(DeviceNode->UserFlags & DNUF_NOT_DISABLEABLE))
720 
721  return Output;
722 }
723 
724 static NTSTATUS
726 {
729  ULONG Operation = 0;
730  ULONG DeviceStatus = 0;
731  ULONG DeviceProblem = 0;
734 
735  DPRINT("IopDeviceStatus() called\n");
736 
738  if (!NT_SUCCESS(Status))
739  {
740  return Status;
741  }
742 
743  DPRINT("Device name: '%wZ'\n", &DeviceInstance);
744 
745  _SEH2_TRY
746  {
747  Operation = StatusData->Operation;
749  {
750  DeviceStatus = StatusData->DeviceStatus;
751  DeviceProblem = StatusData->DeviceProblem;
752  }
753  }
755  {
756  if (DeviceInstance.Buffer != NULL)
757  {
759  }
761  }
762  _SEH2_END;
763 
764  /* Get the device object */
766  if (DeviceInstance.Buffer != NULL)
767  {
769  }
770  if (DeviceObject == NULL)
771  {
772  return STATUS_NO_SUCH_DEVICE;
773  }
774 
776 
777  switch (Operation)
778  {
780  DPRINT("Get status data\n");
781  DeviceStatus = IopGetDeviceNodeStatus(DeviceNode);
782  DeviceProblem = DeviceNode->Problem;
783  break;
784 
786  DPRINT1("Set status data is NOT SUPPORTED\n");
787  break;
788 
790  DPRINT1("FIXME: Clear status data!\n");
791  break;
792  }
793 
795 
797  {
798  _SEH2_TRY
799  {
800  StatusData->DeviceStatus = DeviceStatus;
801  StatusData->DeviceProblem = DeviceProblem;
802  }
804  {
806  }
807  _SEH2_END;
808  }
809 
810  return Status;
811 }
812 
813 static
814 NTSTATUS
816 {
821  PDEVICE_RELATIONS DeviceRelations = NULL;
822  PDEVICE_OBJECT ChildDeviceObject;
823  PDEVICE_NODE ChildDeviceNode;
824  ULONG i;
825  ULONG Relations;
827  ULONG BufferLeft;
828  PWCHAR Buffer, Ptr;
830 
831  DPRINT("IopGetDeviceRelations() called\n");
832  DPRINT("Device name: %wZ\n", &RelationsData->DeviceInstance);
833  DPRINT("Relations: %lu\n", RelationsData->Relations);
834  DPRINT("BufferSize: %lu\n", RelationsData->BufferSize);
835  DPRINT("Buffer: %p\n", RelationsData->Buffer);
836 
837  _SEH2_TRY
838  {
839  Relations = RelationsData->Relations;
840  BufferSize = RelationsData->BufferSize;
841  Buffer = RelationsData->Buffer;
842 
843  ProbeForWrite(Buffer, BufferSize, sizeof(CHAR));
844  }
846  {
848  }
849  _SEH2_END;
850 
852  if (!NT_SUCCESS(Status))
853  {
854  DPRINT1("IopCaptureUnicodeString() failed (Status 0x%08lx)\n", Status);
855  return Status;
856  }
857 
858  /* Get the device object */
860  if (DeviceObject == NULL)
861  {
862  DPRINT1("IopGetDeviceObjectFromDeviceInstance() returned NULL\n");
864  goto done;
865  }
866 
867  switch (Relations)
868  {
869  case PNP_EJECT_RELATIONS:
870  Stack.Parameters.QueryDeviceRelations.Type = EjectionRelations;
871  break;
872 
874  Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations;
875  break;
876 
877  case PNP_POWER_RELATIONS:
878  Stack.Parameters.QueryDeviceRelations.Type = PowerRelations;
879  break;
880 
881  case PNP_BUS_RELATIONS:
882  Stack.Parameters.QueryDeviceRelations.Type = BusRelations;
883  break;
884 
885  default:
887  goto done;
888  }
889 
891  &IoStatusBlock,
893  &Stack);
894  if (!NT_SUCCESS(Status))
895  {
896  DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status);
897  goto done;
898  }
899 
900  DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
901 
902  DPRINT("Found %d device relations\n", DeviceRelations->Count);
903 
904  _SEH2_TRY
905  {
906  RequiredSize = 0;
907  BufferLeft = BufferSize;
908  Ptr = Buffer;
909 
910  for (i = 0; i < DeviceRelations->Count; i++)
911  {
912  ChildDeviceObject = DeviceRelations->Objects[i];
913 
914  ChildDeviceNode = IopGetDeviceNode(ChildDeviceObject);
915  if (ChildDeviceNode)
916  {
917  DPRINT("Device instance: %wZ\n", &ChildDeviceNode->InstancePath);
918  DPRINT("RequiredSize: %hu\n", ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
919 
920  if (Ptr != NULL)
921  {
922  if (BufferLeft < ChildDeviceNode->InstancePath.Length + 2 * sizeof(WCHAR))
923  {
925  break;
926  }
927 
929  ChildDeviceNode->InstancePath.Buffer,
930  ChildDeviceNode->InstancePath.Length);
931  Ptr = (PWCHAR)((ULONG_PTR)Ptr + ChildDeviceNode->InstancePath.Length);
932  *Ptr = UNICODE_NULL;
933  Ptr = (PWCHAR)((ULONG_PTR)Ptr + sizeof(WCHAR));
934 
935  BufferLeft -= (ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
936  }
937 
938  RequiredSize += (ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
939  }
940  }
941 
942  if (Ptr != NULL && BufferLeft >= sizeof(WCHAR))
943  *Ptr = UNICODE_NULL;
944 
945  if (RequiredSize > 0)
946  RequiredSize += sizeof(WCHAR);
947 
948  DPRINT("BufferSize: %lu RequiredSize: %lu\n", RelationsData->BufferSize, RequiredSize);
949 
950  RelationsData->BufferSize = RequiredSize;
951  }
953  {
955  }
956  _SEH2_END;
957 
958 done:
959  if (DeviceRelations != NULL)
960  ExFreePool(DeviceRelations);
961 
962  if (DeviceObject != NULL)
964 
965  if (DeviceInstance.Buffer != NULL)
967 
968  return Status;
969 }
970 
971 static NTSTATUS
973 {
978 
979  DPRINT("IopGetDeviceDepth() called\n");
980  DPRINT("Device name: %wZ\n", &DepthData->DeviceInstance);
981 
983  if (!NT_SUCCESS(Status))
984  {
985  return Status;
986  }
987 
988  /* Get the device object */
990  if (DeviceInstance.Buffer != NULL)
991  {
993  }
994  if (DeviceObject == NULL)
995  {
996  return STATUS_NO_SUCH_DEVICE;
997  }
998 
1000 
1001  _SEH2_TRY
1002  {
1003  DepthData->Depth = DeviceNode->Level;
1004  }
1006  {
1008  }
1009  _SEH2_END;
1010 
1012 
1013  return Status;
1014 }
1015 
1016 static
1017 NTSTATUS
1021 {
1023  NTSTATUS Status;
1025 
1029 
1031  if (!NT_SUCCESS(Status))
1032  {
1033  return Status;
1034  }
1035 
1037  if (DeviceInstance.Buffer != NULL)
1038  {
1040  }
1041  if (DeviceObject == NULL)
1042  {
1043  return STATUS_NO_SUCH_DEVICE;
1044  }
1045 
1047 
1048  switch (ControlClass)
1049  {
1052  break;
1055  break;
1058  break;
1059  default:
1060  UNREACHABLE;
1061  break;
1062  }
1063 
1065 
1067 
1068  return Status;
1069 }
1070 
1071 /* PUBLIC FUNCTIONS **********************************************************/
1072 
1073 /*
1074  * Plug and Play event structure used by NtGetPlugPlayEvent.
1075  *
1076  * EventGuid
1077  * Can be one of the following values:
1078  * GUID_HWPROFILE_QUERY_CHANGE
1079  * GUID_HWPROFILE_CHANGE_CANCELLED
1080  * GUID_HWPROFILE_CHANGE_COMPLETE
1081  * GUID_TARGET_DEVICE_QUERY_REMOVE
1082  * GUID_TARGET_DEVICE_REMOVE_CANCELLED
1083  * GUID_TARGET_DEVICE_REMOVE_COMPLETE
1084  * GUID_PNP_CUSTOM_NOTIFICATION
1085  * GUID_PNP_POWER_NOTIFICATION
1086  * GUID_DEVICE_* (see above)
1087  *
1088  * EventCategory
1089  * Type of the event that happened.
1090  *
1091  * Result
1092  * ?
1093  *
1094  * Flags
1095  * ?
1096  *
1097  * TotalSize
1098  * Size of the event block including the device IDs and other
1099  * per category specific fields.
1100  */
1101 
1102 /*
1103  * NtGetPlugPlayEvent
1104  *
1105  * Returns one Plug & Play event from a global queue.
1106  *
1107  * Parameters
1108  * Reserved1
1109  * Reserved2
1110  * Always set to zero.
1111  *
1112  * Buffer
1113  * The buffer that will be filled with the event information on
1114  * successful return from the function.
1115  *
1116  * BufferSize
1117  * Size of the buffer pointed by the Buffer parameter. If the
1118  * buffer size is not large enough to hold the whole event
1119  * information, error STATUS_BUFFER_TOO_SMALL is returned and
1120  * the buffer remains untouched.
1121  *
1122  * Return Values
1123  * STATUS_PRIVILEGE_NOT_HELD
1124  * STATUS_BUFFER_TOO_SMALL
1125  * STATUS_SUCCESS
1126  *
1127  * Remarks
1128  * This function isn't multi-thread safe!
1129  *
1130  * @implemented
1131  */
1132 NTSTATUS
1133 NTAPI
1135  IN ULONG Reserved2,
1138 {
1140  NTSTATUS Status;
1141 
1142  DPRINT("NtGetPlugPlayEvent() called\n");
1143 
1144  /* Function can only be called from user-mode */
1145  if (KeGetPreviousMode() == KernelMode)
1146  {
1147  DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1148  return STATUS_ACCESS_DENIED;
1149  }
1150 
1151  /* Check for Tcb privilege */
1153  UserMode))
1154  {
1155  DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1157  }
1158 
1159  /* Wait for a PnP event */
1160  DPRINT("Waiting for pnp notification event\n");
1162  UserRequest,
1163  UserMode,
1164  FALSE,
1165  NULL);
1167  {
1168  DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status);
1170  return Status;
1171  }
1172 
1173  /* Get entry from the tail of the queue */
1176  ListEntry);
1177 
1178  /* Check the buffer size */
1179  if (BufferSize < Entry->Event.TotalSize)
1180  {
1181  DPRINT1("Buffer is too small for the pnp-event\n");
1182  return STATUS_BUFFER_TOO_SMALL;
1183  }
1184 
1185  /* Copy event data to the user buffer */
1186  _SEH2_TRY
1187  {
1189  Entry->Event.TotalSize,
1190  sizeof(UCHAR));
1192  &Entry->Event,
1193  Entry->Event.TotalSize);
1194  }
1196  {
1198  }
1199  _SEH2_END;
1200 
1201  DPRINT("NtGetPlugPlayEvent() done\n");
1202 
1203  return STATUS_SUCCESS;
1204 }
1205 
1206 /*
1207  * NtPlugPlayControl
1208  *
1209  * A function for doing various Plug & Play operations from user mode.
1210  *
1211  * Parameters
1212  * PlugPlayControlClass
1213  * 0x00 Reenumerate device tree
1214  *
1215  * Buffer points to UNICODE_STRING decribing the instance
1216  * path (like "HTREE\ROOT\0" or "Root\ACPI_HAL\0000"). For
1217  * more information about instance paths see !devnode command
1218  * in kernel debugger or look at "Inside Windows 2000" book,
1219  * chapter "Driver Loading, Initialization, and Installation".
1220  *
1221  * 0x01 Register new device
1222  * 0x02 Deregister device
1223  * 0x03 Initialize device
1224  * 0x04 Start device
1225  * 0x06 Query and remove device
1226  * 0x07 User response
1227  *
1228  * Called after processing the message from NtGetPlugPlayEvent.
1229  *
1230  * 0x08 Generate legacy device
1231  * 0x09 Get interface device list
1232  * 0x0A Get property data
1233  * 0x0B Device class association (Registration)
1234  * 0x0C Get related device
1235  * 0x0D Get device interface alias
1236  * 0x0E Get/set/clear device status
1237  * 0x0F Get device depth
1238  * 0x10 Query device relations
1239  * 0x11 Query target device relation
1240  * 0x12 Query conflict list
1241  * 0x13 Retrieve dock data
1242  * 0x14 Reset device
1243  * 0x15 Halt device
1244  * 0x16 Get blocked driver data
1245  *
1246  * Buffer
1247  * The buffer contains information that is specific to each control
1248  * code. The buffer is read-only.
1249  *
1250  * BufferSize
1251  * Size of the buffer pointed by the Buffer parameter. If the
1252  * buffer size specifies incorrect value for specified control
1253  * code, error ??? is returned.
1254  *
1255  * Return Values
1256  * STATUS_PRIVILEGE_NOT_HELD
1257  * STATUS_SUCCESS
1258  * ...
1259  *
1260  * @unimplemented
1261  */
1262 NTSTATUS
1263 NTAPI
1265  IN OUT PVOID Buffer,
1267 {
1268  DPRINT("NtPlugPlayControl(%d %p %lu) called\n",
1269  PlugPlayControlClass, Buffer, BufferLength);
1270 
1271  /* Function can only be called from user-mode */
1272  if (KeGetPreviousMode() == KernelMode)
1273  {
1274  DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1275  return STATUS_ACCESS_DENIED;
1276  }
1277 
1278  /* Check for Tcb privilege */
1280  UserMode))
1281  {
1282  DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1284  }
1285 
1286  /* Probe the buffer */
1287  _SEH2_TRY
1288  {
1290  BufferLength,
1291  sizeof(ULONG));
1292  }
1294  {
1296  }
1297  _SEH2_END;
1298 
1299  switch (PlugPlayControlClass)
1300  {
1303  return STATUS_INVALID_PARAMETER;
1304  // the Flags field is not used anyway
1306  PlugPlayControlClass);
1307 
1308 // case PlugPlayControlRegisterNewDevice:
1309 // case PlugPlayControlDeregisterDevice:
1310 // case PlugPlayControlInitializeDevice:
1311 
1315  return STATUS_INVALID_PARAMETER;
1317  PlugPlayControlClass);
1318 
1319 // case PlugPlayControlUnlockDevice:
1320 // case PlugPlayControlQueryAndRemoveDevice:
1321 
1324  return STATUS_INVALID_PARAMETER;
1326 
1327 // case PlugPlayControlGenerateLegacyDevice:
1328 
1331  return STATUS_INVALID_PARAMETER;
1333 
1336  return STATUS_INVALID_PARAMETER;
1338 
1339 // case PlugPlayControlDeviceClassAssociation:
1340 
1343  return STATUS_INVALID_PARAMETER;
1345 
1346 // case PlugPlayControlGetInterfaceDeviceAlias:
1347 
1350  return STATUS_INVALID_PARAMETER;
1352 
1355  return STATUS_INVALID_PARAMETER;
1357 
1360  return STATUS_INVALID_PARAMETER;
1362 
1363 // case PlugPlayControlTargetDeviceRelation:
1364 // case PlugPlayControlQueryConflictList:
1365 // case PlugPlayControlRetrieveDock:
1366 // case PlugPlayControlHaltDevice:
1367 // case PlugPlayControlGetBlockedDriverList:
1368 
1369  default:
1370  return STATUS_NOT_IMPLEMENTED;
1371  }
1372 
1373  return STATUS_NOT_IMPLEMENTED;
1374 }
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
static ULONG IopGetDeviceNodeStatus(PDEVICE_NODE DeviceNode)
Definition: plugplay.c:680
#define PNP_PROPERTY_POWER_DATA
Definition: cmtypes.h:39
#define IN
Definition: typedefs.h:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
#define PNP_REMOVAL_RELATIONS
Definition: cmtypes.h:67
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define PDCAP_WARM_EJECT_SUPPORTED
Definition: advprop.cpp:44
NTSTATUS IopInitPlugPlayEvents(VOID)
PDEVICE_OBJECT PhysicalDeviceObject
Definition: iotypes.h:850
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
#define DNF_HAS_PROBLEM
Definition: iotypes.h:183
struct _Entry Entry
Definition: kefuncs.h:627
static const WCHAR ControlClass[]
Definition: cfgmgr.c:44
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:690
static NTSTATUS IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
Definition: plugplay.c:532
#define DNUF_NOT_DISABLEABLE
Definition: iotypes.h:211
#define PDCAP_D1_SUPPORTED
Definition: advprop.cpp:37
#define PNP_POWER_RELATIONS
Definition: cmtypes.h:68
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define DN_ROOT_ENUMERATED
Definition: cfg.h:118
#define TRUE
Definition: types.h:120
Definition: plugplay.c:15
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define DN_DRIVER_BLOCKED
Definition: cfg.h:154
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
#define PNP_GET_SIBLING_DEVICE
Definition: cmtypes.h:54
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE PLIST_ENTRY RemoveTailList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:154
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define KeGetPreviousMode()
Definition: ketypes.h:1107
LONG NTSTATUS
Definition: precomp.h:26
#define DN_DRIVER_LOADED
Definition: cfg.h:119
#define DN_DISABLEABLE
Definition: cfg.h:131
PLUGPLAY_EVENT_BLOCK Event
Definition: plugplay.c:18
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
Definition: deviface.c:454
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:520
#define PNP_SET_DEVICE_STATUS
Definition: cmtypes.h:60
#define PNP_GET_PARENT_DEVICE
Definition: cmtypes.h:52
DEVICE_CAPABILITIES
Definition: iotypes.h:965
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
#define PNP_BUS_RELATIONS
Definition: cmtypes.h:69
PDEVICE_LIST DeviceList
Definition: utils.c:27
static LIST_ENTRY IopPnpEventQueueHead
Definition: plugplay.c:24
uint16_t * PWCHAR
Definition: typedefs.h:56
struct _PNP_EVENT_ENTRY PNP_EVENT_ENTRY
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:525
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
static NTSTATUS IopGetDeviceRelations(PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA RelationsData)
Definition: plugplay.c:815
_NullNull_terminated_ WCHAR * PZZWSTR
Definition: ntbasedef.h:420
_In_ ULONG TotalLength
Definition: usbdlib.h:158
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
static PDEVICE_OBJECT IopTraverseDeviceNode(PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:92
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
static NTSTATUS IopRemovePlugPlayEvent(_In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData)
Definition: plugplay.c:194
enum _PLUGPLAY_CONTROL_CLASS PLUGPLAY_CONTROL_CLASS
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSTATUS IopQueueTargetDeviceEvent(const GUID *Guid, PUNICODE_STRING DeviceIds)
Definition: plugplay.c:42
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
static NTSTATUS IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
Definition: plugplay.c:294
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
PLUGPLAY_EVENT_CATEGORY EventCategory
Definition: cmtypes.h:406
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
#define DNUF_DONT_SHOW_IN_UI
Definition: iotypes.h:209
NTSTATUS NTAPI NtGetPlugPlayEvent(IN ULONG Reserved1, IN ULONG Reserved2, OUT PPLUGPLAY_EVENT_BLOCK Buffer, IN ULONG BufferSize)
Definition: plugplay.c:1134
#define PDCAP_D2_SUPPORTED
Definition: advprop.cpp:38
ULONG PD_D2Latency
Definition: advprop.cpp:52
struct NameRec_ * Name
Definition: cdprocs.h:459
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
unsigned char BOOLEAN
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:121
#define _In_
Definition: ms_sal.h:308
#define PNP_PROPERTY_BUSTYPEGUID
Definition: cmtypes.h:36
#define DeviceCapabilities
Definition: wingdi.h:4448
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1952
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT
Definition: cmtypes.h:44
Definition: bufpool.h:45
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
#define PDCAP_D3_SUPPORTED
Definition: advprop.cpp:39
static KEVENT IopPnpNotifyEvent
Definition: plugplay.c:25
Definition: bcd.h:202
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
#define PNP_PROPERTY_ADDRESS
Definition: cmtypes.h:42
enum _DEVICE_ACTION DEVICE_ACTION
ULONG PD_D3Latency
Definition: advprop.cpp:53
NTSTATUS CODE_SEG("INIT")
Definition: plugplay.c:29
Status
Definition: gdiplustypes.h:24
#define PNP_PROPERTY_LOCATION_PATHS
Definition: cmtypes.h:46
#define PNP_PROPERTY_ENUMERATOR_NAME
Definition: cmtypes.h:43
#define DN_PRIVATE_PROBLEM
Definition: cfg.h:133
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
#define ASSERT(a)
Definition: mode.c:44
static BOOLEAN PiIsDevNodeStarted(_In_ PDEVICE_NODE DeviceNode)
Definition: plugplay.c:665
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PNP_GET_DEVICE_STATUS
Definition: cmtypes.h:59
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:760
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define PNP_PROPERTY_REMOVAL_POLICY
Definition: cmtypes.h:40
struct _PNP_EVENT_ENTRY * PPNP_EVENT_ENTRY
static NTSTATUS IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
Definition: plugplay.c:725
#define ObDereferenceObject
Definition: obfuncs.h:203
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define DN_NT_DRIVER
Definition: cfg.h:142
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define DN_NT_ENUMERATOR
Definition: cfg.h:141
Definition: Node.h:9
#define DNF_CHILD_WITH_INVALID_ID
Definition: iotypes.h:191
#define PNP_PROPERTY_UI_NUMBER
Definition: cmtypes.h:34
#define PNP_PROPERTY_REMOVAL_POLICY_OVERRIDE
Definition: cmtypes.h:41
unsigned char UCHAR
Definition: xmlstorage.h:181
#define PNP_CLEAR_DEVICE_STATUS
Definition: cmtypes.h:61
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static const WCHAR L[]
Definition: oid.c:1250
Definition: arc.h:85
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cmtypes.h:35
struct _PLUGPLAY_EVENT_BLOCK::@2329::@2332 TargetDevice
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:142
#define DNF_LEGACY_DRIVER
Definition: iotypes.h:182
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: typedefs.h:119
#define PNP_GET_CHILD_DEVICE
Definition: cmtypes.h:53
static NTSTATUS IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
Definition: plugplay.c:972
UNICODE_STRING InstancePath
Definition: iotypes.h:853
NTSTATUS PiPerformSyncDeviceAction(_In_ PDEVICE_OBJECT DeviceObject, _In_ DEVICE_ACTION Action)
Perfom a device operation synchronously via PiQueueDeviceAction.
Definition: devaction.c:2679
const LUID SeTcbPrivilege
Definition: priv.c:24
#define PDCAP_WAKE_FROM_D1_SUPPORTED
Definition: advprop.cpp:41
#define STATUS_USER_APC
Definition: ntstatus.h:78
_In_ DWORD Property
Definition: setupapi.h:1545
static NTSTATUS PiControlSyncDeviceAction(_In_ PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA DeviceData, _In_ PLUGPLAY_CONTROL_CLASS ControlClass)
Definition: plugplay.c:1018
ULONG_PTR SIZE_T
Definition: typedefs.h:80
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:126
SYSTEM_POWER_STATE PD_DeepestSystemWake
Definition: advprop.cpp:55
_SEH2_END
Definition: create.c:4400
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1264
LIST_ENTRY ListEntry
Definition: plugplay.c:17
ULONG PD_D1Latency
Definition: advprop.cpp:51
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
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
Definition: glfuncs.h:248
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
struct CM_Power_Data_s CM_POWER_DATA
struct CM_Power_Data_s * PCM_POWER_DATA
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define PNP_PROPERTY_LEGACYBUSTYPE
Definition: cmtypes.h:37
#define DNF_HAS_PRIVATE_PROBLEM
Definition: iotypes.h:184
#define NULL
Definition: types.h:112
#define IRP_MN_QUERY_DEVICE_RELATIONS
struct _DEVICE_NODE * Sibling
Definition: iotypes.h:834
Definition: bcd.h:201
DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum]
Definition: advprop.cpp:54
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
#define PNP_EJECT_RELATIONS
Definition: cmtypes.h:66
#define DN_LEGACY_DRIVER
Definition: cfg.h:155
#define DN_CHILD_WITH_INVALID_ID
Definition: cfg.h:156
#define PNP_PROPERTY_INSTALL_STATE
Definition: cmtypes.h:45
#define DN_STARTED
Definition: cfg.h:121
#define OUT
Definition: typedefs.h:40
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:115
#define UNREACHABLE
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define PDCAP_WAKE_FROM_D0_SUPPORTED
Definition: advprop.cpp:40
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1467
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define PNP_PROPERTY_BUSNUMBER
Definition: cmtypes.h:38
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
DEVICE_POWER_STATE PD_MostRecentPowerState
Definition: advprop.cpp:49
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define _SEH2_LEAVE
Definition: filesup.c:20
#define DPRINT
Definition: sndvol32.h:71
#define PDCAP_WAKE_FROM_D2_SUPPORTED
Definition: advprop.cpp:42
#define PNP_PROPERTY_CONTAINERID
Definition: cmtypes.h:47
#define DN_WILL_BE_REMOVED
Definition: cfg.h:136
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
static NTSTATUS IopGetInterfaceDeviceList(PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList)
Definition: plugplay.c:216
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:534
#define PDCAP_WAKE_FROM_D3_SUPPORTED
Definition: advprop.cpp:43
base of all file and directory entries
Definition: entries.h:82
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
ULONG PD_Capabilities
Definition: advprop.cpp:50
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
#define PDCAP_D0_SUPPORTED
Definition: advprop.cpp:36
#define DNF_DRIVER_BLOCKED
Definition: iotypes.h:190
#define IRP_MN_QUERY_CAPABILITIES
Definition: dlist.c:348
#define DNUF_WILL_BE_REMOVED
Definition: iotypes.h:208