16#if !defined(__REACTOS__) || defined(_MSC_VER)
18#pragma warning (disable: 4206)
19#pragma message ("Plug and play support feature is disabled.")
33#pragma alloc_text(PAGE, VfdPlugAndPlay)
34#pragma alloc_text(PAGE, VfdPowerControl)
35#pragma alloc_text(PAGE, VfdSystemControl)
36#pragma alloc_text(PAGE, VfdAddDevice)
37#pragma alloc_text(PAGE, VfdReportDevice)
40#define REMLOCK_TAG 'LdfV'
41#define REMLOCK_MAXIMUM 1
42#define REMLOCK_HIGHWATER 10
45static PCSTR StateTable[] ={
50 {
"SURPRISEREMOVED" },
77 VFDTRACE(VFDINFO, (
"[VFD] VfdPlugAndPlay - IN. %ws %s Device State=%s\n",
88 VFDTRACE(0, (
"Acquire RemoveLock failed - %s\n", NtStatusToStr(
status)));
91 Irp->IoStatus.Information = 0;
108 Irp->IoStatus.Information = 0;
120 Irp->IoStatus.Information = 0;
132 Irp->IoStatus.Information = 0;
161 Irp->IoStatus.Information = 0;
171 Irp->IoStatus.Information = 0;
180 Irp->IoStatus.Information = 0;
199 Irp->IoStatus.Information = 0;
205 Irp->IoStatus.Information = 0;
209 VFDTRACE(VFDINFO, (
"------- BusRelations Query\n"));
213 VFDTRACE(VFDINFO, (
"------- EjectionRelations Query\n"));
217 VFDTRACE(VFDINFO, (
"------- PowerRelations Query\n"));
221 VFDTRACE(VFDINFO, (
"------- RemovalRelations Query\n"));
225 VFDTRACE(VFDINFO, (
"------- TargetDeviceRelation Query\n"));
230 if (
Irp->IoStatus.Information) {
244 VFDTRACE(VFDINFO, (
"------- Unknown Query\n"));
272 Irp->IoStatus.Information = 0;
284 Irp->IoStatus.Information = 0;
292 if (lockHeld ==
TRUE) {
296 VFDTRACE(VFDINFO, (
"[VFD] VfdPlugAndPlay - %s\n", NtStatusToStr(
status)));
316 VFDTRACE(VFDINFO, (
"[VFD] VfdPowerControl - IN. %ws %s Device State=%s\n",
336 Irp->IoStatus.Information = 0;
339 VFDTRACE(VFDINFO, (
"[VFD] VfdPowerControl - %s\n", NtStatusToStr(
status)));
359 VFDTRACE(VFDINFO, (
"[VFD] VfdSystemControl - IN. %ws %s Device State=%s\n",
366 Irp->IoStatus.Information = 0;
369 VFDTRACE(VFDINFO, (
"[VFD] VfdSystemControl - %s\n", NtStatusToStr(
status)));
386 VFDTRACE(VFDINFO, (
"[VFD] VfdAddDevice - IN\n"));
400 VFDTRACE(VFDINFO, (
"[VFD] Initializing the remove lock\n"));
447 VFDTRACE(VFDINFO,(
"[VFD] Reporting device %lu to the PnP manager\n",
463 (
"[VFD] IoReportDetectedDevice - %s\n",
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
struct _device_extension device_extension
#define NT_SUCCESS(StatCode)
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
#define ExAllocatePoolWithTag(hernya, size, tag)
#define CmResourceTypeDeviceSpecific
static const WCHAR desc[]
#define IRP_MN_SURPRISE_REMOVAL
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
#define IoCompleteRequest
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
#define STATUS_DELETE_PENDING
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
CM_PARTIAL_RESOURCE_LIST PartialResourceList
INTERFACE_TYPE InterfaceType
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
PDEVICE_OBJECT Objects[1]
struct _IO_STACK_LOCATION::@3974::@3999 QueryDeviceRelations
union _IO_STACK_LOCATION::@1575 Parameters
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INSUFFICIENT_RESOURCES
#define VFDTRACE(LEVEL, STRING)
NTSTATUS VfdCreateDevice(IN PDRIVER_OBJECT DriverObject, OUT PVOID Parameter)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PDEVICE_OBJECT PhysicalDevice
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
#define IoAcquireRemoveLock(RemoveLock, Tag)
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
#define IoReleaseRemoveLock(_RemoveLock, _Tag)
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE