小编use*_*684的帖子

C++ 从 64 位应用程序读取 SOFTWARE\WOW6432 中的注册表项

我有一些 32 位 C++ 代码来从注册表读取键/值对,如下所示:

    // Get a handle to the required key
    HKEY    hKey;
    if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\MyKey", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        // Look up the value for the key
        bOK = (RegQueryValueEx(hKey, szKey, NULL, NULL, (PBYTE)szValue, &dwMax) == ERROR_SUCCESS);
        
        // Release the handle
        RegCloseKey(hKey);
    }
Run Code Online (Sandbox Code Playgroud)

由于它是一个 32 位应用程序,因此它从 SOFTWARE\WOW6432Node\MyKey 读取

在我将应用程序移植到 64 位之前,它工作得很好,所以它现在从 SOFTWARE\MyKey 读取。

我的安装程序不允许我将条目同时放入注册表的 32 位和 64 位部分,因此我需要 64 位应用程序继续从 WOW6432Node 获取其数据。

有谁知道如何做到这一点?

非常感谢托尼·雷诺兹

c++ registry winapi

2
推荐指数
1
解决办法
121
查看次数

标签 统计

c++ ×1

registry ×1

winapi ×1