Sign in to follow this  
Followers 0
samuria

read registery

8 posts in this topic

I am trying to read write delete from the registery specifically from

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN

I cant get it to work can any give me a bit of code to get me started? If I know the keys I can do it but I want to write software that will find what is there and display it and then optionally edit it\delete it

Share this post


Link to post
Share on other sites



Did you even look at the help file? Searching for 'registry' returns RegRead as the first result.

Share this post


Link to post
Share on other sites

I found the help but couldnt get it to work if I didnt know what was there ie if I knew there was one winpatrol I could read the value but if i didnt know the list that was there i couldnt work it out as I am knew to this

Share this post


Link to post
Share on other sites

I found the help but couldnt get it to work if I didnt know what was there ie if I knew there was one winpatrol I could read the value but if i didnt know the list that was there i couldnt work it out as I am knew to this

Are you not familiar with search boxes? Doesn't get easier than that.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think what danielkza is trying to say is, you need to show some active interest/investment which you will need show, as almost everyone in this community has and it will benefit you in the long run.

Here is an example

$regR1 = RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "StartCCC" )
msgbox(0, "", "Reading from Registry:" & @CRLF & $regR1)

the first part is the actual reg key/path the last part "StartCCC" is the actually key value that you see on the left hand pane of the registry editor.

Taken from the Helpfile:

RegRead

--------------------------------------------------------------------------------

Reads a value from the registry.

RegRead ( "keyname", "valuename" )

Parameters

keyname The registry key to read.

valuename The value to read.

Return Value

Success: Returns the requested registry value. @EXTENDED is set to the type of the value $REG_... . These types are defined in the "Constants.au3" include file.

Failure: Returns "" and sets the @error flag:

1 if unable to open requested key

2 if unable to open requested main key

3 if unable to remote connect to the registry

-1 if unable to open requested value

-2 if value type not supported

Remarks

A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").

And then there is Regwrite, most of all the examples in the helpfile are practical and can be altered to suit what you may require at a base level.

ftc

Edited by failedtocompile

Share this post


Link to post
Share on other sites

The above code just gives a msgbox that saya reading register it doesnt give any values

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$check = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\RegEdit Test", "RegGroup")
$reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\RegEdit Test", "RegGroup")

If $check = "" Then
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\RegEdit Test", "RegGroup", "REG_SZ", "This is from REG")
EndIf

$RegEdit = GUICreate("RegEdit", 184, 43, 192, 124)
$Input1 = GUICtrlCreateInput($reg, 8, 10, 89, 21)
$Save = GUICtrlCreateButton("Save", 105, 7, 65, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\RegEdit Test", "RegGroup", "REG_SZ", GUICtrlRead($Input1))
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Or you can use "reg.exe query <keyname>" and output the results to a file or msgbox to view the contents or the registry.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0