Hello,
Does anyone know how I can programmaically move a registry from HKEY_LOCAL_MCAHINE to HKEY_CURRENT_USER?
I wrote a recursive function that uses RegEnumKeyEx and RegEnumValue, but it appears that RegEnumValue returns all of the values under the top level key.
For example, if the key is HKEY_LOCAL_MACHINE\SOFTWARE\MyApp\KeyName1 and has 3 values under it and I have HKEY_LOCAL_MACHINE\SOFTWARE\MyApp\KeyName2 and that has 2 values. It looks like RegEnumKeyEx is returning the proper keys, but when I call RegEnumValue for the first Key (ie. KeyName1) i get all 5 values returned and not just the 3 under that key.
Hope that all makes sense... am I doing something wrong?
Thanks for any help
Here is a snippet, if it helps:
void CArgusApp::RecurseSubKeys(CString csStartKey)
{
CQERegistry reg;
HRESULT hr = reg.Open(HKEY_LOCAL_MACHINE, "SOFTWARE\\" + csStartKey, KEY_QUERY_VALUE );
CStringArray csaDataNames;
reg.GetAllDataNames(csaDataNames);
for (int j = 0; j < csaDataNames.GetSize(); j++)
{
CString csValueName = csaDataNames.ElementAt(j);
TRACE(csStartKey + " - " + csValueName);
}
CStringArray csaKeys;
reg.GetAllSubKeys(csaKeys);
for (int i = 0; i < csaKeys.GetSize(); i++)
{
CString csKey = csaKeys.ElementAt(i);
this->RecurseSubKeys(csStartKey + "\\" + csKey);
}
reg.Close();
}
i.e. GetAllDataNames above simply calls RegEnumValue and GetAllSubKeys call RegEnumKeyEx.