ReactOS 0.4.17-dev-1190-g4c812f4
fdo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Floppy Disk Controller Driver
3 * LICENSE: GNU GPLv2 only as published by the Free Software Foundation
4 * FILE: drivers/storage/fdc/fdc/fdo.c
5 * PURPOSE: Functional Device Object routines
6 * PROGRAMMERS: Eric Kohl
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "fdc.h"
12
13#include <stdio.h>
14#define NDEBUG
15#include <debug.h>
16
17/* FUNCTIONS ******************************************************************/
18
23 IN PIRP Irp)
24{
25 PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
26
27 ASSERT(LowerDevice);
28
30 return IoCallDriver(LowerDevice, Irp);
31}
32
33
34static
39 IN PCM_RESOURCE_LIST ResourceListTranslated)
40{
41 PFDO_DEVICE_EXTENSION DeviceExtension;
42 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
43// PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorTranslated;
44 ULONG i;
45
46 DPRINT("FdcFdoStartDevice called\n");
47
48 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
49
50 ASSERT(DeviceExtension);
51
52 if (ResourceList == NULL ||
53 ResourceListTranslated == NULL)
54 {
55 DPRINT1("No allocated resources sent to driver\n");
57 }
58
59 if (ResourceList->Count != 1)
60 {
61 DPRINT1("Wrong number of allocated resources sent to driver\n");
63 }
64
65 if (ResourceList->List[0].PartialResourceList.Version != 1 ||
66 ResourceList->List[0].PartialResourceList.Revision != 1 ||
67 ResourceListTranslated->List[0].PartialResourceList.Version != 1 ||
68 ResourceListTranslated->List[0].PartialResourceList.Revision != 1)
69 {
70 DPRINT1("Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
71 ResourceList->List[0].PartialResourceList.Version,
72 ResourceList->List[0].PartialResourceList.Revision,
73 ResourceListTranslated->List[0].PartialResourceList.Version,
74 ResourceListTranslated->List[0].PartialResourceList.Revision);
76 }
77
78 DeviceExtension->ControllerInfo.PortAddressValid = FALSE;
79 DeviceExtension->ControllerInfo.PortAddress.QuadPart = 0;
80
81 for (i = 0; i < ResourceList->List[0].PartialResourceList.Count; i++)
82 {
83 PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
84// PartialDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[i];
85
86 switch (PartialDescriptor->Type)
87 {
89 DPRINT("Port: 0x%lx (%lu)\n",
90 PartialDescriptor->u.Port.Start.u.LowPart,
91 PartialDescriptor->u.Port.Length);
92 if (!DeviceExtension->ControllerInfo.PortAddressValid ||
93 PartialDescriptor->u.Port.Start.QuadPart <
94 DeviceExtension->ControllerInfo.PortAddress.QuadPart)
95 {
96 DeviceExtension->ControllerInfo.PortAddress = PartialDescriptor->u.Port.Start;
97 DeviceExtension->ControllerInfo.PortAddressValid = TRUE;
98 }
99 break;
100
102 DPRINT("Interrupt: Level %lu Vector %lu\n",
103 PartialDescriptor->u.Interrupt.Level,
104 PartialDescriptor->u.Interrupt.Vector);
105/*
106 Dirql = (KIRQL)PartialDescriptorTranslated->u.Interrupt.Level;
107 Vector = PartialDescriptorTranslated->u.Interrupt.Vector;
108 Affinity = PartialDescriptorTranslated->u.Interrupt.Affinity;
109 if (PartialDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
110 InterruptMode = Latched;
111 else
112 InterruptMode = LevelSensitive;
113 ShareInterrupt = (PartialDescriptorTranslated->ShareDisposition == CmResourceShareShared);
114*/
115 break;
116
118 DPRINT("Dma: Channel %lu\n",
119 PartialDescriptor->u.Dma.Channel);
120 break;
121 }
122 }
123
124 return STATUS_SUCCESS;
125}
126
127
128static
130NTAPI
133 PUNICODE_STRING PathName,
137 CONFIGURATION_TYPE ControllerType,
138 ULONG ControllerNumber,
139 PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
140 CONFIGURATION_TYPE PeripheralType,
141 ULONG PeripheralNumber,
142 PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
143{
144 PKEY_VALUE_FULL_INFORMATION ControllerFullDescriptor;
145 PCM_FULL_RESOURCE_DESCRIPTOR ControllerResourceDescriptor;
146 PKEY_VALUE_FULL_INFORMATION PeripheralFullDescriptor;
147 PCM_FULL_RESOURCE_DESCRIPTOR PeripheralResourceDescriptor;
148 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
149 PCM_FLOPPY_DEVICE_DATA FloppyDeviceData;
150 PFDO_DEVICE_EXTENSION DeviceExtension;
151 PDRIVE_INFO DriveInfo;
152 BOOLEAN ControllerFound = FALSE;
153 ULONG64 PortAddress;
154 ULONG64 PortRangeStart;
155 ULONG i;
156
157 DPRINT("FdcFdoConfigCallback() called\n");
158
159 DeviceExtension = (PFDO_DEVICE_EXTENSION)Context;
160
161 /* Get the controller resources */
162 if (ControllerInformation == NULL ||
163 ControllerInformation[IoQueryDeviceConfigurationData] == NULL)
164 {
165 DPRINT1("Ignoring controller %lu: no configuration data\n",
166 ControllerNumber);
167 return STATUS_SUCCESS;
168 }
169
170 ControllerFullDescriptor = ControllerInformation[IoQueryDeviceConfigurationData];
171 ControllerResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)ControllerFullDescriptor +
172 ControllerFullDescriptor->DataOffset);
173
174 for(i = 0; i < ControllerResourceDescriptor->PartialResourceList.Count; i++)
175 {
176 PartialDescriptor = &ControllerResourceDescriptor->PartialResourceList.PartialDescriptors[i];
177
178 if (PartialDescriptor->Type != CmResourceTypePort ||
179 !DeviceExtension->ControllerInfo.PortAddressValid)
180 {
181 continue;
182 }
183
184 PortAddress = DeviceExtension->ControllerInfo.PortAddress.QuadPart;
185 PortRangeStart = PartialDescriptor->u.Port.Start.QuadPart;
186
187 if (PortAddress < PortRangeStart ||
188 PortAddress - PortRangeStart >= PartialDescriptor->u.Port.Length)
189 {
190 continue;
191 }
192
193 ControllerFound = TRUE;
194 break;
195 }
196
197 /* Leave, if the enumerated controller is not the one represented by the FDO */
198 if (ControllerFound == FALSE)
199 return STATUS_SUCCESS;
200
201 /* Get the peripheral resources */
202 if (PeripheralInformation == NULL ||
203 PeripheralInformation[IoQueryDeviceConfigurationData] == NULL)
204 {
205 DPRINT1("Ignoring floppy drive %lu: no configuration data\n",
206 PeripheralNumber);
207 return STATUS_SUCCESS;
208 }
209
210 PeripheralFullDescriptor = PeripheralInformation[IoQueryDeviceConfigurationData];
211 PeripheralResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)PeripheralFullDescriptor +
212 PeripheralFullDescriptor->DataOffset);
213
214 /* learn about drives attached to controller */
215 for(i = 0; i < PeripheralResourceDescriptor->PartialResourceList.Count; i++)
216 {
217 PartialDescriptor = &PeripheralResourceDescriptor->PartialResourceList.PartialDescriptors[i];
218
219 if (PartialDescriptor->Type != CmResourceTypeDeviceSpecific)
220 continue;
221
222 if (PartialDescriptor->u.DeviceSpecificData.DataSize < sizeof(CM_FLOPPY_DEVICE_DATA))
223 {
224 DPRINT1("Ignoring floppy drive %lu: device-specific data is too small (%lu bytes)\n",
225 PeripheralNumber,
226 PartialDescriptor->u.DeviceSpecificData.DataSize);
227 continue;
228 }
229
231 {
232 DPRINT1("Ignoring floppy drive %lu: controller supports at most %u drives\n",
233 PeripheralNumber,
235 continue;
236 }
237
238 FloppyDeviceData = (PCM_FLOPPY_DEVICE_DATA)(PartialDescriptor + 1);
239
240 DriveInfo = &DeviceExtension->ControllerInfo.DriveInfo[DeviceExtension->ControllerInfo.NumberOfDrives];
241
242 DriveInfo->ControllerInfo = &DeviceExtension->ControllerInfo;
243 DriveInfo->UnitNumber = DeviceExtension->ControllerInfo.NumberOfDrives;
244 DriveInfo->PeripheralNumber = PeripheralNumber;
245
246 DriveInfo->FloppyDeviceData.MaxDensity = FloppyDeviceData->MaxDensity;
247 DriveInfo->FloppyDeviceData.MountDensity = FloppyDeviceData->MountDensity;
249 DriveInfo->FloppyDeviceData.HeadLoadTime = FloppyDeviceData->HeadLoadTime;
250 DriveInfo->FloppyDeviceData.MotorOffTime = FloppyDeviceData->MotorOffTime;
251 DriveInfo->FloppyDeviceData.SectorLengthCode = FloppyDeviceData->SectorLengthCode;
252 DriveInfo->FloppyDeviceData.SectorPerTrack = FloppyDeviceData->SectorPerTrack;
253 DriveInfo->FloppyDeviceData.ReadWriteGapLength = FloppyDeviceData->ReadWriteGapLength;
254 DriveInfo->FloppyDeviceData.FormatGapLength = FloppyDeviceData->FormatGapLength;
255 DriveInfo->FloppyDeviceData.FormatFillCharacter = FloppyDeviceData->FormatFillCharacter;
256 DriveInfo->FloppyDeviceData.HeadSettleTime = FloppyDeviceData->HeadSettleTime;
257 DriveInfo->FloppyDeviceData.MotorSettleTime = FloppyDeviceData->MotorSettleTime;
258 DriveInfo->FloppyDeviceData.MaximumTrackValue = FloppyDeviceData->MaximumTrackValue;
259 DriveInfo->FloppyDeviceData.DataTransferLength = FloppyDeviceData->DataTransferLength;
260
261 /* Once it's all set up, acknowledge its existence in the controller info object */
262 DeviceExtension->ControllerInfo.NumberOfDrives++;
263 }
264
265 DeviceExtension->ControllerInfo.Populated = TRUE;
266
267 DPRINT("Detected %lu floppy drives!\n",
268 DeviceExtension->ControllerInfo.NumberOfDrives);
269
270 return STATUS_SUCCESS;
271}
272
273
274static
277{
278 WCHAR Buffer[256];
279 UNICODE_STRING BufferU;
280 ULONG Index;
281
282 Index = 0;
284 L"FDC\\GENERIC_FLOPPY_DRIVE");
285 Index++;
286
288
289 BufferU.Length = BufferU.MaximumLength = (USHORT) Index * sizeof(WCHAR);
290 BufferU.Buffer = Buffer;
291
292 return DuplicateUnicodeString(0, &BufferU, HardwareIDs);
293}
294
295
296static
299{
300 WCHAR Buffer[256];
301 UNICODE_STRING BufferU;
302 ULONG Index;
303
304 Index = 0;
306 L"GenFloppyDisk");
307 Index++;
308
310
311 BufferU.Length = BufferU.MaximumLength = (USHORT)Index * sizeof(WCHAR);
312 BufferU.Buffer = Buffer;
313
314 return DuplicateUnicodeString(0, &BufferU, CompatibleIDs);
315}
316
317
318static
321 ULONG PeripheralNumber)
322{
323 WCHAR Buffer[3];
324
325 _swprintf(Buffer, L"%02X", PeripheralNumber & 0xff);
326
328}
329
330
331static
334 IN PDEVICE_RELATIONS Relations,
336{
337 ULONG i;
338
339 if (Relations == NULL)
340 return FALSE;
341
342 for (i = 0; i < Relations->Count; i++)
343 {
344 if (Relations->Objects[i] == DeviceObject)
345 return TRUE;
346 }
347
348 return FALSE;
349}
350
351
352static
353VOID
355 IN PFDO_DEVICE_EXTENSION FdoDeviceExtension)
356{
357 PPDO_DEVICE_EXTENSION PdoDeviceExtension;
358 PDRIVE_INFO DriveInfo;
359 ULONG i;
360
361 for (i = 0; i < FdoDeviceExtension->ControllerInfo.NumberOfDrives; i++)
362 {
363 DriveInfo = &FdoDeviceExtension->ControllerInfo.DriveInfo[i];
364 if (DriveInfo->DeviceObject == NULL)
365 continue;
366
367 PdoDeviceExtension =
369 PdoDeviceExtension->ReportedPresent = TRUE;
370 }
371}
372
373
374static
378 IN PDEVICE_RELATIONS ExistingRelations,
379 OUT PDEVICE_RELATIONS *DeviceRelations)
380{
381 PFDO_DEVICE_EXTENSION FdoDeviceExtension;
382 PPDO_DEVICE_EXTENSION PdoDeviceExtension;
384 CONFIGURATION_TYPE ControllerType = DiskController;
386 PDEVICE_RELATIONS Relations;
387 PDRIVE_INFO DriveInfo;
389 WCHAR DeviceNameBuffer[80];
392 ULONG ExistingCount;
393 ULONG MissingCount = 0;
394 ULONG AddedCount = 0;
395 ULONG TotalCount;
396 SIZE_T Size;
397 ULONG i;
399
400 DPRINT("FdcFdoQueryBusRelations() called\n");
401
402 FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
403 *DeviceRelations = ExistingRelations;
404
405 if (!FdoDeviceExtension->ControllerInfo.Populated)
406 {
407 FdoDeviceExtension->ControllerInfo.NumberOfDrives = 0;
408
410 NULL,
411 &ControllerType,
412 NULL,
413 &PeripheralType,
414 NULL,
416 FdoDeviceExtension);
418 return Status;
419
420 FdoDeviceExtension->ControllerInfo.Populated = TRUE;
421 }
422
423 ExistingCount = (ExistingRelations != NULL) ? ExistingRelations->Count : 0;
424
425 for (i = 0; i < FdoDeviceExtension->ControllerInfo.NumberOfDrives; i++)
426 {
427 DriveInfo = &FdoDeviceExtension->ControllerInfo.DriveInfo[i];
428 if (DriveInfo->DeviceObject == NULL ||
429 !FdcRelationsContainDeviceObject(ExistingRelations, DriveInfo->DeviceObject))
430 {
431 MissingCount++;
432 }
433 }
434
435 if (MissingCount == 0 && ExistingRelations != NULL)
436 {
437 FdcMarkPdosPresent(FdoDeviceExtension);
438 return STATUS_SUCCESS;
439 }
440
441 if (MissingCount == 0)
442 {
445 FDC_TAG);
446 if (Relations == NULL)
448
449 Relations->Count = 0;
450 *DeviceRelations = Relations;
451 return STATUS_SUCCESS;
452 }
453
454 if (ExistingCount > MAXULONG - MissingCount)
456
457 TotalCount = ExistingCount + MissingCount;
458 if (TotalCount > ((MAXULONG - FIELD_OFFSET(DEVICE_RELATIONS, Objects)) /
459 sizeof(PDEVICE_OBJECT)))
460 {
462 }
463
465 ((SIZE_T)TotalCount * sizeof(PDEVICE_OBJECT));
467 if (Relations == NULL)
468 {
470 }
471
472 if (ExistingCount != 0)
473 {
474 RtlCopyMemory(Relations->Objects,
475 ExistingRelations->Objects,
476 ExistingCount * sizeof(PDEVICE_OBJECT));
477 }
478
479 for (i = 0; i < FdoDeviceExtension->ControllerInfo.NumberOfDrives; i++)
480 {
481 DriveInfo = &FdoDeviceExtension->ControllerInfo.DriveInfo[i];
482
483 if (DriveInfo->DeviceObject == NULL)
484 {
485 Pdo = NULL;
486
487 do
488 {
489 _swprintf(DeviceNameBuffer, L"\\Device\\FloppyPDO%lu", DeviceNumber++);
490 RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
491 DPRINT("Device name: %S\n", DeviceNameBuffer);
492
493 /* Create physical device object */
494 Status = IoCreateDevice(FdoDeviceExtension->Common.DeviceObject->DriverObject,
495 sizeof(PDO_DEVICE_EXTENSION),
496 &DeviceName,
499 FALSE,
500 &Pdo);
501 }
503
504 if (!NT_SUCCESS(Status))
505 {
506 DPRINT1("PDO creation failed (Status 0x%08lx)\n", Status);
507 goto done;
508 }
509
510 DPRINT("PDO created: %S\n", DeviceNameBuffer);
511
512 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
513 RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
514
515 PdoDeviceExtension->Common.IsFDO = FALSE;
516 PdoDeviceExtension->Common.DeviceObject = Pdo;
517
518 PdoDeviceExtension->Fdo = FdoDeviceExtension->Common.DeviceObject;
519 PdoDeviceExtension->DriveInfo = DriveInfo;
520
521 /* Add Device ID string */
522 if (!RtlCreateUnicodeString(&PdoDeviceExtension->DeviceId,
523 L"FDC\\GENERIC_FLOPPY_DRIVE"))
524 {
526 goto free_pdo;
527 }
528 DPRINT("DeviceID: %S\n", PdoDeviceExtension->DeviceId.Buffer);
529
530 /* Add Hardware IDs string */
531 Status = PciCreateHardwareIDsString(&PdoDeviceExtension->HardwareIds);
532 if (!NT_SUCCESS(Status))
533 {
534 goto free_pdo;
535 }
536
537 /* Add Compatible IDs string */
538 Status = PciCreateCompatibleIDsString(&PdoDeviceExtension->CompatibleIds);
539 if (!NT_SUCCESS(Status))
540 {
541 goto free_pdo;
542 }
543
544 /* Add Instance ID string */
545 Status = PciCreateInstanceIDString(&PdoDeviceExtension->InstanceId,
546 DriveInfo->PeripheralNumber);
547 if (!NT_SUCCESS(Status))
548 {
549 goto free_pdo;
550 }
551
552#if 0
553 /* Add device description string */
555 if (!NT_SUCCESS(Status))
556 {
557// ErrorStatus = Status;
558// ErrorOccurred = TRUE;
559 break;
560 }
561
562 /* Add device location string */
564 if (!NT_SUCCESS(Status))
565 {
566// ErrorStatus = Status;
567// ErrorOccurred = TRUE;
568 break;
569 }
570#endif
571
572 Pdo->Flags |= DO_DIRECT_IO;
573 Pdo->Flags |= DO_POWER_PAGABLE;
574 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
575
576 DriveInfo->DeviceObject = Pdo;
577 }
578
579 if (FdcRelationsContainDeviceObject(ExistingRelations, DriveInfo->DeviceObject))
580 continue;
581
583 Relations->Objects[ExistingCount + AddedCount] = DriveInfo->DeviceObject;
584 AddedCount++;
585 }
586
587 ASSERT(AddedCount == MissingCount);
588 Relations->Count = ExistingCount + AddedCount;
589
590 /* Only publish PDO presence after the complete relations query succeeds. */
591 FdcMarkPdosPresent(FdoDeviceExtension);
592
593 if (ExistingRelations != NULL)
594 ExFreePool(ExistingRelations);
595
596 *DeviceRelations = Relations;
597 return STATUS_SUCCESS;
598
599free_pdo:
600 RtlFreeUnicodeString(&PdoDeviceExtension->DeviceId);
601 RtlFreeUnicodeString(&PdoDeviceExtension->HardwareIds);
602 RtlFreeUnicodeString(&PdoDeviceExtension->CompatibleIds);
603 RtlFreeUnicodeString(&PdoDeviceExtension->InstanceId);
605
606done:
607 while (AddedCount != 0)
608 {
609 AddedCount--;
610 ObDereferenceObject(Relations->Objects[ExistingCount + AddedCount]);
611 }
612
613 ExFreePool(Relations);
614
615 return Status;
616}
617
618
620NTAPI
623 IN PIRP Irp)
624{
627 PDEVICE_RELATIONS DeviceRelations = NULL;
631 ULONG i;
632
633 DPRINT("FdcFdoPnp()\n");
634
636 Information = Irp->IoStatus.Information;
637
638 switch (IrpSp->MinorFunction)
639 {
641 DPRINT(" IRP_MN_START_DEVICE received\n");
642
643 /* Call lower driver */
645 FdoExtension = DeviceObject->DeviceExtension;
646
647 if (IoForwardIrpSynchronously(FdoExtension->LowerDevice, Irp))
648 {
649 Status = Irp->IoStatus.Status;
650 if (NT_SUCCESS(Status))
651 {
653 IrpSp->Parameters.StartDevice.AllocatedResources,
654 IrpSp->Parameters.StartDevice.AllocatedResourcesTranslated);
655 }
656 }
657
658 break;
659
661 DPRINT(" IRP_MN_QUERY_REMOVE_DEVICE\n");
662 Irp->IoStatus.Status = STATUS_SUCCESS;
664
666 DPRINT(" IRP_MN_REMOVE_DEVICE received\n");
667 FdoExtension = DeviceObject->DeviceExtension;
668
669 for (i = 0; i < FdoExtension->ControllerInfo.NumberOfDrives; i++)
670 {
671 Pdo = FdoExtension->ControllerInfo.DriveInfo[i].DeviceObject;
672 if (Pdo != NULL)
674 }
675
676 /* The lower stack owns the remove IRP after we forward it. */
677 Irp->IoStatus.Status = STATUS_SUCCESS;
679 Status = IoCallDriver(FdoExtension->LowerDevice, Irp);
680
681 IoDetachDevice(FdoExtension->LowerDevice);
683 return Status;
684
686 DPRINT(" IRP_MN_CANCEL_REMOVE_DEVICE\n");
687 Irp->IoStatus.Status = STATUS_SUCCESS;
689
691 DPRINT(" IRP_MN_STOP_DEVICE received\n");
692 Irp->IoStatus.Status = STATUS_SUCCESS;
694
696 DPRINT(" IRP_MN_QUERY_STOP_DEVICE received\n");
697 Irp->IoStatus.Status = STATUS_SUCCESS;
699
701 DPRINT(" IRP_MN_CANCEL_STOP_DEVICE\n");
702 Irp->IoStatus.Status = STATUS_SUCCESS;
704
706 DPRINT(" IRP_MN_QUERY_DEVICE_RELATIONS\n");
707
709 {
710 case BusRelations:
711 DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
714 &DeviceRelations);
715 if (NT_SUCCESS(Status))
716 {
717 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
718 Irp->IoStatus.Status = STATUS_SUCCESS;
720 }
721 break;
722
723 case RemovalRelations:
724 DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
726
727 default:
728 DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
731 }
732 break;
733
735 DPRINT(" IRP_MN_SURPRISE_REMOVAL received\n");
736 Irp->IoStatus.Status = STATUS_SUCCESS;
738
739 default:
740 DPRINT(" Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
742 }
743
744 Irp->IoStatus.Information = Information;
745 Irp->IoStatus.Status = Status;
747
748 return Status;
749}
750
751/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define STATUS_INTEGER_OVERFLOW
Definition: log.c:20
@ DiskController
Definition: arcname.c:68
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
Definition: bufpool.h:45
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#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 L(x)
Definition: resources.c:13
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4138
#define FDC_TAG
Definition: fdc.h:105
#define MAX_DRIVES_PER_CONTROLLER
Definition: fdc.h:16
VOID FdcPdoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: pdo.c:120
#define ULONG_PTR
Definition: config.h:101
@ FdoExtension
Definition: precomp.h:60
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: misc.c:31
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
NTSTATUS NTAPI IoQueryDeviceDescription(_In_opt_ PINTERFACE_TYPE BusType, _In_opt_ PULONG BusNumber, _In_opt_ PCONFIGURATION_TYPE ControllerType, _In_opt_ PULONG ControllerNumber, _In_opt_ PCONFIGURATION_TYPE PeripheralType, _In_opt_ PULONG PeripheralNumber, _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, _In_opt_ PVOID Context)
Reads and returns Hardware information from the appropriate hardware registry key.
Definition: iorsrce.c:1213
_In_ PIRP Irp
Definition: kse.h:79
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define FILE_DEVICE_MASS_STORAGE
Definition: imports.h:60
unsigned __int64 ULONG64
Definition: imports.h:198
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define UNICODE_NULL
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
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 IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1306
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
#define IoCompleteRequest
Definition: irp.c:1272
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1657
#define IoCallDriver
Definition: irp.c:1257
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:285
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
NTSTATUS PciCreateInstanceIDString(PUNICODE_STRING InstanceID, PPCI_DEVICE Device)
Definition: pci.c:302
NTSTATUS PciCreateDeviceDescriptionString(PUNICODE_STRING DeviceDescription, PPCI_DEVICE Device)
Definition: pci.c:430
NTSTATUS PciCreateCompatibleIDsString(PUNICODE_STRING CompatibleIDs, PPCI_DEVICE Device)
Definition: pci.c:366
NTSTATUS PciCreateHardwareIDsString(PUNICODE_STRING HardwareIDs, PPCI_DEVICE Device)
Definition: pci.c:314
NTSTATUS PciCreateDeviceLocationString(PUNICODE_STRING DeviceLocation, PPCI_DEVICE Device)
Definition: pci.c:698
_In_ ULONG BusNumber
Definition: pciidex.h:65
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
#define CmResourceTypeDma
Definition: restypes.h:107
#define CmResourceTypeDeviceSpecific
Definition: restypes.h:108
@ Isa
Definition: restypes.h:123
enum _INTERFACE_TYPE INTERFACE_TYPE
#define CmResourceTypePort
Definition: restypes.h:104
#define CmResourceTypeInterrupt
Definition: restypes.h:105
@ FloppyDiskPeripheral
Definition: arc.h:139
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
NTSTATUS NTAPI FdcFdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:621
static NTSTATUS FdcFdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST ResourceList, IN PCM_RESOURCE_LIST ResourceListTranslated)
Definition: fdo.c:36
static VOID FdcMarkPdosPresent(IN PFDO_DEVICE_EXTENSION FdoDeviceExtension)
Definition: fdo.c:354
static BOOLEAN FdcRelationsContainDeviceObject(IN PDEVICE_RELATIONS Relations, IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:333
static NTSTATUS FdcFdoQueryBusRelations(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_RELATIONS ExistingRelations, OUT PDEVICE_RELATIONS *DeviceRelations)
Definition: fdo.c:376
static NTSTATUS NTAPI FdcFdoConfigCallback(PVOID Context, PUNICODE_STRING PathName, INTERFACE_TYPE BusType, ULONG BusNumber, PKEY_VALUE_FULL_INFORMATION *BusInformation, CONFIGURATION_TYPE ControllerType, ULONG ControllerNumber, PKEY_VALUE_FULL_INFORMATION *ControllerInformation, CONFIGURATION_TYPE PeripheralType, ULONG PeripheralNumber, PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
Definition: fdo.c:131
PDEVICE_OBJECT DeviceObject
Definition: kstypes.h:153
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:490
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:145
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@496 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@503 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@500 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@497 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
UCHAR NumberOfDrives
Definition: fdc.h:59
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:61
PHYSICAL_ADDRESS PortAddress
Definition: fdc.h:50
BOOLEAN PortAddressValid
Definition: fdc.h:49
BOOLEAN Populated
Definition: fdc.h:39
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
PDEVICE_OBJECT DeviceObject
Definition: fdc.h:26
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
Definition: fdc.h:27
ULONG PeripheralNumber
Definition: fdc.h:25
UCHAR UnitNumber
Definition: fdc.h:24
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
CONTROLLER_INFO ControllerInfo
Definition: fdc.h:84
struct _IO_STACK_LOCATION::@5020::@5045 QueryDeviceRelations
struct _IO_STACK_LOCATION::@5020::@5057 StartDevice
union _IO_STACK_LOCATION::@1814 Parameters
PDEVICE_OBJECT Fdo
Definition: pci.h:61
UNICODE_STRING InstanceId
Definition: serenum.h:53
UNICODE_STRING DeviceDescription
Definition: pci.h:73
UNICODE_STRING HardwareIds
Definition: serenum.h:54
BOOLEAN ReportedPresent
Definition: fdc.h:95
UNICODE_STRING DeviceLocation
Definition: pci.h:75
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:59
UNICODE_STRING CompatibleIds
Definition: serenum.h:55
PDRIVE_INFO DriveInfo
Definition: fdc.h:94
UNICODE_STRING DeviceId
Definition: serenum.h:52
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define MAXULONG
Definition: typedefs.h:251
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#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
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING InstanceID
Definition: wdfpdo.h:309
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
struct _CM_FLOPPY_DEVICE_DATA * PCM_FLOPPY_DEVICE_DATA
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
#define IRP_MN_CANCEL_STOP_DEVICE
@ RemovalRelations
Definition: iotypes.h:2157
@ BusRelations
Definition: iotypes.h:2154
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
@ IoQueryDeviceConfigurationData
Definition: iotypes.h:4465
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DO_POWER_PAGABLE
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204