0

我的机器是 Windows 8 机器。我想HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36fc9e60-c465-11cf-8056-444553540000}从我的自定义驱动程序中读取“UpperFilters”键,以通过 USB 设备获取过滤器驱动程序的存在。

4

2 回答 2

3

自 XP 时代以来,我还没有编写过驱动程序,但假设您正在谈论我相信您想要的内核模式驱动程序ZwOpenKeyZwQueryValueKey并且ZwClose. 一般指导在这里

于 2013-07-29T11:57:19.517 回答
-2

是在c中读取注册表的代码示例

这是一个示例:

DWORD BufferSize = TOTALBYTES;
DWORD cbData;
DWORD dwRet;

PPERF_DATA_BLOCK PerfData = (PPERF_DATA_BLOCK) malloc( BufferSize );
cbData = BufferSize;

printf("\nRetrieving the data...");

dwRet = RegQueryValueEx( HKEY_PERFORMANCE_DATA,
                         TEXT("Global"),
                         NULL,
                         NULL,
                         (LPBYTE) PerfData,
                         &cbData );
while( dwRet == ERROR_MORE_DATA )
{
    // Get a buffer that is big enough.

    BufferSize += BYTEINCREMENT;
    PerfData = (PPERF_DATA_BLOCK) realloc( PerfData, BufferSize );
    cbData = BufferSize;

    printf(".");
    dwRet = RegQueryValueEx( HKEY_PERFORMANCE_DATA,
                     TEXT("Global"),
                     NULL,
                     NULL,
                     (LPBYTE) PerfData,
                     &cbData );
}
if( dwRet == ERROR_SUCCESS )
    printf("\n\nFinal buffer size is %d\n", BufferSize);
else printf("\nRegQueryValueEx failed (%d)\n", dwRet);

或者在一个简单的例子中

RegGetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class", "{36fc9e60-c465-11cf-8056-444553540000}", RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);
于 2013-07-29T11:32:51.130 回答