我需要获得硬盘传输模式(dma或pio)并打印它,你可以在设备管理器中找到它(在屏幕截图中的红色圆圈中)。here
所以我需要从programm获取红圈中的信息。我曾尝试使用wmi类,但Win32_DiskDrive,Win32_IDEController和其他人都没有提供我需要的信息。设备管理器最接近属性窗口的是Win32_IDEController,字段Win32_IDEController [“Name”]返回字符串irb.h
。
我也发现了这个,但它使用的是
self.tabBar.delegate = self
,这是ddk(wdk)的一部分而且之前从未使用过它,所以我甚至不知道怎么做使用此功能。
现在我正在学习WDK)任何语言的任何解决方案都会很好,在我正在使用C#的项目中,但如果解决方案将使用另一种语言,我可以将“DMA”或“PIO”写入文件中这个解决方案,从C#执行.exe并从文件中读取。 C#中的OFC解决方案将受到更多赞赏。
答案 0 :(得分:3)
您可以使用自动(https://www.autoitscript.com)直接从GUI中读取它。
示例(请注意不同的Windows版本和不同的语言):
Run ("mmc c:\windows\system32\devmgmt.msc")
WinWaitActive ( "Device Manager" )
send("{tab}{down}{down}{down}{down}{down}{down}{down}{NUMPADADD}{down}!{enter}")
WinWaitActive ( "Primary IDE Channel Properties" )
send("^{tab}")
$drivemode = ControlGetText("Primary IDE Channel Properties", "", "Static4")
ControlClick("Primary IDE Channel Properties","Cancel","Button6")
WinKill ( "Device Manager" )
如果您想在C#中使用自动:
https://www.autoitscript.com/forum/topic/177167-using-autoitx-from-c-net/
答案 1 :(得分:1)
您可以使用STORAGE_ADAPTER_DESCRIPTOR结构中的AdapterUsesPio
成员。这是一个C ++示例,演示了如何查询磁盘:
#include "stdafx.h"
int main()
{
wchar_t path[1024];
wsprintf(path, L"\\\\?\\C:"); // or L"\\\\.\\PhysicalDrive0"
// note we use 0, not GENERIC_READ to avoid the need for admin rights
// 0 is ok if you only need to query for characteristics
HANDLE device = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL);
if (device == INVALID_HANDLE_VALUE)
return 0;
STORAGE_PROPERTY_QUERY query = {};
query.PropertyId = StorageAdapterProperty;
query.QueryType = PropertyStandardQuery;
STORAGE_ADAPTER_DESCRIPTOR descriptor = {};
DWORD read;
if (!DeviceIoControl(device, IOCTL_STORAGE_QUERY_PROPERTY,
&query,
sizeof(query),
&descriptor,
sizeof(descriptor),
&read,
NULL
))
{
wprintf(L"DeviceIoControl error: %i\n", GetLastError());
}
else
{
wprintf(L"AdapterUsesPio: %i\n", descriptor.AdapterUsesPio);
}
CloseHandle(device);
return 0;
}