ReactOS  0.4.15-dev-2701-g34593d9
halpnpdd.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS HAL
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: hal/halx86/acpi/halpnpdd.c
5  * PURPOSE: HAL Plug and Play Device Driver
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <hal.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 typedef enum _EXTENSION_TYPE
16 {
20 
21 typedef enum _PDO_TYPE
22 {
23  AcpiPdo = 0x80,
25 } PDO_TYPE;
26 
27 typedef struct _FDO_EXTENSION
28 {
35 
36 typedef struct _PDO_EXTENSION
37 {
46 
47 /* GLOBALS ********************************************************************/
48 
50 
51 /* PRIVATE FUNCTIONS **********************************************************/
52 
54 NTAPI
57 {
61  PDEVICE_OBJECT DeviceObject, AttachedDevice;
64 
65  DPRINT("HAL: PnP Driver ADD!\n");
66 
67  /* Create the FDO */
69  sizeof(FDO_EXTENSION),
70  NULL,
72  0,
73  FALSE,
74  &DeviceObject);
75  if (!NT_SUCCESS(Status))
76  {
77  /* Should not happen */
78  DbgBreakPoint();
79  return Status;
80  }
81 
82  /* Setup the FDO extension */
83  FdoExtension = DeviceObject->DeviceExtension;
84  FdoExtension->ExtensionType = FdoExtensionType;
85  FdoExtension->PhysicalDeviceObject = TargetDevice;
86  FdoExtension->FunctionalDeviceObject = DeviceObject;
87  FdoExtension->ChildPdoList = NULL;
88 
89  /* FDO is done initializing */
91 
92  /* Attach to the physical device object (the bus) */
94  if (!AttachedDevice)
95  {
96  /* Failed, undo everything */
98  return STATUS_NO_SUCH_DEVICE;
99  }
100 
101  /* Save the attachment */
102  FdoExtension->AttachedDeviceObject = AttachedDevice;
103 
104  /* Create the PDO */
106  sizeof(PDO_EXTENSION),
107  NULL,
110  FALSE,
111  &PdoDeviceObject);
112  if (!NT_SUCCESS(Status))
113  {
114  /* Fail */
115  DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
116  return Status;
117  }
118 
119  /* Setup the PDO device extension */
120  PdoExtension = PdoDeviceObject->DeviceExtension;
121  PdoExtension->ExtensionType = PdoExtensionType;
122  PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
123  PdoExtension->ParentFdoExtension = FdoExtension;
124  PdoExtension->PdoType = AcpiPdo;
125 
126  /* Add the PDO to the head of the list */
127  PdoExtension->Next = FdoExtension->ChildPdoList;
128  FdoExtension->ChildPdoList = PdoExtension;
129 
130  /* Initialization is finished */
132 
133  /* Find the ACPI watchdog table */
134  Wdrt = HalAcpiGetTable(0, 'TRDW');
135  if (Wdrt)
136  {
137  /* FIXME: TODO */
138  DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
139  }
140 
141  /* Return status */
142  DPRINT("Device added %lx\n", Status);
143  return Status;
144 }
145 
146 NTSTATUS
147 NTAPI
150  IN USHORT Version,
152  IN ULONG InterfaceBufferSize,
154  OUT PULONG Length)
155 {
157  return STATUS_NOT_SUPPORTED;
158 }
159 
160 NTSTATUS
161 NTAPI
164  OUT PDEVICE_RELATIONS* DeviceRelations)
165 {
169  PDEVICE_RELATIONS PdoRelations, FdoRelations;
170  PDEVICE_OBJECT* ObjectEntry;
171  ULONG i = 0, PdoCount = 0;
172 
173  /* Get FDO device extension and PDO count */
174  FdoExtension = DeviceObject->DeviceExtension;
175  ExtensionType = FdoExtension->ExtensionType;
176 
177  /* What do they want? */
178  if (RelationType == BusRelations)
179  {
180  /* This better be an FDO */
182  {
183  /* Count how many PDOs we have */
184  PdoExtension = FdoExtension->ChildPdoList;
185  while (PdoExtension)
186  {
187  /* Next one */
188  PdoExtension = PdoExtension->Next;
189  PdoCount++;
190  }
191 
192  /* Add the PDOs that already exist in the device relations */
193  if (*DeviceRelations)
194  {
195  PdoCount += (*DeviceRelations)->Count;
196  }
197 
198  /* Allocate our structure */
199  FdoRelations = ExAllocatePoolWithTag(PagedPool,
201  Objects) +
202  sizeof(PDEVICE_OBJECT) * PdoCount,
203  TAG_HAL);
204  if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
205 
206  /* Save our count */
207  FdoRelations->Count = PdoCount;
208 
209  /* Query existing relations */
210  ObjectEntry = FdoRelations->Objects;
211  if (*DeviceRelations)
212  {
213  /* Check if there were any */
214  if ((*DeviceRelations)->Count)
215  {
216  /* Loop them all */
217  do
218  {
219  /* Copy into our structure */
220  *ObjectEntry++ = (*DeviceRelations)->Objects[i];
221  }
222  while (++i < (*DeviceRelations)->Count);
223  }
224 
225  /* Free existing structure */
226  ExFreePool(*DeviceRelations);
227  }
228 
229  /* Now check if we have a PDO list */
230  PdoExtension = FdoExtension->ChildPdoList;
231  if (PdoExtension)
232  {
233  /* Loop the PDOs */
234  do
235  {
236  /* Save our own PDO and reference it */
237  *ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
238  ObReferenceObject(PdoExtension->PhysicalDeviceObject);
239 
240  /* Go to our next PDO */
241  PdoExtension = PdoExtension->Next;
242  }
243  while (PdoExtension);
244  }
245 
246  /* Return the new structure */
247  *DeviceRelations = FdoRelations;
248  return STATUS_SUCCESS;
249  }
250  }
251  else
252  {
253  /* The only other thing we support is a target relation for the PDO */
256  {
257  /* Only one entry */
258  PdoRelations = ExAllocatePoolWithTag(PagedPool,
259  sizeof(DEVICE_RELATIONS),
260  TAG_HAL);
261  if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
262 
263  /* Fill it out and reference us */
264  PdoRelations->Count = 1;
265  PdoRelations->Objects[0] = DeviceObject;
267 
268  /* Return it */
269  *DeviceRelations = PdoRelations;
270  return STATUS_SUCCESS;
271  }
272  }
273 
274  /* We don't support anything else */
275  return STATUS_NOT_SUPPORTED;
276 }
277 
278 NTSTATUS
279 NTAPI
282 {
283  //PPDO_EXTENSION PdoExtension;
285  PAGED_CODE();
286 
287  /* Get the extension and check for valid version */
288  //PdoExtension = DeviceObject->DeviceExtension;
289  ASSERT(Capabilities->Version == 1);
290  if (Capabilities->Version == 1)
291  {
292  /* Can't lock or eject us */
293  Capabilities->LockSupported = FALSE;
294  Capabilities->EjectSupported = FALSE;
295 
296  /* Can't remove or dock us */
297  Capabilities->Removable = FALSE;
298  Capabilities->DockDevice = FALSE;
299 
300  /* Can't access us raw */
301  Capabilities->RawDeviceOK = FALSE;
302 
303  /* We have a unique ID, and don't bother the user */
304  Capabilities->UniqueID = TRUE;
305  Capabilities->SilentInstall = TRUE;
306 
307  /* Fill out the adress */
310 
311  /* Fill out latencies */
312  Capabilities->D1Latency = 0;
313  Capabilities->D2Latency = 0;
314  Capabilities->D3Latency = 0;
315 
316  /* Fill out supported device states */
321 
322  /* Done */
324  }
325  else
326  {
327  /* Fail */
329  }
330 
331  /* Return status */
332  return Status;
333 }
334 
335 NTSTATUS
336 NTAPI
339 {
340  PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
346  ULONG i;
347  PAGED_CODE();
348 
349  /* Only the ACPI PDO has requirements */
350  if (DeviceExtension->PdoType == AcpiPdo)
351  {
352  /* Query ACPI requirements */
354  if (!NT_SUCCESS(Status)) return Status;
355 
356  ASSERT(RequirementsList->AlternativeLists == 1);
357 
358  /* Allocate the resourcel ist */
360  sizeof(CM_RESOURCE_LIST),
361  TAG_HAL);
362  if (!ResourceList )
363  {
364  /* Fail, no memory */
367  return Status;
368  }
369 
370  /* Initialize it */
372  ResourceList->Count = 1;
373 
374  /* Setup the list fields */
375  ResourceList->List[0].BusNumber = -1;
376  ResourceList->List[0].InterfaceType = PNPBus;
377  ResourceList->List[0].PartialResourceList.Version = 1;
378  ResourceList->List[0].PartialResourceList.Revision = 1;
379  ResourceList->List[0].PartialResourceList.Count = 0;
380 
381  /* Setup the first descriptor */
382  PartialDesc = ResourceList->List[0].PartialResourceList.PartialDescriptors;
383 
384  /* Find the requirement descriptor for the SCI */
385  for (i = 0; i < RequirementsList->List[0].Count; i++)
386  {
387  /* Get this descriptor */
388  Descriptor = &RequirementsList->List[0].Descriptors[i];
389  if (Descriptor->Type == CmResourceTypeInterrupt)
390  {
391  /* Copy requirements descriptor into resource descriptor */
392  PartialDesc->Type = CmResourceTypeInterrupt;
393  PartialDesc->ShareDisposition = Descriptor->ShareDisposition;
394  PartialDesc->Flags = Descriptor->Flags;
395  ASSERT(Descriptor->u.Interrupt.MinimumVector ==
396  Descriptor->u.Interrupt.MaximumVector);
397  PartialDesc->u.Interrupt.Vector = Descriptor->u.Interrupt.MinimumVector;
398  PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector;
399  PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF;
400 
401  ResourceList->List[0].PartialResourceList.Count++;
402 
403  break;
404  }
405  }
406 
407  /* Return resources and success */
409 
411 
412  return STATUS_SUCCESS;
413  }
414  else if (DeviceExtension->PdoType == WdPdo)
415  {
416  /* Watchdog doesn't */
417  return STATUS_NOT_SUPPORTED;
418  }
419  else
420  {
421  /* This shouldn't happen */
422  return STATUS_UNSUCCESSFUL;
423  }
424 }
425 
426 NTSTATUS
427 NTAPI
429  OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
430 {
431  PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
432  PAGED_CODE();
433 
434  /* Only the ACPI PDO has requirements */
435  if (DeviceExtension->PdoType == AcpiPdo)
436  {
437  /* Query ACPI requirements */
438  return HalpQueryAcpiResourceRequirements(Requirements);
439  }
440  else if (DeviceExtension->PdoType == WdPdo)
441  {
442  /* Watchdog doesn't */
443  return STATUS_NOT_SUPPORTED;
444  }
445  else
446  {
447  /* This shouldn't happen */
448  return STATUS_UNSUCCESSFUL;
449  }
450 }
451 
452 NTSTATUS
453 NTAPI
456  OUT PUSHORT *BusQueryId)
457 {
460  PWCHAR CurrentId;
461  WCHAR Id[100];
463  SIZE_T Length = 0;
464  PWCHAR Buffer;
465 
466  /* Get the PDO type */
467  PdoExtension = DeviceObject->DeviceExtension;
468  PdoType = PdoExtension->PdoType;
469 
470  /* What kind of ID is being requested? */
471  DPRINT("ID: %d\n", IdType);
472  switch (IdType)
473  {
474  case BusQueryDeviceID:
475  case BusQueryHardwareIDs:
476 
477  /* What kind of PDO is this? */
478  if (PdoType == AcpiPdo)
479  {
480  /* ACPI ID */
481  CurrentId = L"ACPI_HAL\\PNP0C08";
482  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
483  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
484 
485  CurrentId = L"*PNP0C08";
486  RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
487  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
488  }
489  else if (PdoType == WdPdo)
490  {
491  /* WatchDog ID */
492  CurrentId = L"ACPI_HAL\\PNP0C18";
493  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
494  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
495 
496  CurrentId = L"*PNP0C18";
497  RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
498  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
499  }
500  else
501  {
502  /* Unknown */
503  return STATUS_NOT_SUPPORTED;
504  }
505  break;
506 
507  case BusQueryInstanceID:
508 
509  /* Instance ID */
510  CurrentId = L"0";
511  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
512  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
513  break;
514 
516  default:
517 
518  /* We don't support anything else */
519  return STATUS_NOT_SUPPORTED;
520  }
521 
522 
523  /* Allocate the buffer */
525  Length + sizeof(UNICODE_NULL),
526  TAG_HAL);
527  if (Buffer)
528  {
529  /* Copy the string and null-terminate it */
531  Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
532 
533  /* Return string */
534  *BusQueryId = Buffer;
536  DPRINT("Returning: %S\n", *BusQueryId);
537  }
538  else
539  {
540  /* Fail */
542  }
543 
544  /* Return status */
545  return Status;
546 }
547 
548 NTSTATUS
549 NTAPI
552  OUT PUSHORT *BusQueryId)
553 {
555  SIZE_T Length;
556  PWCHAR Id;
557  PWCHAR Buffer;
558 
559  /* What kind of ID is being requested? */
560  DPRINT("ID: %d\n", IdType);
561  switch (IdType)
562  {
563  case BusQueryDeviceID:
564  case BusQueryHardwareIDs:
565 
566  /* This is our hardware ID */
568  break;
569 
570  case BusQueryInstanceID:
571 
572  /* And our instance ID */
573  Id = L"0";
574  break;
575 
576  default:
577 
578  /* We don't support anything else */
579  return STATUS_NOT_SUPPORTED;
580  }
581 
582  /* Calculate the length */
583  Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
584 
585  /* Allocate the buffer */
587  Length + sizeof(UNICODE_NULL),
588  TAG_HAL);
589  if (Buffer)
590  {
591  /* Copy the string and null-terminate it */
593  Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
594 
595  /* Return string */
596  *BusQueryId = Buffer;
598  DPRINT("Returning: %S\n", *BusQueryId);
599  }
600  else
601  {
602  /* Fail */
604  }
605 
606  /* Return status */
607  return Status;
608 }
609 
610 NTSTATUS
611 NTAPI
613  IN PIRP Irp)
614 {
615  PIO_STACK_LOCATION IoStackLocation;
616  //PPDO_EXTENSION PdoExtension;
619  UCHAR Minor;
620 
621  /* Get the device extension and stack location */
622  FdoExtension = DeviceObject->DeviceExtension;
623  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
624  Minor = IoStackLocation->MinorFunction;
625 
626  /* FDO? */
627  if (FdoExtension->ExtensionType == FdoExtensionType)
628  {
629  /* Query the IRP type */
630  switch (Minor)
631  {
633 
634  /* Call the worker */
635  DPRINT("Querying device relations for FDO\n");
637  IoStackLocation->Parameters.QueryDeviceRelations.Type,
638  (PVOID)&Irp->IoStatus.Information);
639  break;
640 
642 
643  /* Call the worker */
644  DPRINT("Querying interface for FDO\n");
646  IoStackLocation->Parameters.QueryInterface.InterfaceType,
647  IoStackLocation->Parameters.QueryInterface.Size,
648  IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
649  IoStackLocation->Parameters.QueryInterface.Version,
650  IoStackLocation->Parameters.QueryInterface.Interface,
651  (PVOID)&Irp->IoStatus.Information);
652  break;
653 
654 
655  case IRP_MN_QUERY_ID:
656 
657  /* Call the worker */
658  DPRINT("Querying ID for FDO\n");
660  IoStackLocation->Parameters.QueryId.IdType,
661  (PVOID)&Irp->IoStatus.Information);
662  break;
663 
665 
666  /* Call the worker */
667  DPRINT("Querying the capabilities for the FDO\n");
669  IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
670  break;
671 
672  default:
673 
674  DPRINT("Other IRP: %lx\n", Minor);
676  break;
677  }
678 
679  /* What happpened? */
681  {
682  /* Set the IRP status, unless this isn't understood */
684  {
685  Irp->IoStatus.Status = Status;
686  }
687 
688  /* Pass it on */
690  return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
691  }
692 
693  /* Otherwise, we failed, so set the status and complete the request */
694  DPRINT1("IRP failed with status: %lx\n", Status);
695  Irp->IoStatus.Status = Status;
697  return Status;
698  }
699  else
700  {
701  /* This is a PDO instead */
702  ASSERT(FdoExtension->ExtensionType == PdoExtensionType);
703  //PdoExtension = (PPDO_EXTENSION)FdoExtension;
704  /* Query the IRP type */
706  switch (Minor)
707  {
708  case IRP_MN_START_DEVICE:
709 
710  /* We only care about a PCI PDO */
711  DPRINT1("Start device received\n");
712  /* Complete the IRP normally */
713  break;
714 
716 
717  /* Check if this is a PCI device */
718  DPRINT1("Remove device received\n");
719 
720  /* We're done */
722  break;
723 
725 
726  /* Inherit whatever status we had */
727  DPRINT1("Surprise removal IRP\n");
728  Status = Irp->IoStatus.Status;
729  break;
730 
732 
733  /* Query the device relations */
734  DPRINT("Querying PDO relations\n");
736  IoStackLocation->Parameters.QueryDeviceRelations.Type,
737  (PVOID)&Irp->IoStatus.Information);
738  break;
739 
741 
742  /* Call the worker */
743  DPRINT("Querying interface for PDO\n");
745  IoStackLocation->Parameters.QueryInterface.InterfaceType,
746  IoStackLocation->Parameters.QueryInterface.Size,
747  IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
748  IoStackLocation->Parameters.QueryInterface.Version,
749  IoStackLocation->Parameters.QueryInterface.Interface,
750  (PVOID)&Irp->IoStatus.Information);
751  break;
752 
754 
755  /* Call the worker */
756  DPRINT("Querying the capabilities for the PDO\n");
758  IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
759  break;
760 
762 
763  /* Call the worker */
764  DPRINT("Querying the resources for the PDO\n");
765  Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
766  break;
767 
769 
770  /* Call the worker */
771  DPRINT("Querying the resource requirements for the PDO\n");
773  (PVOID)&Irp->IoStatus.Information);
774  break;
775 
776  case IRP_MN_QUERY_ID:
777 
778  /* Call the worker */
779  DPRINT("Query the ID for the PDO\n");
781  IoStackLocation->Parameters.QueryId.IdType,
782  (PVOID)&Irp->IoStatus.Information);
783  break;
784 
785  default:
786 
787  /* We don't handle anything else, so inherit the old state */
788  DPRINT("Illegal IRP: %lx\n", Minor);
789  Status = Irp->IoStatus.Status;
790  break;
791  }
792 
793  /* If it's not supported, inherit the old status */
794  if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
795 
796  /* Complete the IRP */
797  DPRINT("IRP completed with status: %lx\n", Status);
798  Irp->IoStatus.Status = Status;
800  return Status;
801  }
802 }
803 
804 NTSTATUS
805 NTAPI
807  IN PIRP Irp)
808 {
809  UNIMPLEMENTED_DBGBREAK("HAL: PnP Driver WMI!\n");
810  return STATUS_SUCCESS;
811 }
812 
813 NTSTATUS
814 NTAPI
816  IN PIRP Irp)
817 {
819 
820  DPRINT("HAL: PnP Driver Power!\n");
821  FdoExtension = DeviceObject->DeviceExtension;
822  if (FdoExtension->ExtensionType == FdoExtensionType)
823  {
826  return PoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
827  }
828  else
829  {
831  Irp->IoStatus.Status = STATUS_SUCCESS;
833  return STATUS_SUCCESS;
834  }
835 }
836 
837 NTSTATUS
838 NTAPI
841 {
844 
845  DPRINT("HAL: PnP Driver ENTRY!\n");
846 
847  /* This is us */
849 
850  /* Set up add device */
852 
853  /* Set up the callouts */
854  DriverObject->MajorFunction[IRP_MJ_PNP] = HalpDispatchPnp;
855  DriverObject->MajorFunction[IRP_MJ_POWER] = HalpDispatchPower;
857 
858  /* Create the PDO and tell the PnP manager about us*/
861  -1,
862  -1,
863  NULL,
864  NULL,
865  FALSE,
866  &TargetDevice);
867  if (!NT_SUCCESS(Status))
868  return Status;
869 
871 
872  /* Set up the device stack */
874  if (!NT_SUCCESS(Status))
875  {
877  return Status;
878  }
879 
880  /* Return to kernel */
881  return Status;
882 }
883 
884 NTSTATUS
885 NTAPI
887 {
889  UNICODE_STRING DriverString;
890  PAGED_CODE();
891 
892  /* Create the driver */
893  RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
894  Status = IoCreateDriver(&DriverString, HalpDriverEntry);
895 
896  /* Return status */
897  return Status;
898 }
899 
900 /* EOF */
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@377::@380 Interrupt
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
NTSTATUS NTAPI HalpQueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID *InterfaceType, IN USHORT Version, IN PVOID InterfaceSpecificData, IN ULONG InterfaceBufferSize, IN PINTERFACE Interface, OUT PULONG Length)
Definition: halpnpdd.c:148
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44
NTSTATUS NTAPI HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:454
#define IN
Definition: typedefs.h:39
return STATUS_NOT_SUPPORTED
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:461
#define IRP_MN_QUERY_RESOURCES
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IRP_MN_QUERY_ID
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:690
LONG InterfaceReferenceCount
Definition: halpnpdd.c:44
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:31
#define TRUE
Definition: types.h:120
PDRIVER_OBJECT HalpDriverObject
Definition: halpnpdd.c:49
NTSTATUS NTAPI HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:815
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
_PDO_TYPE
Definition: halpnpdd.c:21
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:40
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
PVOID NTAPI HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG Signature)
Definition: halacpi.c:446
struct _PDO_EXTENSION * Next
Definition: halpnpdd.c:39
enum _EXTENSION_TYPE EXTENSION_TYPE
EXTENSION_TYPE
Definition: precomp.h:44
NTSTATUS NTAPI HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halacpi.c:1016
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT _In_ PUSB_PORT_PATH _Out_ PUSB_CD_ERROR_INFORMATION _In_ USHORT _In_ PDEVICE_OBJECT PdoDeviceObject
Definition: hubbusif.h:89
uint16_t * PWCHAR
Definition: typedefs.h:56
void DbgBreakPoint()
Definition: mach.c:553
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
NTSTATUS NTAPI HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halpnpdd.c:428
DWORD Id
PDEVICE_OBJECT FunctionalDeviceObject
Definition: halpnpdd.c:32
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
NTSTATUS NTAPI HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:612
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
_In_ PIRP Irp
Definition: csq.h:116
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
long LONG
Definition: pedump.c:60
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2282
NTSTATUS NTAPI HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:550
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI IoCreateDriver(_In_opt_ PUNICODE_STRING DriverName, _In_ PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1513
NTSTATUS NTAPI HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:806
Definition: bufpool.h:45
_In_ BUS_QUERY_ID_TYPE IdType
Definition: classpnp.h:374
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE
Status
Definition: gdiplustypes.h:24
PFDO_EXTENSION ParentFdoExtension
Definition: halpnpdd.c:41
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@377 u
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:38
_In_ DEVICE_RELATION_TYPE RelationType
Definition: wdfdevice.h:1059
#define ASSERT(a)
Definition: mode.c:44
struct _PDO_EXTENSION * PPDO_EXTENSION
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
PWCHAR HalHardwareIdString
Definition: halacpi.c:44
PDEVICE_OBJECT AttachedDeviceObject
Definition: halpnpdd.c:33
#define IRP_MN_START_DEVICE
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
#define IRP_MN_QUERY_INTERFACE
NTSTATUS NTAPI HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: halpnpdd.c:839
enum _PDO_TYPE PDO_TYPE
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IRP_MJ_POWER
struct _FDO_EXTENSION * PFDO_EXTENSION
static const WCHAR L[]
Definition: oid.c:1250
#define TAG_HAL
Definition: hal.h:61
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:29
PDESCRIPTION_HEADER WdTable
Definition: halpnpdd.c:43
PDO_TYPE PdoType
Definition: halpnpdd.c:42
#define IRP_MJ_SYSTEM_CONTROL
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
Definition: pnpreport.c:148
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
ULONG_PTR SIZE_T
Definition: typedefs.h:80
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2220
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:745
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 PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
unsigned short USHORT
Definition: pedump.c:61
struct _PDO_EXTENSION * ChildPdoList
Definition: halpnpdd.c:30
NTSTATUS NTAPI HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, OUT PCM_RESOURCE_LIST *Resources)
Definition: halpnpdd.c:337
NTSTATUS NTAPI HalpAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT TargetDevice)
Definition: halpnpdd.c:55
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI HaliInitPnpDriver(VOID)
Definition: halpnpdd.c:886
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
NTSTATUS NTAPI HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE RelationType, OUT PDEVICE_RELATIONS *DeviceRelations)
Definition: halpnpdd.c:162
#define OUT
Definition: typedefs.h:40
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
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
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:115
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
Definition: halpnpdd.c:24
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:148
struct _FDO_EXTENSION FDO_EXTENSION
unsigned short * PUSHORT
Definition: retypes.h:2
#define CONST
Definition: pedump.c:81
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:461
_EXTENSION_TYPE
Definition: halpnpdd.c:15
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
struct _PDO_EXTENSION PDO_EXTENSION
NTSTATUS NTAPI HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_CAPABILITIES Capabilities)
Definition: halpnpdd.c:280
#define IRP_MN_QUERY_CAPABILITIES
#define PAGED_CODE()