ReactOS 0.4.15-dev-7788-g1ad9096
fdo.c File Reference
#include "isapnp.h"
#include <debug.h>
Include dependency graph for fdo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS IsaFdoStartDevice (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
 
static NTSTATUS IsaFdoQueryBusRelations (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
 
static NTSTATUS IsaFdoRemoveDevice (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
 
NTSTATUS IsaFdoPnp (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file fdo.c.

Function Documentation

◆ IsaFdoPnp()

NTSTATUS IsaFdoPnp ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp,
_In_ PIO_STACK_LOCATION  IrpSp 
)

Definition at line 123 of file fdo.c.

127{
129
130 PAGED_CODE();
131
132 DPRINT("%s(%p, %p) FDO %lu, Minor - %X\n",
134 FdoExt,
135 Irp,
136 FdoExt->BusNumber,
138
139 switch (IrpSp->MinorFunction)
140 {
142 Status = IsaFdoStartDevice(FdoExt, Irp);
143
144 Irp->IoStatus.Status = Status;
146 return Status;
147
149 {
150 if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
151 break;
152
154 if (!NT_SUCCESS(Status))
155 {
156 Irp->IoStatus.Status = Status;
158
159 return Status;
160 }
161
162 Irp->IoStatus.Status = Status;
163 break;
164 }
165
167 return IsaFdoRemoveDevice(FdoExt, Irp);
168
170 Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
171 Irp->IoStatus.Status = STATUS_SUCCESS;
172 break;
173
175 {
178 {
179 break;
180 }
181 else if (!NT_SUCCESS(Status))
182 {
183 Irp->IoStatus.Status = Status;
185
186 return Status;
187 }
188
189 Irp->IoStatus.Status = Status;
190 break;
191 }
192
199 Irp->IoStatus.Status = STATUS_SUCCESS;
200 break;
201
202 default:
203 DPRINT("Unknown PnP code: %X\n", IrpSp->MinorFunction);
204 break;
205 }
206
208
209 return IoCallDriver(FdoExt->Ldo, Irp);
210}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS IsaFdoStartDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:18
static NTSTATUS IsaFdoQueryBusRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:44
static NTSTATUS IsaFdoRemoveDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:56
_In_ PIRP Irp
Definition: csq.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS IsaFdoQueryInterface(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PIO_STACK_LOCATION IrpSp)
Definition: interface.c:19
#define __FUNCTION__
Definition: types.h:116
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
Status
Definition: gdiplustypes.h:25
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:1006
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#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

Referenced by _Dispatch_type_().

◆ IsaFdoQueryBusRelations()

static NTSTATUS IsaFdoQueryBusRelations ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp 
)
static

Definition at line 44 of file fdo.c.

47{
48 PAGED_CODE();
49
50 return IsaPnpFillDeviceRelations(FdoExt, Irp, TRUE);
51}
#define TRUE
Definition: types.h:120
NTSTATUS IsaPnpFillDeviceRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ BOOLEAN IncludeDataPort)
Definition: isapnp.c:1304

Referenced by IsaFdoPnp().

◆ IsaFdoRemoveDevice()

static NTSTATUS IsaFdoRemoveDevice ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp 
)
static

Definition at line 56 of file fdo.c.

59{
62
63 PAGED_CODE();
64
65 IsaPnpAcquireDeviceDataLock(FdoExt);
66
67 /* Remove our logical devices */
68 while (!IsListEmpty(&FdoExt->DeviceListHead))
69 {
73 DeviceLink);
74
75 --FdoExt->DeviceCount;
76
77 if (LogDevice->Pdo)
78 {
80 }
81 }
82
83 IsaPnpReleaseDeviceDataLock(FdoExt);
84
85 IsaPnpAcquireBusDataLock();
86
87 /* Remove the Read Port */
88 if (FdoExt->ReadPortPdo)
89 {
90 IsaPnpRemoveReadPortDO(FdoExt->ReadPortPdo);
91 ReadPortCreated = FALSE;
92 }
93
94 /* Find the next ISA bus, if any */
95 Entry = BusListHead.Flink;
96 if (Entry != &BusListHead)
97 {
100 BusLink);
101
102 /* Create a new Read Port for it */
103 if (!ReadPortCreated)
105 }
106
107 RemoveEntryList(&FdoExt->BusLink);
108
109 IsaPnpReleaseBusDataLock();
110
111 Irp->IoStatus.Status = STATUS_SUCCESS;
113 Status = IoCallDriver(FdoExt->Ldo, Irp);
114
115 IoDetachDevice(FdoExt->Ldo);
116 IoDeleteDevice(FdoExt->Common.Self);
117
118 return Status;
119}
static LIST_ENTRY DeviceListHead
Definition: fs.c:52
#define FALSE
Definition: types.h:117
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
VOID IsaPnpRemoveReadPortDO(_In_ PDEVICE_OBJECT Pdo)
Definition: isapnp.c:1284
VOID IsaPnpRemoveLogicalDeviceDO(_In_ PDEVICE_OBJECT Pdo)
Definition: pdo.c:820
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:1772
base of all file and directory entries
Definition: entries.h:83
PDEVICE_OBJECT Pdo
Definition: isapnp.h:159
PDEVICE_OBJECT Pdo
Definition: isapnp.h:103
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IsaFdoPnp().

◆ IsaFdoStartDevice()

static NTSTATUS IsaFdoStartDevice ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp 
)
static

Definition at line 18 of file fdo.c.

21{
23
24 PAGED_CODE();
25
26 if (!IoForwardIrpSynchronously(FdoExt->Ldo, Irp))
27 {
29 }
30 Status = Irp->IoStatus.Status;
31 if (!NT_SUCCESS(Status))
32 {
33 return Status;
34 }
35
36 FdoExt->Common.State = dsStarted;
37
38 return STATUS_SUCCESS;
39}
@ dsStarted
Definition: isapnp.h:35
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by IsaFdoPnp().