ReactOS  0.4.15-dev-1397-g19779b3
inport.h File Reference
#include <wdm.h>
#include <wmilib.h>
#include <wmistr.h>
#include <kbdmou.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 16 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 18 of file inport.h.

19 {
20  dsStopped,
21  dsStarted,
22  dsRemoved
INPORT_DEVICE_STATE
Definition: inport.h:18

◆ INPORT_MOUSE_TYPE

Enumerator
NecBusMouse 
MsInPortMouse 
LogitechBusMouse 

Definition at line 25 of file inport.h.

Function Documentation

◆ _Dispatch_type_() [1/5]

_Dispatch_type_ ( IRP_MJ_CREATE  )

Definition at line 4769 of file create.c.

4771  {
4772  NTSTATUS Status;
4774  device_extension* Vcb = DeviceObject->DeviceExtension;
4775  bool top_level, locked = false;
4776 
4778 
4779  TRACE("create (flags = %lx)\n", Irp->Flags);
4780 
4781  top_level = is_top_level(Irp);
4782 
4783  /* return success if just called for FS device object */
4784  if (DeviceObject == master_devobj) {
4785  TRACE("create called for FS device object\n");
4786 
4787  Irp->IoStatus.Information = FILE_OPENED;
4789 
4790  goto exit;
4791  } else if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
4793  goto exit;
4794  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
4796  goto exit;
4797  }
4798 
4799  if (!(Vcb->Vpb->Flags & VPB_MOUNTED)) {
4801  goto exit;
4802  }
4803 
4804  if (Vcb->removing) {
4806  goto exit;
4807  }
4808 
4809  Status = verify_vcb(Vcb, Irp);
4810  if (!NT_SUCCESS(Status)) {
4811  ERR("verify_vcb returned %08lx\n", Status);
4812  goto exit;
4813  }
4814 
4815  ExAcquireResourceSharedLite(&Vcb->load_lock, true);
4816  locked = true;
4817 
4819 
4820  if (IrpSp->Flags != 0) {
4822 
4823  TRACE("flags:\n");
4824 
4825  if (flags & SL_CASE_SENSITIVE) {
4826  TRACE("SL_CASE_SENSITIVE\n");
4828  }
4829 
4830  if (flags & SL_FORCE_ACCESS_CHECK) {
4831  TRACE("SL_FORCE_ACCESS_CHECK\n");
4833  }
4834 
4835  if (flags & SL_OPEN_PAGING_FILE) {
4836  TRACE("SL_OPEN_PAGING_FILE\n");
4838  }
4839 
4841  TRACE("SL_OPEN_TARGET_DIRECTORY\n");
4843  }
4844 
4845  if (flags & SL_STOP_ON_SYMLINK) {
4846  TRACE("SL_STOP_ON_SYMLINK\n");
4848  }
4849 
4850  if (flags)
4851  WARN("unknown flags: %x\n", flags);
4852  } else {
4853  TRACE("flags: (none)\n");
4854  }
4855 
4856  if (!IrpSp->FileObject) {
4857  ERR("FileObject was NULL\n");
4859  goto exit;
4860  }
4861 
4862  if (IrpSp->FileObject->RelatedFileObject) {
4863  fcb* relatedfcb = IrpSp->FileObject->RelatedFileObject->FsContext;
4864 
4865  if (relatedfcb && relatedfcb->Vcb != Vcb) {
4866  WARN("RelatedFileObject was for different device\n");
4868  goto exit;
4869  }
4870  }
4871 
4872  // opening volume
4873  if (IrpSp->FileObject->FileName.Length == 0 && !IrpSp->FileObject->RelatedFileObject) {
4874  ULONG RequestedDisposition = ((IrpSp->Parameters.Create.Options >> 24) & 0xff);
4875  ULONG RequestedOptions = IrpSp->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
4876 #ifdef DEBUG_FCB_REFCOUNTS
4877  LONG rc;
4878 #endif
4879  ccb* ccb;
4880 
4881  TRACE("open operation for volume\n");
4882 
4883  if (RequestedDisposition != FILE_OPEN && RequestedDisposition != FILE_OPEN_IF) {
4885  goto exit;
4886  }
4887 
4888  if (RequestedOptions & FILE_DIRECTORY_FILE) {
4890  goto exit;
4891  }
4892 
4894  if (!ccb) {
4895  ERR("out of memory\n");
4897  goto exit;
4898  }
4899 
4900  RtlZeroMemory(ccb, sizeof(*ccb));
4901 
4903  ccb->NodeSize = sizeof(*ccb);
4904  ccb->disposition = RequestedDisposition;
4905  ccb->options = RequestedOptions;
4906  ccb->access = IrpSp->Parameters.Create.SecurityContext->AccessState->PreviouslyGrantedAccess;
4908  IrpSp->Flags & SL_FORCE_ACCESS_CHECK ? UserMode : Irp->RequestorMode);
4909  ccb->reserving = false;
4910  ccb->lxss = called_from_lxss();
4911 
4912 #ifdef DEBUG_FCB_REFCOUNTS
4913  rc = InterlockedIncrement(&Vcb->volume_fcb->refcount);
4914  WARN("fcb %p: refcount now %i (volume)\n", Vcb->volume_fcb, rc);
4915 #else
4916  InterlockedIncrement(&Vcb->volume_fcb->refcount);
4917 #endif
4918  IrpSp->FileObject->FsContext = Vcb->volume_fcb;
4919  IrpSp->FileObject->FsContext2 = ccb;
4920 
4921  IrpSp->FileObject->SectionObjectPointer = &Vcb->volume_fcb->nonpaged->segment_object;
4922 
4923  if (!IrpSp->FileObject->Vpb)
4924  IrpSp->FileObject->Vpb = DeviceObject->Vpb;
4925 
4926  InterlockedIncrement(&Vcb->open_files);
4927 
4928  Irp->IoStatus.Information = FILE_OPENED;
4930  } else {
4932  bool skip_lock;
4933 
4935 
4936  TRACE("file name: %.*S\n", (int)(IrpSp->FileObject->FileName.Length / sizeof(WCHAR)), IrpSp->FileObject->FileName.Buffer);
4937 
4938  if (IrpSp->FileObject->RelatedFileObject)
4939  TRACE("related file = %p\n", IrpSp->FileObject->RelatedFileObject);
4940 
4941  // Don't lock again if we're being called from within CcCopyRead etc.
4942  skip_lock = ExIsResourceAcquiredExclusiveLite(&Vcb->tree_lock);
4943 
4944  if (!skip_lock)
4945  ExAcquireResourceSharedLite(&Vcb->tree_lock, true);
4946 
4947  ExAcquireResourceSharedLite(&Vcb->fileref_lock, true);
4948 
4950 
4951  if (!NT_SUCCESS(Status))
4953  else
4955 
4956  ExReleaseResourceLite(&Vcb->fileref_lock);
4957 
4958  if (!skip_lock)
4959  ExReleaseResourceLite(&Vcb->tree_lock);
4960  }
4961 
4962 exit:
4963  Irp->IoStatus.Status = Status;
4965 
4966  TRACE("create returning %08lx\n", Status);
4967 
4968  if (locked)
4969  ExReleaseResourceLite(&Vcb->load_lock);
4970 
4971  if (top_level)
4973 
4975 
4976  return Status;
4977 }
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
Definition: treefuncs.c:1050
void clear_rollback(LIST_ENTRY *rollback)
Definition: treefuncs.c:1029
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1800
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FsRtlEnterFileSystem
#define FILE_OPEN_IF
Definition: from_kernel.h:56
ULONG options
Definition: btrfs_drv.h:390
USHORT Flags
Definition: iotypes.h:171
#define FsRtlExitFileSystem
Iosb Status
Definition: create.c:4287
#define SL_OPEN_PAGING_FILE
Definition: iotypes.h:1797
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_OPENED
Definition: nt_native.h:769
#define SL_STOP_ON_SYMLINK
Definition: iotypes.h:1799
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
ACCESS_MASK access
Definition: btrfs_drv.h:398
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
#define SL_FORCE_ACCESS_CHECK
Definition: iotypes.h:1796
bool manage_volume_privilege
Definition: btrfs_drv.h:395
#define FILE_VALID_OPTION_FLAGS
Definition: nt_native.h:759
#define ALLOC_TAG
Definition: btrfs_drv.h:91
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB Vcb
Definition: create.c:4137
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define IO_DISK_INCREMENT
Definition: iotypes.h:583
_In_ PIRP Irp
Definition: csq.h:116
long LONG
Definition: pedump.c:60
PDEVICE_OBJECT master_devobj
Definition: btrfs.c:69
BOOLEAN NTAPI ExIsResourceAcquiredExclusiveLite(IN PERESOURCE Resource)
Definition: resource.c:1619
#define IoCompleteRequest
Definition: irp.c:1240
static bool has_manage_volume_privilege(ACCESS_STATE *access_state, KPROCESSOR_MODE processor_mode)
Definition: create.c:4758
#define BTRFS_NODE_TYPE_CCB
Definition: btrfs_drv.h:88
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
NTSTATUS vol_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:36
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
USHORT NodeType
Definition: btrfs_drv.h:387
GLbitfield flags
Definition: glext.h:7161
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static NTSTATUS open_file(PDEVICE_OBJECT DeviceObject, _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, PIRP Irp, LIST_ENTRY *rollback)
Definition: create.c:4408
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
Definition: typedefs.h:119
#define FILE_OPEN
Definition: from_kernel.h:54
#define ERR(fmt,...)
Definition: debug.h:110
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3148
#define SL_OPEN_TARGET_DIRECTORY
Definition: iotypes.h:1798
#define InterlockedIncrement
Definition: armddk.h:53
ULONG disposition
Definition: btrfs_drv.h:389
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
Definition: btrfs_drv.h:1357
UINT32 uint32_t
Definition: types.h:75
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define called_from_lxss()
Definition: create.c:2989
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
bool reserving
Definition: btrfs_drv.h:397
#define STATUS_SUCCESS
Definition: shellext.h:65
bool lxss
Definition: btrfs_drv.h:407
void exit(int exitcode)
Definition: _exit.c:33
struct _ccb ccb
static NTSTATUS verify_vcb(device_extension *Vcb, PIRP Irp)
Definition: create.c:4696
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
CSHORT NodeSize
Definition: btrfs_drv.h:388
#define VPB_MOUNTED
Definition: iotypes.h:1787
HRESULT Create([out]ITransactionReceiver **ppReceiver)
struct _device_extension * Vcb
Definition: btrfs_drv.h:298
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70

