我如何“安装”自定义 Windows 驱动程序?
我计划用 C 语言编写一个基本的 Windows 注册表过滤器。该过滤器的目的是挂钩所有(用户和内核特权)注册表调用,以便我可以在我的程序中使用它们。我基本上是复制 Mark Rusinovich 的 regmon/进程监视器,但更基本。
我的问题是,一旦用 C 编写过滤器,如何让系统实现自定义行为而不实现注册表调用的原始预期行为?
我正在使用 Windows 7
编辑:我试图将其作为业余爱好 C++ 项目的一部分来执行,该项目可以挂接所有注册表调用。
I am planning to write a basic windows registry filter in C. The purpose of the filter is to hook all (user and kernel privileged) registry calls so that I can use them in my program. I am basically copying regmon/process monitor by Mark Rusinovich but more basic.
My question is, once the filter is written in C, how do you get the system to implement the custom behaviour and to not implement the original intended behaviour of the registry calls?
I am using windows 7
EDIT: I am trying to do this as part of a hobby c++ project which can hook all registry calls.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有专门的函数可以实现这一点。请参阅CmRegisterCallback(), CmRegisterCallbackEx() 和 <一个MSDN 上的 href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff545879%28v=vs.85%29.aspx" rel="noreferrer">过滤注册表调用 。
对于仅安装内核模式驱动程序,您可以使用服务控制器(sc.exe)。使用
sc create [service name] binPath= [path to your .sys file] type= kernel
创建内核模式服务,并使用sc start [service name]
启动它。在更改驱动程序之前,不要忘记sc stop
和sc delete
它。There are special functions for that. See CmRegisterCallback(), CmRegisterCallbackEx() and Filtering Registry Calls on MSDN.
As for just installing a kernel mode driver, you may use the Service Controller (sc.exe). Use
sc create [service name] binPath= [path to your .sys file] type= kernel
to create a kernel-mode service andsc start [service name]
to start it. Don't forget tosc stop
andsc delete
it before making changes to the driver.基本上驱动程序被视为服务,因此您可以利用 服务控制管理器 使用上述 API,您基本上实现的是注册表中 Services 项下的相应条目。有关如何实现此目的的示例,请查看这篇文章,滚动到底部名为“动态加载和卸载驱动程序”的部分。此外,如果您想实现轻松的调试/开发并且正在使用 VS2k10,我建议您使用免费的 VisualDDK 我相信这应该足以让你继续前进。
Basically drivers are considered as Services as such you can utilize the Service COntrol manager Using the aforementioned APIs what you basically achieve is the appropriate entries in the registry under the Services key. For a sample of how to achieve this check this article, scroll to the bottom to the section named "Dynamically Loading and Unloading the Driver". Furthermore if you want to achieve easy debugging/development and are using VS2k10 I'd suggest you use the free VisualDDK I believe this should be enough to get you going.