ok,i have this code to enumerate the keys,that is working fine,and the code to enumerate the values and datas for a key that is working good also,but,if i combined them i doesnt produce the expecting result,i tried to call enum_value() in the enum_keys() function :
void enum_key(HKEY Hkey , DWORD level)
{
int i = 0;
size = sizeof(name);
while(RegEnumKeyEx(Hkey , i , name , &size , 0 , 0 , 0 , &filetime) != ERROR_NO_MORE_ITEMS)
{
if(i == 0)
{
cout << "----==== ENUMERATING KEYS FOR:" << name << "====----" << endl;
}
cout << i << ":" << name << endl;
enum_value(Hkey);
i++;
size = sizeof(name);
HKEY subhkey;
if(open_key_ex(Hkey , name, subhkey))
{
enum_key(subhkey , level + 1);
RegCloseKey(subhkey);
}
}
}
void enum_value(HKEY Hkey)
{
DWORD type = REG_NONE;
int i = 0;
size = sizeof(name);
size2 = sizeof(name2);
BOOL bContinue = TRUE;
do
{
lRet = RegEnumValue(Hkey , i , name , &size , 0 , &type , name2 , &size2);
switch(lRet)
{
case ERROR_SUCCESS:
print_values(name , type , name2 , size2);
i++;
size = sizeof(name);
size2 = sizeof(name2);
break;
case ERROR_NO_MORE_ITEMS:
bContinue = false;
break;
default:
cout << "Unexpected error: " << GetLastError() << endl;
bContinue = false;
break;
}
}while(bContinue);
}