◆ _Dispatch_type_() [2/5]

_Dispatch_type_ ( IRP_MJ_INTERNAL_DEVICE_CONTROL  )

◆ _Dispatch_type_() [3/5]

_Dispatch_type_ ( IRP_MJ_POWER  )

Definition at line 5581 of file btrfs.c.

5583  {
5584  NTSTATUS Status;
5586  device_extension* Vcb = DeviceObject->DeviceExtension;
5587  bool top_level;
5588 
5589  // no need for FsRtlEnterFileSystem, as this only ever gets called in a system thread
5590 
5591  top_level = is_top_level(Irp);
5592 
5593  Irp->IoStatus.Information = 0;
5594 
5595  if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
5596  volume_device_extension* vde = DeviceObject->DeviceExtension;
5597 
5599  IrpSp->Parameters.Power.State.SystemState != PowerSystemWorking && vde->mounted_device) {
5601 
5602  /* If power state is about to go to sleep or hibernate, do a flush. We do this on IRP_MJ_QUERY_POWER
5603  * rather than IRP_MJ_SET_POWER because we know that the hard disks are still awake. */
5604 
5605  if (Vcb2) {
5606  ExAcquireResourceExclusiveLite(&Vcb2->tree_lock, true);
5607 
5608  if (Vcb2->need_write && !Vcb2->readonly) {
5609  TRACE("doing protective flush on power state change\n");
5610  Status = do_write(Vcb2, NULL);
5611  } else
5613 
5614  free_trees(Vcb2);
5615 
5616  if (!NT_SUCCESS(Status))
5617  ERR("do_write returned %08lx\n", Status);
5618 
5619  ExReleaseResourceLite(&Vcb2->tree_lock);
5620  }
5621  } else if (IrpSp->MinorFunction == IRP_MN_SET_POWER && IrpSp->Parameters.Power.Type == SystemPowerState &&
5622  IrpSp->Parameters.Power.State.SystemState == PowerSystemWorking && vde->mounted_device) {
5624 
5625  /* If waking up, make sure that the FS hasn't been changed while we've been out (e.g., by dual-boot Linux) */
5626 
5627  if (Vcb2) {
5628  PIO_WORKITEM work_item;
5629 
5630  work_item = IoAllocateWorkItem(DeviceObject);
5631  if (!work_item) {
5632  ERR("out of memory\n");
5633  } else
5634  IoQueueWorkItem(work_item, check_after_wakeup, DelayedWorkQueue, Vcb2);
5635  }
5636  }
5637 
5640  Status = PoCallDriver(vde->attached_device, Irp);
5641 
5642  goto exit;
5643  } else if (Vcb && Vcb->type == VCB_TYPE_FS) {
5645 
5646  Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
5647 
5648  goto exit;
5649  } else if (Vcb && Vcb->type == VCB_TYPE_BUS) {
5650  bus_device_extension* bde = DeviceObject->DeviceExtension;
5651 
5654  Status = PoCallDriver(bde->attached_device, Irp);
5655 
5656  goto exit;
5657  }
5658 
5660  Irp->IoStatus.Status = STATUS_SUCCESS;
5661 
5662  Status = Irp->IoStatus.Status;
5663 
5665 
5667 
5668 exit:
5669  if (top_level)
5671 
5672  return Status;
5673 }
#define IRP_MN_QUERY_POWER
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7789
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: btrfs.c:4232
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:699
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:794
InsertTailList & Vcb
Definition: btrfs.c:2978
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
PDEVICE_OBJECT mounted_device
Definition: btrfs_drv.h:884
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define IRP_MN_SET_POWER
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:888
#define ERR(fmt,...)
Definition: debug.h:110
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:857
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IO_NO_INCREMENT
Definition: iotypes.h:581
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7498
void exit(int exitcode)
Definition: _exit.c:33
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ _Dispatch_type_() [4/5]

