Access denied to delete Registry (even in regedit)

Asked

Viewed 715 times

0

I am trying to delete a Windows registry using Delphi but without success (even with Regedit itself I cannot).

Code I am 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:

inserir a descrição da imagem aqui

But when I delete by software (PC Hunter) the same and deleted successfully. How can I delete this Record?

  • 1

    The user must have permission to access the registration, otherwise it does not give. Right-click on the entry and see the security/credentials section to better understand. Most likely what the mentioned soft did was change the permissions before removal.

  • 1

    How are you forcing the registration with the KEY_WOW64_64/32KEY flags, came to check if the variable Isreg64 is correct for the case? According to the path in your screenshot, it would only work with Isreg64 in false, because the key is in Wow6432node. (32-bit application running in 64)

  • If not even in regedit you are getting should be permission. Try to check that your user is an administrator in: Start > Run > command: control userpasswords2

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.