什么是 Windows 内核驱动程序?
什么是用 WDK 编写的 Windows 内核驱动程序?
与普通应用程序或服务有什么不同?
What is Windows Kernel Driver written with the WDK?
What is different from normal app or service?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
内核驱动程序是针对 Windows NT 的本机 API(而不是 Win32 子系统的 API)编写的程序,并且在底层硬件上以内核模式执行。这意味着驱动程序需要能够处理进程之间虚拟内存上下文的切换,并且需要编写得非常稳定——因为内核驱动程序在内核模式下运行,如果一个崩溃,就会导致整个系统崩溃。内核驱动程序不适合除硬件设备之外的任何设备,因为它们需要管理访问权限才能安装或启动,并且因为它们消除了内核通常为崩溃程序提供的安全性,即它们本身崩溃,而不是整个系统崩溃。
长话短说:
Kernel drivers are programs written against Windows NT's native API (rather than the Win32 Subsystem's API) and which execute in kernel mode on the underlying hardware. This means that a driver needs to be able to deal with switching virtual memory contexts between processes, and needs to be written to be incredibly stable -- because kernel drivers run in kernel mode, if one crashes, it brings down the entire system. Kernel drivers are unsuitable for anything but hardware devices because they require administrative access to install or start, and because they remove the security the kernel normally provides to programs that crash -- namely, that they crash themselves and not the entire system.
Long story short:
它是在内核模式而不是用户模式下运行的代码。内核模式代码可以直接访问操作系统、硬件等的内部结构。
您总是编写内核模式模块来实现 设备驱动程序。
It is code that runs in kernel mode rather than user mode. Kernel mode code has direct access to the internals of the OS, hardware etc.
Invariably you write kernel mode modules to implement device drivers.
内核驱动程序是“应用程序”的低级实现。
因为它运行在内核上下文中,所以它有能力直接访问内核API和内存。
例如,内核驱动程序应用于:
如果您想了解更多信息,您可以使用您喜欢的搜索引擎搜索关键字“ring0”。
A kernel driver is a low-level implementation of an "application".
Because it runs in the kernel context, it has the ability to access the kernel API and memory directly.
For example, a kernel driver should be used to:
If you'd like to get know more, you can search for keyword "ring0" with your favorite search engine.
其他人从系统级别的角度解释了这种差异。
如果您使用 C++ 进行开发,则用户模式开发和内核模式开发存在以下差异。
Others have explained the difference as the perspective of system level.
If you are doing development in C++, there are below differences in User mode development and kernel-mode development.