news 2026/4/22 22:37:57

从mouhid!MouHid_ReadComplete到mouclass!MouseClassServiceCallback

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
从mouhid!MouHid_ReadComplete到mouclass!MouseClassServiceCallback

从mouhid!MouHid_ReadComplete到mouclass!MouseClassServiceCallback

0: kd> kc
#
00 nt!KeInitializeApc
01 nt!IopfCompleteRequest
02 mouclass!MouseClassServiceCallback
03 mouhid!MouHid_ReadComplete

04 nt!IopfCompleteRequest
05 HIDCLASS!HidpDistributeInterruptReport
06 HIDCLASS!HidpInterruptReadComplete
07 nt!IopfCompleteRequest
08 USBPORT!USBPORT_CompleteTransfer
09 USBPORT!USBPORT_DoneTransfer
0a USBPORT!USBPORT_FlushDoneTransferList
0b USBPORT!USBPORT_DpcWorker
0c USBPORT!USBPORT_IsrDpcWorker
0d USBPORT!USBPORT_IsrDpc
0e nt!KiRetireDpcList
0f nt!KiDispatchInterrupt
WARNING: Frame IP not in any known module. Following frames may be wrong.
10 0x0


NTSTATUS
MouHid_ReadComplete (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PDEVICE_EXTENSION Data // (PVOID Context)
)
{


if (Data->EnableCount)
{
//
// Synchronization issue - it's not a big deal if .Enabled is set
// FALSE after the condition above, but before the callback below,
// so long as the .MouClassCallback field is not nulled. This is
// guaranteed since the disconnect IOCTL is not implemented yet.
//
// Mouse class callback assumes we are running at DISPATCH level,
// however this IoCompletion routine can be running <= DISPATCH.
// Raise the IRQL before calling the callback. [13.1]
//
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);

//
// Call the callback.
//
(*(PSERVICE_CALLBACK_ROUTINE)
Data->ConnectData.ClassService) (
Data->ConnectData.ClassDeviceObject,
&Data->InputData,
&Data->InputData + 1, // (one data element)
&inputDataConsumed);

1: kd> dx -id 0,0,89831250 -r1 -nv (*((basesrv!_DEVICE_OBJECT *)0x897f9020))
(*((basesrv!_DEVICE_OBJECT *)0x897f9020)) : Device for "\Driver\mouhid" [Type: _DEVICE_OBJECT]
[+0x000] Type : 3 [Type: short]
[+0x002] Size : 0x1f0 [Type: unsigned short]
[+0x004] ReferenceCount : 0 [Type: long]
[+0x008] DriverObject : 0x894e7418 : Driver "\Driver\mouhid" [Type: _DRIVER_OBJECT *]
[+0x00c] NextDevice : 0x897fa020 : Device for "\Driver\mouhid" [Type: _DEVICE_OBJECT *]
[+0x010] AttachedDevice : 0x897a0c78 : Device for "\Driver\Mouclass" [Type: _DEVICE_OBJECT *]
[+0x014] CurrentIrp : 0x0 [Type: _IRP *]
[+0x018] Timer : 0x0 [Type: _IO_TIMER *]
[+0x01c] Flags : 0x2000 [Type: unsigned long]
[+0x020] Characteristics : 0x0 [Type: unsigned long]
[+0x024] Vpb : 0x0 [Type: _VPB *]
[+0x028] DeviceExtension : 0x897f90d8 [Type: void *]
[+0x02c] DeviceType : 0xf [Type: unsigned long]
[+0x030] StackSize : 9 '\t' [Type: char]
[+0x034] Queue [Type: __unnamed]
[+0x05c] AlignmentRequirement : 0x0 [Type: unsigned long]
[+0x060] DeviceQueue [Type: _KDEVICE_QUEUE]
[+0x074] Dpc [Type: _KDPC]
[+0x094] ActiveThreadCount : 0x0 [Type: unsigned long]
[+0x098] SecurityDescriptor : 0x0 [Type: void *]
[+0x09c] DeviceLock [Type: _KEVENT]
[+0x0ac] SectorSize : 0x0 [Type: unsigned short]
[+0x0ae] Spare1 : 0x1 [Type: unsigned short]
[+0x0b0] DeviceObjectExtension : 0x897f9210 [Type: _DEVOBJ_EXTENSION *]
[+0x0b4] Reserved : 0x0 [Type: void *]


1: kd> dt mouhid!_DEVICE_EXTENSION 0x897f90d8
+0x000 Self : 0x897f9020 _DEVICE_OBJECT
+0x004 TopOfStack : 0x89764948 _DEVICE_OBJECT
+0x008 PDO : 0x89764948 _DEVICE_OBJECT
+0x00c EnableCount : 0n1
+0x010 ReadInterlock : 2
+0x014 Started : 0x1 ''
+0x015 ShuttingDown : 0 ''
+0x016 Initialized : 0x1 ''
+0x018 UnitId : 2
+0x01a FlipFlop : 0 ''
+0x01b Reserved : [3] ""
+0x020 WheelScalingFactor : 0x78
+0x024 ReadIrp : 0x89800cd8 _IRP
+0x028 ProblemFlags : 0
+0x02c ReadFile : 0x895f1788 _FILE_OBJECT
+0x030 ReadCompleteEvent : _KEVENT
+0x040 ReadSentEvent : _KEVENT
+0x050 HidExtension : 0x89537b80 _HID_EXTENSION
+0x054 ConnectData : _CONNECT_DATA
+0x060 RemoveLock : _IO_REMOVE_LOCK
+0x0b8 CreateCloseMutex : _FAST_MUTEX
+0x0d8 StartEvent : _KEVENT
+0x0e8 InputData : _MOUSE_INPUT_DATA
+0x100 Attributes : _MOUSE_ATTRIBUTES
+0x10c AttributesAllignmentProblem : 0
+0x110 Link : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x118 WmiLibInfo : _WMILIB_CONTEXT

1: kd> dx -id 0,0,89831250 -r1 (*((mouhid!_CONNECT_DATA *)0x897f912c))
(*((mouhid!_CONNECT_DATA *)0x897f912c)) [Type: _CONNECT_DATA]
[+0x000] ClassDeviceObject : 0x897a0c78 : Device for "\Driver\Mouclass" [Type: _DEVICE_OBJECT *]
[+0x004] ClassService : 0xf751a596 [Type: void *]
1: kd> u 0xf751a596
mouclass!MouseClassServiceCallback [d:\srv03rtm\drivers\input\mouclass\mouclass.c @ 2416]:
f751a596 55 push ebp
f751a597 8bec mov ebp,esp
f751a599 83ec0c sub esp,0Ch
f751a59c 53 push ebx
f751a59d 56 push esi
f751a59e 57 push edi
f751a59f 6820a051f7 push offset mouclass!MouseClassHandleRead+0x104 (f751a020)
f751a5a4 6a02 push 2

NTSTATUS
MouseAddDeviceEx(
IN PDEVICE_EXTENSION ClassData,
IN PWCHAR FullClassName,
IN PFILE_OBJECT File
)
{

} else if ((Globals.GrandMaster != ClassData) &&
(ClassData == trueClassData)) {

//
// Connect to port device.
//
status = MouSendConnectRequest(ClassData, MouseClassServiceCallback);
ASSERT (STATUS_SUCCESS == status);
}


NTSTATUS
MouSendConnectRequest(
IN PDEVICE_EXTENSION ClassData,
IN PVOID ServiceCallback
)
{
PIRP irp;
IO_STATUS_BLOCK ioStatus;
NTSTATUS status;
KEVENT event;
CONNECT_DATA connectData;

PAGED_CODE ();

MouPrint((2,"MOUCLASS-MouSendConnectRequest: enter\n"));

//
// Create notification event object to be used to signal the
// request completion.
//

KeInitializeEvent(&event, NotificationEvent, FALSE);

//
// Build the synchronous request to be sent to the port driver
// to perform the request. Allocate an IRP to issue the port internal
// device control connect call. The connect parameters are passed in
// the input buffer.
//
//

connectData.ClassDeviceObject = ClassData->TrueClassDevice;
connectData.ClassService = ServiceCallback;//这里进行了赋值为MouseClassServiceCallback

irp = IoBuildDeviceIoControlRequest(
IOCTL_INTERNAL_MOUSE_CONNECT,
ClassData->TopPort,
&connectData,
sizeof(CONNECT_DATA),
NULL,
0,
TRUE,
&event,
&ioStatus
);

if (irp) {

//
// Call the port driver to perform the operation. If the returned status
// is PENDING, wait for the request to complete.
//

status = IoCallDriver(ClassData->TopPort, irp);

if (status == STATUS_PENDING) {

(VOID) KeWaitForSingleObject(
&event,
Executive,
KernelMode,
FALSE,
NULL
);

status = irp->IoStatus.Status;

} else {

//
// Ensure that the proper status value gets picked up.
//

ioStatus.Status = status;

}

} else {

ioStatus.Status = STATUS_INSUFFICIENT_RESOURCES;

}

MouPrint((2,"MOUCLASS-MouSendConnectRequest: exit\n"));

return(ioStatus.Status);

} // end MouSendConnectRequest()

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/23 9:32:46

Open-AutoGLM实战指南:5步搭建高效电商评价自动回复系统

第一章&#xff1a;Open-AutoGLM 电商评价自动回复在电商平台运营中&#xff0c;及时、准确地回应用户评价是提升客户满意度的关键环节。Open-AutoGLM 是一款基于开源大语言模型的自动化回复系统&#xff0c;专为处理电商用户评论设计&#xff0c;能够理解语义情感并生成个性化…

作者头像 李华
网站建设 2026/4/22 18:28:14

Open-AutoGLM安全升级指南,如何在2小时内完成MFA全流程集成

第一章&#xff1a;Open-AutoGLM安全升级指南概述随着大语言模型在自动化推理与代码生成场景中的广泛应用&#xff0c;Open-AutoGLM 作为开源智能代理框架&#xff0c;其安全性成为部署过程中的核心关注点。本指南旨在为系统管理员和开发人员提供一套完整的安全加固路径&#x…

作者头像 李华
网站建设 2026/4/23 10:13:49

日志泄露危机频发:Open-AutoGLM加密存储为何成最后防线?

第一章&#xff1a;日志泄露危机频发&#xff1a;安全防护的迫切需求近年来&#xff0c;随着企业数字化转型加速&#xff0c;系统日志成为运维与故障排查的重要依据。然而&#xff0c;日志数据中常包含用户身份信息、会话令牌、API密钥等敏感内容&#xff0c;一旦暴露&#xff…

作者头像 李华
网站建设 2026/4/23 11:05:21

17.5 安全保障机制:控制AI生成内容风险

17.5 安全保障机制:控制AI生成内容风险 在前几节中,我们探讨了模型工程化实施、Agent工作流构建、知识库设计和效果评估体系等关键技术环节。今天,我们将重点关注AI系统安全这一至关重要的主题——如何建立完善的安全保障机制,有效控制AI生成内容的风险,确保系统安全可靠…

作者头像 李华
网站建设 2026/4/23 11:07:03

基于Spring Boot的游戏攻略交流平台毕业设计源码

博主介绍&#xff1a;✌ 专注于Java,python,✌关注✌私信我✌具体的问题&#xff0c;我会尽力帮助你。一、研究目的本研究旨在构建一个基于Spring Boot框架的游戏攻略交流平台&#xff0c;以实现游戏玩家之间的信息共享和互动。具体研究目的如下&#xff1a; 首先&#xff0c;通…

作者头像 李华
网站建设 2026/4/23 11:07:03

5款AI写论文工具大比拼:宏智树AI凭何成为毕业季“学术引擎”?

当毕业论文的DDL如达摩克利斯之剑高悬头顶&#xff0c;熬夜查文献、改框架、降重复率的循环成为学术常态&#xff0c;如何高效完成一篇兼具学术深度与创新性的论文&#xff0c;成了毕业生们最焦虑的命题。如今&#xff0c;AI写作工具如雨后春笋般涌现&#xff0c;但真正能满足“…

作者头像 李华