有没有办法让 Windows 重新加载驱动程序而无需重新启动?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5179026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 08:07:39  来源:igfitidea点击:

Is there any way of making windows reload a driver without reboot?

windowsdriver

提问by yonix

I was wondering - how do windows driver developers test themselves?

我想知道 - Windows 驱动程序开发人员如何测试自己?

Lets' say I'm debugging a nasty problem in a driver I wrote. I want to be able to constantly add traces and logs, modify small parts of code, etc.

假设我正在调试我编写的驱动程序中的一个令人讨厌的问题。我希望能够不断添加跟踪和日志,修改小部分代码等。

Each time I build a version of my driver and get a .sys file I want to deploy on a test-machine, and have a look at a tool like dbgview to understand what's happening. AFAIK, in order for the modifications in code to take place, the only way is to reboot the test server.

每次我构建一个版本的驱动程序并获得一个 .sys 文件时,我想在测试机器上部署,并查看像 dbgview 这样的工具来了解发生了什么。AFAIK,为了进行代码修改,唯一的方法是重新启动测试服务器。

This is awful! This means I have to wait a long time between making a minor adjustment in code and being.

这太可怕了!这意味着我必须等待很长时间才能在代码中进行微小的调整和存在。

Is this really the case? Is there no way of telling windows to dynamically reload my driver?

真的是这样吗?有没有办法告诉 Windows 动态重新加载我的驱动程序?

If not - how do windows driver developers work?? Do they constantly reboot their testing servers in order to see if things worked for them?

如果没有 - Windows 驱动程序开发人员如何工作?他们是否不断重启他们的测试服务器以查看是否对他们有用?

回答by Sergey Podobry

We are using virtual machines to test and debug drivers. Reverting to snapshot is much faster then rebooting and gives you always the same environment.

我们正在使用虚拟机来测试和调试驱动程序。恢复快照比重新启动要快得多,并且始终为您提供相同的环境。

Also you can stop and replace your driver if it supports unloading: disable device in device manager or stop the driver using sc stop service_name.

如果驱动程序支持卸载,您也可以停止并更换驱动程序:在设备管理器中禁用设备或使用sc stop service_name.

回答by Mark

You can also disable/enable host controller in Device Manager.

您还可以在设备管理器中禁用/启用主机控制器。

回答by Lars Brinkhoff

This does the trick for me:

这对我有用:

devcon disable <driver>
devcon enable <driver>

Devcon download here: http://support.microsoft.com/kb/311272

Devcon 在这里下载:http: //support.microsoft.com/kb/311272