_Dispatch_type_ ( IRP_MJ_SYSTEM_CONTROL  )

Definition at line 5675 of file btrfs.c.

5677  {
5678  NTSTATUS Status;
5679  device_extension* Vcb = DeviceObject->DeviceExtension;
5680  bool top_level;
5681 
5683 
5684  top_level = is_top_level(Irp);
5685 
5686  Irp->IoStatus.Information = 0;
5687 
5688  if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
5689  volume_device_extension* vde = DeviceObject->DeviceExtension;
5690 
5692 
5694 
5695  goto exit;
5696  } else if (Vcb && Vcb->type == VCB_TYPE_FS) {
5698 
5699  Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
5700 
5701  goto exit;
5702  } else if (Vcb && Vcb->type == VCB_TYPE_BUS) {
5703  bus_device_extension* bde = DeviceObject->DeviceExtension;
5704 
5706 
5708 
5709  goto exit;
5710  }
5711 
5712  Status = Irp->IoStatus.Status;
5714 
5715 exit:
5716  if (top_level)
5718 
5720 
5721  return Status;
5722 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: btrfs.c:4232
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:699
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
InsertTailList & Vcb
Definition: btrfs.c:2978
Status
Definition: gdiplustypes.h:24
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:888
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:857
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IO_NO_INCREMENT
Definition: iotypes.h:581
void exit(int exitcode)
Definition: _exit.c:33

