ReactOS  0.4.13-dev-241-g63286c6
isapnp.h File Reference
#include <wdm.h>
Include dependency graph for isapnp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ISAPNP_COMMON_EXTENSION
 
struct  _ISAPNP_FDO_EXTENSION
 
struct  _ISAPNP_LOGICAL_DEVICE
 

Macros

#define TAG_ISAPNP   'PNPI'
 

Typedefs

typedef struct _ISAPNP_COMMON_EXTENSION ISAPNP_COMMON_EXTENSION
 
typedef struct _ISAPNP_COMMON_EXTENSIONPISAPNP_COMMON_EXTENSION
 
typedef struct _ISAPNP_FDO_EXTENSION ISAPNP_FDO_EXTENSION
 
typedef struct _ISAPNP_FDO_EXTENSIONPISAPNP_FDO_EXTENSION
 
typedef struct _ISAPNP_LOGICAL_DEVICE ISAPNP_LOGICAL_DEVICE
 
typedef struct _ISAPNP_LOGICAL_DEVICEPISAPNP_LOGICAL_DEVICE
 

Enumerations

enum  ISAPNP_DEVICE_STATE { dsStopped, dsStarted }
 

Functions

NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 
NTSTATUS NTAPI IsaForwardIrpSynchronous (IN PISAPNP_FDO_EXTENSION FdoExt, IN PIRP Irp)
 
