HKEY hkey;
DWORD nSubKeys = 0;
TCHAR name[MAX_PATH];
DWORD size = sizeof(name);
FILETIME filetime;
if(RegOpenKeyEx(HKEY_CURRENT_USER , "Software" , 0 , KEY_QUERY_VALUE , &hkey) == ERROR_SUCCESS)
{
if(RegQueryInfoKey(hkey , 0 , 0 , 0 , &nSubKeys , 0 , 0 , 0 , 0 , 0 , 0 , &filetime) == ERROR_SUCCESS)
{
if(nSubKeys)
{
cout << "Number of subkeys: " << nSubKeys << endl;
for(DWORD i = 0; i < nSubKeys; i++)
{
if(RegEnumKeyEx(hkey , i , name , &size , 0 , 0 , 0 , &filetime) == ERROR_SUCCESS)
{
cout << i << ":" << name << endl;
}
}
}
}
}
It prints that are 68 keys,but it doesnt print every key,one by one ,why is that ?