◆ _Dispatch_type_() [5/5]

_Dispatch_type_ ( IRP_MJ_PNP  )

Definition at line 620 of file pnp.c.

622  {
624  device_extension* Vcb = DeviceObject->DeviceExtension;
626  bool top_level;
627 
629 
630  top_level = is_top_level(Irp);
631 
632  if (Vcb && Vcb->type == VCB_TYPE_BUS) {
633  Status = bus_pnp(DeviceObject->DeviceExtension, Irp);
634  goto exit;
635  } else if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
636  volume_device_extension* vde = DeviceObject->DeviceExtension;
639  goto exit;
640  } else if (Vcb && Vcb->type == VCB_TYPE_PDO) {
642  goto end;
643  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
645  goto end;
646  }
647 
649 
650  switch (IrpSp->MinorFunction) {
653  break;
654 
657  break;
658 
661  break;
662 
665  break;
666 
669  goto exit;
670 
671  default:
672  TRACE("passing minor function 0x%x on\n", IrpSp->MinorFunction);
673 
675  Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
676  goto exit;
677  }
678 
679 end:
680  Irp->IoStatus.Status = Status;
681 
683 
684 exit:
685  TRACE("returning %08lx\n", Status);
686 
687  if (top_level)
689 
691 
692  return Status;
693 }
NTSTATUS pnp_query_remove_device(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:181
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define VCB_TYPE_PDO
Definition: btrfs_drv.h:698
#define IRP_MN_REMOVE_DEVICE
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:699
static NTSTATUS pnp_remove_device(PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:221
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define TRACE(s)
Definition: solgame.cpp:4
static NTSTATUS bus_pnp(bus_device_extension *bde, PIRP Irp)
Definition: pnp.c:360
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
#define Vcb
Definition: cdprocs.h:1415
GLuint GLuint end
Definition: gl.h:1545
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
static NTSTATUS pnp_cancel_remove_device(PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:155
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:888
static NTSTATUS pdo_pnp(PDEVICE_OBJECT pdo, PIRP Irp)
Definition: pnp.c:572
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
static NTSTATUS pnp_device_usage_notification(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:599
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
void exit(int exitcode)
Definition: _exit.c:33
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:254

◆ InPortInitializeMouse()

VOID NTAPI InPortInitializeMouse ( _In_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 343 of file hardware.c.

345 {
346  PAGED_CODE();
347 
348  /* Initialize mouse and disable interrupts */
349  switch (DeviceExtension->MouseType)
350  {
351  case NecBusMouse:
353 
354  /* Setup interrupt rate (unavailable on hireso machines) */
355  if (DeviceExtension->IoBase != NEC_BM_HIRESO_BASE)
356  WRITE_MOUSE(DeviceExtension, NEC_BM_INT_RATE, NEC_RATE_60_HZ);
357 
358  WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_INT_DISABLE);
359  WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_NO_CLEAR);
360  WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_CLEAR);
361  break;
362 
363  case MsInPortMouse:
364  WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_RESET);
365  WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_REG_MODE);
366  WRITE_MOUSE(DeviceExtension, MS_INPORT_DATA, INPORT_MODE_BASE);
367  break;
368 
369  case LogitechBusMouse:
370  WRITE_MOUSE(DeviceExtension, LOG_BM_CONFIG, LOG_DEFAULT_MODE);
371  WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_DISABLE_IRQ);
372  break;
373  }
374 }
#define NEC_RATE_60_HZ
Definition: hardware.c:55
#define LOG_BM_CONTROL
Definition: hardware.c:93
#define INPORT_MODE_BASE
Definition: hardware.c:76
#define NEC_PPI_HC_CLEAR
Definition: hardware.c:50
#define INPORT_REG_MODE
Definition: hardware.c:71
#define NEC_BM_INT_RATE
Definition: hardware.c:53
#define NEC_BM_HIRESO_BASE
Definition: hardware.c:59
#define NEC_PPI_INT_DISABLE
Definition: hardware.c:48
#define MS_INPORT_DATA
Definition: hardware.c:74
#define LOG_BM_CONFIG
Definition: hardware.c:102
#define NEC_PPI_DEFAULT_MODE
Definition: hardware.c:51
#define LOG_DEFAULT_MODE
Definition: hardware.c:103
#define INPORT_RESET
Definition: hardware.c:72
#define MS_INPORT_CONTROL
Definition: hardware.c:67
#define WRITE_MOUSE(DeviceExtension, Port, Data)
Definition: hardware.c:26
#define NEC_BM_CONFIG
Definition: hardware.c:46
#define LOG_DISABLE_IRQ
Definition: hardware.c:95
#define NEC_PPI_HC_NO_CLEAR
Definition: hardware.c:49
#define PAGED_CODE()

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 62 of file wmi.c.

