ReactOS 0.4.17-dev-1190-g4c812f4
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;
31
32 DPRINT("PortCreatePdo(%p %p)\n",
33 FdoDeviceExtension, PdoDeviceExtension);
34
35 /* Create the port device */
36 Status = IoCreateDevice(FdoDeviceExtension->Device->DriverObject,
38 NULL,
41 FALSE,
42 &Pdo);
43 if (!NT_SUCCESS(Status))
44 {
45 DPRINT1("IoCreateDevice() failed (Status 0x%lX)\n", Status);
46 return Status;
47 }
48
49 /* Initialize the device */
50 Pdo->Flags |= DO_DIRECT_IO;
51 Pdo->Flags |= DO_POWER_PAGABLE;
52
53 DeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
54 RtlZeroMemory(DeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
55
56 DeviceExtension->ExtensionType = PdoExtension;
57
58 DeviceExtension->Device = Pdo;
59 DeviceExtension->FdoExtension = FdoDeviceExtension;
60 DeviceExtension->PnpState = dsStopped;
61
62 /* Add the PDO to the PDO list*/
63 StorpInterlockedInsertHeadListCounted(&FdoDeviceExtension->PdoListLock,
64 &FdoDeviceExtension->PdoListHead,
65 &DeviceExtension->PdoListEntry,
66 &FdoDeviceExtension->PdoCount);
67
68 DeviceExtension->Bus = Bus;
69 DeviceExtension->Target = Target;
70 DeviceExtension->Lun = Lun;
71
72 /* Initialize IO flow control structure */
73 // KeInitializeSpinLock(&DeviceExtension->FlowControl.Lock);
74 DeviceExtension->FlowControl.IsBusy = FALSE;
75 DeviceExtension->FlowControl.IsPaused = FALSE;
76 DeviceExtension->FlowControl.IsWaitingQueueClear = FALSE;
77 DeviceExtension->FlowControl.StrongOrderedCount = 0;
78 DeviceExtension->FlowControl.RemainingBusyRequests = 0;
79 DeviceExtension->FlowControl.RemainingPauseTime = 0;
80
81 /* Beginning from Windows 8, when you specified SRB_TYPE_STORAGE_REQUEST_BLOCK, you can increase
82 maximum number of outstanding requests to (254, MaxNumberOfIO) range. We do not support
83 STORAGE_REQUEST_BLOCKs so we're not implementing it.
84 */
86 // InitializeListHead(&DeviceExtension->FlowControl.ApprovedRequestsListHead);
88 DeviceExtension->FlowControl.OutstandingRequestCount = 0;
89 DeviceExtension->OutstandingRequestMax = 254;
90 DeviceExtension->TagCounter = -1;
91
92 DeviceExtension->IsClaimed = 0;
93
94 // FIXME: More initialization
95
96 DeviceExtension->SpecialRequestCounter = 0; /* FIXME: DELETE AFTER DEBUG */
97
98 /* The device has been initialized */
99 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
100
101 *PdoDeviceExtension = DeviceExtension;
102
103 return STATUS_SUCCESS;
104}
105
106
110{
111 DPRINT("PortDeletePdo(%p)\n", PdoExtension);
112
113 /* Remove the PDO from the PDO list*/
114 StorpInterlockedRemoveEntryListCounted(&PdoExtension->FdoExtension->PdoListLock,
115 &PdoExtension->PdoListEntry,
116 &PdoExtension->FdoExtension->PdoCount);
117
118 if (PdoExtension->InquiryBuffer)
119 {
121 PdoExtension->InquiryBuffer = NULL;
122 }
123
124
125 // FIXME: More uninitialization
126
127
128 /* Delete the PDO */
130
131 return STATUS_SUCCESS;
132}
133
134
135/* FROM SCSIPORT */
136
137static
138ULONG
140 IN PUCHAR Name,
142 IN ULONG MaxLength,
143 IN CHAR DefaultCharacter,
144 IN BOOLEAN Trim)
145{
146 ULONG Index;
147
148 for (Index = 0; Index < MaxLength; Index++)
149 {
150 if (Name[Index] <= ' ' || Name[Index] >= 0x7F /* last printable ascii character */ || Name[Index] == ',')
151 {
152 // convert to underscore
153 Buffer[Index] = DefaultCharacter;
154 }
155 else
156 {
157 // just copy character
159 }
160 }
161
162 /* Trim trailing default characters */
163 if (Trim)
164 {
165 while (Index > 0 && Buffer[Index - 1] == DefaultCharacter)
166 Index--;
167 }
168
169 return Index;
170}
171
172
173static
176 _In_ PPDO_DEVICE_EXTENSION DeviceExtension,
178{
182 PINQUIRYDATA InquiryData;
184 size_t CharCount;
185 CHAR VidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId) + sizeof(ANSI_NULL)];
186 CHAR PidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductId) + sizeof(ANSI_NULL)];
187 CHAR RevLevelBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) + sizeof(ANSI_NULL)];
188
189 InquiryData = DeviceExtension->InquiryBuffer;
190 DeviceType = GetDeviceType(InquiryData);
191
192 CharCount = (sizeof("SCSI\\") - 1) + strlen(DeviceType) +
193 (sizeof("&Ven_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
194 (sizeof("&Prod_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
195 (sizeof("&Rev_") - 1) + RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) +
196 sizeof(ANSI_NULL);
197
199 CharCount * sizeof(WCHAR),
201 if (!Buffer)
202 {
203 Irp->IoStatus.Information = 0;
205 }
206
207 Offset = CopyField(InquiryData->VendorId,
208 VidBuffer,
209 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
210 '_',
211 TRUE);
212 VidBuffer[Offset] = ANSI_NULL;
213
214 Offset = CopyField(InquiryData->ProductId,
215 PidBuffer,
216 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
217 '_',
218 TRUE);
219 PidBuffer[Offset] = ANSI_NULL;
220
222 RevLevelBuffer,
223 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel),
224 '_',
225 TRUE);
226 RevLevelBuffer[Offset] = ANSI_NULL;
227
229 CharCount,
230 NULL,
231 NULL,
232 0,
233 L"SCSI\\%hs&Ven_%hs&Prod_%hs&Rev_%hs",
235 VidBuffer,
236 PidBuffer,
237 RevLevelBuffer);
239
240 DPRINT("DeviceID: '%S'\n", Buffer);
241
242 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
243 return STATUS_SUCCESS;
244}
245
246
247static
252{
254 PWCHAR Buffer, End, IdStart;
255 PINQUIRYDATA InquiryData;
257 size_t CharCount, Remaining;
258 CHAR VidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId)];
259 CHAR PidBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductId)];
260 CHAR RevLevelBuffer[RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel)];
261
263
264 InquiryData = PdoExtension->InquiryBuffer;
265 DeviceType = GetDeviceType(InquiryData);
266 GenericType = GetGenericType(InquiryData);
267
268 /*
269 * 1) SCSI\DeviceTypeVendorId(8)ProductId(16)Revision(4)
270 * 2) SCSI\DeviceTypeVendorId(8)ProductId(16)
271 * 3) SCSI\DeviceTypeVendorId(8)
272 * 4) SCSI\VendorId(8)ProductId(16)Revision(1)
273 * 5) VendorId(8)ProductId(16)Revision(1)
274 * 6) GenericType
275 */
276 CharCount = strlen(DeviceType) * 3 +
278 (sizeof("SCSI\\") - 1) * 4 +
279 RTL_FIELD_SIZE(INQUIRYDATA, VendorId) * 5 +
280 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) * 4 +
281 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel) + 1 * 2 +
282 6 * sizeof(ANSI_NULL) +
283 sizeof(ANSI_NULL); /* multi-string */
284
286 CharCount * sizeof(WCHAR),
288 if (!Buffer)
289 {
290 Irp->IoStatus.Information = 0;
292 }
293
294 CopyField(InquiryData->VendorId,
295 VidBuffer,
296 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
297 '_',
298 FALSE);
299
300 CopyField(InquiryData->ProductId,
301 PidBuffer,
302 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
303 '_',
304 FALSE);
305
306 CopyField(InquiryData->ProductRevisionLevel,
307 RevLevelBuffer,
308 RTL_FIELD_SIZE(INQUIRYDATA, ProductRevisionLevel),
309 '_',
310 FALSE);
311
312 DPRINT("HardwareIDs:\n");
313
314 /* ID 1 */
315 IdStart = Buffer;
317 CharCount,
318 &End,
319 &Remaining,
320 0,
321 L"SCSI\\%hs%.8hs%.16hs%.4hs",
323 VidBuffer,
324 PidBuffer,
325 RevLevelBuffer);
327
328 DPRINT("1) '%S'\n", IdStart);
329
330 ++End;
331 --Remaining;
332
333 /* ID 2 */
334 IdStart = End;
336 Remaining,
337 &End,
338 &Remaining,
339 0,
340 L"SCSI\\%hs%.8hs%.16hs",
342 VidBuffer,
343 PidBuffer);
345
346 DPRINT("2) '%S'\n", IdStart);
347
348 ++End;
349 --Remaining;
350
351 /* ID 3 */
352 IdStart = End;
354 Remaining,
355 &End,
356 &Remaining,
357 0,
358 L"SCSI\\%hs%.8hs",
360 VidBuffer);
362
363 DPRINT("3) '%S'\n", IdStart);
364
365 ++End;
366 --Remaining;
367
368 /* ID 4 */
369 IdStart = End;
371 Remaining,
372 &End,
373 &Remaining,
374 0,
375 L"SCSI\\%.8hs%.16hs%.1hs",
376 VidBuffer,
377 PidBuffer,
378 RevLevelBuffer);
380
381 DPRINT("4) '%S'\n", IdStart);
382
383 ++End;
384 --Remaining;
385
386 /* ID 5 */
387 IdStart = End;
389 Remaining,
390 &End,
391 &Remaining,
392 0,
393 L"%.8hs%.16hs%.1hs",
394 VidBuffer,
395 PidBuffer,
396 RevLevelBuffer);
398
399 DPRINT("5) '%S'\n", IdStart);
400
401 ++End;
402 --Remaining;
403
404 /* ID 6 */
405 IdStart = End;
407 Remaining,
408 &End,
409 &Remaining,
410 0,
411 L"%hs",
414
415 DPRINT("6) '%S'\n", IdStart);
416
417 *++End = UNICODE_NULL; /* multi-string */
418
419 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
420 return STATUS_SUCCESS;
421}
422
423
424static
429{
431 PWCHAR Buffer, End, IdStart;
433 size_t CharCount, Remaining;
434
436
437 DeviceType = GetDeviceType(PdoExtension->InquiryBuffer);
438
439 /*
440 * 1) SCSI\DeviceType
441 * 2) SCSI\RAW
442 */
443 CharCount = (sizeof("SCSI\\") - 1) + strlen(DeviceType) + sizeof(ANSI_NULL) +
444 (sizeof("SCSI\\RAW") - 1) + sizeof(ANSI_NULL) +
445 sizeof(ANSI_NULL); /* multi-string */
446
448 CharCount * sizeof(WCHAR),
450 if (!Buffer)
451 {
452 Irp->IoStatus.Information = 0;
454 }
455
456 DPRINT("CompatibleIDs:\n");
457
458 /* ID 1 */
459 IdStart = Buffer;
461 CharCount,
462 &End,
463 &Remaining,
464 0,
465 L"SCSI\\%hs",
466 DeviceType);
468
469 DPRINT("1) '%S'\n", IdStart);
470
471 ++End;
472 --Remaining;
473
474 /* ID 2 */
475 IdStart = End;
477 Remaining,
478 &End,
479 &Remaining,
480 0,
481 L"SCSI\\RAW");
483
484 DPRINT("2) '%S'\n", IdStart);
485
486 *++End = UNICODE_NULL; /* multi-string */
487
488 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
489 return STATUS_SUCCESS;
490}
491
492
493static
498{
501 size_t CharCount;
502
503 /* PathTargetLun */
504 CharCount = sizeof("FFFFFF");
505
507 CharCount * sizeof(WCHAR),
509 if (!Buffer)
510 {
511 Irp->IoStatus.Information = 0;
513 }
514
516 CharCount,
517 NULL,
518 NULL,
519 0,
520 L"%x%x%x",
521 PdoExtension->Bus,
522 PdoExtension->Target,
523 PdoExtension->Lun);
525
526 DPRINT("InstanceID: '%S'\n", Buffer);
527
528 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
529 return STATUS_SUCCESS;
530}
531
532
533static
538{
539 PIO_STACK_LOCATION IoStack;
542 size_t CharCount;
543
545 switch (IoStack->Parameters.QueryDeviceText.DeviceTextType)
546 {
548 {
549 PINQUIRYDATA InquiryData;
552 CHAR LocalBuffer[RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
553 (sizeof(" ") - 1) +
554 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
555 sizeof(ANSI_NULL)];
556
557 InquiryData = PdoExtension->InquiryBuffer;
558 DeviceType = GetDeviceType(InquiryData);
559
560 CharCount = RTL_FIELD_SIZE(INQUIRYDATA, VendorId) +
561 (sizeof(" ") - 1) +
562 RTL_FIELD_SIZE(INQUIRYDATA, ProductId) +
563 (sizeof(" SCSI ") - 1) +
565 (sizeof(" Device ") - 1) +
566 sizeof(ANSI_NULL);
567
569 CharCount * sizeof(WCHAR),
571 if (!Buffer)
572 {
574 break;
575 }
576
577 /* Combine VendorId and ProductId, separated by a space */
578 Offset = 0;
579 Offset += CopyField(InquiryData->VendorId,
580 &LocalBuffer[Offset],
581 RTL_FIELD_SIZE(INQUIRYDATA, VendorId),
582 ' ',
583 TRUE);
584 LocalBuffer[Offset++] = ' ';
585 Offset += CopyField(InquiryData->ProductId,
586 &LocalBuffer[Offset],
587 RTL_FIELD_SIZE(INQUIRYDATA, ProductId),
588 ' ',
589 TRUE);
590 LocalBuffer[Offset++] = ANSI_NULL;
591
593 CharCount,
594 NULL,
595 NULL,
596 0,
597 L"%hs SCSI %hs Device",
598 LocalBuffer,
599 DeviceType);
601
602 DPRINT("TextDescription: '%S'\n", Buffer);
603 break;
604 }
605
607 {
608 CharCount = sizeof("Bus Number 255, Target ID 255, LUN 255");
609
611 CharCount * sizeof(WCHAR),
613 if (!Buffer)
614 {
616 break;
617 }
618
620 CharCount,
621 NULL,
622 NULL,
623 0,
624 L"Bus Number %lu, Target ID %lu, LUN %lu",
625 PdoExtension->Bus,
626 PdoExtension->Target,
627 PdoExtension->Lun);
629
630 DPRINT("TextLocationInformation: '%S'\n", Buffer);
631 break;
632 }
633
634 default:
635 {
636 Buffer = NULL;
637 Status = Irp->IoStatus.Status;
638 break;
639 }
640 }
641
642 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
643 return Status;
644}
645
646
647static
652{
653 PDEVICE_RELATIONS deviceRelations;
655
656 // check if relation type is BusRelations
658 {
659 // PDO handles only target device relation
660 return Irp->IoStatus.Status;
661 }
662
663 deviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(*deviceRelations), TAG_DEVICE_RELATION);
664 if (!deviceRelations)
665 {
667 }
668
669 // initialize device relations
670 deviceRelations->Count = 1;
671 deviceRelations->Objects[0] = PdoExtension->Device;
673
674 Irp->IoStatus.Information = (ULONG_PTR)deviceRelations;
675 return STATUS_SUCCESS;
676}
677
678
680NTAPI
683 _In_ PIRP Irp)
684{
687 PPDO_DEVICE_EXTENSION DeviceExtension;
688
689 DPRINT1("PortPdoPnp(%p %p)\n", DeviceObject, Irp);
690
691 DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
692 ASSERT(DeviceExtension->ExtensionType == PdoExtension);
693
695
696 switch (Stack->MinorFunction)
697 {
699 {
700 // RegistryInitLunKey(lunExt);
701 DeviceExtension->PnpState = dsStarted;
703 break;
704 }
707 {
708 DeviceExtension->PnpState = (Stack->MinorFunction == IRP_MN_REMOVE_DEVICE)
711 break;
712 }
716 {
718 break;
719 }
721 {
722 Status = PdoHandleDeviceRelations(DeviceExtension, Irp);
723 break;
724 }
726 {
727 Status = PdoHandleQueryDeviceText(DeviceExtension, Irp);
728 break;
729 }
730 case IRP_MN_QUERY_ID:
731 {
732 DPRINT("IRP_MN_QUERY_ID IdType %s\n",
733 DbgGetDeviceIDString(Stack->Parameters.QueryId.IdType));
734
735 if (Stack->Parameters.QueryId.IdType == BusQueryDeviceID)
736 {
737 Status = PdoHandleQueryDeviceId(DeviceExtension, Irp);
738 break;
739 }
740 else if (Stack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
741 {
742 Status = PdoHandleQueryHardwareId(DeviceExtension, Irp);
743 break;
744 }
745 else if (Stack->Parameters.QueryId.IdType == BusQueryInstanceID)
746 {
747 Status = PdoHandleQueryInstanceId(DeviceExtension, Irp);
748 break;
749 }
750 else if (Stack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
751 {
752 Status = PdoHandleQueryCompatibleId(DeviceExtension, Irp);
753 break;
754 }
755
757 }
758 default:
759 {
760 // do nothing
761 Status = Irp->IoStatus.Status;
762 break;
763 }
764 }
765
766 if (Status != STATUS_PENDING)
767 {
768 Irp->IoStatus.Status = Status;
770 }
771
772 return Status;
773}
774
775
776/* 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
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_INQUIRY_DATA
Definition: precomp.h:37
@ PdoExtension
Definition: precomp.h:61
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#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
FORCEINLINE ULONG StorpInterlockedInsertHeadListCounted(_In_ PKSPIN_LOCK SpinLock, _In_ PLIST_ENTRY ListHead, _In_ PLIST_ENTRY Entry, _In_ PULONG Counter)
InsertHeadList and increment element counter with a corresponding spin lock held.
Definition: inline.h:71
FORCEINLINE BOOLEAN StorpInterlockedRemoveEntryListCounted(_In_ PKSPIN_LOCK SpinLock, _In_ PLIST_ENTRY Entry, _In_ PULONG Counter)
RemoveEntryList and decrement element counter with a corresponding spin lock held.
Definition: inline.h:126
@ 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
#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
#define __fallthrough
Definition: sal_old.h:314
#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
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:108
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:681
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
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
struct _IO_STACK_LOCATION::@5020::@5045 QueryDeviceRelations
union _IO_STACK_LOCATION::@1814 Parameters
struct _IO_STACK_LOCATION::@5020::@5052 QueryDeviceText
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:303
PDO_IO_FLOW_CONTROL FlowControl
Definition: precomp.h:315
LIST_ENTRY PdoListEntry
Definition: precomp.h:305
PDEVICE_OBJECT Device
Definition: precomp.h:302
ULONG OutstandingRequestMax
Definition: precomp.h:316
DEVICE_STATE PnpState
Definition: precomp.h:304
EXTENSION_TYPE ExtensionType
Definition: precomp.h:300
LONG SpecialRequestCounter
Definition: precomp.h:319
LIST_ENTRY ActiveRequestsListHead
Definition: precomp.h:180
BOOLEAN IsWaitingQueueClear
Definition: precomp.h:162
ULONG RemainingBusyRequests
Definition: precomp.h:174
ULONG OutstandingRequestCount
Definition: precomp.h:171
ULONG StrongOrderedCount
Definition: precomp.h:168
ULONG RemainingPauseTime
Definition: precomp.h:177
LIST_ENTRY AwaitingRequestsListHead
Definition: precomp.h:186
#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