ReactOS 0.4.17-dev-812-ged4f258
device.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/io/iomgr/device.c
5 * PURPOSE: Device Object Management, including Notifications and Queues.
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Filip Navara (navaraf@reactos.org)
8 * Hervé Poussineau (hpoussin@reactos.org)
9 * Pierre Schweitzer
10 */
11
12/* INCLUDES *******************************************************************/
13
14#include <ntoskrnl.h>
15#define NDEBUG
16#include <debug.h>
17
18/* GLOBALS ********************************************************************/
19
27
28#define DACL_SET 4
29
30/* PRIVATE FUNCTIONS **********************************************************/
31
32VOID
35{
37 PAGED_CODE();
38
39 /* Set the driver as initialized */
40 Driver->Flags |= DRVO_INITIALIZED;
41 DeviceObject = Driver->DeviceObject;
42 while (DeviceObject)
43 {
44 /* Set every device as initialized too */
45 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
46 DeviceObject = DeviceObject->NextDevice;
47 }
48}
49
50VOID
53{
54 PDEVICE_OBJECT DeviceObject = ObjectBody;
56 PAGED_CODE();
57
58 /* Cleanup and free the device node */
59 if (DeviceNode)
61
62 /* Dereference the driver object, referenced in IoCreateDevice */
63 if (DeviceObject->DriverObject)
64 ObDereferenceObject(DeviceObject->DriverObject);
65}
66
67static PDEVICE_OBJECT
72 _Out_opt_ PDEVICE_OBJECT* AttachedToDeviceObject)
73{
74 PDEVICE_OBJECT AttachedDevice;
75 PEXTENDED_DEVOBJ_EXTENSION SourceDeviceExtension;
77
78 /* Lock the device list while attaching the device */
80
81 /* Get the attached device and source extension */
82 AttachedDevice = IoGetAttachedDevice(TargetDevice);
83 SourceDeviceExtension = IoGetDevObjExtension(SourceDevice);
84 ASSERT(SourceDeviceExtension->AttachedTo == NULL);
85
86 /* Make sure that it's in a correct state */
87 if ((AttachedDevice->Flags & DO_DEVICE_INITIALIZING) ||
88 (IoGetDevObjExtension(AttachedDevice)->ExtensionFlags &
91 {
92 /* The device is unloading or being removed */
93 AttachedDevice = NULL;
94 }
95 else
96 {
97 /* Update the attached device fields */
98 AttachedDevice->AttachedDevice = SourceDevice;
99 AttachedDevice->Spare1++;
100
101 /* Update the source with the attached data */
102 SourceDevice->StackSize = AttachedDevice->StackSize + 1;
104 SourceDevice->SectorSize = AttachedDevice->SectorSize;
105
106 /* Check for pending start flag and propagate it */
107 if (IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & DOE_START_PENDING)
109
110 /* Set the attachment in the device extension */
111 SourceDeviceExtension->AttachedTo = AttachedDevice;
112 }
113
114 /* Return the attached device (under the lock) */
115 if (AttachedToDeviceObject)
116 *AttachedToDeviceObject = AttachedDevice;
117
118 /* Release the device list lock */
120
121 return AttachedDevice;
122}
123
124VOID
125NTAPI
127{
128 /* This routine is only used by Driver Verifier to validate shutdown */
129 return;
130}
131
132VOID
133NTAPI
135{
136 PLIST_ENTRY ListEntry;
138 PSHUTDOWN_ENTRY ShutdownEntry;
139 IO_STATUS_BLOCK StatusBlock;
140 PIRP Irp;
143
144 /* Initialize an event to wait on */
146
147 /* What phase? */
148 if (Phase == 0)
149 {
150 /* Shutdown PnP */
152
153 /* Loop first-chance shutdown notifications */
156 while (ListEntry)
157 {
158 /* Get the shutdown entry */
159 ShutdownEntry = CONTAINING_RECORD(ListEntry,
161 ShutdownList);
162
163 /* Get the attached device */
165
166 /* Build the shutdown IRP and call the driver */
169 NULL,
170 0,
171 NULL,
172 &Event,
173 &StatusBlock);
174 if (Irp)
175 {
177 if (Status == STATUS_PENDING)
178 {
179 /* Wait on the driver */
181 }
182 }
183
184 /* Remove the flag */
185 ShutdownEntry->DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED;
186
187 /* Get rid of our reference to it */
188 ObDereferenceObject(ShutdownEntry->DeviceObject);
189
190 /* Free the shutdown entry and reset the event */
193
194 /* Go to the next entry */
197 }
198 }
199 else if (Phase == 1)
200 {
201 /* Acquire resource forever */
203
204 /* Shutdown disk file systems */
206
207 /* Shutdown cdrom file systems */
209
210 /* Shutdown tape filesystems */
212
213 /* Loop last-chance shutdown notifications */
216 while (ListEntry)
217 {
218 /* Get the shutdown entry */
219 ShutdownEntry = CONTAINING_RECORD(ListEntry,
221 ShutdownList);
222
223 /* Get the attached device */
225
226 /* Build the shutdown IRP and call the driver */
229 NULL,
230 0,
231 NULL,
232 &Event,
233 &StatusBlock);
234 if (Irp)
235 {
237 if (Status == STATUS_PENDING)
238 {
239 /* Wait on the driver */
241 }
242 }
243
244 /* Remove the flag */
245 ShutdownEntry->DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED;
246
247 /* Get rid of our reference to it */
248 ObDereferenceObject(ShutdownEntry->DeviceObject);
249
250 /* Free the shutdown entry and reset the event */
253
254 /* Go to the next entry */
257 }
258
259 }
260}
261
263NTAPI
268 IN ULONG AttachFlag)
269{
271 IO_STATUS_BLOCK StatusBlock;
272 PFILE_OBJECT LocalFileObject;
275
276 /* Open the Device */
280 NULL,
281 NULL);
282
283 /* Honor the internal I/O System case (in)sensitivity */
285
289 &StatusBlock,
290 0,
291 FILE_NON_DIRECTORY_FILE | AttachFlag);
292 if (!NT_SUCCESS(Status)) return Status;
293
294 /* Get File Object */
296 0,
299 (PVOID*)&LocalFileObject,
300 NULL);
301 if (NT_SUCCESS(Status))
302 {
303 /* Return the requested data */
304 *DeviceObject = IoGetRelatedDeviceObject(LocalFileObject);
305 *FileObject = LocalFileObject;
306 }
307
308 /* Close the handle */
310
311 return Status;
312}
313
315NTAPI
317{
318 PDEVICE_OBJECT LowestDevice;
319 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
320
321 /* Get the current device and its extension */
322 LowestDevice = DeviceObject;
323 DeviceExtension = IoGetDevObjExtension(LowestDevice);
324
325 /* Keep looping as long as we're attached */
326 while (DeviceExtension->AttachedTo)
327 {
328 /* Get the lowest device and its extension */
329 LowestDevice = DeviceExtension->AttachedTo;
330 DeviceExtension = IoGetDevObjExtension(LowestDevice);
331 }
332
333 /* Return the lowest device */
334 return LowestDevice;
335}
336
337VOID
338NTAPI
342{
343 PDEVICE_OBJECT Previous;
345
346 /* Lock the device list while we edit it */
348
349 /* Check the type of operation */
350 if (Type == IopRemove)
351 {
352 /* Get the current device and check if it's the current one */
353 Previous = DeviceObject->DriverObject->DeviceObject;
354 if (Previous == DeviceObject)
355 {
356 /* It is, simply unlink this one directly */
357 DeviceObject->DriverObject->DeviceObject =
358 DeviceObject->NextDevice;
359 }
360 else
361 {
362 /* It's not, so loop until we find the device */
363 while (Previous->NextDevice != DeviceObject)
364 {
365 /* Not this one, keep moving */
366 if (!Previous->NextDevice)
367 {
368 DPRINT1("Failed to remove PDO %p (not found)\n",
370
371 ASSERT(FALSE);
373 return;
374 }
375 Previous = Previous->NextDevice;
376 }
377
378 /* We found it, now unlink us */
379 Previous->NextDevice = DeviceObject->NextDevice;
380 }
381 }
382 else
383 {
384 /* Link the device object and the driver object */
385 DeviceObject->NextDevice = DriverObject->DeviceObject;
386 DriverObject->DeviceObject = DeviceObject;
387 }
388
389 /* Release the device list lock */
391}
392
393VOID
394NTAPI
396{
399
400 /* Check if deletion is pending */
401 if (ThisExtension->ExtensionFlags & DOE_DELETE_PENDING)
402 {
403 if (DeviceObject->AttachedDevice)
404 {
405 DPRINT("Device object is in the middle of a device stack\n");
406 return;
407 }
408
409 if (DeviceObject->ReferenceCount)
410 {
411 DPRINT("Device object still has %d references\n", DeviceObject->ReferenceCount);
412 return;
413 }
414
415 /* Check if we have a Security Descriptor */
416 if (DeviceObject->SecurityDescriptor)
417 {
418 /* Dereference it */
419 ObDereferenceSecurityDescriptor(DeviceObject->SecurityDescriptor, 1);
420 }
421
422 /* Remove the device from the list */
424
425 /* Dereference the keep-alive */
427 }
428
429 /* We can't unload a non-PnP driver here */
430 if (DriverObject->Flags & DRVO_LEGACY_DRIVER)
431 {
432 DPRINT("Not a PnP driver! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
433 return;
434 }
435
436 /* Return if we've already called unload (maybe we're in it?) */
437 if (DriverObject->Flags & DRVO_UNLOAD_INVOKED) return;
438
439 /* We can't unload unless there's an unload handler */
440 if (!DriverObject->DriverUnload)
441 {
442 DPRINT1("No DriverUnload function on PnP driver! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
443 return;
444 }
445
446 /* Bail if there are still devices present */
447 if (DriverObject->DeviceObject)
448 {
449 DPRINT("Devices still present! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
450 return;
451 }
452
453 DPRINT1("Unloading driver '%wZ' (automatic)\n", &DriverObject->DriverName);
454
455 /* Set the unload invoked flag */
457
458 /* Unload it */
459 DriverObject->DriverUnload(DriverObject);
460
461 /* Make object temporary so it can be deleted */
463}
464
465VOID
466NTAPI
468 IN BOOLEAN ForceUnload)
469{
470 /* Sanity check */
471 ASSERT(DeviceObject->ReferenceCount);
472
473 /* Dereference the device */
474 InterlockedDecrement(&DeviceObject->ReferenceCount);
475
476 /*
477 * Check if we can unload it and it's safe to unload (or if we're forcing
478 * an unload, which is OK too).
479 */
480 ASSERT(!ForceUnload);
481 if (!(DeviceObject->ReferenceCount) &&
483 {
484 /* Unload it */
486 }
487}
488
489VOID
490NTAPI
493 IN ULONG Key)
494{
496 PIRP Irp;
498
499 /* Acquire the cancel lock if this is cancelable */
501
502 /* Clear the current IRP */
503 DeviceObject->CurrentIrp = NULL;
504
505 /* Remove an entry from the queue */
507 if (Entry)
508 {
509 /* Get the IRP and set it */
510 Irp = CONTAINING_RECORD(Entry, IRP, Tail.Overlay.DeviceQueueEntry);
511 DeviceObject->CurrentIrp = Irp;
512
513 /* Check if this is a cancelable packet */
514 if (Cancelable)
515 {
516 /* Check if the caller requested no cancellation */
517 if (IoGetDevObjExtension(DeviceObject)->StartIoFlags &
519 {
520 /* He did, so remove the cancel routine */
521 Irp->CancelRoutine = NULL;
522 }
523
524 /* Release the cancel lock */
526 }
527
528 /* Call the Start I/O Routine */
529 DeviceObject->DriverObject->DriverStartIo(DeviceObject, Irp);
530 }
531 else
532 {
533 /* Otherwise, release the cancel lock if we had acquired it */
535 }
536}
537
538VOID
539NTAPI
542{
544 PIRP Irp;
546
547 /* Acquire the cancel lock if this is cancelable */
549
550 /* Clear the current IRP */
551 DeviceObject->CurrentIrp = NULL;
552
553 /* Remove an entry from the queue */
554 Entry = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue);
555 if (Entry)
556 {
557 /* Get the IRP and set it */
558 Irp = CONTAINING_RECORD(Entry, IRP, Tail.Overlay.DeviceQueueEntry);
559 DeviceObject->CurrentIrp = Irp;
560
561 /* Check if this is a cancelable packet */
562 if (Cancelable)
563 {
564 /* Check if the caller requested no cancellation */
565 if (IoGetDevObjExtension(DeviceObject)->StartIoFlags &
567 {
568 /* He did, so remove the cancel routine */
569 Irp->CancelRoutine = NULL;
570 }
571
572 /* Release the cancel lock */
574 }
575
576 /* Call the Start I/O Routine */
577 DeviceObject->DriverObject->DriverStartIo(DeviceObject, Irp);
578 }
579 else
580 {
581 /* Otherwise, release the cancel lock if we had acquired it */
583 }
584}
585
586VOID
587NTAPI
589 IN ULONG Key,
590 IN ULONG Flags)
591{
592 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
593 ULONG CurrentKey = Key;
594 ULONG CurrentFlags = Flags;
595
596 /* Get the device extension and start the packet loop */
597 DeviceExtension = IoGetDevObjExtension(DeviceObject);
598 while (TRUE)
599 {
600 /* Increase the count */
601 if (InterlockedIncrement(&DeviceExtension->StartIoCount) > 1)
602 {
603 /*
604 * We've already called the routine once...
605 * All we have to do is save the key and add the new flags
606 */
607 DeviceExtension->StartIoFlags |= CurrentFlags;
608 DeviceExtension->StartIoKey = CurrentKey;
609 }
610 else
611 {
612 /* Mask out the current packet flags and key */
613 DeviceExtension->StartIoFlags &= ~(DOE_SIO_WITH_KEY |
616 DeviceExtension->StartIoKey = 0;
617
618 /* Check if this is a packet start with key */
620 {
621 /* Start the packet with a key */
624 TRUE : FALSE,
625 CurrentKey);
626 }
627 else if (Flags & DOE_SIO_NO_KEY)
628 {
629 /* Start the packet */
632 TRUE : FALSE);
633 }
634 }
635
636 /* Decrease the Start I/O count and check if it's 0 now */
637 if (!InterlockedDecrement(&DeviceExtension->StartIoCount))
638 {
639 /* Get the current active key and flags */
640 CurrentKey = DeviceExtension->StartIoKey;
641 CurrentFlags = DeviceExtension->StartIoFlags & (DOE_SIO_WITH_KEY |
644
645 /* Check if we should still loop */
646 if (!(CurrentFlags & (DOE_SIO_WITH_KEY | DOE_SIO_NO_KEY))) break;
647 }
648 else
649 {
650 /* There are still Start I/Os active, so quit this loop */
651 break;
652 }
653 }
654}
655
657NTAPI
660{
663 PDEVICE_RELATIONS DeviceRelations;
665
667
668 /* Get DeviceObject related to given FileObject */
671
672 /* Define input parameters */
673 Stack.MajorFunction = IRP_MJ_PNP;
674 Stack.MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
675 Stack.Parameters.QueryDeviceRelations.Type = TargetDeviceRelation;
676 Stack.FileObject = FileObject;
677
678 /* Call the driver to query all relations (IRP_MJ_PNP) */
680 &Stack,
681 (PVOID)&DeviceRelations);
682 if (!NT_SUCCESS(Status)) return Status;
683
684 /* Make sure it's not NULL and contains only one object */
685 ASSERT(DeviceRelations);
686 ASSERT(DeviceRelations->Count == 1);
687
688 /* Finally get the device node */
689 *DeviceNode = IopGetDeviceNode(DeviceRelations->Objects[0]);
691
692 /* Free the DEVICE_RELATIONS structure, it's not needed anymore */
693 ExFreePool(DeviceRelations);
694
695 return Status;
696}
697
699NTAPI
701 IN PDEVICE_OBJECT TopDeviceObjectHint)
702{
705 PDEVICE_OBJECT LoopObject;
706
707 ASSERT(BaseDeviceObject != NULL);
708
709 Result = FALSE;
710 /* Simply loop on the device stack and try to find our hint */
712 for (LoopObject = BaseDeviceObject; ; LoopObject = LoopObject->AttachedDevice)
713 {
714 /* It was found, it's a success */
715 if (LoopObject == TopDeviceObjectHint)
716 {
717 Result = TRUE;
718 break;
719 }
720
721 /* End of the stack, that's a failure - default */
722 if (LoopObject == NULL)
723 {
724 break;
725 }
726 }
728
729 return Result;
730}
731
733NTAPI
736 OUT PULONG OutputFlags)
737{
738 PACL Dacl;
740
741 /* Select the DACL the caller wants */
742 switch (Type)
743 {
744 case RestrictedPublic:
746 break;
747
750 break;
751
754 break;
755
758 break;
759
760 case SystemDefault:
762 break;
763
764 default:
765 ASSERT(FALSE);
767 }
768
769 /* Create the SD and set the DACL caller wanted */
773
774 /* We've set DACL */
775 if (OutputFlags) *OutputFlags |= DACL_SET;
776
777 /* Done */
778 return Status;
779}
780
782NTAPI
785 IN BOOLEAN HasDeviceName,
787 OUT PACL * OutputDacl,
788 OUT PULONG OutputFlags)
789{
790 PACL Dacl;
791 ULONG AceId;
794 BOOLEAN AdminsSet, WorldSet;
795
796 PAGED_CODE();
797
798 /* Zero our output vars */
799 if (OutputFlags) *OutputFlags = 0;
800
801 *OutputDacl = NULL;
802
803 /* For FSD, easy use SePublicDefaultUnrestrictedDacl */
808 {
811 OutputFlags);
812 goto Quit;
813 }
814 /* For storage devices with a name and floppy attribute,
815 * use SePublicOpenUnrestrictedDacl
816 */
825 {
828 OutputFlags);
829 goto Quit;
830 }
831
832 /* The rest...
833 * We will rely on SePublicDefaultUnrestrictedDacl as well
834 */
836 if (Dacl == NULL)
837 {
838 return NULL;
839 }
840
841 /* Copy our DACL */
843
844 /* Now, browse the DACL to make sure we have everything we want in them,
845 * including permissions
846 */
847 AceId = 0;
848 AdminsSet = FALSE;
849 WorldSet = FALSE;
850 while (NT_SUCCESS(RtlGetAce(Dacl, AceId, (PVOID *)&Ace)))
851 {
852 /* Admins must acess and in RWX, set it */
853 if (RtlEqualSid(SeAliasAdminsSid, &Ace->SidStart))
854 {
856 AdminsSet = TRUE;
857 }
858
859 /* World can read a CD_ROM device */
861 {
862 SetFlag(Ace->Mask, GENERIC_READ);
863 WorldSet = TRUE;
864 }
865
866 ++AceId;
867 }
868
869 /* AdminSid was present and set (otherwise, we have big trouble) */
870 ASSERT(AdminsSet);
871
872 /* If CD_ROM device, we've set world permissions */
873 if (DeviceType == FILE_DEVICE_CD_ROM) ASSERT(WorldSet);
874
875 /* Now our DACL is correct, setup the security descriptor */
878
879 /* We've set DACL */
880 if (OutputFlags) *OutputFlags |= DACL_SET;
881
882 /* Return DACL to allow later freeing */
883 *OutputDacl = Dacl;
885
886Quit:
887 /* Only return SD if we succeed */
888 if (!NT_SUCCESS(Status))
889 {
890 return NULL;
891 }
892
893 return SecurityDescriptor;
894}
895
896/* PUBLIC FUNCTIONS ***********************************************************/
897
898/*
899 * IoAttachDevice
900 *
901 * Layers a device over the highest device in a device stack.
902 *
903 * Parameters
904 * SourceDevice
905 * Device to be attached.
906 *
907 * TargetDevice
908 * Name of the target device.
909 *
910 * AttachedDevice
911 * Caller storage for the device attached to.
912 *
913 * Status
914 * @implemented
915 */
917NTAPI
919 PUNICODE_STRING TargetDeviceName,
920 PDEVICE_OBJECT *AttachedDevice)
921{
925
926 /* Call the helper routine for an attach operation */
927 Status = IopGetDeviceObjectPointer(TargetDeviceName,
929 &FileObject,
932 if (!NT_SUCCESS(Status)) return Status;
933
934 /* Attach the device */
937 AttachedDevice);
938
939 /* Dereference it */
941 return Status;
942}
943
944/*
945 * IoAttachDeviceByPointer
946 *
947 * Status
948 * @implemented
949 */
951NTAPI
954{
955 PDEVICE_OBJECT AttachedDevice;
957
958 /* Do the Attach */
960 if (!AttachedDevice) Status = STATUS_NO_SUCH_DEVICE;
961
962 /* Return the status */
963 return Status;
964}
965
966/*
967 * @implemented
968 */
970NTAPI
973{
974 /* Attach it safely */
977 NULL);
978}
979
980/*
981 * @implemented
982 */
984NTAPI
987 IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
988{
989 /* Call the internal function */
992 AttachedToDeviceObject))
993 {
994 /* Nothing found */
996 }
997
998 /* Success! */
999 return STATUS_SUCCESS;
1000}
1001
1002/*
1003 * IoCreateDevice
1004 *
1005 * Allocates memory for and intializes a device object for use for
1006 * a driver.
1007 *
1008 * Parameters
1009 * DriverObject
1010 * Driver object passed by IO Manager when the driver was loaded.
1011 *
1012 * DeviceExtensionSize
1013 * Number of bytes for the device extension.
1014 *
1015 * DeviceName
1016 * Unicode name of device.
1017 *
1018 * DeviceType
1019 * Device type of the new device.
1020 *
1021 * DeviceCharacteristics
1022 * Bit mask of device characteristics.
1023 *
1024 * Exclusive
1025 * TRUE if only one thread can access the device at a time.
1026 *
1027 * DeviceObject
1028 * On successful return this parameter is filled by pointer to
1029 * allocated device object.
1030 *
1031 * Status
1032 * @implemented
1033 */
1035NTAPI
1037 IN ULONG DeviceExtensionSize,
1043{
1044 WCHAR AutoNameBuffer[20];
1045 UNICODE_STRING AutoName;
1046 PDEVICE_OBJECT CreatedDeviceObject;
1047 PDEVOBJ_EXTENSION DeviceObjectExtension;
1050 ULONG AlignedDeviceExtensionSize;
1051 ULONG TotalSize;
1052 HANDLE TempHandle;
1053 PACL Dacl;
1055 PAGED_CODE();
1056
1057 /* Check if we have to generate a name */
1059 {
1060 /* Generate it */
1061 _swprintf(AutoNameBuffer,
1062 L"\\Device\\%08lx",
1064
1065 /* Initialize the name */
1066 RtlInitUnicodeString(&AutoName, AutoNameBuffer);
1067 DeviceName = &AutoName;
1068 }
1069
1070 /* Get the security descriptor */
1073 DeviceName != NULL,
1075 &Dacl,
1076 NULL);
1077
1078 /* Initialize the Object Attributes */
1080 DeviceName,
1082 NULL,
1083 ReturnedSD);
1084
1085 /* Honor the internal I/O System case (in)sensitivity */
1087
1088 /* Honor the exclusive flag */
1089 if (Exclusive) ObjectAttributes.Attributes |= OBJ_EXCLUSIVE;
1090
1091 /* Create a permanent object for named devices */
1092 if (DeviceName) ObjectAttributes.Attributes |= OBJ_PERMANENT;
1093
1094 /* Align the Extension Size to 8-bytes */
1095 AlignedDeviceExtensionSize = ALIGN_UP_BY(DeviceExtensionSize,
1097
1098 /* Total Size */
1099 TotalSize = AlignedDeviceExtensionSize +
1100 sizeof(DEVICE_OBJECT) +
1102
1103 /* Create the Device Object */
1104 *DeviceObject = NULL;
1108 KernelMode,
1109 NULL,
1110 TotalSize,
1111 0,
1112 0,
1113 (PVOID*)&CreatedDeviceObject);
1114 if (!NT_SUCCESS(Status))
1115 {
1116 if (Dacl != NULL) ExFreePoolWithTag(Dacl, 'eSoI');
1117
1118 return Status;
1119 }
1120
1121 /* Clear the whole Object and extension so we don't null stuff manually */
1122 RtlZeroMemory(CreatedDeviceObject, TotalSize);
1123
1124 /*
1125 * Setup the Type and Size. Note that we don't use the aligned size,
1126 * because that's only padding for the DevObjExt and not part of the Object.
1127 */
1128 CreatedDeviceObject->Type = IO_TYPE_DEVICE;
1129 CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + (USHORT)DeviceExtensionSize;
1130
1131 /* The kernel extension is after the driver internal extension */
1132 DeviceObjectExtension = (PDEVOBJ_EXTENSION)
1133 ((ULONG_PTR)(CreatedDeviceObject + 1) +
1134 AlignedDeviceExtensionSize);
1135
1136 /* Set the Type and Size. Question: why is Size 0 on Windows? */
1137 DeviceObjectExtension->Type = IO_TYPE_DEVICE_OBJECT_EXTENSION;
1138 DeviceObjectExtension->Size = 0;
1139
1140 /* Initialize with Power Manager */
1141 PoInitializeDeviceObject(DeviceObjectExtension);
1142
1143 /* Link the Object and Extension */
1144 DeviceObjectExtension->DeviceObject = CreatedDeviceObject;
1145 CreatedDeviceObject->DeviceObjectExtension = DeviceObjectExtension;
1146
1147 /* Set Device Object Data */
1148 CreatedDeviceObject->DeviceType = DeviceType;
1149 CreatedDeviceObject->Characteristics = DeviceCharacteristics;
1150 CreatedDeviceObject->DeviceExtension = DeviceExtensionSize ?
1151 CreatedDeviceObject + 1 :
1152 NULL;
1153 CreatedDeviceObject->StackSize = 1;
1154 CreatedDeviceObject->AlignmentRequirement = 0;
1155
1156 /* Set the Flags */
1157 CreatedDeviceObject->Flags = DO_DEVICE_INITIALIZING;
1158 if (Exclusive) CreatedDeviceObject->Flags |= DO_EXCLUSIVE;
1159 if (DeviceName) CreatedDeviceObject->Flags |= DO_DEVICE_HAS_NAME;
1160
1161 /* Attach a Vpb for Disks and Tapes, and create the Device Lock */
1162 if ((CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK) ||
1163 (CreatedDeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK) ||
1164 (CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM) ||
1165 (CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE))
1166 {
1167 /* Create Vpb */
1168 Status = IopCreateVpb(CreatedDeviceObject);
1169 if (!NT_SUCCESS(Status))
1170 {
1171 if (Dacl != NULL) ExFreePoolWithTag(Dacl, 'eSoI');
1172
1173 /* Dereference the device object and fail */
1174 ObDereferenceObject(CreatedDeviceObject);
1175 return Status;
1176 }
1177
1178 /* Initialize Lock Event */
1179 KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
1181 TRUE);
1182 }
1183
1184 /* Set the right Sector Size */
1185 switch (DeviceType)
1186 {
1187 /* All disk systems */
1189 case FILE_DEVICE_DISK:
1191
1192 /* The default is 512 bytes */
1193 CreatedDeviceObject->SectorSize = 512;
1194 break;
1195
1196 /* CD-ROM file systems */
1198
1199 /* The default is 2048 bytes */
1200 CreatedDeviceObject->SectorSize = 2048;
1201 }
1202
1203 /* Create the Device Queue */
1204 if ((CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) ||
1205 (CreatedDeviceObject->DeviceType == FILE_DEVICE_FILE_SYSTEM) ||
1206 (CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) ||
1207 (CreatedDeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) ||
1208 (CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE_FILE_SYSTEM))
1209 {
1210 /* Simple FS Devices, they don't need a real Device Queue */
1211 InitializeListHead(&CreatedDeviceObject->Queue.ListEntry);
1212 }
1213 else
1214 {
1215 /* An actual Device, initialize its DQ */
1216 KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
1217 }
1218
1219 /* Insert the Object */
1220 Status = ObInsertObject(CreatedDeviceObject,
1221 NULL,
1223 1,
1224 (PVOID*)&CreatedDeviceObject,
1225 &TempHandle);
1226 if (!NT_SUCCESS(Status))
1227 {
1228 if (Dacl != NULL) ExFreePoolWithTag(Dacl, 'eSoI');
1229
1230 return Status;
1231 }
1232
1233 /* Now do the final linking */
1235 ASSERT((DriverObject->Flags & DRVO_UNLOAD_INVOKED) == 0);
1236 CreatedDeviceObject->DriverObject = DriverObject;
1237 IopEditDeviceList(DriverObject, CreatedDeviceObject, IopAdd);
1238
1239 /* Link with the power manager */
1240 if (CreatedDeviceObject->Vpb) PoVolumeDevice(CreatedDeviceObject);
1241
1242 /* Close the temporary handle and return to caller */
1243 ObCloseHandle(TempHandle, KernelMode);
1244 *DeviceObject = CreatedDeviceObject;
1245
1246 if (Dacl != NULL) ExFreePoolWithTag(Dacl, 'eSoI');
1247
1248 return STATUS_SUCCESS;
1249}
1250
1251/*
1252 * IoDeleteDevice
1253 *
1254 * Status
1255 * @implemented
1256 */
1257VOID
1258NTAPI
1260{
1262
1263 /* Check if the device is registered for shutdown notifications */
1265 {
1266 /* Call the shutdown notifications */
1268 }
1269
1270 /* Check if it has a timer */
1272 if (Timer)
1273 {
1274 /* Remove it and free it */
1277 }
1278
1279 /* Check if the device has a name */
1280 if (DeviceObject->Flags & DO_DEVICE_HAS_NAME)
1281 {
1282 /* It does, make it temporary so we can remove it */
1284 }
1285
1286 /* Set the pending delete flag */
1288
1289 /* Unlink with the power manager */
1291
1292 /* Check if the device object can be unloaded */
1293 if (!DeviceObject->ReferenceCount) IopUnloadDevice(DeviceObject);
1294}
1295
1296/*
1297 * IoDetachDevice
1298 *
1299 * Status
1300 * @implemented
1301 */
1302VOID
1303NTAPI
1305{
1306 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1307
1308 /* Sanity check */
1309 DeviceExtension = IoGetDevObjExtension(TargetDevice->AttachedDevice);
1310 ASSERT(DeviceExtension->AttachedTo == TargetDevice);
1311
1312 /* Remove the attachment */
1313 DeviceExtension->AttachedTo = NULL;
1314 TargetDevice->AttachedDevice = NULL;
1315
1316 /* Check if it's ok to delete this device */
1317 if ((IoGetDevObjExtension(TargetDevice)->ExtensionFlags & DOE_DELETE_PENDING) &&
1318 !(TargetDevice->ReferenceCount))
1319 {
1320 /* It is, do it */
1322 }
1323}
1324
1325/*
1326 * @implemented
1327 */
1329NTAPI
1331 IN PDEVICE_OBJECT *DeviceObjectList,
1332 IN ULONG DeviceObjectListSize,
1333 OUT PULONG ActualNumberDeviceObjects)
1334{
1335 ULONG ActualDevices = 1;
1336 PDEVICE_OBJECT CurrentDevice = DriverObject->DeviceObject;
1337 KIRQL OldIrql;
1338
1339 /* Lock the device list while we enumerate it */
1341
1342 /* Find out how many devices we'll enumerate */
1343 while ((CurrentDevice = CurrentDevice->NextDevice)) ActualDevices++;
1344
1345 /* Go back to the first */
1346 CurrentDevice = DriverObject->DeviceObject;
1347
1348 /* Start by at least returning this */
1349 *ActualNumberDeviceObjects = ActualDevices;
1350
1351 /* Check if we can support so many */
1352 if ((ActualDevices * sizeof(PDEVICE_OBJECT)) > DeviceObjectListSize)
1353 {
1354 /* Fail because the buffer was too small */
1357 }
1358
1359 /* Check if the caller wanted the device list */
1360 if (DeviceObjectList)
1361 {
1362 /* Loop through all the devices */
1363 while (ActualDevices)
1364 {
1365 /* Reference each Device */
1366 ObReferenceObject(CurrentDevice);
1367
1368 /* Add it to the list */
1369 *DeviceObjectList = CurrentDevice;
1370
1371 /* Go to the next one */
1372 CurrentDevice = CurrentDevice->NextDevice;
1373 ActualDevices--;
1374 DeviceObjectList++;
1375 }
1376 }
1377
1378 /* Release the device list lock */
1380
1381 /* Return the status */
1382 return STATUS_SUCCESS;
1383}
1384
1385/*
1386 * IoGetAttachedDevice
1387 *
1388 * Status
1389 * @implemented
1390 */
1392NTAPI
1394{
1395 /* Get the last attached device */
1396 while (DeviceObject->AttachedDevice)
1397 {
1398 /* Move to the next one */
1399 DeviceObject = DeviceObject->AttachedDevice;
1400 }
1401
1402 /* Return it */
1403 return DeviceObject;
1404}
1405
1406/*
1407 * IoGetAttachedDeviceReference
1408 *
1409 * Status
1410 * @implemented
1411 */
1413NTAPI
1415{
1416 KIRQL OldIrql;
1417
1418 /* Retrieve and reference the attached device under the device list lock */
1423
1424 return DeviceObject;
1425}
1426
1427/*
1428 * @implemented
1429 */
1431NTAPI
1433{
1434 KIRQL OldIrql;
1435
1436 /* Retrieve and reference the lowest attached device under the device list lock */
1441
1442 return DeviceObject;
1443}
1444
1445/*
1446 * IoGetDeviceObjectPointer
1447 *
1448 * Status
1449 * @implemented
1450 */
1452NTAPI
1457{
1458 /* Call the helper routine for a normal operation */
1461 FileObject,
1463 0);
1464}
1465
1466/*
1467 * @implemented
1468 */
1470NTAPI
1473{
1474 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1475 PVPB Vpb;
1476 KIRQL OldIrql;
1478
1479 /* Make sure there's a VPB */
1480 if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
1481
1482 /* Acquire it */
1484
1485 /* Get the Device Extension */
1486 DeviceExtension = IoGetDevObjExtension(FileSystemDeviceObject);
1487
1488 /* Make sure this one has a VPB too */
1489 Vpb = DeviceExtension->Vpb;
1490 if (Vpb)
1491 {
1492 /* Make sure that it's mounted */
1493 if ((Vpb->ReferenceCount) &&
1494 (Vpb->Flags & VPB_MOUNTED))
1495 {
1496 /* Return the Disk Device Object */
1497 *DiskDeviceObject = Vpb->RealDevice;
1498
1499 /* Reference it and return success */
1500 ObReferenceObject(Vpb->RealDevice);
1502 }
1503 else
1504 {
1505 /* It's not, so return failure */
1507 }
1508 }
1509 else
1510 {
1511 /* Fail */
1513 }
1514
1515 /* Release the lock */
1517 return Status;
1518}
1519
1520/*
1521 * @implemented
1522 */
1524NTAPI
1526{
1527 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1529
1530 /* Make sure it's not getting deleted */
1531 DeviceExtension = IoGetDevObjExtension(DeviceObject);
1532 if (!(DeviceExtension->ExtensionFlags &
1535 {
1536 /* Get the Lower Device Object */
1537 LowerDeviceObject = DeviceExtension->AttachedTo;
1538
1539 /* Check that we got a valid device object */
1541 {
1542 /* We did so let's reference it */
1544 }
1545 }
1546
1547 /* Return it */
1548 return LowerDeviceObject;
1549}
1550
1551/*
1552 * @implemented
1553 */
1555NTAPI
1557{
1558 PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject;
1559
1560 /* Check if we have a VPB with a device object */
1561 if ((FileObject->Vpb) && (FileObject->Vpb->DeviceObject))
1562 {
1563 /* Then use the DO from the VPB */
1565 DeviceObject = FileObject->Vpb->DeviceObject;
1566 }
1567 else if (!(FileObject->Flags & FO_DIRECT_DEVICE_OPEN) &&
1568 (FileObject->DeviceObject->Vpb) &&
1569 (FileObject->DeviceObject->Vpb->DeviceObject))
1570 {
1571 /* The disk device actually has a VPB, so get the DO from there */
1572 DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
1573 }
1574 else
1575 {
1576 /* Otherwise, this was a direct open */
1577 DeviceObject = FileObject->DeviceObject;
1578 }
1579
1580 /* Sanity check */
1582
1583 /* Check if we were attached */
1584 if (DeviceObject->AttachedDevice)
1585 {
1586 /* Check if the file object has an extension present */
1588 {
1589 /* Sanity check, direct open files can't have this */
1591
1592 /* Check if the extension is really present */
1593 if (FileObject->FileObjectExtension)
1594 {
1595 PFILE_OBJECT_EXTENSION FileObjectExtension;
1596
1597 /* Cast the buffer to something we understand */
1598 FileObjectExtension = FileObject->FileObjectExtension;
1599
1600 /* Check if have a valid replacement top level device */
1601 if (FileObjectExtension->TopDeviceObjectHint &&
1603 FileObjectExtension->TopDeviceObjectHint))
1604 {
1605 /* Use this instead of returning the top level device */
1606 return FileObjectExtension->TopDeviceObjectHint;
1607 }
1608 }
1609 }
1610
1611 /* Return the highest attached device */
1613 }
1614
1615 /* Return the DO we found */
1616 return DeviceObject;
1617}
1618
1619/*
1620 * @implemented
1621 */
1623NTAPI
1626{
1629
1630 /* Call the internal helper function */
1633 {
1634 *DeviceObject = DeviceNode->PhysicalDeviceObject;
1635 }
1636 return Status;
1637}
1638
1639/*
1640 * @implemented
1641 */
1643NTAPI
1645{
1647
1648 /*
1649 * If the FILE_OBJECT's VPB is defined,
1650 * get the device from it.
1651 */
1652 if ((FileObject->Vpb) && (FileObject->Vpb->DeviceObject))
1653 {
1654 /* Use the VPB's Device Object's */
1655 DeviceObject = FileObject->Vpb->DeviceObject;
1656 }
1657 else if (!(FileObject->Flags & FO_DIRECT_DEVICE_OPEN) &&
1658 (FileObject->DeviceObject->Vpb) &&
1659 (FileObject->DeviceObject->Vpb->DeviceObject))
1660 {
1661 /* Use the VPB's File System Object */
1662 DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
1663 }
1664 else
1665 {
1666 /* Use the FO's Device Object */
1667 DeviceObject = FileObject->DeviceObject;
1668 }
1669
1670 /* Return the device object we found */
1672 return DeviceObject;
1673}
1674
1675/*
1676 * @implemented
1677 */
1679NTAPI
1681{
1683
1684 /* Allocate the shutdown entry */
1686 sizeof(SHUTDOWN_ENTRY),
1689
1690 /* Set the DO */
1691 Entry->DeviceObject = DeviceObject;
1692
1693 /* Reference it so it doesn't go away */
1695
1696 /* Insert it into the list */
1698 &Entry->ShutdownList,
1700
1701 /* Set the shutdown registered flag */
1703 return STATUS_SUCCESS;
1704}
1705
1706/*
1707 * @implemented
1708 */
1710NTAPI
1712{
1714
1715 /* Allocate the shutdown entry */
1717 sizeof(SHUTDOWN_ENTRY),
1720
1721 /* Set the DO */
1722 Entry->DeviceObject = DeviceObject;
1723
1724 /* Reference it so it doesn't go away */
1726
1727 /* Insert it into the list */
1729 &Entry->ShutdownList,
1731
1732 /* Set the shutdown registered flag */
1734 return STATUS_SUCCESS;
1735}
1736
1737/*
1738 * @implemented
1739 */
1740VOID
1741NTAPI
1743{
1744 PSHUTDOWN_ENTRY ShutdownEntry;
1745 PLIST_ENTRY NextEntry;
1746 KIRQL OldIrql;
1747
1748 /* Remove the flag */
1749 DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED;
1750
1751 /* Acquire the shutdown lock and loop the shutdown list */
1753 NextEntry = ShutdownListHead.Flink;
1754 while (NextEntry != &ShutdownListHead)
1755 {
1756 /* Get the entry */
1757 ShutdownEntry = CONTAINING_RECORD(NextEntry,
1759 ShutdownList);
1760
1761 /* Get if the DO matches */
1762 if (ShutdownEntry->DeviceObject == DeviceObject)
1763 {
1764 /* Remove it from the list */
1765 RemoveEntryList(NextEntry);
1766 NextEntry = NextEntry->Blink;
1767
1768 /* Free the entry */
1769 ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
1770
1771 /* Get rid of our reference to it */
1773 }
1774
1775 /* Go to the next entry */
1776 NextEntry = NextEntry->Flink;
1777 }
1778
1779 /* Now loop the last chance list */
1781 while (NextEntry != &LastChanceShutdownListHead)
1782 {
1783 /* Get the entry */
1784 ShutdownEntry = CONTAINING_RECORD(NextEntry,
1786 ShutdownList);
1787
1788 /* Get if the DO matches */
1789 if (ShutdownEntry->DeviceObject == DeviceObject)
1790 {
1791 /* Remove it from the list */
1792 RemoveEntryList(NextEntry);
1793 NextEntry = NextEntry->Blink;
1794
1795 /* Free the entry */
1796 ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
1797
1798 /* Get rid of our reference to it */
1800 }
1801
1802 /* Go to the next entry */
1803 NextEntry = NextEntry->Flink;
1804 }
1805
1806 /* Release the shutdown lock */
1808}
1809
1810/*
1811 * @implemented
1812 */
1813VOID
1814NTAPI
1816 IN BOOLEAN DeferredStartIo,
1817 IN BOOLEAN NonCancelable)
1818{
1819 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1820
1821 /* Get the Device Extension */
1822 DeviceExtension = IoGetDevObjExtension(DeviceObject);
1823
1824 /* Set the flags the caller requested */
1825 DeviceExtension->StartIoFlags |= (DeferredStartIo) ? DOE_SIO_DEFERRED : 0;
1826 DeviceExtension->StartIoFlags |= (NonCancelable) ? DOE_SIO_NO_CANCEL : 0;
1827}
1828
1829/*
1830 * @implemented
1831 */
1832VOID
1833NTAPI
1836 IN ULONG Key)
1837{
1838 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1839
1840 /* Get the Device Extension */
1841 DeviceExtension = IoGetDevObjExtension(DeviceObject);
1842
1843 /* Check if deferred start was requested */
1844 if (DeviceExtension->StartIoFlags & DOE_SIO_DEFERRED)
1845 {
1846 /* Call our internal function to handle the defered case */
1848 Key,
1851 }
1852 else
1853 {
1854 /* Call the normal routine */
1856 }
1857}
1858
1859/*
1860 * @implemented
1861 */
1862VOID
1863NTAPI
1866{
1867 PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
1868
1869 /* Get the Device Extension */
1870 DeviceExtension = IoGetDevObjExtension(DeviceObject);
1871
1872 /* Check if deferred start was requested */
1873 if (DeviceExtension->StartIoFlags & DOE_SIO_DEFERRED)
1874 {
1875 /* Call our internal function to handle the defered case */
1877 0,
1880 }
1881 else
1882 {
1883 /* Call the normal routine */
1885 }
1886}
1887
1888/*
1889 * @implemented
1890 */
1891VOID
1892NTAPI
1894 IN PIRP Irp,
1895 IN PULONG Key,
1897{
1898 BOOLEAN Stat;
1899 KIRQL OldIrql, CancelIrql;
1900
1901 /* Raise to dispatch level */
1903
1904 /* Check if we should acquire the cancel lock */
1905 if (CancelFunction)
1906 {
1907 /* Acquire and set it */
1908 IoAcquireCancelSpinLock(&CancelIrql);
1909 Irp->CancelRoutine = CancelFunction;
1910 }
1911
1912 /* Check if we have a key */
1913 if (Key)
1914 {
1915 /* Insert by key */
1917 &Irp->Tail.Overlay.DeviceQueueEntry,
1918 *Key);
1919 }
1920 else
1921 {
1922 /* Insert without a key */
1923 Stat = KeInsertDeviceQueue(&DeviceObject->DeviceQueue,
1924 &Irp->Tail.Overlay.DeviceQueueEntry);
1925 }
1926
1927 /* Check if this was a first insert */
1928 if (!Stat)
1929 {
1930 /* Set the IRP */
1931 DeviceObject->CurrentIrp = Irp;
1932
1933 /* Check if this is a cancelable packet */
1934 if (CancelFunction)
1935 {
1936 /* Check if the caller requested no cancellation */
1937 if (IoGetDevObjExtension(DeviceObject)->StartIoFlags &
1939 {
1940 /* He did, so remove the cancel routine */
1941 Irp->CancelRoutine = NULL;
1942 }
1943
1944 /* Release the cancel lock */
1945 IoReleaseCancelSpinLock(CancelIrql);
1946 }
1947
1948 /* Call the Start I/O function */
1949 DeviceObject->DriverObject->DriverStartIo(DeviceObject, Irp);
1950 }
1951 else
1952 {
1953 /* The packet was inserted... check if we have a cancel function */
1954 if (CancelFunction)
1955 {
1956 /* Check if the IRP got cancelled */
1957 if (Irp->Cancel)
1958 {
1959 /*
1960 * Set the cancel IRQL, clear the currnet cancel routine and
1961 * call ours
1962 */
1963 Irp->CancelIrql = CancelIrql;
1964 Irp->CancelRoutine = NULL;
1966 }
1967 else
1968 {
1969 /* Otherwise, release the lock */
1970 IoReleaseCancelSpinLock(CancelIrql);
1971 }
1972 }
1973 }
1974
1975 /* Return back to previous IRQL */
1977}
1978
1979#if defined (_WIN64)
1980ULONG
1981NTAPI
1984{
1986 return 0;
1987}
1988#endif
1989
1990/* EOF */
#define PAGED_CODE()
#define ALIGN_UP_BY(size, align)
@ DeviceNode
Definition: Node.h:9
Type
Definition: Type.h:7
unsigned char BOOLEAN
Definition: actypes.h:127
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
@ Ace
Definition: card.h:12
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_z_ PCCHAR _In_ PDEVICE_OBJECT LowerDeviceObject
Definition: classpnp.h:983
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
_In_ PIRP Irp
Definition: csq.h:116
PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue)
Definition: devqueue.c:153
BOOLEAN NTAPI KeInsertByKeyDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry, IN ULONG SortKey)
Definition: devqueue.c:83
BOOLEAN NTAPI KeInsertDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry)
Definition: devqueue.c:41
VOID NTAPI KeInitializeDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue)
Definition: devqueue.c:22
PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveByKeyDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue, IN ULONG SortKey)
Definition: devqueue.c:197
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define DEVICE_TYPE
Definition: guid.c:10
#define GENERIC_READ
Definition: compat.h:135
#define L(x)
Definition: resources.c:13
#define DOE_START_PENDING
Definition: boot.c:37
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define DO_SHUTDOWN_REGISTERED
Definition: env_spec_w32.h:403
struct _DEVICE_OBJECT DEVICE_OBJECT
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define DO_EXCLUSIVE
Definition: env_spec_w32.h:395
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_DEVICE_HAS_NAME
Definition: env_spec_w32.h:398
#define NonPagedPool
Definition: env_spec_w32.h:307
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define InterlockedIncrementUL(Addend)
Definition: ex.h:1544
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1676
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
_Outptr_ PDEVICE_OBJECT * DiskDeviceObject
Definition: fltkernel.h:1672
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
Status
Definition: gdiplustypes.h:24
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
PLIST_ENTRY NTAPI ExInterlockedInsertHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:114
PLIST_ENTRY NTAPI ExInterlockedRemoveHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:166
POBJECT_TYPE IoDeviceObjectType
Definition: iomgr.c:35
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
#define Stat
Definition: syshdrs.h:78
DeviceType
Definition: mmdrv.h:42
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define FILE_DEVICE_MASS_STORAGE
Definition: imports.h:60
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
#define KernelMode
Definition: asm.h:38
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define DOE_SIO_WITH_KEY
Definition: iotypes.h:164
#define DOE_DELETE_PENDING
Definition: iotypes.h:154
#define DOE_SIO_DEFERRED
Definition: iotypes.h:166
#define DOE_SIO_NO_KEY
Definition: iotypes.h:163
#define FO_FILE_OBJECT_HAS_EXTENSION
Definition: iotypes.h:148
#define IO_ATTACH_DEVICE_API
Definition: iotypes.h:223
#define DOE_REMOVE_PROCESSED
Definition: iotypes.h:156
#define DOE_SIO_NO_CANCEL
Definition: iotypes.h:167
#define DOE_UNLOAD_PENDING
Definition: iotypes.h:153
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:142
#define DOE_REMOVE_PENDING
Definition: iotypes.h:155
#define DOE_SIO_CANCELABLE
Definition: iotypes.h:165
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1625
NTSYSAPI NTSTATUS NTAPI RtlGetAce(PACL Acl, ULONG AceIndex, PVOID *Ace)
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
NTSYSAPI BOOLEAN NTAPI RtlEqualSid(_In_ PSID Sid1, _In_ PSID Sid2)
#define _Out_opt_
Definition: no_sal2.h:214
#define _In_
Definition: no_sal2.h:158
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define FILE_FLOPPY_DISKETTE
Definition: nt_native.h:809
#define GENERIC_WRITE
Definition: nt_native.h:90
#define GENERIC_EXECUTE
Definition: nt_native.h:91
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90
@ NotificationEvent
@ SynchronizationEvent
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)
enum _SECURITY_DESCRIPTOR_TYPE SECURITY_DESCRIPTOR_TYPE
VOID NTAPI IopRemoveTimerFromTimerList(IN PIO_TIMER Timer)
Definition: iotimer.c:70
ULONG IopCaseInsensitive
Definition: iomgr.c:38
@ RestrictedPublicOpen
Definition: io.h:515
@ RestrictedPublic
Definition: io.h:513
@ UnrestrictedPublicOpen
Definition: io.h:516
@ SystemDefault
Definition: io.h:517
@ UnrestrictedPublic
Definition: io.h:514
VOID NTAPI IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead)
Definition: volume.c:349
NTSTATUS NTAPI IopCreateVpb(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:158
NTSTATUS IopSynchronousCall(IN PDEVICE_OBJECT DeviceObject, IN PIO_STACK_LOCATION IoStackLocation, OUT PVOID *Information)
NTSTATUS IopFreeDeviceNode(IN PDEVICE_NODE DeviceNode)
@ IopAdd
Definition: io.h:252
@ IopRemove
Definition: io.h:251
enum _IOP_DEVICE_LIST_OPERATION IOP_DEVICE_LIST_OPERATION
#define IoGetDevObjExtension(DeviceObject)
Definition: io.h:128
PACL SePublicOpenDacl
Definition: acl.c:19
PACL SePublicDefaultUnrestrictedDacl
Definition: acl.c:18
PACL SePublicOpenUnrestrictedDacl
Definition: acl.c:20
PSID SeAliasAdminsSid
Definition: sid.c:41
PSID SeWorldSid
Definition: sid.c:25
PSECURITY_DESCRIPTOR NTAPI IopCreateDefaultDeviceSecurityDescriptor(IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN HasDeviceName, IN PSECURITY_DESCRIPTOR SecurityDescriptor, OUT PACL *OutputDacl, OUT PULONG OutputFlags)
Definition: device.c:783
NTSTATUS NTAPI IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT *DeviceObjectList, IN ULONG DeviceObjectListSize, OUT PULONG ActualNumberDeviceObjects)
Definition: device.c:1330
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:971
VOID NTAPI IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:395
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1525
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:1036
LIST_ENTRY ShutdownListHead
Definition: device.c:21
NTSTATUS NTAPI IoAttachDevice(PDEVICE_OBJECT SourceDevice, PUNICODE_STRING TargetDeviceName, PDEVICE_OBJECT *AttachedDevice)
Definition: device.c:918
VOID NTAPI IopStartNextPacketByKey(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Cancelable, IN ULONG Key)
Definition: device.c:491
VOID NTAPI IoStartPacket(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PULONG Key, IN PDRIVER_CANCEL CancelFunction)
Definition: device.c:1893
NTSTATUS NTAPI IopCreateSecurityDescriptorPerType(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN SECURITY_DESCRIPTOR_TYPE Type, OUT PULONG OutputFlags)
Definition: device.c:734
#define DACL_SET
Definition: device.c:28
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:985
VOID NTAPI IopStartNextPacket(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Cancelable)
Definition: device.c:540
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1556
BOOLEAN NTAPI IopVerifyDeviceObjectOnStack(IN PDEVICE_OBJECT BaseDeviceObject, IN PDEVICE_OBJECT TopDeviceObjectHint)
Definition: device.c:700
NTSTATUS NTAPI IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject, OUT PDEVICE_OBJECT *DiskDeviceObject)
Definition: device.c:1471
VOID NTAPI IopEditDeviceList(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN IOP_DEVICE_LIST_OPERATION Type)
Definition: device.c:339
VOID NTAPI IopDereferenceDeviceObject(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN ForceUnload)
Definition: device.c:467
NTSTATUS NTAPI IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1711
NTSTATUS NTAPI IoRegisterLastChanceShutdownNotification(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1680
KSPIN_LOCK ShutdownListLock
Definition: device.c:22
LIST_ENTRY IopCdRomFileSystemQueueHead
Definition: volume.c:22
NTSTATUS NTAPI IopGetRelatedTargetDevice(IN PFILE_OBJECT FileObject, OUT PDEVICE_NODE *DeviceNode)
Definition: device.c:658
NTSTATUS NTAPI IoGetRelatedTargetDevice(IN PFILE_OBJECT FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1624
ERESOURCE IopDatabaseResource
Definition: volume.c:20
VOID NTAPI IoShutdownPnpDevices(VOID)
Definition: device.c:126
NTSTATUS NTAPI IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject, IN ULONG AttachFlag)
Definition: device.c:264
PDEVICE_OBJECT NTAPI IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1644
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1432
ULONG IopDeviceObjectNumber
Definition: device.c:20
VOID NTAPI IoShutdownSystem(IN ULONG Phase)
Definition: device.c:134
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1304
VOID NTAPI IoSetStartIoAttributes(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN DeferredStartIo, IN BOOLEAN NonCancelable)
Definition: device.c:1815
LIST_ENTRY LastChanceShutdownListHead
Definition: device.c:21
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1259
VOID NTAPI IopStartNextPacketByKeyEx(IN PDEVICE_OBJECT DeviceObject, IN ULONG Key, IN ULONG Flags)
Definition: device.c:588
VOID NTAPI IoStartNextPacketByKey(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Cancelable, IN ULONG Key)
Definition: device.c:1834
static PDEVICE_OBJECT NTAPI IopAttachDeviceToDeviceStackSafe(_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice, _Out_opt_ PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:69
PDEVICE_OBJECT NTAPI IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1393
NTSTATUS NTAPI IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:952
PDEVICE_OBJECT NTAPI IopGetLowestDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:316
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1453
VOID NTAPI IopDeleteDevice(IN PVOID ObjectBody)
Definition: device.c:52
LIST_ENTRY IopDiskFileSystemQueueHead
Definition: volume.c:21
VOID NTAPI IopReadyDeviceObjects(IN PDRIVER_OBJECT Driver)
Definition: device.c:34
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1414
VOID NTAPI IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1742
VOID NTAPI IoStartNextPacket(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Cancelable)
Definition: device.c:1864
LIST_ENTRY IopTapeFileSystemQueueHead
Definition: volume.c:22
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1101
#define IoCallDriver
Definition: irp.c:1257
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1215
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1204
PACL SePublicDefaultDacl
Definition: acl.c:16
PACL SeSystemDefaultDacl
Definition: acl.c:17
#define STATUS_VOLUME_DISMOUNTED
Definition: ntstatus.h:869
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3406
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2957
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1040
VOID NTAPI ObMakeTemporaryObject(IN PVOID ObjectBody)
Definition: oblife.c:1450
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
VOID NTAPI ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Count)
Definition: obsdcach.c:287
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
VOID NTAPI PoInitializeDeviceObject(IN OUT PDEVOBJ_EXTENSION DeviceObjectExtension)
Definition: povolume.c:361
VOID NTAPI PoVolumeDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: povolume.c:81
VOID NTAPI PoRemoveVolumeDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: povolume.c:103
#define FILE_DEVICE_FILE_SYSTEM
Definition: winioctl.h:54
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:53
#define FILE_DEVICE_TAPE
Definition: winioctl.h:76
#define FILE_DEVICE_TAPE_FILE_SYSTEM
Definition: winioctl.h:77
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:47
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:48
#define FILE_DEVICE_NETWORK_FILE_SYSTEM
Definition: winioctl.h:65
#define FILE_DEVICE_DFS_FILE_SYSTEM
Definition: winioctl.h:98
#define FILE_DEVICE_NETWORK
Definition: winioctl.h:63
#define FILE_DEVICE_DISK
Definition: winioctl.h:52
#define FILE_DEVICE_VIRTUAL_DISK
Definition: winioctl.h:81
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_EXCLUSIVE
Definition: winternl.h:227
#define OBJ_PERMANENT
Definition: winternl.h:226
Entry
Definition: section.c:5216
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
USHORT AclSize
Definition: ms-dtyp.idl:296
ULONG AlignmentRequirement
Definition: env_spec_w32.h:420
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2171
PDEVICE_OBJECT AttachedTo
Definition: iotypes.h:1096
PDEVICE_OBJECT TopDeviceObjectHint
Definition: io.h:102
Definition: ketypes.h:646
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: io.h:427
PDEVICE_OBJECT DeviceObject
Definition: io.h:429
Definition: iotypes.h:189
#define TAG_IO_TIMER
Definition: tag.h:94
#define TAG_SHUTDOWN_ENTRY
Definition: tag.h:58
#define STATUS_PENDING
Definition: telnetd.h:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2664
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
Definition: wdfdevice.h:2781
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT SourceDevice
Definition: iofuncs.h:690
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:691
#define IoWMIDeviceObjectToProviderId(DeviceObject)
_In_ BOOLEAN Cancelable
Definition: iofuncs.h:1258
_In_ PIRP _In_opt_ PULONG _In_opt_ PDRIVER_CANCEL CancelFunction
Definition: iofuncs.h:1277
@ TargetDeviceRelation
Definition: iotypes.h:2158
#define IO_TYPE_DEVICE
struct _DEVOBJ_EXTENSION * PDEVOBJ_EXTENSION
#define VPB_MOUNTED
Definition: iotypes.h:1807
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2761
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define FO_DIRECT_DEVICE_OPEN
Definition: iotypes.h:1787
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IO_TYPE_DEVICE_OBJECT_EXTENSION
#define DRVO_UNLOAD_INVOKED
Definition: iotypes.h:2227
#define IRP_MJ_SHUTDOWN
#define DRVO_INITIALIZED
Definition: iotypes.h:4473
#define DRVO_LEGACY_DRIVER
Definition: iotypes.h:2228
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:467
@ LockQueueIoDatabaseLock
Definition: ketypes.h:736
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58