aleeksunder Posted July 21, 2016 Posted July 21, 2016 (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 July 21, 2016 by aleeksunder
jpm Posted July 30, 2016 Posted July 30, 2016 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
blemas Posted March 23, 2017 Posted March 23, 2017 The simple fix for me was to add "#RequireAdmin" at the top of the code.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now