在 Windows 上以编程方式降低硬盘转速? [英] Spin Down Hard Disk Programmatically on Windows?

查看:19
本文介绍了在 Windows 上以编程方式降低硬盘转速?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何以编程方式请求 Windows 降低硬盘转速?是否有任何我可以调用的用户模式函数(或内核模式函数调用或 IRP 发送)来实现这一点?

How do you request Windows to spin down a hard disk programmatically? Is there any user-mode function I can call (or kernel-mode function to call or IRP to send) in order to make this happen?

我尝试制作一个程序,将ATA STANDBY 命令直接发送到硬盘磁盘,但问题是这种方法不会通知系统,因此每当系统需要刷新缓存时,它都会再次唤醒硬盘.我如何告诉系统为我做这件事?(如果系统这样做,它会保存缓存并在数据变得太大时爆破"数据,而不是以小增量写入.)

I've tried making a program to send an ATA STANDBY command directly to the hard disk, but the problem is that this method doesn't inform the system, and hence whenever the system needs to flush the cache, it'll wake up the hard disk again. How do I tell the system to do this for me? (If the system does it, it'll save up the cache and "burst" the data when it gets too large, instead of writing in small increments.)

(这里的重点是直接不是通过将系统范围的减速超时更改为 1 秒周期并等待磁盘降速.我需要一个可以在我使用笔记本电脑时的特定时刻调用的函数,而不是不适合 95% 情况的通用函数.)

(The entire point here is to do this directly, not by changing the system-wide spin-down timeout to a 1-second period and waiting for the disk to spin down. I need a function I can call at a specific moment in time when I'm using my laptop, not something generic that doesn't suit 95% of situations.)

到目前为止我已经走了多远:

How far I've gotten so far:

我觉得 PoCallDriverIRP_MJ_POWER 可能对此有用,但我的内核模式编程经验非常有限(并且几乎为零驱动程序经验)所以我真的不知道.

I have a feeling that PoCallDriver and IRP_MJ_POWER might be useful for this, but I have very limited kernel-mode programming experience (and pretty much zero driver experience) so I really have no idea.

更新:

人们似乎反复提到我已经提到的解决方案不起作用.就像我上面说的那样,我已经已经尝试过hacky"解决方案来更改超时值或直接向驱动器发出命令,以及我问过的全部原因这里的问题是那些没有没有做我需要的.阅读整个问题(尤其是第 2 段和第 3 段),然后再重复我在你的答案中已经说过的内容——这就是整个问题在问题中.

People seem to be repeatedly mentioning the solutions that I have already mentioned do not work. Like I said above, I've already tried "hacky" solutions that change the timeout value or that directly issue the drive a command, and the entire reason I've asked this question here is that those did not do what I needed. Please read the entire question (especially paragraphs 2 and 3) before repeating what I've already said inside your answers -- that's the entire difficulty in the question.

更多信息:

我找到了这篇关于磁盘空闲的文档检测很有用,但我的答案不在那里.它指出电源管理器向磁盘驱动程序发送一个 IRP(因此我怀疑 IRP_MJ_POWER 很有用),但我不知道如何使用这些信息.

I've found this document about Disk Idle Detection to be useful, but my answer isn't in there. It states that the Power Manager sends an IRP to the disk driver (hence why I suspect IRP_MJ_POWER to be useful), but I have no idea how to use the information.

推荐答案

我希望这会有所帮助:

此:http://msdn.microsoft.com/en-us/library/aa394173%28VS.85%29.aspx

导致:http://msdn.microsoft.com/en-us/library/aa394132%28VS.85%29.aspx#properties

然后,您可以浏览到:http://msdn.microsoft.com/en-us/library/aa393485(v=VS.85).aspx

该文档似乎概述了我认为您正在寻找的内容.

This documentation seems to outline what you are looking for I think.

附言只是想帮忙,不要向信使开枪.

P.S. Just trying to help, don't shoot the messanger.

这篇关于在 Windows 上以编程方式降低硬盘转速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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