ReactOS 0.4.16-dev-297-gc569aee
stub.c File Reference
#include "isapnp.h"
#include <debug.h>
Include dependency graph for stub.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 _Dispatch_type_ (IRP_MJ_CREATE)
 
 _Dispatch_type_ (IRP_MJ_DEVICE_CONTROL)
 
 _Dispatch_type_ (IRP_MJ_PNP)
 
 _Dispatch_type_ (IRP_MJ_POWER)
 
static CODE_SEG ("PAGE")
 
NTSTATUS NTAPI DriverEntry (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 18 of file stub.c.

Function Documentation

◆ _Dispatch_type_() [1/4]

_Dispatch_type_ ( IRP_MJ_CREATE  )

Definition at line 23 of file stub.c.

34{
36
37 PAGED_CODE();
38
39 Irp->IoStatus.Status = STATUS_SUCCESS;
41
42 return STATUS_SUCCESS;
43}
#define PAGED_CODE()
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ _Dispatch_type_() [2/4]

_Dispatch_type_ ( IRP_MJ_DEVICE_CONTROL  )

Definition at line 45 of file stub.c.

56{
57 PISAPNP_FDO_EXTENSION FdoExt = DeviceObject->DeviceExtension;
58
59 PAGED_CODE();
60
62 return IoCallDriver(FdoExt->Ldo, Irp);
63}
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCallDriver
Definition: irp.c:1225
PDEVICE_OBJECT Ldo
Definition: isapnp.h:51

◆ _Dispatch_type_() [3/4]

_Dispatch_type_ ( IRP_MJ_PNP  )

Definition at line 65 of file stub.c.

75{
76 PISAPNP_FDO_EXTENSION FdoExt = DeviceObject->DeviceExtension;
79
80 PAGED_CODE();
81
82 DPRINT("%s(%p, %p) Minor - %X\n",
84 FdoExt,
85 Irp,
87
88 switch (IrpSp->MinorFunction)
89 {
91 {
92 if (IoForwardIrpSynchronously(FdoExt->Ldo, Irp))
93 Status = Irp->IoStatus.Status;
94 else
96
97 goto CompleteIrp;
98 }
99
101 {
102 PDEVICE_RELATIONS DeviceRelations;
103
105 break;
106
107 DeviceRelations = ExAllocatePoolWithTag(PagedPool,
109 TAG_ISAPNP);
110 if (!DeviceRelations)
111 {
113 goto CompleteIrp;
114 }
115
116 DeviceRelations->Count = 0;
117
118 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
119 Irp->IoStatus.Status = STATUS_SUCCESS;
120 break;
121 }
122
124 {
125 Irp->IoStatus.Status = STATUS_SUCCESS;
127 Status = IoCallDriver(FdoExt->Ldo, Irp);
128
129 IoDetachDevice(FdoExt->Ldo);
130 IoDeleteDevice(FdoExt->Common.Self);
131
132 return Status;
133 }
134
136 {
137 Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
138 Irp->IoStatus.Status = STATUS_SUCCESS;
139 break;
140 }
141
143 {
146 {
147 break;
148 }
149 else if (!NT_SUCCESS(Status))
150 {
151 goto CompleteIrp;
152 }
153
154 Irp->IoStatus.Status = Status;
155 break;
156 }
157
164 {
165 Irp->IoStatus.Status = STATUS_SUCCESS;
166 break;
167 }
168
169 default:
170 break;
171 }
172
174 return IoCallDriver(FdoExt->Ldo, Irp);
175
177 Irp->IoStatus.Status = Status;
179 return Status;
180}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
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
#define ULONG_PTR
Definition: config.h:101
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: pnp.c:12
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
#define TAG_ISAPNP
Definition: isapnp.h:26
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
#define DPRINT
Definition: sndvol32.h:73
union _IO_STACK_LOCATION::@1579 Parameters
struct _IO_STACK_LOCATION::@3978::@4003 QueryDeviceRelations
PDEVICE_OBJECT Self
Definition: isapnp.h:44
ISAPNP_COMMON_EXTENSION Common
Definition: isapnp.h:50
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#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 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

◆ _Dispatch_type_() [4/4]

_Dispatch_type_ ( IRP_MJ_POWER  )

Definition at line 182 of file stub.c.

191{
192 PISAPNP_FDO_EXTENSION FdoExt = DeviceObject->DeviceExtension;
193
196 return PoCallDriver(FdoExt->Ldo, Irp);
197}
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758

◆ CODE_SEG()

static CODE_SEG ( "PAGE"  )
static

Definition at line 199 of file stub.c.

208{
212
213 PAGED_CODE();
214
216
218 sizeof(ISAPNP_FDO_EXTENSION),
219 NULL,
222 FALSE,
223 &Fdo);
224 if (!NT_SUCCESS(Status))
225 {
226 DPRINT1("Failed to create FDO (0x%08lx)\n", Status);
227 return Status;
228 }
229
230 FdoExt = Fdo->DeviceExtension;
231
232 RtlZeroMemory(FdoExt, sizeof(ISAPNP_FDO_EXTENSION));
233 FdoExt->Common.Self = Fdo;
234 FdoExt->Common.Signature = IsaPnpBus;
235 FdoExt->DriverObject = DriverObject;
236 FdoExt->Pdo = PhysicalDeviceObject;
238 if (!FdoExt->Ldo)
239 {
242 }
243
244 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
245
246 return STATUS_SUCCESS;
247}
#define DPRINT1
Definition: precomp.h:8
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define STATUS_DEVICE_REMOVED
Definition: d3dkmdt.h:39
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
@ IsaPnpBus
Definition: isapnp.h:36
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
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:1031
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:43
PDRIVER_OBJECT DriverObject
Definition: isapnp.h:63
PDEVICE_OBJECT Pdo
Definition: isapnp.h:52
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PUNICODE_STRING  RegistryPath 
)

Definition at line 268 of file stub.c.

271{
272 DPRINT("%s(%p, %wZ)\n", __FUNCTION__, DriverObject, RegistryPath);
273
274 DriverObject->MajorFunction[IRP_MJ_CREATE] = IsaStubCreateClose;
275 DriverObject->MajorFunction[IRP_MJ_CLOSE] = IsaStubCreateClose;
276 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IsaStubForward;
277 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IsaStubForward;
278 DriverObject->MajorFunction[IRP_MJ_PNP] = IsaStubPnp;
279 DriverObject->MajorFunction[IRP_MJ_POWER] = IsaStubPower;
280 DriverObject->DriverExtension->AddDevice = IsaStubAddDevice;
281 DriverObject->DriverUnload = IsaStubUnload;
282
283 return STATUS_SUCCESS;
284}
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER