Hello,
I've been trying to delete registry keys, including all their subkeys, without resorting to SHDeleteKey (Which isn't directly Windows 95 compatible). So far I've come up with:-
This manages to delete just one of the main subkeys of a key I'm trying to delete.Code:int DeleteKey(HKEY hKey, char *szSubKey) { char szKeyDelete[255]; unsigned long ulSize = 255; DWORD dwIndex = 0; HKEY hKeySub; if (!RegOpenKeyEx(hKey, szSubKey, 0, DELETE | KEY_ENUMERATE_SUB_KEYS, &hKeySub)) { while (!RegEnumKeyEx(hKeySub, dwIndex, szKeyDelete, &ulSize, NULL, NULL, NULL, NULL)) { DeleteKey(hKeySub, szKeyDelete); ulSize = 255; dwIndex++; } RegCloseKey(hKeySub); RegDeleteKey(hKey, szSubKey); return TRUE; } else return FALSE; }
Is there anything here that might be problematic or wrong that I'm not seeing?



LinkBack URL
About LinkBacks




CornedBee