为什么RegOpenKeyEx()在Vista 64位上返回错误代码2? [英] Why is RegOpenKeyEx() returning error code 2 on Vista 64bit?
本文介绍了为什么RegOpenKeyEx()在Vista 64位上返回错误代码2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在进行下列调用:
result = RegOpenKeyEx(key, s, 0, KEY_READ, &key);
(C ++,Visual Studio 5,Vista 64bit)。
(C++, Visual Studio 5, Vista 64bit).
即使 regedit
显示该键存在,它也会出现错误代码2(文件未找到)。这段代码总是工作在32位XP。为什么显然存在文件未找到?
It is failing with error code 2 ("File not found") even though "regedit
" shows that the key exists. This code has always worked on 32bit XP. Why is it "file not found" when it clearly is there?
推荐答案
我发现我可以使用flag解决我的问题: KEY_WOW64_64KEY
,如:
I discovered that I could solve my problem using the flag: KEY_WOW64_64KEY
, as in:
result = RegOpenKeyEx(key, s, 0, KEY_READ|KEY_WOW64_64KEY, &key);
有关完整说明:注册表中的32位和64位应用程序数据
这篇关于为什么RegOpenKeyEx()在Vista 64位上返回错误代码2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文