Jump to content
Sign in to follow this  
MerkurAlex

RegExists?

Recommended Posts

MerkurAlex

Is there a way to check if a registry "folder" exists not a key just a path for example "HKCU\software\cheat engine" i have searched but i'm unable to find anything.

I'm wondering this cause its gonna be part of my "hack detection" software me and a few friends need for our game we are making in python.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

Could do something like:

$RegExists = RegRead ( "keyname", "valuename" )

If $RegExists = @Error Then

If it's @Error , than it doesn't exist. If it's successfull , it doesn't exist. Idk. I couldn't find a command that just told if it existed, so I tried to compromise.

EDIT

And of course, I could be completely wrong. I just like to help if I think I can.

EDIT EDIT

Btw. What UDF's do you have? ( Link in sig is broken. )

Edited by Drew

Share this post


Link to post
Share on other sites
MerkurAlex

Could do something like:

$RegExists = RegRead( blah )

If $RegExists = @Error Then

If it's @Error , than it doesn't exist. If it's successfull , it doesn't exist. Idk. I couldn't find a command that just told if it existed, so I tried to compromise.

EDIT

And of course, I could be completely wrong. I just like to help if I think I can.

EDIT EDIT

Btw. What UDF's do you have? ( Link in sig is broken. )

Well that essentially wouldn't work if im correct also my udf website no longer exists cause my server crashed the hard drive is fried also that website was for other people to upload their udf's i did have a few on there though.

EDIT

Yea regread requires a key im trying to just use a path.

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

Alright , I'm still learning.

Although I have to ask... where was I wrong at?

Because theoretically if its @error , can't read it , than that would mean its not there basically telling you whether or not the FileExists.

Sorry for asking a question in your help thread.

*Regards

EDIT

Aha. Sorry. I should have read your first post clearer.

Edited by Drew

Share this post


Link to post
Share on other sites
Drew

Hmmm... Maybe you could do something with the RegEdit located in the WINDOWS folder?

If it's able to edit them... then there has to be a path.

Share this post


Link to post
Share on other sites
MerkurAlex

Alright , I'm still learning.

Although I have to ask... where was I wrong at?

Because theoretically if its @error , can't read it , than that would mean its not there basically telling you whether or not the FileExists.

Sorry for asking a question in your help thread.

*Regards

EDIT

Aha. Sorry. I should have read your first post clearer.

well regread has two params (key,value) where as key would be the path i specified above and then the value would be a key inside that path so it wouldn't work.

Although i did find a way to do it with regread so you did help me you made me think along the lines i needed to heres my code:

if regread("HKCU\software\cheat engine","")="" Then
    msgbox("","Hack-Defender","Cheat Engine was found please uninstall to run TIO")
    exit
endif

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

Well I just found something. Check this out. Open RegEdit ( it's in your WINDOWS FOLDER , mines at C:/WINDOWS/RegEdit )

Open that up. Locate the file you want and highlight it. ( Click it once. )

Alright now up top of regedit , find where it says "View" ( Has: File, Edit, View, Favorites etc. )

Make sure that: Status Bar <-- Is checked.

Now look at the status bar. On my screen, it has the path to the file I highlighted in regedit.

Share this post


Link to post
Share on other sites
MerkurAlex

Well I just found something. Check this out. Open RegEdit ( it's in your WINDOWS FOLDER , mines at C:/WINDOWS/RegEdit )

Open that up. Locate the file you want and highlight it. ( Click it once. )

Alright now up top of regedit , find where it says "View" ( Has: File, Edit, View, Favorites etc. )

Make sure that: Status Bar <-- Is checked.

Now look at the status bar. On my screen, it has the path to the file I highlighted in regedit.

Yea i new this but that doesn't help me :) anyway i already solved my problem sorry to bother you.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

No bother. I like to help if I think I'm able.

Share this post


Link to post
Share on other sites
MerkurAlex

It appears after doing some testing i was wrong.... i will have to find another way to do this.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

After doing some of my own testing , I found another way to tell if the file is there. ( Again... based off an error. )

Code:

$Yes = RegRead( "HKEY_CURRENT_USER\Software\AutoIt v3\Aut2Exe", "UseUPX")
MsgBox(4096, "This works.", "The reg exists because I can't open it. Further Info, Error: "&$Yes)

It returns Error: 1 , and the HelpFile says this for RegRead:

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

1 if unable to open requested key

[blah blah....]

So by not being able to open it... you know its there.

Hope this helps.

Share this post


Link to post
Share on other sites
MerkurAlex

After doing some of my own testing , I found another way to tell if the file is there. ( Again... based off an error. )

Code:

$Yes = RegRead( "HKEY_CURRENT_USER\Software\AutoIt v3\Aut2Exe", "UseUPX")
MsgBox(4096, "This works.", "The reg exists because I can't open it. Further Info, Error: "&$Yes)

It returns Error: 1 , and the HelpFile says this for RegRead:

So by not being able to open it... you know its there.

Hope this helps.

I'm guessing your missing my point i want to be able to only specifiy the first parameter of regread without knowing a "value" inside the "key".

So basically i will always know the first parameter but i will never know what the second will be so i need to know if it exists in the registry without knowing the second parameter.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
Drew

Alrighty. I'm out of ideas. Sorry I couldn't help.

Share this post


Link to post
Share on other sites
MerkurAlex

Alrighty. I'm out of ideas. Sorry I couldn't help.

No problem i guess i just gotta keep on testing and searching.

EDIT

Hey just wanted to let you know i have found a new way to do this here is a quick function i made for it

Func RegExists($path)
    $check=runwait('reg query "'&$path&'"','',@SW_HIDE)
    if $check=0 Then
        return 1
    elseif $check=1 Then
        return 0
    endif
endfunc

It returns 1 if it exists and 0 if it does not i have tested this and it seems to work properly.

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
weaponx

Theres nothing wring with using RegRead to do this. Every key has to have the default value, @ERROR is set to 1 if default can't be accessed.

Edited by weaponx

Share this post


Link to post
Share on other sites
Richard Robertson

You check error using the code

If @error Then
    ; it doesn't exist
EndIf

You don't compare the return value to @error, I don't know where you got that idea.

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  

×