Jump to content



Photo

RegEdit Jumper


  • Please log in to reply
No replies to this topic

#1 Realm

Realm

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 608 posts

Posted 15 October 2010 - 07:17 PM

First, I want to explain, that I did not develop that actual function that jumps around in the 'Registry Editor', I just spiced it up with a small Interface to increase it's functionality.

I concepted this example based on Yashied's _RegJump(). In Yashied's example the _RegJump() function opens a registry editor in the specified hive.

I have added a GUI with a combo bar, that starts with the basic keys, and as you choose the key, it will enumerate sub-keys into the combo box until you have found the registry you wish to jump to, or another input option if you know exactly where you need to look.

Hope you find it as useful, as have I.

AutoIt         
#include <GUIConstantsEx.au3> Local $keyString, $regExist = 0 $regJumpGUI = GUICreate("Registry Jumper",600,125,(@DesktopWidth-600)/2,0) GUICtrlCreateLabel("Choose and Enumerate Keys until you have found the spot you would like to open Registry Editor at:",10,10) $select_Root = GUICtrlCreateCombo("HKCR",10,32,530) GUICtrlSetData(-1,"HKCU|HKLM|HKU|HKCC") $open_RegEdit_fromRoot = GUICtrlCreateButton("Open",550,30,40) GUICtrlCreateLabel("If you know the exact location you want to jump to enter here:",10,60) $select_Jump = GUICtrlCreateInput("HKCR.txt",10,80,530) $open_RegEdit_fromJump = GUICtrlCreateButton("Open",550,80,40) GUISetState() While 1     If $regExist Then         If Not WinExists("Registry Editor","") Then Exit     EndIf     $msg = GUIGetMsg()     Switch $msg         Case $GUI_EVENT_CLOSE             If MsgBox(4+32,"Registery Jumper","Do you want to close the 'Registry Editor' as well?")=6 Then                 If WinExists("Registry Editor","") Then WinClose("Registry Editor","")             EndIf             Exit         Case $select_Root             $keyString = ""             $lastSelection = GUICtrlRead($select_Root)             $rootkey = StringSplit(GUICtrlRead($select_Root),"",2)             If IsArray($rootkey) Then                 For $a=1 To UBound($rootkey)-1                     $keyString &= "" & $rootkey[$a]                 Next                 $rootkey = $rootkey[0]             Else                 $rootkey = GUICtrlRead($select_Root)             EndIf             Switch $rootkey                 Case 'HKEY_CLASSES_ROOT', 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE', 'HKEY_USERS', 'HKEY_CURRENT_CONFIG'                     $Enum_Root = $rootkey                 Case 'HKCR'                     $Enum_Root = 'HKEY_CLASSES_ROOT'                 Case 'HKCU'                     $Enum_Root = 'HKEY_CURRENT_USER'                 Case 'HKLM'                     $Enum_Root = 'HKEY_LOCAL_MACHINE'                 Case 'HKU'                     $Enum_Root = 'HKEY_USERS'                 Case 'HKCC'                     $Enum_Root = 'HKEY_CURRENT_CONFIG'                 Case Else                     MsgBox(0,"Error","An Error occured while attempting to recognize the selected Registery Key")             EndSwitch             $data = "|HKCR|HKCU|HKLM|HKU|HKCC|" & $lastSelection             For $i = 1 To 1000                 $var = RegEnumKey($Enum_Root & $keyString,$i)                 If @error <> 0 Then ExitLoop                 If $i=1 Then $default_Key = $Enum_Root & $keyString & "" & $var                 $data &= "|" & $Enum_Root & $keyString & "" & $var             Next             GUICtrlSetData($select_Root,$data,$lastSelection)         Case $open_RegEdit_fromRoot             If _RegJump(GUICtrlRead($select_Root)) Then                 WinWait("Registry Editor","")                 $pos = WinGetPos("Registry Editor","")                 If @DesktopHeight >= $pos[3]+157 Then                     WinMove("Registry Editor","",(@DesktopWidth-$pos[2])/2,157)                 Else                     WinMove("Registry Editor","",(@DesktopWidth-$pos[2])/2,(@DesktopHeight-$pos[3]))                 EndIf                 $regExist = 1             EndIf         Case $open_RegEdit_fromJump             If _RegJump(GUICtrlRead($select_Jump)) Then                 WinWait("Registry Editor","")                 $pos = WinGetPos("Registry Editor","")                 If @DesktopHeight >= $pos[3]+157 Then                     WinMove("Registry Editor","",(@DesktopWidth-$pos[2])/2,157)                 Else                     WinMove("Registry Editor","",(@DesktopWidth-$pos[2])/2,(@DesktopHeight-$pos[3]))                 EndIf                 $regExist = 1             EndIf     EndSwitch WEnd Func _RegJump($sKey) ;Function by: Yashied     Local $Root, $Text = StringSplit($sKey, '', 2)     If IsArray($Text) Then         $Text = $Text[0]     Else         $Text = $sKey     EndIf     Switch $Text         Case 'HKEY_CLASSES_ROOT', 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE', 'HKEY_USERS', 'HKEY_CURRENT_CONFIG'             $Root = $Text         Case 'HKCR'             $Root = 'HKEY_CLASSES_ROOT'         Case 'HKCU'             $Root = 'HKEY_CURRENT_USER'         Case 'HKLM'             $Root = 'HKEY_LOCAL_MACHINE'         Case 'HKU'             $Root = 'HKEY_USERS'         Case 'HKCC'             $Root = 'HKEY_CURRENT_CONFIG'         Case Else             Return 0     EndSwitch     Local $Class = '[CLASS:RegEdit_RegEdit]', $Delay = Opt('WinWaitDelay', 0)     Local $Prev, $Result = 1     If WinExists($Class) Then         WinClose($Class)         If Not WinWaitClose($Class, '', 5) Then             $Result = 0         EndIf     EndIf     If $Result Then         $Prev = RegRead('HKCUSoftwareMicrosoftWindowsCurrentVersionAppletsRegedit', 'Lastkey')         If @error Then             $Prev = 0         EndIf         If Not RegWrite('HKCUSoftwareMicrosoftWindowsCurrentVersionAppletsRegedit', 'Lastkey', 'REG_SZ', StringReplace($sKey, $Text, $Root, 1)) Then             $Result = 0         Else             If Not Run('regedit.exe') Then                 $Result = 0                 If IsString($Prev) Then                     RegWrite('HKCUSoftwareMicrosoftWindowsCurrentVersionAppletsRegedit', 'Lastkey', 'REG_SZ', $Prev)                 EndIf             EndIf         EndIf     EndIf     Opt('WinWaitDelay', $Delay)     Return $Result EndFunc ;==>_RegJump


Edit: Cleaned it up to make it more readable, and change the format of the msg loop to a switch. I also forgot to include a brief description.

Edit 2: Removed a duplicated 'WEnd' statement in code.

Edited by Realm, 27 April 2012 - 01:11 AM.

...and then we shall see if your insanity can be cured!______________________________________________________________________My Contributions: RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.








0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users