Ashalshaikh Posted June 5, 2009 Share Posted June 5, 2009 (edited) Hello First:: My English is very bad, so I'm sorry But I like this forum and AUtoIt ============================= We are all exposed to the problem when dealing with this key : HKEY_USERS\S-1-5-21-861567501-507921405-1202660629-1003 The reason is that changing from one system to another system I made a small function ; #FUNCTION# ====================================== ; Name...........: _Ash_UserKey_Detect ; Description ...: Detect User Key ,,, ; Syntax.........: _Ash_UserKey_Detect ([$ReturnType = 0]) ; Parameters ....: $ReturnType ; 0 = Return Only User Key ; 1 = Return All Path ; Return values .: Success - Returns User Key ; Failure - none ; Author ........: Ashalshaikh - Ahmad Alshaikh ; ============================================================== Func _Ash_UserKey_Detect ($ReturnType = 0) IF $ReturnType <0 Or $ReturnType >1 Then $ReturnType = 0 $CountReg = 1 Do $EnumKey = RegEnumKey ("HKEY_USERS",$CountReg ) If @Error Then ExitLoop $CountReg= 1 + $CountReg Until StringLeft ($EnumKey,StringLen ("S-1-5-21")) = "S-1-5-21" If $ReturnType = 0 Then Return $EnumKey Else Return "HKEY_USERS\" & $EnumKey EndIf EndFuncoÝ÷ ØLZ^jëh×6#include "_Ash_UserKey_Detect.au3" ;With Nithing $UserKey = _Ash_UserKey_Detect () Msgbox (0,"","User Key Is : " & $UserKey) ;With 0 $UserKey = _Ash_UserKey_Detect (0) Msgbox (0,"","User Key Is : " & $UserKey) ;With 1 $UserKey = _Ash_UserKey_Detect (1) Msgbox (0,"","User Key Is : " & $UserKey) Thank You_Ash_UserKey_Detect.zip Edited June 5, 2009 by Ashalshaikh Link to comment Share on other sites More sharing options...
Squirrely1 Posted June 5, 2009 Share Posted June 5, 2009 Ashalshaikh - Please describe for me more perspicaciously exactly what this function has purpose to do - use any modern language. Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Ashalshaikh Posted June 5, 2009 Author Share Posted June 5, 2009 (edited) Ashalshaikh - Please describe for me more perspicaciously exactly what this function has purpose to do - use any modern language.i am sorry My English bad ,, but i try always i meet this problem ,, when I Delete Or Edit Or Read Or Write With This Key HKEY_USERS \S-1-5-21-861567501-507921405-1202660629-1003because theS-1-5-21-861567501-507921405-1202660629-1003is not the same in all systems,, and you will notice that when comparing these on your systemcannot use S-1-5-21-861567501-507921405-1202660629-1003 because it will Not Exist In Other System ,, So will happen Error For That I Made this function to Detect The S-1-5-21-861567501-507921405-1202660629-1003 anywhere!! Thank YouI Sory If Exist Wrongs In This Reply Edited June 5, 2009 by Ashalshaikh Link to comment Share on other sites More sharing options...
Squirrely1 Posted June 5, 2009 Share Posted June 5, 2009 (edited) Ashalshaikh - Thank you very much: you have succeeded completely in communicating what the function does. I have not discovered why anyone should write to this key or read from it except to clean out the registry of unnecessary clutter. Probably you should use a key under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE instead. Edited June 5, 2009 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Ashalshaikh Posted June 5, 2009 Author Share Posted June 5, 2009 Ashalshaikh - Thank you very much: you have succeeded completely in communicating what the function does.I have not discovered why anyone should write to this key or read from it except to clean out the registry of unnecessary clutter. Probably you should use a key under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE instead.Yes .. I KnowBut ,,There are lots of data and keys , you need to deal with It sometimesExample HKEY_USERS\S-1-5-21-861567501-507921405-1202660629-1003\SoftwareIt's contains information about some programs ,, do not find in otherThanks Link to comment Share on other sites More sharing options...
ResNullius Posted June 6, 2009 Share Posted June 6, 2009 Yes .. I Know But ,, There are lots of data and keys , you need to deal with It sometimes Example HKEY_USERS\S-1-5-21-861567501-507921405-1202660629-1003\Software It's contains information about some programs ,, do not find in other Thanks Ashalshaikh, It's my understanding the keys should always be the same. On my system, when I compare this key with HKEY_CURRENT_USER, all data is the same. Verified by exporting both keys in their entirety, doing a replace of "[HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" with "[HKEY_CURRENT_USER" within the HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx export, and then running a file comparison on both. Link to comment Share on other sites More sharing options...
Ashalshaikh Posted June 6, 2009 Author Share Posted June 6, 2009 Ashalshaikh, It's my understanding the keys should always be the same. On my system, when I compare this key with HKEY_CURRENT_USER, all data is the same. Verified by exporting both keys in their entirety, doing a replace of "[HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" with "[HKEY_CURRENT_USER" within the HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx export, and then running a file comparison on both.Yes, but i mean you key HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx change from one computer to another,, That's The Problem !! If I Don't UnderStand You , I am Sorry . Thank You Link to comment Share on other sites More sharing options...
ResNullius Posted June 6, 2009 Share Posted June 6, 2009 Yes, but i mean you keyHKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx change from one computer to another,,That's The Problem !! If I Don't UnderStand You , I am Sorry .Thank YouWhat I mean to say is that on any computer, the "HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" key is the same as the "HKEY_CURRENT_USER" key on that computer, for the currently logged on user.So if you want to read or write any info from/to "HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" just read/write "HKEY_CURRENT_USER" on that computer instead. Link to comment Share on other sites More sharing options...
GEOSoft Posted June 6, 2009 Share Posted June 6, 2009 I did much the same here#659946and I have another one that uses the same key (HKU) to get all the user IDs from the same hive. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Ashalshaikh Posted June 7, 2009 Author Share Posted June 7, 2009 What I mean to say is that on any computer, the "HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" key is the same as the "HKEY_CURRENT_USER" key on that computer, for the currently logged on user.So if you want to read or write any info from/to "HKEY_USERS\S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx" just read/write "HKEY_CURRENT_USER" on that computer instead.That is new information for meThank you very much Link to comment Share on other sites More sharing options...
Ashalshaikh Posted June 7, 2009 Author Share Posted June 7, 2009 (edited) I did much the same here#659946and I have another one that uses the same key (HKU) to get all the user IDs from the same hive.Indeed,Your Function works very wellMy Function Us Sample , Because My Skill Is Semple Thanks all of youI learned something new today Edited June 7, 2009 by Ashalshaikh 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