1 | /* $Id: VBoxMF.h 76563 2019-01-01 03:53:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Mouse Filter Driver - Internal Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef GA_INCLUDED_SRC_WINNT_Mouse_NT5_VBoxMF_h
|
---|
19 | #define GA_INCLUDED_SRC_WINNT_Mouse_NT5_VBoxMF_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <iprt/cdefs.h>
|
---|
25 | #define LOG_GROUP LOG_GROUP_DRV_MOUSE
|
---|
26 | #include <VBox/log.h>
|
---|
27 | #include <iprt/err.h>
|
---|
28 | #include <iprt/assert.h>
|
---|
29 | #include "../common/VBoxMouseLog.h"
|
---|
30 | #include <iprt/nt/ntddk.h>
|
---|
31 | RT_C_DECLS_BEGIN
|
---|
32 | #include <ntddmou.h>
|
---|
33 | #include <ntddkbd.h>
|
---|
34 | #include <ntdd8042.h>
|
---|
35 | RT_C_DECLS_END
|
---|
36 | #include <VBox/VMMDev.h> /* for VMMDevReqMouseStatus */
|
---|
37 |
|
---|
38 | #define IOCTL_INTERNAL_MOUSE_CONNECT CTL_CODE(FILE_DEVICE_MOUSE, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
39 |
|
---|
40 | typedef VOID (*PFNSERVICECB)(PDEVICE_OBJECT DeviceObject, PMOUSE_INPUT_DATA InputDataStart,
|
---|
41 | PMOUSE_INPUT_DATA InputDataEnd, PULONG InputDataConsumed);
|
---|
42 |
|
---|
43 | typedef struct _INTERNAL_MOUSE_CONNECT_DATA
|
---|
44 | {
|
---|
45 | PDEVICE_OBJECT pDO;
|
---|
46 | PFNSERVICECB pfnServiceCB;
|
---|
47 | } INTERNAL_MOUSE_CONNECT_DATA, *PINTERNAL_MOUSE_CONNECT_DATA;
|
---|
48 |
|
---|
49 | typedef struct _VBOXMOUSE_DEVEXT
|
---|
50 | {
|
---|
51 | LIST_ENTRY ListEntry;
|
---|
52 | PDEVICE_OBJECT pdoMain; /* PDO passed to VBoxDrvAddDevice */
|
---|
53 | PDEVICE_OBJECT pdoSelf; /* our PDO created in VBoxDrvAddDevice*/
|
---|
54 | PDEVICE_OBJECT pdoParent; /* Highest PDO in chain before we've attached our filter */
|
---|
55 |
|
---|
56 | BOOLEAN bHostMouse; /* Indicates if we're filtering the chain with emulated i8042 PS/2 adapter */
|
---|
57 |
|
---|
58 | INTERNAL_MOUSE_CONNECT_DATA OriginalConnectData; /* Original connect data intercepted in IOCTL_INTERNAL_MOUSE_CONNECT */
|
---|
59 | VMMDevReqMouseStatus *pSCReq; /* Preallocated request to use in pfnServiceCB */
|
---|
60 |
|
---|
61 | IO_REMOVE_LOCK RemoveLock;
|
---|
62 | } VBOXMOUSE_DEVEXT, *PVBOXMOUSE_DEVEXT;
|
---|
63 |
|
---|
64 | /* Interface functions */
|
---|
65 | RT_C_DECLS_BEGIN
|
---|
66 | NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);
|
---|
67 | RT_C_DECLS_END
|
---|
68 |
|
---|
69 | NTSTATUS VBoxDrvAddDevice(IN PDRIVER_OBJECT Driver, IN PDEVICE_OBJECT PDO);
|
---|
70 | VOID VBoxDrvUnload(IN PDRIVER_OBJECT Driver);
|
---|
71 |
|
---|
72 | /* IRP handlers */
|
---|
73 | NTSTATUS VBoxIrpPassthrough(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
---|
74 | NTSTATUS VBoxIrpInternalIOCTL(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
---|
75 | NTSTATUS VBoxIrpPnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
---|
76 | NTSTATUS VBoxIrpPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
---|
77 |
|
---|
78 | /* Internal functions */
|
---|
79 | void VBoxMouFltInitGlobals(void);
|
---|
80 | void VBoxMouFltDeleteGlobals(void);
|
---|
81 | void VBoxDeviceAdded(PVBOXMOUSE_DEVEXT pDevExt);
|
---|
82 | void VBoxInformHost(PVBOXMOUSE_DEVEXT pDevExt);
|
---|
83 | void VBoxDeviceRemoved(PVBOXMOUSE_DEVEXT pDevExt);
|
---|
84 |
|
---|
85 | VOID VBoxDrvNotifyServiceCB(PVBOXMOUSE_DEVEXT pDevExt, PMOUSE_INPUT_DATA InputDataStart, PMOUSE_INPUT_DATA InputDataEnd, PULONG InputDataConsumed);
|
---|
86 |
|
---|
87 | #endif /* !GA_INCLUDED_SRC_WINNT_Mouse_NT5_VBoxMF_h */
|
---|