Jump to content

Recommended Posts

Posted (edited)

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.

$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 )

Edited by aleeksunder
  • 2 weeks later...
Posted

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

  • 7 months later...

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
×
×
  • Create New...