首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

RegQueryValueEx的有关问题

2013-03-06 
RegQueryValueEx的问题求教CSDN高手解答。在线等。在RegQueryValueEx的返回值上应该如何处理?HKEY hKEY LPC

RegQueryValueEx的问题
求教CSDN高手解答。在线等。
在RegQueryValueEx的返回值上应该如何处理?


HKEY hKEY; 
LPCTSTR data_Set="Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";  
long ret0=(::RegOpenKeyEx(HKEY_CURRENT_USER, data_Set, 0, KEY_WRITE,&hKEY)); 
if(ret0!=ERROR_SUCCESS) 

MessageBox("错误: 无法打开有关的hKEY!"); 
return; 


int SetContent_D[256];
int SetContent_B[256];
int keyValue = 0;
long ret1;
DWORD dwSize = sizeof(SetContent_B);
SetContent_D[0]=1;
DWORD type_1=REG_DWORD; 
RegQueryValueEx(hKEY,_T("CertificateRevocation"),0,&type_1,(LPBYTE)SetContent_B,&dwSize);//为什么SetContent_B里面的数据都是未初始化的数据呢?


if(1 != SetContent_B[0])
{
 ret1=::RegSetValueEx(hKEY, "CertificateRevocation", NULL, type_1, (const unsigned char *)SetContent_D,4); 
if(ret1!=ERROR_SUCCESS) 

MessageBox("错误: 无法修改有关注册表信息!"); 
return; 

}
microsoft windows
[解决办法]
If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code.

If the lpData buffer is too small to receive the data, the function returns ERROR_MORE_DATA.

If the lpValueName registry value does not exist, the function returns ERROR_FILE_NOT_FOUND.


[解决办法]
long ret0=(::RegOpenKeyEx(HKEY_CURRENT_USER, data_Set, 0, KEY_READ
[解决办法]
KEY_WRITE,&hKEY));
[解决办法]
if(ERROR_SUCCESS != RegOpenKeyEx(...))
{
 // Failed
}

热点排行