NTSTATUS NTAPI IsaFdoPnp (IN PISAPNP_FDO_EXTENSION FdoExt, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IsaPdoPnp (IN PISAPNP_LOGICAL_DEVICE LogDev, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IsaHwDetectReadDataPort (IN PISAPNP_FDO_EXTENSION FdoExt)
 
NTSTATUS NTAPI IsaHwFillDeviceList (IN PISAPNP_FDO_EXTENSION FdoExt)
 
NTSTATUS NTAPI IsaHwDeactivateDevice (IN PISAPNP_LOGICAL_DEVICE LogicalDevice)
 
NTSTATUS NTAPI IsaHwActivateDevice (IN PISAPNP_LOGICAL_DEVICE LogicalDevice)
 

Variables

DRIVER_INITIALIZE DriverEntry
 

Macro Definition Documentation

◆ TAG_ISAPNP

#define TAG_ISAPNP   'PNPI'

Definition at line 10 of file isapnp.h.

Typedef Documentation

◆ ISAPNP_COMMON_EXTENSION

◆ ISAPNP_FDO_EXTENSION

◆ ISAPNP_LOGICAL_DEVICE

◆ PISAPNP_COMMON_EXTENSION

◆ PISAPNP_FDO_EXTENSION

◆ PISAPNP_LOGICAL_DEVICE

Enumeration Type Documentation

◆ ISAPNP_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 

Definition at line 12 of file isapnp.h.

12  {
13  dsStopped,
14  dsStarted
ISAPNP_DEVICE_STATE
Definition: isapnp.h:12

Function Documentation

◆ DriverEntry()

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

Definition at line 367 of file beep.c.

369 {
370  PDEVICE_EXTENSION DeviceExtension;
372  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Beep");
374 
376 
377  /* Create the device */
379  sizeof(DEVICE_EXTENSION),
380  &DeviceName,
382  0,
383  FALSE,
384  &DeviceObject);
385  if (!NT_SUCCESS(Status)) return Status;
386 
387  /* Make it use buffered I/O */
389 
390  /* Setup the Driver Object */
397 
398  /* Set up device extension */
399  DeviceExtension = DeviceObject->DeviceExtension;
400  DeviceExtension->ReferenceCount = 0;
401  DeviceExtension->TimerActive = FALSE;
403  KeInitializeTimer(&DeviceExtension->Timer);
404  ExInitializeFastMutex(&DeviceExtension->Mutex);
405 
406  /* Page the entire driver */
408  return STATUS_SUCCESS;
409 }
DRIVER_DISPATCH BeepClose
Definition: beep.c:78
FORCEINLINE VOID IoInitializeDpcRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIO_DPC_ROUTINE DpcRoutine)
Definition: iofuncs.h:2792
DRIVER_STARTIO BeepStartIo
Definition: beep.c:295
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTSTATUS
Definition: precomp.h:26
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define FILE_DEVICE_BEEP
Definition: winioctl.h:106
DRIVER_DISPATCH BeepDeviceControl
Definition: beep.c:206
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
DRIVER_DISPATCH BeepCreate
Definition: beep.c:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
PVOID NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection)
Definition: sysldr.c:3322
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2491
VOID NTAPI BeepDPC(IN PKDPC Dpc, IN PDEVICE_OBJECT DeviceObject, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: beep.c:34
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2179
DRIVER_DISPATCH BeepCleanup
Definition: beep.c:145
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FAST_MUTEX Mutex
Definition: beep.c:24
DRIVER_UNLOAD BeepUnload
Definition: beep.c:268
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2180
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
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
PDRIVER_STARTIO DriverStartIo
Definition: iotypes.h:2178
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ IsaFdoPnp()

NTSTATUS NTAPI IsaFdoPnp ( IN PISAPNP_FDO_EXTENSION  FdoExt,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 99 of file fdo.c.

103 {
104  NTSTATUS Status = Irp->IoStatus.Status;
105 
106  switch (IrpSp->MinorFunction)
107  {
108  case IRP_MN_START_DEVICE:
110 
111  if (NT_SUCCESS(Status))
112  Status = IsaFdoStartDevice(FdoExt, Irp, IrpSp);
113 
114  Irp->IoStatus.Status = Status;
115 
117  return Status;
118 
119  case IRP_MN_STOP_DEVICE:
120  FdoExt->Common.State = dsStopped;
121 
123  break;
124 
127 
128  Irp->IoStatus.Status = Status;
129 
131  return Status;
132 
134  DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
135  break;
136 
137  default:
138  DPRINT1("Unknown PnP code: %x\n", IrpSp->MinorFunction);
139  break;
140  }
141 
143 
144  return IoCallDriver(FdoExt->Ldo, Irp);
145 }
NTSTATUS NTAPI IsaFdoQueryDeviceRelations(IN PISAPNP_FDO_EXTENSION FdoExt, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:44
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI IsaForwardIrpSynchronous(IN PISAPNP_FDO_EXTENSION FdoExt, IN PIRP Irp)
Definition: isapnp.c:34
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
NTSTATUS NTAPI IsaFdoStartDevice(IN PISAPNP_FDO_EXTENSION FdoExt, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:15
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by IsaPnp().

◆ IsaForwardIrpSynchronous()

NTSTATUS NTAPI IsaForwardIrpSynchronous ( IN PISAPNP_FDO_EXTENSION  FdoExt,
IN PIRP  Irp 
)

Definition at line 34 of file isapnp.c.

37 {
38  KEVENT Event;
40 
43 
45 
46  Status = IoCallDriver(FdoExt->Ldo, Irp);
47  if (Status == STATUS_PENDING)
48  {
50  if (NT_SUCCESS(Status))
51  Status = Irp->IoStatus.Status;
52  }
53 
54  return Status;
55 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2820
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
static IO_COMPLETION_ROUTINE ForwardIrpCompletion
Definition: isapnp.c:13
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218

Referenced by IsaFdoPnp().

◆ IsaHwActivateDevice()

NTSTATUS NTAPI IsaHwActivateDevice ( IN PISAPNP_LOGICAL_DEVICE  LogicalDevice)

Definition at line 554 of file hardware.c.

556 {
557  DeviceActivation(LogicalDevice,
558  TRUE);
559 
560  return STATUS_SUCCESS;
561 }
#define TRUE
Definition: types.h:120
VOID DeviceActivation(PISAPNP_LOGICAL_DEVICE IsaDevice, BOOLEAN Activate)
Definition: hardware.c:441
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by IsaPdoPnp().

◆ IsaHwDeactivateDevice()

NTSTATUS NTAPI IsaHwDeactivateDevice ( IN PISAPNP_LOGICAL_DEVICE  LogicalDevice)

Definition at line 565 of file hardware.c.

567 {
568  DeviceActivation(LogicalDevice,
569  FALSE);
570 
571  return STATUS_SUCCESS;
572 }
VOID DeviceActivation(PISAPNP_LOGICAL_DEVICE IsaDevice, BOOLEAN Activate)
Definition: hardware.c:441
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by IsaPdoPnp().

◆ IsaHwDetectReadDataPort()

NTSTATUS NTAPI IsaHwDetectReadDataPort ( IN PISAPNP_FDO_EXTENSION  FdoExt)

Definition at line 537 of file hardware.c.

539 {
540  FdoExt->ReadDataPort = Isolate();
541  if (!FdoExt->ReadDataPort)
542  {
543  DPRINT1("No read data port found\n");
544  return STATUS_UNSUCCESSFUL;
545  }
546 
547  DPRINT1("Detected read data port at 0x%p\n", FdoExt->ReadDataPort);
548 
549  return STATUS_SUCCESS;
550 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static PUCHAR Isolate(VOID)
Definition: hardware.c:420
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by IsaFdoStartDevice().

◆ IsaHwFillDeviceList()

NTSTATUS NTAPI IsaHwFillDeviceList ( IN PISAPNP_FDO_EXTENSION  FdoExt)

Definition at line 576 of file hardware.c.

578 {
579  return ProbeIsaPnpBus(FdoExt);
580 }
NTSTATUS ProbeIsaPnpBus(PISAPNP_FDO_EXTENSION FdoExt)
Definition: hardware.c:459

Referenced by IsaFdoQueryDeviceRelations().

◆ IsaPdoPnp()

NTSTATUS NTAPI IsaPdoPnp ( IN PISAPNP_LOGICAL_DEVICE  LogDev,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 40 of file pdo.c.

44 {
45  NTSTATUS Status = Irp->IoStatus.Status;
46 
47  switch (IrpSp->MinorFunction)
48  {
50  Status = IsaHwActivateDevice(LogDev);
51 
52  if (NT_SUCCESS(Status))
53  LogDev->Common.State = dsStarted;
54  break;
55 
56  case IRP_MN_STOP_DEVICE:
57  Status = IsaHwDeactivateDevice(LogDev);
58 
59  if (NT_SUCCESS(Status))
60  LogDev->Common.State = dsStopped;
61  break;
62 
65  break;
66 
68  DPRINT1("IRP_MN_QUERY_RESOURCES is UNIMPLEMENTED!\n");
69  break;
70 
72  DPRINT1("IRP_MN_QUERY_RESOURCE_REQUIREMENTS is UNIMPLEMENTED!\n");
73  break;
74 
75  default:
76  DPRINT1("Unknown PnP code: %x\n", IrpSp->MinorFunction);
77  break;
78  }
79 
80  Irp->IoStatus.Status = Status;
82 
83  return Status;
84 }
#define IRP_MN_QUERY_RESOURCES
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI IsaPdoQueryDeviceRelations(IN PISAPNP_LOGICAL_DEVICE LogDev, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:15
#define IoCompleteRequest
Definition: irp.c:1240
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
NTSTATUS NTAPI IsaHwActivateDevice(IN PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:554
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define IRP_MN_QUERY_DEVICE_RELATIONS
NTSTATUS NTAPI IsaHwDeactivateDevice(IN PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:565
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565

Referenced by IsaPnp().

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 46 of file isapnp.h.