我拨打了以下电话:
result = RegOpenKeyEx(key, s, 0, KEY_READ, &key);
(C++、Visual Studio 5、Vista 64 位).
(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?
我发现我可以使用标志来解决我的问题: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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!