71 {
73  PPOINTER_PORT_WMI_STD_DATA InPortData;
74  PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
75 
76  PAGED_CODE();
77 
78  DPRINT("%s()\n", __FUNCTION__);
79 
81  {
83  goto Complete;
84  }
85 
86  /* Only register 1 instance per GUID */
87  if (InstanceIndex != 0 || InstanceCount != 1)
88  {
90  goto Complete;
91  }
92 
93  if (!InstanceLengthArray || BufferAvail < sizeof(POINTER_PORT_WMI_STD_DATA))
94  {
96  goto Complete;
97  }
98 
99  InPortData = (PPOINTER_PORT_WMI_STD_DATA)Buffer;
100 
101  /* Bus mouse connector isn't defined in the DDK, so set type to something generic */
103  /* 1 packet */
104  InPortData->DataQueueSize = 1;
105  /* Not supported by device */
106  InPortData->ErrorCount = 0;
107 
108  InPortData->Buttons = DeviceExtension->MouseAttributes.NumberOfButtons;
110  *InstanceLengthArray = sizeof(POINTER_PORT_WMI_STD_DATA);
111 
113 
114 Complete:
116  Irp,
117  Status,
120 }
#define STATUS_WMI_GUID_NOT_FOUND
Definition: ntstatus.h:776
WMIGUIDREGINFO InPortWmiGuidList[]
Definition: wmi.c:27
LONG NTSTATUS
Definition: precomp.h:26
_In_ LPGUID _In_ ULONG InstanceIndex
Definition: classpnp.h:1250
NTSTATUS NTAPI WmiCompleteRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN NTSTATUS Status, IN ULONG BufferUsed, IN CCHAR PriorityBoost)
Definition: wmilib.c:24
#define STATUS_WMI_INSTANCE_NOT_FOUND
Definition: ntstatus.h:777
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
struct _POINTER_PORT_WMI_STD_DATA * PPOINTER_PORT_WMI_STD_DATA
_In_ PIRP Irp
Definition: csq.h:116
pRequest Complete(RequestStatus)
_In_ PIRP _In_ ULONG GuidIndex
Definition: classpnp.h:418
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
struct _POINTER_PORT_WMI_STD_DATA POINTER_PORT_WMI_STD_DATA
Status
Definition: gdiplustypes.h:24
_In_ PIRP _In_ ULONG _In_ ULONG BufferAvail
Definition: classpnp.h:418
#define POINTER_PORT_WMI_STD_MOUSE
Definition: wmidata.h:3180
MOUSE_ATTRIBUTES MouseAttributes
Definition: inport.h:74
#define POINTER_PORT_WMI_STD_I8042
Definition: wmidata.h:3169
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define IO_NO_INCREMENT
Definition: iotypes.h:581
_In_ ULONG InstanceCount
Definition: iofuncs.h:1319
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __FUNCTION__
Definition: types.h:112
USHORT NumberOfButtons
Definition: ntddmou.h:110
#define PAGED_CODE()

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 36 of file wmi.c.

