Henry
驱动牛犊
驱动牛犊
  • 注册日期2001-04-27
  • 最后登录2011-06-20
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望27点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
阅读:1605回复:1

HIDUSB Lower Filter Driver 如何定时读写注册表

楼主#
更多 发布于:2005-07-19 10:59
  我曾经试着在Lower Filter Driver的InternalDeviceControl::SubmitURB::URB_BULK_OR_INTERRUPT_TRANSFER::In中来读取注册表,在Windows 98下面没有问题。但是在Windows 2000和XP下,出现IRQL_NOT_LESS_OR_EQUAL BSOD.

使用Google查找,可以找到以下一段话:
In general, HIDCLASS can call your DispatchInternalControl callback at any interrupt request level (IRQL) less than or equal to DISPATCH_LEVEL and in an arbitrary thread. These facts imply that your callback, and all the data objects it uses, must be in nonpaged memory. Furthermore, you cannot block the calling thread. If you create subsidiary IRPs to communicate with your hardware, you must use asynchronous IRPs. Finally, any driver to which you send an IRP directly from this callback must be able to tolerate receiving the IRP at DISPATCH_LEVEL. As a point of information, the standard SERIAL.SYS driver allows IRPs at DISPATCH_LEVEL, and the USB bus driver allows you to send USB request blocks (URBs) at DISPATCH_LEVEL as well。

大概意思是说HIDCLASS会在DISPATCH_LEVEL下调用HIDUSB::InternalDeviceControl,而我
的Lower Filter Driver的InternalDeviceControl也会在DISPATCH_LEVEL下调用。而IoOpenDeviceInterfaceRegistryKey和ZwOpenKey等函数,均要求在PASSIVE_LEVEL下调用。

所以Lower Filter Driver会导致IRQL_NOT_LESS_OR_EQUAL BSOD.

除了上面的方法外,可以使用定时器,但是定时器函数的运行IRQL为APC_LEVEL,也不满足注册表函数
的PASSIVE_LEVEL的要求。

那么有什么方法可以定时读写注册表呢?不知道各位大大有什么建议?
驱动人生。
Henry
驱动牛犊
驱动牛犊
  • 注册日期2001-04-27
  • 最后登录2011-06-20
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望27点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2005-07-20 11:06
嘿嘿,自己解决啦,用Timer + Worker Queue
驱动人生。
游客

返回顶部