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 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码


- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 静态初始化顺序失败 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 近似搜索的工作原理 2021-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 从python回调到c++的选项 2022-11-16
- C++ 协变模板 2021-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 使用/clr 时出现 LNK2022 错误 2022-01-01