Windows 7注册表问题 [英] Windows 7 Registry Problem
本文介绍了Windows 7注册表问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此调用用于打开注册表项:
This call is used to open the Registry Key:
HKEY hKey;
LPCTSTR CFDW_Reg_Key = TEXT("SOFTWARE\\Company A\\Application_Name\\1.13");
result = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
CFDW_Reg_Key,
NULL,
KEY_READ | KEY_WRITE,
&hKey);
以下调用在Windows XP计算机上有效,但在Windows 7计算机上返回错误代码= 2.
The following call works on a Windows XP computer, but returns an error code=2 on my Windows 7 computer.
HKEY hKey;
DWORD buflen;
LPCWSTR REG_INSTALL_PATH_NAME = TEXT("InstallPath");
result = RegQueryValueEx(hKey, REG_INSTALL_PATH_NAME, 0, 0, 0, &buflen);
任何帮助将不胜感激.
谢谢.
Scott
Any help would be greatly appreciated.
Thank you.
Scott
推荐答案
返回码2表示ERROR_FILE_NOT_FOUND
...
您的应用程序是在Windows 7上作为64位应用程序运行还是作为32位应用程序运行(您可以使用任务管理器进行检查)?该问题可能是由32位和64位应用程序的不同注册表配置单元引起的.当您告诉HKLM\Software\Wow6432Node
打开HKLM\Software
时,实际上是一个32位程序.因此,我建议仔细检查这些可能性.
Return code 2 meansERROR_FILE_NOT_FOUND
...
Does your application run as a 64bit application or as a 32bit application on Windows 7 (you can check that with the task manager)? The problem might arise from the different registry hives for 32bit and 64bit applications. A 32bit program actually looks atHKLM\Software\Wow6432Node
when you tell it to openHKLM\Software
. Hence I''d suggest to scrutinize these possibilities.
尝试一下.
try this.
REGSAM flag = KEY_WOW64_32KEY or KEY_WOW64_64KEY; // fake code
result = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
CFDW_Reg_Key,
NULL,
KEY_READ | KEY_WRITE | flag,
&hKey);
这篇关于Windows 7注册表问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文