ReactOS 0.4.15-dev-8127-g6338913
inport.h File Reference
#include <wdm.h>
#include <wmilib.h>
#include <wmistr.h>
#include <kbdmou.h>
#include <section_attribs.h>
Include dependency graph for inport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _INPORT_RAW_DATA
 
struct  _INPORT_DEVICE_EXTENSION
 

Macros

#define INPORT_TAG   'tPnI'
 

Typedefs

typedef struct _INPORT_RAW_DATA INPORT_RAW_DATA
 
typedef struct _INPORT_RAW_DATAPINPORT_RAW_DATA
 
typedef struct _INPORT_DEVICE_EXTENSION INPORT_DEVICE_EXTENSION
 
typedef struct _INPORT_DEVICE_EXTENSIONPINPORT_DEVICE_EXTENSION
 

Enumerations

enum  INPORT_DEVICE_STATE { dsStopped , dsStarted , dsRemoved }
 
enum  INPORT_MOUSE_TYPE { NecBusMouse , MsInPortMouse , LogitechBusMouse }
 

Functions

 _Dispatch_type_ (IRP_MJ_CREATE) _Dispatch_type_(IRP_MJ_CLOSE) DRIVER_DISPATCH_PAGED InPortCreateClose
 
 _Dispatch_type_ (IRP_MJ_INTERNAL_DEVICE_CONTROL) DRIVER_DISPATCH_RAISED InPortInternalDeviceControl
 
 _Dispatch_type_ (IRP_MJ_POWER) DRIVER_DISPATCH_RAISED InPortPower
 
 _Dispatch_type_ (IRP_MJ_SYSTEM_CONTROL) DRIVER_DISPATCH_PAGED InPortWmi
 
 _Dispatch_type_ (IRP_MJ_PNP) DRIVER_DISPATCH_PAGED InPortPnp
 
