I'm trying to delete a Windows registry using Delphi but without success (even with Regedit itself I can not).
Code I'm using:
Function DeleteKeyAPI(hRoot: HKEY; sPath: String; IsReg64: BOOL): BOOL;
Var
iRet: Integer;
Begin
If IsReg64 Then
iRet := RegDeleteKeyEx(hRoot, PChar(sPath), KEY_WOW64_64KEY, 0)
Else
iRet := RegDeleteKeyEx(hRoot, PChar(sPath), KEY_WOW64_32KEY, 0);
If iRet = ERROR_SUCCESS Then
Result := True
Else
Result := False;
End;
Error message when I try to delete by Regedit:
But when I delete the software (PC Hunter) it is deleted successfully. How can I delete this registry?