我拨打了以下电话:
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模板网!
当没有异常时,C++ 异常会以何种方式减慢代码速In what ways do C++ exceptions slow down code when there are no exceptions thown?(当没有异常时,C++ 异常会以何种方式减慢代码速度?)
为什么要捕获异常作为对 const 的引用?Why catch an exception as reference-to-const?(为什么要捕获异常作为对 const 的引用?)
我应该何时以及如何使用异常处理?When and how should I use exception handling?(我应该何时以及如何使用异常处理?)
C++中异常对象的范围Scope of exception object in C++(C++中异常对象的范围)
从构造函数的初始化列表中捕获异常Catching exceptions from a constructor#39;s initializer list(从构造函数的初始化列表中捕获异常)
C++03 throw() 说明符 C++11 noexcept 之间的区别Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 说明符 C++11 noexcept 之间的区别)