NTSTATUS NTAPI InPortStartDevice (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS NTAPI InPortRemoveDevice (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
VOID NTAPI InPortInitializeMouse (_In_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI InPortWmiRegistration (_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI InPortWmiDeRegistration (_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI InPortQueryWmiRegInfo (_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ PULONG RegFlags, _Inout_ PUNICODE_STRING InstanceName, _Out_opt_ PUNICODE_STRING *RegistryPath, _Inout_ PUNICODE_STRING MofResourceName, _Out_opt_ PDEVICE_OBJECT *Pdo)
 
NTSTATUS NTAPI InPortQueryWmiDataBlock (_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _In_ ULONG GuidIndex, _In_ ULONG InstanceIndex, _In_ ULONG InstanceCount, _Out_opt_ PULONG InstanceLengthArray, _In_ ULONG BufferAvail, _Out_opt_ PUCHAR Buffer)
 

Variables

DRIVER_INITIALIZE DriverEntry
 
DRIVER_UNLOAD InPortUnload
 
DRIVER_ADD_DEVICE InPortAddDevice
 
KSERVICE_ROUTINE InPortIsr
 
IO_DPC_ROUTINE InPortDpcForIsr
 
KSYNCHRONIZE_ROUTINE InPortStartMouse
 
KSYNCHRONIZE_ROUTINE InPortStopMouse
 
UNICODE_STRING DriverRegistryPath
 

Macro Definition Documentation

◆ INPORT_TAG

#define INPORT_TAG   'tPnI'

Definition at line 18 of file inport.h.

Typedef Documentation

◆ INPORT_DEVICE_EXTENSION

◆ INPORT_RAW_DATA

◆ PINPORT_DEVICE_EXTENSION

◆ PINPORT_RAW_DATA

Enumeration Type Documentation

◆ INPORT_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 
dsRemoved 

Definition at line 20 of file inport.h.

21{
INPORT_DEVICE_STATE
Definition: inport.h:21
@ dsStopped
Definition: inport.h:22
@ dsStarted
Definition: inport.h:23
@ dsRemoved
Definition: inport.h:24

◆ INPORT_MOUSE_TYPE

Enumerator
NecBusMouse 
MsInPortMouse 
LogitechBusMouse 

Definition at line 27 of file inport.h.

28{
INPORT_MOUSE_TYPE
Definition: inport.h:28
@ NecBusMouse
Definition: inport.h:29
@ MsInPortMouse
Definition: inport.h:30
@ LogitechBusMouse
Definition: inport.h:31

Function Documentation

◆ _Dispatch_type_() [1/5]

_Dispatch_type_ ( IRP_MJ_CREATE  )

Definition at line 984 of file isapnp.c.

995{
996 PAGED_CODE();
997
998 Irp->IoStatus.Status = STATUS_SUCCESS;
999
1000 DPRINT("%s(%p, %p)\n", __FUNCTION__, DeviceObject, Irp);
1001
1003
1004 return STATUS_SUCCESS;
1005}
#define PAGED_CODE()
_In_ PIRP Irp
Definition: csq.h:116
#define __FUNCTION__
Definition: types.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ _Dispatch_type_() [2/5]

_Dispatch_type_ ( IRP_MJ_INTERNAL_DEVICE_CONTROL  )

◆ _Dispatch_type_() [3/5]

_Dispatch_type_ ( IRP_MJ_PNP  )

Definition at line 1581 of file isapnp.c.

1591{
1593 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1594
1595 PAGED_CODE();
1596
1597 if (DevExt->Signature == IsaPnpBus)
1598 return IsaFdoPnp((PISAPNP_FDO_EXTENSION)DevExt, Irp, IrpSp);
1599 else
1600 return IsaPdoPnp((PISAPNP_PDO_EXTENSION)DevExt, Irp, IrpSp);
1601}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:123
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
@ IsaPnpBus
Definition: isapnp.h:143
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:864
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:150

◆ _Dispatch_type_() [4/5]

_Dispatch_type_ ( IRP_MJ_POWER  )

Definition at line 1543 of file isapnp.c.

1552{
1553 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1555
1556 if (DevExt->Signature != IsaPnpBus)
1557 {
1559 {
1560 case IRP_MN_SET_POWER:
1561 case IRP_MN_QUERY_POWER:
1563 Irp->IoStatus.Status = Status;
1564 break;
1565
1566 default:
1567 Status = Irp->IoStatus.Status;
1568 break;
1569 }
1570
1573 return Status;
1574 }
1575
1578 return PoCallDriver(((PISAPNP_FDO_EXTENSION)DevExt)->Ldo, Irp);
1579}
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
#define IRP_MN_SET_POWER
#define IRP_MN_QUERY_POWER

◆ _Dispatch_type_() [5/5]

_Dispatch_type_ ( IRP_MJ_SYSTEM_CONTROL  )

Definition at line 5748 of file btrfs.c.

5750 {
5752 device_extension* Vcb = DeviceObject->DeviceExtension;
5753 bool top_level;
5754
5756
5757 top_level = is_top_level(Irp);
5758
5759 Irp->IoStatus.Information = 0;
5760
5761 if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
5762 volume_device_extension* vde = DeviceObject->DeviceExtension;
5763
5765
5767
5768 goto exit;
5769 } else if (Vcb && Vcb->type == VCB_TYPE_FS) {
5771
5772 Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
5773
5774 goto exit;
5775 } else if (Vcb && Vcb->type == VCB_TYPE_BUS) {
5776 bus_device_extension* bde = DeviceObject->DeviceExtension;
5777
5779
5781
5782 goto exit;
5783 }
5784
5785 Status = Irp->IoStatus.Status;
5787
5788exit:
5789 if (top_level)
5791
5793
5794 return Status;
5795}
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:689
#define VCB_TYPE_FS
Definition: btrfs_drv.h:687
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:691
#define NULL
Definition: types.h:112
InsertTailList & Vcb
Definition: btrfs.c:3044
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:278
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define exit(n)
Definition: config.h:202
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:880
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:849

◆ InPortInitializeMouse()

VOID NTAPI InPortInitializeMouse ( _In_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 350 of file hardware.c.

352{
353 PAGED_CODE();
354
355 /* Initialize mouse and disable interrupts */
356 switch (DeviceExtension->MouseType)
357 {
358 case NecBusMouse:
360
361 /* Setup interrupt rate (unavailable on hireso machines) */
362 if (DeviceExtension->IoBase != NEC_BM_HIRESO_BASE)
363 WRITE_MOUSE(DeviceExtension, NEC_BM_INT_RATE, NEC_RATE_60_HZ);
364
367 WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_CLEAR);
368 break;
369
370 case MsInPortMouse:
371 WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_RESET);
374 break;
375
376 case LogitechBusMouse:
377 WRITE_MOUSE(DeviceExtension, LOG_BM_CONFIG, LOG_DEFAULT_MODE);
378 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_DISABLE_IRQ);
379 break;
380 }
381}
#define MS_INPORT_CONTROL
Definition: hardware.c:63
#define WRITE_MOUSE(DeviceExtension, Port, Data)
Definition: hardware.c:22
#define LOG_BM_CONFIG
Definition: hardware.c:99
#define INPORT_MODE_BASE
Definition: hardware.c:72
#define LOG_DEFAULT_MODE
Definition: hardware.c:100
#define NEC_RATE_60_HZ
Definition: hardware.c:51
#define NEC_PPI_INT_DISABLE
Definition: hardware.c:44
#define LOG_BM_CONTROL
Definition: hardware.c:90
#define NEC_BM_HIRESO_BASE
Definition: hardware.c:55
#define NEC_PPI_HC_NO_CLEAR
Definition: hardware.c:45
#define MS_INPORT_DATA
Definition: hardware.c:70
#define NEC_BM_CONFIG
Definition: hardware.c:42
#define INPORT_REG_MODE
Definition: hardware.c:67
#define NEC_PPI_DEFAULT_MODE
Definition: hardware.c:47
#define NEC_BM_INT_RATE
Definition: hardware.c:49
#define INPORT_RESET
Definition: hardware.c:68
#define NEC_PPI_HC_CLEAR
Definition: hardware.c:46
#define LOG_DISABLE_IRQ
Definition: hardware.c:92

Referenced by InPortStartDevice().

◆ InPortQueryWmiDataBlock()

NTSTATUS NTAPI InPortQueryWmiDataBlock ( _Inout_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp,
_In_ ULONG  GuidIndex,
_In_ ULONG  InstanceIndex,
_In_ ULONG  InstanceCount,
_Out_opt_ PULONG  InstanceLengthArray,
_In_ ULONG  BufferAvail,
_Out_opt_ PUCHAR  Buffer 
)

Definition at line 55 of file wmi.c.

64{
67 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
68
69 PAGED_CODE();
70
71 DPRINT("%s()\n", __FUNCTION__);
72
74 {
76 goto Complete;
77 }
78
79 /* Only register 1 instance per GUID */
80 if (InstanceIndex != 0 || InstanceCount != 1)
81 {
83 goto Complete;
84 }
85
86 if (!InstanceLengthArray || BufferAvail < sizeof(POINTER_PORT_WMI_STD_DATA))
87 {
89 goto Complete;
90 }
91
93
94 /* Bus mouse connector isn't defined in the DDK, so set type to something generic */
96 /* 1 packet */
97 InPortData->DataQueueSize = 1;
98 /* Not supported by device */
99 InPortData->ErrorCount = 0;
100
101 InPortData->Buttons = DeviceExtension->MouseAttributes.NumberOfButtons;
103 *InstanceLengthArray = sizeof(POINTER_PORT_WMI_STD_DATA);
104
106
109 Irp,
110 Status,
113}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
Definition: bufpool.h:45
_In_ LPGUID _In_ ULONG InstanceIndex
Definition: classpnp.h:1251
_In_ PIRP _In_ ULONG GuidIndex
Definition: classpnp.h:419
_In_ PIRP _In_ ULONG _In_ ULONG BufferAvail
Definition: classpnp.h:420
WMIGUIDREGINFO InPortWmiGuidList[]
Definition: wmi.c:19
pRequest Complete(RequestStatus)
#define STATUS_WMI_INSTANCE_NOT_FOUND
Definition: ntstatus.h:777
#define STATUS_WMI_GUID_NOT_FOUND
Definition: ntstatus.h:776
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
MOUSE_ATTRIBUTES MouseAttributes
Definition: inport.h:76
USHORT NumberOfButtons
Definition: ntddmou.h:110
#define POINTER_PORT_WMI_STD_MOUSE
Definition: wmidata.h:3180
struct _POINTER_PORT_WMI_STD_DATA POINTER_PORT_WMI_STD_DATA
struct _POINTER_PORT_WMI_STD_DATA * PPOINTER_PORT_WMI_STD_DATA
#define POINTER_PORT_WMI_STD_I8042
Definition: wmidata.h:3169
NTSTATUS NTAPI WmiCompleteRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN NTSTATUS Status, IN ULONG BufferUsed, IN CCHAR PriorityBoost)
Definition: wmilib.c:24
_In_ ULONG InstanceCount
Definition: iofuncs.h:1323

Referenced by InPortWmiRegistration().

◆ InPortQueryWmiRegInfo()

NTSTATUS NTAPI InPortQueryWmiRegInfo ( _Inout_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PULONG  RegFlags,
_Inout_ PUNICODE_STRING  InstanceName,
_Out_opt_ PUNICODE_STRING RegistryPath,
_Inout_ PUNICODE_STRING  MofResourceName,
_Out_opt_ PDEVICE_OBJECT Pdo 
)

Definition at line 28 of file wmi.c.

35{
36 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
37
40
41 PAGED_CODE();
42
43 DPRINT("%s()\n", __FUNCTION__);
44
47 *Pdo = DeviceExtension->Pdo;
48
49 return STATUS_SUCCESS;
50}
_Out_ ULONG * RegFlags
Definition: classpnp.h:403
_Must_inspect_result_ _Inout_ PFLT_VOLUME _In_opt_ PCUNICODE_STRING InstanceName
Definition: fltkernel.h:1163
UNICODE_STRING DriverRegistryPath
Definition: inport.c:17
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
PDEVICE_OBJECT Pdo
Definition: inport.h:45
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING MofResourceName
Definition: wdfdevice.h:2464
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
Definition: wdfminiport.h:72
#define WMIREG_FLAG_INSTANCE_PDO
Definition: wmistr.h:69

Referenced by InPortWmiRegistration().

◆ InPortRemoveDevice()

NTSTATUS NTAPI InPortRemoveDevice ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 177 of file pnp.c.

180{
182 BOOLEAN IsStarted;
183 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
184
185 PAGED_CODE();
186
187 InPortWmiDeRegistration(DeviceExtension);
188
189 IsStarted = (DeviceExtension->State == dsStarted);
190
191 DeviceExtension->State = dsRemoved;
192
193 Irp->IoStatus.Status = STATUS_SUCCESS;
195 Status = IoCallDriver(DeviceExtension->Ldo, Irp);
196
197 IoReleaseRemoveLockAndWait(&DeviceExtension->RemoveLock, Irp);
198
199 /* Device is active */
200 if (IsStarted)
201 {
204 DeviceExtension);
205
206 IoDisconnectInterrupt(DeviceExtension->InterruptObject);
207
208 /* Flush DPC for ISR */
210 }
211
212 IoDetachDevice(DeviceExtension->Ldo);
214
215 return Status;
216}
unsigned char BOOLEAN
VOID NTAPI KeFlushQueuedDpcs(VOID)
Definition: dpc.c:919
@ dsRemoved
Definition: pci.h:38
KSYNCHRONIZE_ROUTINE InPortStopMouse
Definition: inport.h:113
NTSTATUS NTAPI InPortWmiDeRegistration(_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: wmi.c:140
@ dsStarted
Definition: isapnp.h:35
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:237
PDEVICE_OBJECT Ldo
Definition: inport.h:46
IO_REMOVE_LOCK RemoveLock
Definition: inport.h:48
PKINTERRUPT InterruptObject
Definition: inport.h:54
INPORT_DEVICE_STATE State
Definition: inport.h:47
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
Definition: iofuncs.h:2774

Referenced by InPortPnp().

◆ InPortStartDevice()

NTSTATUS NTAPI InPortStartDevice ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 20 of file pnp.c.

23{
26 PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, DescriptorTranslated;
27 ULONG i;
28 ULONG RawVector;
29 BOOLEAN FoundBasePort = FALSE, FoundIrq = FALSE;
30 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
32
33 PAGED_CODE();
34
35 ASSERT(DeviceExtension->State == dsStopped);
36
37 if (!IoForwardIrpSynchronously(DeviceExtension->Ldo, Irp))
38 {
40 goto Complete;
41 }
42 Status = Irp->IoStatus.Status;
43 if (!NT_SUCCESS(Status))
44 {
45 DPRINT1("LDO failed to start 0x%X\n", Status);
46 goto Complete;
47 }
48
49 AllocatedResources = IrpSp->Parameters.StartDevice.AllocatedResources;
50 AllocatedResourcesTranslated = IrpSp->Parameters.StartDevice.AllocatedResourcesTranslated;
52 {
53 DPRINT1("No allocated resources\n");
55 goto Complete;
56 }
57
58 if (AllocatedResources->Count != 1)
59 DPRINT1("Expected FullList count is 1, got %d\n", AllocatedResources->Count);
60
61 for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++)
62 {
63 Descriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i];
64 DescriptorTranslated = &AllocatedResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i];
65
66 switch (Descriptor->Type)
67 {
69 {
70 DPRINT("[%p:%X:%X] I/O ports at [%p-%p]\n",
72 Descriptor->ShareDisposition,
73 Descriptor->Flags,
74 Descriptor->u.Port.Start.LowPart,
75 Descriptor->u.Port.Start.LowPart + (Descriptor->u.Port.Length - 1));
76
77 if (!FoundBasePort)
78 {
79 DeviceExtension->IoBase = ULongToPtr(Descriptor->u.Port.Start.u.LowPart);
80
81 FoundBasePort = TRUE;
82 }
83
84 break;
85 }
86
88 {
89 DPRINT("[%p:%X:%X] INT Vec %d Lev %d Aff %IX\n",
91 Descriptor->ShareDisposition,
92 Descriptor->Flags,
93 Descriptor->u.Interrupt.Vector,
94 Descriptor->u.Interrupt.Level,
95 Descriptor->u.Interrupt.Affinity);
96
97 if (!FoundIrq)
98 {
99 DeviceExtension->InterruptVector = DescriptorTranslated->u.Interrupt.Vector;
100 DeviceExtension->InterruptLevel = (KIRQL)DescriptorTranslated->u.Interrupt.Level;
101 if (DescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
102 DeviceExtension->InterruptMode = Latched;
103 else
104 DeviceExtension->InterruptMode = LevelSensitive;
105 DeviceExtension->InterruptShared = (DescriptorTranslated->ShareDisposition == CmResourceShareShared);
106 DeviceExtension->InterruptAffinity = DescriptorTranslated->u.Interrupt.Affinity;
107 RawVector = Descriptor->u.Interrupt.Vector;
108
109 FoundIrq = TRUE;
110 }
111
112 break;
113 }
114
115 default:
116 DPRINT("[%p:%X:%X] Unrecognized resource type %X\n",
118 Descriptor->ShareDisposition,
119 Descriptor->Flags,
120 Descriptor->Type);
121 break;
122 }
123 }
124
125 if (!FoundBasePort || !FoundIrq)
126 {
127 DPRINT1("The device resources were not found\n");
129 goto Complete;
130 }
131
132 DPRINT("I/O base at %p\n", DeviceExtension->IoBase);
133 DPRINT("IRQ %d\n", RawVector);
134
135 Status = InPortWmiRegistration(DeviceExtension);
136 if (!NT_SUCCESS(Status))
137 {
138 DPRINT1("WMI registration failed 0x%X\n", Status);
139 goto Complete;
140 }
141
142 InPortInitializeMouse(DeviceExtension);
143
144 Status = IoConnectInterrupt(&DeviceExtension->InterruptObject,
145 InPortIsr,
146 DeviceExtension,
147 NULL,
148 DeviceExtension->InterruptVector,
149 DeviceExtension->InterruptLevel,
150 DeviceExtension->InterruptLevel,
151 DeviceExtension->InterruptMode,
152 DeviceExtension->InterruptShared,
153 DeviceExtension->InterruptAffinity,
154 FALSE);
155 if (!NT_SUCCESS(Status))
156 {
157 DPRINT1("Could not connect to interrupt %d\n", DeviceExtension->InterruptVector);
158 goto Complete;
159 }
160
163 DeviceExtension);
164
165 DeviceExtension->State = dsStarted;
166
168 Irp->IoStatus.Status = Status;
170
171 return Status;
172}
#define DPRINT1
Definition: precomp.h:8
#define ULongToPtr(ul)
Definition: basetsd.h:92
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI InPortInitializeMouse(_In_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: hardware.c:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
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
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
KSERVICE_ROUTINE InPortIsr
Definition: inport.h:107
NTSTATUS NTAPI InPortWmiRegistration(_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: wmi.c:118
KSYNCHRONIZE_ROUTINE InPortStartMouse
Definition: inport.h:111
@ dsStopped
Definition: isapnp.h:34
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4643
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResourcesTranslated
Definition: ndis.h:4644
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:23
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:619
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396::@399 Interrupt
KINTERRUPT_MODE InterruptMode
Definition: inport.h:57
BOOLEAN InterruptShared
Definition: inport.h:58
KAFFINITY InterruptAffinity
Definition: inport.h:59
union _IO_STACK_LOCATION::@1568 Parameters
struct _IO_STACK_LOCATION::@3983::@4020 StartDevice
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ CmResourceShareShared
Definition: cmtypes.h:243

Referenced by InPortPnp().

◆ InPortWmiDeRegistration()

NTSTATUS NTAPI InPortWmiDeRegistration ( _Inout_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 140 of file wmi.c.

142{
143 PAGED_CODE();
144
145 return IoWMIRegistrationControl(DeviceExtension->Self,
147}
NTSTATUS NTAPI IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG Action)
Definition: wmi.c:68
#define WMIREG_ACTION_DEREGISTER

Referenced by InPortRemoveDevice().

◆ InPortWmiRegistration()

NTSTATUS NTAPI InPortWmiRegistration ( _Inout_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 118 of file wmi.c.

120{
121 PAGED_CODE();
122
123 DeviceExtension->WmiLibInfo.GuidCount = RTL_NUMBER_OF(InPortWmiGuidList);
124 DeviceExtension->WmiLibInfo.GuidList = InPortWmiGuidList;
125
126 DeviceExtension->WmiLibInfo.QueryWmiRegInfo = InPortQueryWmiRegInfo;
127 DeviceExtension->WmiLibInfo.QueryWmiDataBlock = InPortQueryWmiDataBlock;
128 DeviceExtension->WmiLibInfo.SetWmiDataBlock = NULL;
129 DeviceExtension->WmiLibInfo.SetWmiDataItem = NULL;
130 DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
131 DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
132
133 return IoWMIRegistrationControl(DeviceExtension->Self,
135}
NTSTATUS NTAPI InPortQueryWmiDataBlock(_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _In_ ULONG GuidIndex, _In_ ULONG InstanceIndex, _In_ ULONG InstanceCount, _Out_opt_ PULONG InstanceLengthArray, _In_ ULONG BufferAvail, _Out_opt_ PUCHAR Buffer)
Definition: wmi.c:55
NTSTATUS NTAPI InPortQueryWmiRegInfo(_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ PULONG RegFlags, _Inout_ PUNICODE_STRING InstanceName, _Out_opt_ PUNICODE_STRING *RegistryPath, _Inout_ PUNICODE_STRING MofResourceName, _Out_opt_ PDEVICE_OBJECT *Pdo)
Definition: wmi.c:28
#define WMIREG_ACTION_REGISTER

Referenced by InPortStartDevice().

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 80 of file inport.h.

◆ DriverRegistryPath

◆ InPortAddDevice

DRIVER_ADD_DEVICE InPortAddDevice

Definition at line 86 of file inport.h.

Referenced by DriverEntry().

◆ InPortDpcForIsr

IO_DPC_ROUTINE InPortDpcForIsr

Definition at line 109 of file inport.h.

Referenced by InPortAddDevice().

◆ InPortIsr

KSERVICE_ROUTINE InPortIsr

Definition at line 107 of file inport.h.

Referenced by InPortStartDevice().

◆ InPortStartMouse

KSYNCHRONIZE_ROUTINE InPortStartMouse

Definition at line 111 of file inport.h.

Referenced by InPortStartDevice().

◆ InPortStopMouse

KSYNCHRONIZE_ROUTINE InPortStopMouse

Definition at line 113 of file inport.h.

Referenced by InPortRemoveDevice().

◆ InPortUnload

DRIVER_UNLOAD InPortUnload

Definition at line 83 of file inport.h.

Referenced by DriverEntry().