Modify

Opened 8 years ago

Closed 8 years ago

#3258 closed Bug (No Bug)

RegDelete bug ? Deleting values from keys without write access rights

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.14.2 Severity: None
Keywords: Cc:

Description

Hello!

I've found some not obvious behaivor of RegDelete() function. So If we already have created registry key 'HKEY_LOCAL_MACHINE\SYSTEM\Test' _without_ 'value' in it. RegDelete() will will raise an Error with code = 1 ( according to documentation 1 means - Unable to open requested key ), instead of code = -2 ( unable to delete requested key/value ).

This code running under account without administrative right, will return @error = 1 even if 'HKEY_LOCAL_MACHINE\SYSTEM\Test' already existing key and no 'value' in it.

Code:


$i_regdelete_result = RegDelete( 'HKEY_LOCAL_MACHINE\SYSTEM\Test' , 'value' ) ; = 2
MsgBox( 0 , 'ERROR' , @error ) ; = 1


Maybe this is due to RegDelete() tries to open target key with write access and gets denied. So I thought that this is not so obvious as it can be. And naturally $i_regdelete_result must have 0 in this scenario ( according to documenatation 0 means Special return value of RegDelete when key/value does not exist )

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by Jos

Please create a replicator script that creates the registry entry and then the statements you are talking about which are not working according to you.
I actually would advice you to come to our forums and post this as a questions to get it confirmed this is a bug before posting it here as this is much harder to have the dialog.

Jos

comment:2 Changed 8 years ago by anonymous

I've already started forum topic one week agou but there was no replies, so I've decided to post it here.

The script can not be made because of write access. If a can write to key with a script the error will not be reproduced.

To reproduce it you can manually create 'HKEY_LOCAL_MACHINE\SYSTEM\Test' key with elevated program like regedit.exe. The key must be empty, without any values.

And after that just try to execute that code with autoit without elevation:


$i_regdelete_result = RegDelete( 'HKEY_LOCAL_MACHINE\SYSTEM\Test' , 'value' )


$i_regdelete_result will have value = 2 , but according to documentation return value must be 0 because there is no 'value' it this key.

Scenario assumes that UAC is on. The topic I've started before is here:
https://www.autoitscript.com/forum/topic/183671-regdelete-bug-deleting-values-from-keys-without-write-access-rights/

comment:3 Changed 8 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

The special return is when you have access successfuly to the key
which is not the case as you don't run i admin mode

For me AutoIT behavior is OK

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.