Sign in to follow this  
Followers 0
norax

Need help with RegDelete

5 posts in this topic

so im making a registry editor tool and im having problems with regdelete

i currently have this code and it returns error 0 which is (Returns 0 if the key/value does not exist.) however the keyname and valuename were copied directly from regedit.exe so could anyone enlighten me as to whats causing autoit to think the key doesnt exist

RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath")

MsgBox(0,"z",@error)

Share this post


Link to post
Share on other sites



This may be a dumb question, but did you check to see if the registry entry was deleted? I'm not sure about this, but if @error is 0 (which is what you're displaying) it might mean that there was no error.

Here's from the helpfile:

Success: Returns 1.

Special: Returns 0 if the key/value does not exist.

Failure: Returns 2 if error deleting key/value.

@error can be set to following values :

1 if unable to open requested key

2 if unable to open requested main key

3 if unable to remote connect to the registry

-1 if unable to delete requested value

-2 if unable to delete requested key/value


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

the key still exists in the registry and when i combine the valuename with the key name it returns error 1 and nothing is deleted ....

after some reading i decided maybe i was wrong about the definition of keyname and valuename but my origional code corrisponds with the registry key exactly as it should. so im not sure where i went wrong =\

Edited by norax

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The @error value will remain 0 unless there is a failure. You should also check the result of the function. This will show you mo' betta

$Result = RegDelete("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath")

Switch @error
    Case 0
        $String = '@error = ' & @error & '    [All went Well]'
    Case 1
        $String = '@error = ' & @error & '    [unable to open requested key]'
    Case 2
        $String = '@error = ' & @error & '    [unable to open requested main key]'
    Case 3
        $String = '@error = ' & @error & '    [unable to remote connect to the registry]'
    Case -1
        $String = '@error = ' & @error & '    [unable to delete requested value]'
    Case -2
        $String = '@error = ' & @error & '    [unable to delete requested key/value]'
EndSwitch
MsgBox(32, 'Results', 'Result = ' & $Result & @LF & '1 means Success, 0 means failure' & @LF & $String)

EDIT: Included @error descriptions

Edited by Varian

Share this post


Link to post
Share on other sites

...

RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath")

MsgBox(0,"z",@error)

You seem to keep mentioning a registry key when your syntax is trying to delete a registry value "StubPath" in the registry key "{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}". If you want to delete a registry key then you omit the registry value parameter of the RegDelete function call. The script may need to be run as admin to modify HKLM so do ensure that is not an issue. ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0