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