zeenmakr Posted April 25, 2020 Share Posted April 25, 2020 Been exchanging values between multiple scripts via ini file and thought to try out RegWrite()/RegRead() but for some reason it fails, Then tried run as Admin and that does the trick. So now found it annoying with uac popup using #RequireAdmin thought to even tried RunAs(admin...RegWrite()) with admin user and pass but it also fails to write unless run as #RequireAdmin. did i missed something or admin is required with this simple task? Link to comment Share on other sites More sharing options...
TheXman Posted April 25, 2020 Share Posted April 25, 2020 2 hours ago, zeenmakr said: did i missed something or admin is required with this simple task? If you are trying to manipulate anything under HKLM, then your process needs to be elevated. Elevation is not required to manipulate the HKCU hive. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
zeenmakr Posted May 6, 2020 Author Share Posted May 6, 2020 What is elevate process means - admin access? Without any knowledge of particular privileges in different hives, I started out under HKEY_CURRENT_CONFIG. Will give HKCU a go, thanks. Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 4, 2020 Share Posted July 4, 2020 (edited) So is this true? I can't get my script to write to HKCU, but it will read values just fine. I created the path (Computer\HKEY_CURRENT_USER\Software\Seadoggie01\TakeControl) in case RegWrite wouldn't do that, but it refuses to write anything. RegWrite returns False with no error Edited July 4, 2020 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
TheXman Posted July 4, 2020 Share Posted July 4, 2020 (edited) 2 hours ago, seadoggie01 said: So is this true? I just tested it again on both Windows 7 & 10, logged in as an Administrator. Running the script below, it ran without any errors when writing to the HKCU hive. When I changed it to write to the HKLM hive, without #RequireAdmin, I get @error = 1 (unable to open requested key). What is odd about your statement, if I understood it correctly, is that you got back a FALSE return without @error set to a non-zero value. The help file explicitly states that if it is not successful, it will return False and set @error to a non-zero value. For the record, the registry key did not exist before running the script. #include <Constants.au3> RegWrite("HKCU\Software\AAAAA", "A3Test", "REG_SZ", "This is a test value.") If @error Then Exit MsgBox($MB_ICONERROR, "ERROR", "RegWrite failed with @error =" & @error) MsgBox($MB_ICONINFORMATION, "INFO", "RegWrite was successful.") Or #include <Constants.au3> If Not RegWrite("HKCU\Software\AAAAA", "A3Test", "REG_SZ", "This is a test value.") Then Exit MsgBox($MB_ICONERROR, "ERROR", "RegWrite failed with @error =" & @error) EndIf MsgBox($MB_ICONINFORMATION, "INFO", "RegWrite was successful.") They both give the same results. Edited July 4, 2020 by TheXman Correction - I get @error = 1 without #RequireAdmin when writing to HKLM CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 4, 2020 Share Posted July 4, 2020 (edited) FML. Apparently, $REG_SZ =/= "REG_SZ" and RegWrite doesn't accept the value from AutoItConstants.au3 I don't know why I thought I needed to use the variable, but I did. Please pardon my brain farts. Need more coffee. Edit: But thank you for testing that for me! I really appreciate it Edited July 4, 2020 by seadoggie01 TheXman 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Skysnake Posted July 5, 2020 Share Posted July 5, 2020 20 hours ago, TheXman said: What is odd about your statement, if I understood it correctly, is that you got back a FALSE return without @error set to a non-zero value. The help file explicitly states that if it is not successful, it will return False and set @error to a non-zero value. @TheXman I can confirm that I have also experienced similar silent fails. Windows 10. Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
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