Why is RegOpenKeyEx() returning error code 2 on Vista 64bit?

后端 未结 5 1027
旧巷少年郎
旧巷少年郎 2020-12-05 17:48

I was making the following call:

result = RegOpenKeyEx(key, s, 0, KEY_READ, &key);

(C++, Visual Studio 5, Vista 64bit).

It is f

5条回答
  •  暖寄归人
    2020-12-05 18:17

    On a Windows 64-bit system the Registry is actually divided into two parts. One section is used by 64-bit processes, and one part by 32-bit processes.

    For example, if a 32-bit application programatically writes to what it believes is HKLM\SOFTWARE\Company\Application, it's actually redirected by the WoW64-layer to HKLM\SOFTWARE\Wow6432Node\Company\Application.

    So when you run your 32-bit application and call RegOpenKeyEx it's actually working against the Wow6432Node\ folder, and not the regular \SOFTWARE node.

提交回复
热议问题