43 {
44  PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
45 
48 
49  PAGED_CODE();
50 
51  DPRINT("%s()\n", __FUNCTION__);
52 
55  *Pdo = DeviceExtension->Pdo;
56 
57  return STATUS_SUCCESS;
58 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
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:64
_Out_ ULONG * RegFlags
Definition: classpnp.h:403
void DPRINT(...)
Definition: polytest.cpp:61
#define WMIREG_FLAG_INSTANCE_PDO
Definition: wmistr.h:69
PDEVICE_OBJECT Pdo
Definition: inport.h:43
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING MofResourceName
Definition: wdfdevice.h:2461
UNICODE_STRING DriverRegistryPath
Definition: inport.c:24
_Must_inspect_result_ _Inout_ PFLT_VOLUME _In_opt_ PCUNICODE_STRING InstanceName
Definition: fltkernel.h:1162
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __FUNCTION__
Definition: types.h:112
#define PAGED_CODE()

Referenced by InPortWmiRegistration().

◆ InPortRemoveDevice()

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

Definition at line 183 of file pnp.c.

186 {
188  BOOLEAN IsStarted;
189  PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
190 
191  PAGED_CODE();
192 
193  InPortWmiDeRegistration(DeviceExtension);
194 
195  IsStarted = (DeviceExtension->State == dsStarted);
196 
197  DeviceExtension->State = dsRemoved;
198 
199  Irp->IoStatus.Status = STATUS_SUCCESS;
201  Status = IoCallDriver(DeviceExtension->Ldo, Irp);
202 
203  IoReleaseRemoveLockAndWait(&DeviceExtension->RemoveLock, Irp);
204 
205  /* Device is active */
206  if (IsStarted)
207  {
208  KeSynchronizeExecution(DeviceExtension->InterruptObject,
210  DeviceExtension);
211 
212  IoDisconnectInterrupt(DeviceExtension->InterruptObject);
213 
214  /* Flush DPC for ISR */
216  }
217 
218  IoDetachDevice(DeviceExtension->Ldo);
220 
221  return Status;
222 }
Definition: pci.h:35
PDEVICE_OBJECT Ldo
Definition: inport.h:44
INPORT_DEVICE_STATE State
Definition: inport.h:45
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
KSYNCHRONIZE_ROUTINE InPortStopMouse
Definition: inport.h:105
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
unsigned char BOOLEAN
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
PKINTERRUPT InterruptObject
Definition: inport.h:52
Status
Definition: gdiplustypes.h:24
IO_REMOVE_LOCK RemoveLock
Definition: inport.h:46
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:142
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
Definition: iofuncs.h:2770
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID NTAPI KeFlushQueuedDpcs(VOID)
Definition: dpc.c:918
NTSTATUS NTAPI InPortWmiDeRegistration(_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: wmi.c:145
#define PAGED_CODE()

Referenced by InPortPnp().

◆ InPortStartDevice()

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

Definition at line 27 of file pnp.c.

30 {
33  PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, DescriptorTranslated;
34  ULONG i;
35  ULONG RawVector;
36  BOOLEAN FoundBasePort = FALSE, FoundIrq = FALSE;
37  PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
39 
40  PAGED_CODE();
41 
42  ASSERT(DeviceExtension->State == dsStopped);
43 
44  if (!IoForwardIrpSynchronously(DeviceExtension->Ldo, Irp))
45  {
47  goto Complete;
48  }
49  Status = Irp->IoStatus.Status;
50  if (!NT_SUCCESS(Status))
51  {
52  DPRINT1("LDO failed to start 0x%X\n", Status);
53  goto Complete;
54  }
55 
56  AllocatedResources = IrpSp->Parameters.StartDevice.AllocatedResources;
57  AllocatedResourcesTranslated = IrpSp->Parameters.StartDevice.AllocatedResourcesTranslated;
59  {
60  DPRINT1("No allocated resources\n");
62  goto Complete;
63  }
64 
65  if (AllocatedResources->Count != 1)
66  DPRINT1("Expected FullList count is 1, got %d\n", AllocatedResources->Count);
67 
68  for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++)
69  {
70  Descriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i];
71  DescriptorTranslated = &AllocatedResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i];
72 
73  switch (Descriptor->Type)
74  {
75  case CmResourceTypePort:
76  {
77  DPRINT("[%p:%X:%X] I/O ports at [%p-%p]\n",
78  Descriptor,
79  Descriptor->ShareDisposition,
80  Descriptor->Flags,
81  Descriptor->u.Port.Start.LowPart,
82  Descriptor->u.Port.Start.LowPart + (Descriptor->u.Port.Length - 1));
83 
84  if (!FoundBasePort)
85  {
86  DeviceExtension->IoBase = ULongToPtr(Descriptor->u.Port.Start.u.LowPart);
87 
88  FoundBasePort = TRUE;
89  }
90 
91  break;
92  }
93 
95  {
96  DPRINT("[%p:%X:%X] INT Vec %d Lev %d Aff %IX\n",
97  Descriptor,
98  Descriptor->ShareDisposition,
99  Descriptor->Flags,
100  Descriptor->u.Interrupt.Vector,
101  Descriptor->u.Interrupt.Level,
102  Descriptor->u.Interrupt.Affinity);
103 
104  if (!FoundIrq)
105  {
106  DeviceExtension->InterruptVector = DescriptorTranslated->u.Interrupt.Vector;
107  DeviceExtension->InterruptLevel = (KIRQL)DescriptorTranslated->u.Interrupt.Level;
108  if (DescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
109  DeviceExtension->InterruptMode = Latched;
110  else
111  DeviceExtension->InterruptMode = LevelSensitive;
112  DeviceExtension->InterruptShared = (DescriptorTranslated->ShareDisposition == CmResourceShareShared);
113  DeviceExtension->InterruptAffinity = DescriptorTranslated->u.Interrupt.Affinity;
114  RawVector = Descriptor->u.Interrupt.Vector;
115 
116  FoundIrq = TRUE;
117  }
118 
119  break;
120  }
121 
122  default:
123  DPRINT("[%p:%X:%X] Unrecognized resource type %X\n",
124  Descriptor,
125  Descriptor->ShareDisposition,
126  Descriptor->Flags,
127  Descriptor->Type);
128  break;
129  }
130  }
131 
132  if (!FoundBasePort || !FoundIrq)
133  {
134  DPRINT1("The device resources were not found\n");
136  goto Complete;
137  }
138 
139  DPRINT("I/O base at %p\n", DeviceExtension->IoBase);
140  DPRINT("IRQ %d\n", RawVector);
141 
142  Status = InPortWmiRegistration(DeviceExtension);
143  if (!NT_SUCCESS(Status))
144  {
145  DPRINT1("WMI registration failed 0x%X\n", Status);
146  goto Complete;
147  }
148 
149  InPortInitializeMouse(DeviceExtension);
150 
151  Status = IoConnectInterrupt(&DeviceExtension->InterruptObject,
152  InPortIsr,
153  DeviceExtension,
154  NULL,
155  DeviceExtension->InterruptVector,
156  DeviceExtension->InterruptLevel,
157  DeviceExtension->InterruptLevel,
158  DeviceExtension->InterruptMode,
159  DeviceExtension->InterruptShared,
160  DeviceExtension->InterruptAffinity,
161  FALSE);
162  if (!NT_SUCCESS(Status))
163  {
164  DPRINT1("Could not connect to interrupt %d\n", DeviceExtension->InterruptVector);
165  goto Complete;
166  }
167 
168  KeSynchronizeExecution(DeviceExtension->InterruptObject,
170  DeviceExtension);
171 
172  DeviceExtension->State = dsStarted;
173 
174 Complete:
175  Irp->IoStatus.Status = Status;
177 
178  return Status;
179 }
PDEVICE_OBJECT Ldo
Definition: inport.h:44
KSYNCHRONIZE_ROUTINE InPortStartMouse
Definition: inport.h:103
INPORT_DEVICE_STATE State
Definition: inport.h:45
#define ULongToPtr(ul)
Definition: basetsd.h:92
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
NTSTATUS NTAPI InPortWmiRegistration(_Inout_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: wmi.c:124
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@388 Interrupt
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
LONG NTSTATUS
Definition: precomp.h:26
KSERVICE_ROUTINE InPortIsr
Definition: inport.h:99
KINTERRUPT_MODE InterruptMode
Definition: inport.h:55
#define CmResourceTypePort
Definition: hwresource.cpp:123
UCHAR KIRQL
Definition: env_spec_w32.h:591
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
pRequest Complete(RequestStatus)
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:22
_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:4640
KAFFINITY InterruptAffinity
Definition: inport.h:57
unsigned char BOOLEAN
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI InPortInitializeMouse(_In_ PINPORT_DEVICE_EXTENSION DeviceExtension)
Definition: hardware.c:343
PKINTERRUPT InterruptObject
Definition: inport.h:52
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:45
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
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
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT1
Definition: precomp.h:8
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:142
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:619
BOOLEAN InterruptShared
Definition: inport.h:56
#define PAGED_CODE()

Referenced by InPortPnp().

◆ InPortWmiDeRegistration()

NTSTATUS NTAPI InPortWmiDeRegistration ( _Inout_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 145 of file wmi.c.

147 {
148  PAGED_CODE();
149 
150  return IoWMIRegistrationControl(DeviceExtension->Self,
152 }
#define WMIREG_ACTION_DEREGISTER
NTSTATUS NTAPI IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG Action)
Definition: wmi.c:68
#define PAGED_CODE()

Referenced by InPortRemoveDevice().

◆ InPortWmiRegistration()

NTSTATUS NTAPI InPortWmiRegistration ( _Inout_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 124 of file wmi.c.

126 {
127  PAGED_CODE();
128 
129  DeviceExtension->WmiLibInfo.GuidCount = RTL_NUMBER_OF(InPortWmiGuidList);
130  DeviceExtension->WmiLibInfo.GuidList = InPortWmiGuidList;
131 
132  DeviceExtension->WmiLibInfo.QueryWmiRegInfo = InPortQueryWmiRegInfo;
133  DeviceExtension->WmiLibInfo.QueryWmiDataBlock = InPortQueryWmiDataBlock;
134  DeviceExtension->WmiLibInfo.SetWmiDataBlock = NULL;
135  DeviceExtension->WmiLibInfo.SetWmiDataItem = NULL;
136  DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
137  DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
138 
139  return IoWMIRegistrationControl(DeviceExtension->Self,
141 }
WMIGUIDREGINFO InPortWmiGuidList[]
Definition: wmi.c:27
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:62
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:36
NTSTATUS NTAPI IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG Action)
Definition: wmi.c:68
#define WMIREG_ACTION_REGISTER
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NULL
Definition: types.h:112
#define PAGED_CODE()

Referenced by InPortStartDevice().

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 77 of file inport.h.

◆ DriverRegistryPath

◆ InPortAddDevice

DRIVER_ADD_DEVICE InPortAddDevice

Definition at line 81 of file inport.h.

◆ InPortDpcForIsr

IO_DPC_ROUTINE InPortDpcForIsr

Definition at line 101 of file inport.h.

Referenced by InPortAddDevice().

◆ InPortIsr

KSERVICE_ROUTINE InPortIsr

Definition at line 99 of file inport.h.

Referenced by InPortStartDevice().

◆ InPortStartMouse

KSYNCHRONIZE_ROUTINE InPortStartMouse

Definition at line 103 of file inport.h.

Referenced by InPortStartDevice().

◆ InPortStopMouse

KSYNCHRONIZE_ROUTINE InPortStopMouse

Definition at line 105 of file inport.h.

Referenced by InPortRemoveDevice().

◆ InPortUnload

DRIVER_UNLOAD InPortUnload

Definition at line 79 of file inport.h.