ReactOS 0.4.17-dev-1321-g5c122a9
pdo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Storport Driver
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Storport PDO code
5 * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org)
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include "precomp.h"
11#include "inline.h"
12
13#define NDEBUG
14#include <debug/driverdbg.h>
15#include <debug.h>
16
17
18/* FUNCTIONS ******************************************************************/
19
22 _In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension,
23 _In_ ULONG Bus,
26 _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
27{
28 PPDO_DEVICE_EXTENSION DeviceExtension = NULL;
32
33 DPRINT("PortCreatePdo(%p %p)\n",
34 FdoDeviceExtension, PdoDeviceExtension);
35
36 /* Create the port device */
37 Status = IoCreateDevice(FdoDeviceExtension->Device->DriverObject,
39 NULL,
42 FALSE,
43 &Pdo);
44 if (!NT_SUCCESS(Status))
45 {
46 DPRINT1("IoCreateDevice() failed (Status 0x%lX)\n", Status);
47 return Status;
48 }
49
50 /* Initialize the device */
51 Pdo->Flags |= DO_DIRECT_IO;
52 Pdo->Flags |= DO_POWER_PAGABLE;
53
54 DeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
55 RtlZeroMemory(DeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
56
57 DeviceExtension->ExtensionType = PdoExtension;
58
59 DeviceExtension->Device = Pdo;
60 DeviceExtension->FdoExtension = FdoDeviceExtension;
61 DeviceExtension->PnpState = dsStopped;
62
63 /* Allocate the miniport's per unit extension before the unit is reachable */
64 if (FdoDeviceExtension->HwInitData != NULL &&
65 FdoDeviceExtension->HwInitData->SpecificLuExtensionSize != 0)
66 {
67 DeviceExtension->LunExtension =
69 FdoDeviceExtension->HwInitData->SpecificLuExtensionSize,
71 if (DeviceExtension->LunExtension == NULL)
72 {
73 DPRINT1("No pool for the unit extension\n");
76 }
77 }
78
79 DeviceExtension->Bus = Bus;
80 DeviceExtension->Target = Target;
81 DeviceExtension->Lun = Lun;
82
83 /* Initialize IO flow control structure */
84 // KeInitializeSpinLock(&DeviceExtension->FlowControl.Lock);
85 DeviceExtension->FlowControl.IsBusy = FALSE;
86 DeviceExtension->FlowControl.IsPaused = FALSE;
87 DeviceExtension->FlowControl.IsWaitingQueueClear = FALSE;
88 DeviceExtension->FlowControl.StrongOrderedCount = 0;
89 DeviceExtension->FlowControl.RemainingBusyRequests = 0;
90 DeviceExtension->FlowControl.RemainingPauseTime = 0;
91
92 /* Beginning from Windows 8, when you specified SRB_TYPE_STORAGE_REQUEST_BLOCK, you can increase
93 maximum number of outstanding requests to (254, MaxNumberOfIO) range. We do not support
94 STORAGE_REQUEST_BLOCKs so we're not implementing it.
95 */
97 // InitializeListHead(&DeviceExtension->FlowControl.ApprovedRequestsListHead);
99 DeviceExtension->FlowControl.OutstandingRequestCount = 0;
100 DeviceExtension->OutstandingRequestMax = 254;
101 DeviceExtension->TagCounter = -1;
102
103 DeviceExtension->IsClaimed = 0;
104
105 // FIXME: More initialization
106
107 DeviceExtension->SpecialRequestCounter = 0; /* FIXME: DELETE AFTER DEBUG */
108
109 /* Add the PDO to the PDO list only once a lookup can match its address */
110 PortFdoLinkPdo(FdoDeviceExtension, DeviceExtension);
111
112 /* Let the miniport know the unit is coming up */
113 StorpBuildUnitAddress(DeviceExtension, &Address);
114 MiniportUnitControl(&FdoDeviceExtension->Miniport, ScsiUnitStart, &Address);
115
116 /* The device has been initialized */
117 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
118
119 *PdoDeviceExtension = DeviceExtension;
120
121 return STATUS_SUCCESS;
122}
123
124
128{
130
131 DPRINT("PortDeletePdo(%p)\n", PdoExtension);
132
133 /* Tell the miniport before the unit goes away under it */
135 MiniportUnitControl(&PdoExtension->FdoExtension->Miniport, ScsiUnitRemove, &Address);
136
137 /* Remove the PDO from the PDO list*/
139
140 if (PdoExtension->InquiryBuffer)
141 {
143 PdoExtension->InquiryBuffer = NULL;
144 }
145
146 /* The miniport was just told the unit is going, so what it kept goes too */
147 if (PdoExtension->LunExtension)
148 {
150 PdoExtension->LunExtension = NULL;
151 }
152
153
154 // FIXME: More uninitialization
155
156
157 /* Delete the PDO */
159
160 return STATUS_SUCCESS;
161}
162
163
164/* FROM SCSIPORT */
165
166static
167ULONG
169 IN PUCHAR Name,
171 IN ULONG MaxLength,
172 IN CHAR DefaultCharacter,
173 IN BOOLEAN Trim)
174{
175 ULONG Index;
176
177 for (Index = 0; Index < MaxLength; Index++)
178 {
179 if (Name[Index] <= ' ' || Name[Index] >= 0x7F /* last printable ascii character */ || Name[Index] == ',')
180 {
181 // convert to underscore
182 Buffer[Index] = DefaultCharacter;
183 }
184 else
185 {
186 // just copy character
188 }
189 }
190
191 /* Trim trailing default characters */
192 if (Trim)
193 {
194 while (Index > 0 && Buffer[Index - 1] == DefaultCharacter)
195 Index--;
196 }
197
198 return Index;
199}
200
201
202static
205 _In_ PPDO_DEVICE_EXTENSION DeviceExtension,
207{
211 PINQUIRYDATA InquiryData;
213 size_t CharCount;
214 CHAR VidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId) + sizeof(ANSI_NULL)];
215 CHAR PidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductId) + sizeof(ANSI_NULL)];
216 CHAR RevLevelBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) + sizeof(ANSI_NULL)];
217
218 InquiryData = DeviceExtension->InquiryBuffer;
219 DeviceType = GetDeviceType(InquiryData);
220
221 CharCount = (sizeof("SCSI\\") - 1) + strlen(DeviceType) +
222 (sizeof("&Ven_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
223 (sizeof("&Prod_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
224 (sizeof("&Rev_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) +
225 sizeof(ANSI_NULL);
226
228 CharCount * sizeof(WCHAR),
230 if (!Buffer)
231 {
232 Irp->IoStatus.Information = 0;
234 }
235
236 Offset = CopyField(InquiryData->VendorId,
237 VidBuffer,
238 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
239 '_',
240 TRUE);
241 VidBuffer[Offset] = ANSI_NULL;
242
243 Offset = CopyField(InquiryData->ProductId,
244 PidBuffer,
245 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
246 '_',
247 TRUE);
248 PidBuffer[Offset] = ANSI_NULL;
249
251 RevLevelBuffer,
252 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel),
253 '_',
254 TRUE);
255 RevLevelBuffer[Offset] = ANSI_NULL;
256
258 CharCount,
259 NULL,
260 NULL,
261 0,
262 L"SCSI\\%hs&Ven_%hs&Prod_%hs&Rev_%hs",
264 VidBuffer,
265 PidBuffer,
266 RevLevelBuffer);
268
269 DPRINT("DeviceID: '%S'\n", Buffer);
270
271 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
272 return STATUS_SUCCESS;
273}
274
275
276static
281{
283 PWCHAR Buffer, End, IdStart;
284 PINQUIRYDATA InquiryData;
286 size_t CharCount, Remaining;
287 CHAR VidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId)];
288 CHAR PidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductId)];
289 CHAR RevLevelBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel)];
290
292
293 InquiryData = PdoExtension->InquiryBuffer;
294 DeviceType = GetDeviceType(InquiryData);
295 GenericType = GetGenericType(InquiryData);
296
297 /*
298 * 1) SCSI\DeviceTypeVendorId(8)ProductId(16)Revision(4)
299 * 2) SCSI\DeviceTypeVendorId(8)ProductId(16)
300 * 3) SCSI\DeviceTypeVendorId(8)
301 * 4) SCSI\VendorId(8)ProductId(16)Revision(1)
302 * 5) VendorId(8)ProductId(16)Revision(1)
303 * 6) GenericType
304 */
305 CharCount = strlen(DeviceType) * 3 +
307 (sizeof("SCSI\\") - 1) * 4 +
308 RTL_FIELD_SIZE(INQUIRYDATA, VendorId) * 5 +
309 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) * 4 +
310 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) + 1 * 2 +
311 6 * sizeof(ANSI_NULL) +
312 sizeof(ANSI_NULL); /* multi-string */
313
315 CharCount * sizeof(WCHAR),
317 if (!Buffer)
318 {
319 Irp->IoStatus.Information = 0;
321 }
322
323 CopyField(InquiryData->VendorId,
324 VidBuffer,
325 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
326 '_',
327 FALSE);
328
329 CopyField(InquiryData->ProductId,
330 PidBuffer,
331 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
332 '_',
333 FALSE);
334
335 CopyField(InquiryData->ProductRevisionLevel,
336 RevLevelBuffer,
337 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel),
338 '_',
339 FALSE);
340
341 DPRINT("HardwareIDs:\n");
342
343 /* ID 1 */
344 IdStart = Buffer;
346 CharCount,
347 &End,
348 &Remaining,
349 0,
350 L"SCSI\\%hs%.8hs%.16hs%.4hs",
352 VidBuffer,
353 PidBuffer,
354 RevLevelBuffer);
356
357 DPRINT("1) '%S'\n", IdStart);
358
359 ++End;
360 --Remaining;
361
362 /* ID 2 */
363 IdStart = End;
365 Remaining,
366 &End,
367 &Remaining,
368 0,
369 L"SCSI\\%hs%.8hs%.16hs",
371 VidBuffer,
372 PidBuffer);
374
375 DPRINT("2) '%S'\n", IdStart);
376
377 ++End;
378 --Remaining;
379
380 /* ID 3 */
381 IdStart = End;
383 Remaining,
384 &End,
385 &Remaining,
386 0,
387 L"SCSI\\%hs%.8hs",
389 VidBuffer);
391
392 DPRINT("3) '%S'\n", IdStart);
393
394 ++End;
395 --Remaining;
396
397 /* ID 4 */
398 IdStart = End;
400 Remaining,
401 &End,
402 &Remaining,
403 0,
404 L"SCSI\\%.8hs%.16hs%.1hs",
405 VidBuffer,
406 PidBuffer,
407 RevLevelBuffer);
409
410 DPRINT("4) '%S'\n", IdStart);
411
412 ++End;
413 --Remaining;
414
415 /* ID 5 */
416 IdStart = End;
418 Remaining,
419 &End,
420 &Remaining,
421 0,
422 L"%.8hs%.16hs%.1hs",
423 VidBuffer,
424 PidBuffer,
425 RevLevelBuffer);
427
428 DPRINT("5) '%S'\n", IdStart);
429
430 ++End;
431 --Remaining;
432
433 /* ID 6 */
434 IdStart = End;
436 Remaining,
437 &End,
438 &Remaining,
439 0,
440 L"%hs",
443
444 DPRINT("6) '%S'\n", IdStart);
445
446 *++End = UNICODE_NULL; /* multi-string */
447
448 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
449 return STATUS_SUCCESS;
450}
451
452
453static
458{
460 PWCHAR Buffer, End, IdStart;
462 size_t CharCount, Remaining;
463
465
466 DeviceType = GetDeviceType(PdoExtension->InquiryBuffer);
467
468 /*
469 * 1) SCSI\DeviceType
470 * 2) SCSI\RAW
471 */
472 CharCount = (sizeof("SCSI\\") - 1) + strlen(DeviceType) + sizeof(ANSI_NULL) +
473 (sizeof("SCSI\\RAW") - 1) + sizeof(ANSI_NULL) +
474 sizeof(ANSI_NULL); /* multi-string */
475
477 CharCount * sizeof(WCHAR),
479 if (!Buffer)
480 {
481 Irp->IoStatus.Information = 0;
483 }
484
485 DPRINT("CompatibleIDs:\n");
486
487 /* ID 1 */
488 IdStart = Buffer;
490 CharCount,
491 &End,
492 &Remaining,
493 0,
494 L"SCSI\\%hs",
495 DeviceType);
497
498 DPRINT("1) '%S'\n", IdStart);
499
500 ++End;
501 --Remaining;
502
503 /* ID 2 */
504 IdStart = End;
506 Remaining,
507 &End,
508 &Remaining,
509 0,
510 L"SCSI\\RAW");
512
513 DPRINT("2) '%S'\n", IdStart);
514
515 *++End = UNICODE_NULL; /* multi-string */
516
517 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
518 return STATUS_SUCCESS;
519}
520
521
522static
527{
530 size_t CharCount;
531
532 /* PathTargetLun */
533 CharCount = sizeof("FFFFFF");
534
536 CharCount * sizeof(WCHAR),
538 if (!Buffer)
539 {
540 Irp->IoStatus.Information = 0;
542 }
543
545 CharCount,
546 NULL,
547 NULL,
548 0,
549 L"%x%x%x",
550 PdoExtension->Bus,
551 PdoExtension->Target,
552 PdoExtension->Lun);
554
555 DPRINT("InstanceID: '%S'\n", Buffer);
556
557 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
558 return STATUS_SUCCESS;
559}
560
561
562static
567{
568 PIO_STACK_LOCATION IoStack;
571 size_t CharCount;
572
574 switch (IoStack->Parameters.QueryDeviceText.DeviceTextType)
575 {
577 {
578 PINQUIRYDATA InquiryData;
581 CHAR LocalBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
582 (sizeof(" ") - 1) +
583 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
584 sizeof(ANSI_NULL)];
585
586 InquiryData = PdoExtension->InquiryBuffer;
587 DeviceType = GetDeviceType(InquiryData);
588
589 CharCount = RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
590 (sizeof(" ") - 1) +
591 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
592 (sizeof(" SCSI ") - 1) +
594 (sizeof(" Device ") - 1) +
595 sizeof(ANSI_NULL);
596
598 CharCount * sizeof(WCHAR),
600 if (!Buffer)
601 {
603 break;
604 }
605
606 /* Combine VendorId and ProductId, separated by a space */
607 Offset = 0;
608 Offset += CopyField(InquiryData->VendorId,
609 &LocalBuffer[Offset],
610 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
611 ' ',
612 TRUE);
613 LocalBuffer[Offset++] = ' ';
614 Offset += CopyField(InquiryData->ProductId,
615 &LocalBuffer[Offset],
616 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
617 ' ',
618 TRUE);
619 LocalBuffer[Offset++] = ANSI_NULL;
620
622 CharCount,
623 NULL,
624 NULL,
625 0,
626 L"%hs SCSI %hs Device",
627 LocalBuffer,
628 DeviceType);
630
631 DPRINT("TextDescription: '%S'\n", Buffer);
632 break;
633 }
634
636 {
637 CharCount = sizeof("Bus Number 255, Target ID 255, LUN 255");
638
640 CharCount * sizeof(WCHAR),
642 if (!Buffer)
643 {
645 break;
646 }
647
649 CharCount,
650 NULL,
651 NULL,
652 0,
653 L"Bus Number %lu, Target ID %lu, LUN %lu",
654 PdoExtension->Bus,
655 PdoExtension->Target,
656 PdoExtension->Lun);
658
659 DPRINT("TextLocationInformation: '%S'\n", Buffer);
660 break;
661 }
662
663 default:
664 {
665 Buffer = NULL;
666 Status = Irp->IoStatus.Status;
667 break;
668 }
669 }
670
671 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
672 return Status;
673}
674
675
676static
681{
682 PDEVICE_RELATIONS deviceRelations;
684
685 // check if relation type is BusRelations
687 {
688 // PDO handles only target device relation
689 return Irp->IoStatus.Status;
690 }
691
692 deviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(*deviceRelations), TAG_DEVICE_RELATION);
693 if (!deviceRelations)
694 {
696 }
697
698 // initialize device relations
699 deviceRelations->Count = 1;
700 deviceRelations->Objects[0] = PdoExtension->Device;
702
703 Irp->IoStatus.Information = (ULONG_PTR)deviceRelations;
704 return STATUS_SUCCESS;
705}
706
707
709NTAPI
712 _In_ PIRP Irp)
713{
716 PPDO_DEVICE_EXTENSION DeviceExtension;
717
718 DPRINT1("PortPdoPnp(%p %p)\n", DeviceObject, Irp);
719
720 DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
721 ASSERT(DeviceExtension->ExtensionType == PdoExtension);
722
724
725 switch (Stack->MinorFunction)
726 {
728 {
729 // RegistryInitLunKey(lunExt);
730 DeviceExtension->PnpState = dsStarted;
732 break;
733 }
736 {
737 DeviceExtension->PnpState = (Stack->MinorFunction == IRP_MN_REMOVE_DEVICE)
740 break;
741 }
745 {
747 break;
748 }
750 {
751 Status = PdoHandleDeviceRelations(DeviceExtension, Irp);
752 break;
753 }
755 {
756 Status = PdoHandleQueryDeviceText(DeviceExtension, Irp);
757 break;
758 }
759 case IRP_MN_QUERY_ID:
760 {
761 DPRINT("IRP_MN_QUERY_ID IdType %s\n",
762 DbgGetDeviceIDString(Stack->Parameters.QueryId.IdType));
763
764 if (Stack->Parameters.QueryId.IdType == BusQueryDeviceID)
765 {
766 Status = PdoHandleQueryDeviceId(DeviceExtension, Irp);
767 break;
768 }
769 else if (Stack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
770 {
771 Status = PdoHandleQueryHardwareId(DeviceExtension, Irp);
772 break;
773 }
774 else if (Stack->Parameters.QueryId.IdType == BusQueryInstanceID)
775 {
776 Status = PdoHandleQueryInstanceId(DeviceExtension, Irp);
777 break;
778 }
779 else if (Stack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
780 {
781 Status = PdoHandleQueryCompatibleId(DeviceExtension, Irp);
782 break;
783 }
784
786 }
787 default:
788 {
789 // do nothing
790 Status = Irp->IoStatus.Status;
791 break;
792 }
793 }
794
795 if (Status != STATUS_PENDING)
796 {
797 Irp->IoStatus.Status = Status;
799 }
800
801 return Status;
802}
803
804
805/* EOF */
#define ExAllocatePoolUninitialized
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
Definition: actypes.h:127
PCSTR GenericType
Definition: atapi.c:21
@ GetGenericType
Definition: atapi.h:567
@ GetDeviceType
Definition: atapi.h:566
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
Definition: bufpool.h:45
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1315
PUCHAR End
Definition: desccheck.cpp:2229
LPWSTR Name
Definition: desk.c:124
#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
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
PCHAR DbgGetDeviceIDString(BUS_QUERY_ID_TYPE Type)
Definition: driverdbg.h:93
#define L(x)
Definition: resources.c:13
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
@ dsSurpriseRemoved
Definition: pci.h:39
@ dsRemoved
Definition: pci.h:38
#define ULONG_PTR
Definition: config.h:101
#define TAG_DEVICE_ID
Definition: precomp.h:31
#define TAG_DEVICE_TEXT
Definition: precomp.h:32
#define TAG_DEVICE_RELATION
Definition: precomp.h:30
#define TAG_LUN_EXTENSION
Definition: precomp.h:38
VOID NTAPI StorpBuildUnitAddress(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _Out_ PSTOR_ADDR_BTL8 Address)
Fills in the bus, target and LUN address of a logical unit.
Definition: srbex.c:28
#define TAG_INQUIRY_DATA
Definition: precomp.h:37
@ PdoExtension
Definition: precomp.h:62
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:24
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
@ dsStopped
Definition: isapnp.h:30
@ dsStarted
Definition: isapnp.h:31
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:86
_In_ PIRP Irp
Definition: kse.h:79
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
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:142
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:331
#define UNICODE_NULL
#define ANSI_NULL
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
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:1038
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
#define IoCompleteRequest
Definition: irp.c:1272
NTSTRSAFEVAPI RtlStringCchPrintfExW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd, _Out_opt_ size_t *pcchRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1246
short WCHAR
Definition: pedump.c:58
char CHAR
Definition: pedump.c:57
static WCHAR Address[46]
Definition: ping.c:68
#define __fallthrough
Definition: sal_old.h:314
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 STOR_ADDR_BTL8
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
static NTSTATUS PdoHandleDeviceRelations(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:524
static NTSTATUS PdoHandleQueryDeviceText(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:168
static NTSTATUS PdoHandleQueryHardwareId(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:346
static NTSTATUS PdoHandleQueryInstanceId(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:493
static NTSTATUS PdoHandleQueryCompatibleId(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:457
static ULONG CopyField(IN PUCHAR Name, IN PCHAR Buffer, IN ULONG MaxLength, IN CHAR DefaultCharacter, IN BOOLEAN Trim)
Definition: pdo.c:124
static NTSTATUS PdoHandleQueryDeviceId(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:263
VOID NTAPI PortFdoUnlinkPdo(_Inout_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: fdo.c:1451
VOID NTAPI PortFdoLinkPdo(_Inout_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PPDO_DEVICE_EXTENSION PdoExtension)
Adds a PDO where both the list lock and the interrupt service routines respect it.
Definition: fdo.c:1431
SCSI_UNIT_CONTROL_STATUS NTAPI MiniportUnitControl(_In_ PMINIPORT Miniport, _In_ SCSI_UNIT_CONTROL_TYPE ControlType, _In_opt_ PVOID Parameters)
Sends one unit control request, if the miniport claimed it.
Definition: miniport.c:581
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:126
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:710
NTSTATUS PortCreatePdo(_In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
Definition: pdo.c:21
@ ScsiUnitStart
Definition: storport.h:1570
@ ScsiUnitRemove
Definition: storport.h:1577
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
UCHAR ProductId[16]
Definition: cdrw_hw.h:1133
UCHAR ProductRevisionLevel[4]
Definition: cdrw_hw.h:1134
UCHAR VendorId[8]
Definition: cdrw_hw.h:1132
union _IO_STACK_LOCATION::@1823 Parameters
struct _IO_STACK_LOCATION::@5136::@5168 QueryDeviceText
struct _IO_STACK_LOCATION::@5136::@5161 QueryDeviceRelations
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:325
PDO_IO_FLOW_CONTROL FlowControl
Definition: precomp.h:337
PDEVICE_OBJECT Device
Definition: precomp.h:324
ULONG OutstandingRequestMax
Definition: precomp.h:338
DEVICE_STATE PnpState
Definition: precomp.h:326
EXTENSION_TYPE ExtensionType
Definition: precomp.h:322
LONG SpecialRequestCounter
Definition: precomp.h:341
LIST_ENTRY ActiveRequestsListHead
Definition: precomp.h:194
BOOLEAN IsWaitingQueueClear
Definition: precomp.h:176
ULONG RemainingBusyRequests
Definition: precomp.h:188
ULONG OutstandingRequestCount
Definition: precomp.h:185
ULONG StrongOrderedCount
Definition: precomp.h:182
ULONG RemainingPauseTime
Definition: precomp.h:191
LIST_ENTRY AwaitingRequestsListHead
Definition: precomp.h:200
#define STATUS_PENDING
Definition: telnetd.h:14
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
@ TargetDeviceRelation
Definition: iotypes.h:2158
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DO_POWER_PAGABLE
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
@ DeviceTextLocationInformation
Definition: iotypes.h:2961
@ DeviceTextDescription
Definition: iotypes.h:2960
@ BusQueryCompatibleIDs
Definition: iotypes.h:2953
@ BusQueryInstanceID
Definition: iotypes.h:2954
@ BusQueryDeviceID
Definition: iotypes.h:2951
@ BusQueryHardwareIDs
Definition: iotypes.h:2952
#define IRP_MN_QUERY_REMOVE_DEVICE
#define ObReferenceObject
Definition: obfuncs.h:204