ReactOS 0.4.15-dev-8058-ga7cbb60
wmi.c File Reference
#include "inport.h"
#include <debug.h>
Include dependency graph for wmi.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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)
 
NTSTATUS NTAPI InPortWmiRegistration (_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI InPortWmiDeRegistration (_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI InPortWmi (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 

Variables

GUID GuidWmiPortData = POINTER_PORT_WMI_STD_DATA_GUID
 
WMIGUIDREGINFO InPortWmiGuidList []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file wmi.c.

Function Documentation

◆ 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 PAGED_CODE()
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LONG NTSTATUS
Definition: precomp.h:26
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
_In_ PIRP Irp
Definition: csq.h:116
#define __FUNCTION__
Definition: types.h:116
WMIGUIDREGINFO InPortWmiGuidList[]
Definition: wmi.c:19
pRequest Complete(RequestStatus)
Status
Definition: gdiplustypes.h:25
#define STATUS_WMI_INSTANCE_NOT_FOUND
Definition: ntstatus.h:777
#define STATUS_WMI_GUID_NOT_FOUND
Definition: ntstatus.h:776
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:71
MOUSE_ATTRIBUTES MouseAttributes
Definition: inport.h:76
USHORT NumberOfButtons
Definition: ntddmou.h:110
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#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
#define IO_NO_INCREMENT
Definition: iotypes.h:598

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().

◆ InPortWmi()

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

Definition at line 152 of file wmi.c.

155{
158 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
159
160 PAGED_CODE();
161
162 DPRINT("%s(%p, %p) %X\n", __FUNCTION__, DeviceObject, Irp,
164
165 Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, Irp);
166 if (!NT_SUCCESS(Status))
167 {
168 Irp->IoStatus.Information = 0;
169 Irp->IoStatus.Status = Status;
171
172 return Status;
173 }
174
175 Status = WmiSystemControl(&DeviceExtension->WmiLibInfo,
177 Irp,
178 &Disposition);
179 switch (Disposition)
180 {
181 case IrpProcessed:
182 break;
183
184 case IrpNotCompleted:
186 break;
187
188 case IrpForward:
189 case IrpNotWmi:
191 Status = IoCallDriver(DeviceExtension->Ldo, Irp);
192 break;
193 }
194
195 IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp);
196
197 return Status;
198}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
PDEVICE_OBJECT Ldo
Definition: inport.h:46
IO_REMOVE_LOCK RemoveLock
Definition: inport.h:48
WMILIB_CONTEXT WmiLibInfo
Definition: inport.h:49
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
NTSTATUS NTAPI WmiSystemControl(IN PWMILIB_CONTEXT WmiLibInfo, IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT PSYSCTL_IRP_DISPOSITION IrpDisposition)
Definition: wmilib.c:48
@ IrpNotWmi
Definition: wmilib.h:15
@ IrpForward
Definition: wmilib.h:16
@ IrpNotCompleted
Definition: wmilib.h:14
@ IrpProcessed
Definition: wmilib.h:13
enum _SYSCTL_IRP_DISPOSITION SYSCTL_IRP_DISPOSITION
#define IoAcquireRemoveLock(RemoveLock, Tag)
#define IoReleaseRemoveLock(_RemoveLock, _Tag)
Definition: iofuncs.h:2764

Referenced by DriverEntry().

◆ 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}
#define NULL
Definition: types.h:112
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

◆ GuidWmiPortData

Definition at line 17 of file wmi.c.

◆ InPortWmiGuidList

WMIGUIDREGINFO InPortWmiGuidList[]
Initial value:
=
{
{&GuidWmiPortData, 1, 0}
}
GUID GuidWmiPortData
Definition: wmi.c:17

Definition at line 19 of file wmi.c.

Referenced by InPortQueryWmiDataBlock(), and InPortWmiRegistration().