I'm trying a recursive deleting using RecursiveDeleteKey() from CRegKey ATL class. I succeed to get the HKEY valid handler and then using the same path for recursive delete.
Code:
if(RegOpenKeyEx(key, szSubKey, 0, dwAccess, &hKey) == ERROR_SUCCESS)
{
   CRegKey key;
   key.Attach(hKey);
   LONG lRes = key.RecurseDeleteKey(szSubKey);
   if (ERROR_SUCCESS != lRes)
   {
     //	FAILL!!!
   }
}
I don't understand wky hKey is ok from RegOpenKeyEx() runs ok and RecurseDeleteKey() is not ok.
OS is WinXP SP3 x64 and szSubKey it's a HKEY_CURRENT_USER registry path.