breeze916
驱动牛犊
驱动牛犊
  • 注册日期2009-01-14
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分35分
  • 威望271点
  • 贡献值1点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2993回复:2

vhidmini : system hangs on shutdown/reboot

楼主#
更多 发布于:2009-09-19 20:39
我将microsoft的sample -- vhidmini修改成了Virtual mouse driver,
可以成功模拟成HID-compliant mouse, 也能让mouse动起来.
但遇到一个问题,系统无法shutdown或reboot.
但原本microsoft的sample是可以shutdown或reboot的.
我只是修改了report descriptor和read_report function.

用winDbg发现是因为:

Waiting on: \Driver\mouseclass \Device\mousepointer2-xxx e6868c40 irp (ce7b4e10) SetPower-Shutdown status 0xC00000BB

我怀疑是power的问题,但我不知道应该如何处理power,所以follow了vhimini的做法,下面是vhidmini中的power routine:

NTSTATUS
Power(
__in PDEVICE_OBJECT DeviceObject,
__in PIRP Irp
)
{
PDEVICE_EXTENSION deviceInfo;
DebugPrint(("Enter Power()\n"));
deviceInfo = GET_MINIDRIVER_DEVICE_EXTENSION (DeviceObject);
//
// Make sure to store and restore the device context depending
// on whether the system is going into lower power state
// or resuming. The job of converting S-IRPs to D-IRPs is done
// by HIDCLASS. All you need to do here is handle Set-Power request
// for device power state according to the guidelines given in the
// power management documentation of the DDK. Before powering down
// your device make sure to cancel any pending IRPs, if any, sent by
// you to the lower device stack.
//
PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocation(Irp);
return PoCallDriver(GET_NEXT_DEVICE_OBJECT (DeviceObject), Irp);
}

不知道对于mouse miniport driver,应该如何处理power?
期待高手解决…
学好驱动
mikelish
驱动牛犊
驱动牛犊
  • 注册日期2002-05-09
  • 最后登录2011-10-27
  • 粉丝0
  • 关注0
  • 积分1分
  • 威望10点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2009-09-21 10:30
power时, 应cancel说有IRP, 并不接受新的IRP pending。 返回STATUS_DATA_ERROR。
breeze916
驱动牛犊
驱动牛犊
  • 注册日期2009-01-14
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分35分
  • 威望271点
  • 贡献值1点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2009-09-21 13:09
谢谢mikelish,
但我的driver并没有收到IRP_MJ_POWER,也就是说并没有进入我的power routine.

用windbg发现,关机是应该是塞在:

Waiting on: \Driver\Mouclass \Device\PointerClass2 irp (81b04e70) SetPower-Shutdown status c00000bb

 c00000bb是STATUS_NOT_SUPPORTED.

用!irp 81b04e70查询结果如下:

kd> !irp 81b04e70
Irp is active with 7 stacks 7 is current (= 0x81b04fb8)
 No Mdl: No System Buffer: Thread 00000000:  Irp stack trace.  
     cmd  flg cl Device   File     Completion-Context
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
 [  0, 0]   0  0 00000000 00000000 00000000-00000000    

            Args: 00000000 00000000 00000000 00000000
>[ 16, 2]   0 e1 81a8fbc0 00000000 80667f6c-818dfbf4 Success Error Cancel pending
          *** ERROR: Module load completed but symbols could not be loaded for vhidmini.sys
 \Driver\vhidmini    nt!PopCompleteSystemPowerIrp
            Args: 00000000 00000000 00000006 00000005

请问为什么没有进入我的power routine?
学好驱动
游客

返回顶部