强制重新加载Windows视频驱动程序。有可能吗? [英] Force windows video driver reload. Is it possible at all?

查看:124
本文介绍了强制重新加载Windows视频驱动程序。有可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些驱动程序在启动时加载时使用注册表中编写的参数进行配置。
我可以修改这些值,然后重新启动,但是我想知道是否可以强制重新加载驱动程序,从而使更改在不重新启动的情况下有效。



具体来说,我正在谈论视频驱动程序(nvidia)。



我在某处读到,通过pINvoke()[User32.ll] :: ChangeDisplaySettings()调用640x480x8bits分辨率(该分辨率太低以至于现代驱动程序不应该支持)将强制Windows加载标准VGA驱动程序,并以当前分辨率进行另一个调用将再次加载nvidia驱动程序。



但这不起作用。至少在Windows 7中,即使低分辨率未显示为受支持,系统也会将屏幕缩小到屏幕中央的一个小方框,显示低分辨率而没有卸载nvidia驱动程序。



那么,是否有任何.NET / Win32 API,服务重新启动或以任何方式强制重新加载视频驱动程序?



是否可能以编程方式禁用设备(如从设备管理器中执行的操作)然后重新启用它?



有什么想法吗?



非常感谢。

解决方案

我终于做到了。遵循禁用/重新启用设备实际可行的想法。



当然,问题在于从设备管理器中禁用视频卡设备并不是一个好主意,因为也许您无法再次启用它。



以编程方式进行操作,似乎并不那么不安全。从理论上讲,假设该应用已成功禁用该设备,重新启用它应该不会造成问题。



我发现此处,由于贾斯汀·格兰特,在stackoverflow中,一个很棒的类可以完成此任务。 / p>

视频驱动程序会在重新启用视频设备后重新加载。



希望它会帮助到某人。


Some drivers use parameters written in the registry to configure themselves when they get loaded at boot time. I can modify those values and then reboot, but I would like to know if it is possible to force the driver reload, making the changes effective without rebooting.

Specifically, I am talking about the video driver (nvidia).

I read somewhere, that calling through pINvoke() [User32.ll]::ChangeDisplaySettings() with a 640x480x8bits resolution,(which is so low that it should not be supported by a modern driver) will force windows to load the "Standard VGA driver", and making another call with the current resolution will load the nvidia driver again.

This does not work though. At least in Windows 7, even if the low res is not displayed as "supported" the system reduces the screen to a little square in the center of the screen, showing the low res wihtout unloading the nvidia driver.

So, is there any .NET/Win32 API, service to restart, or any way at all to force a video driver reload?

Perhaps programatically disabling the device (as you could do from the Device Manager) and reenabling it again?

Any idea?

Thanks a lot.

解决方案

I finally did it. Following the idea of disabling/reenabling the device actually worked.

Of course the problem is that disabling your video card device from the Device Manager could not be a great idea, as maybe you are not able to reenable it again.

Doing it programatically, does not appear so unsafe though. In theory, asuming that the app has successfully disabled the device, reenabling it should not pose a problem.

I found here, in stackoverflow a fantastic class to accomplish this, thanks to Justin Grant.

The video driver reloads itself as the video device is reenabled.

Hope it helps someone.

这篇关于强制重新加载Windows视频驱动程序。有可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