It is currently Sun Jan 24, 2021 10:27 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to check if a register key exists?
PostPosted: Wed Jan 13, 2021 7:33 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 139
Location: Spain
Why this procedure output is ever = 1 ?? (no matter if key exists or not)

Code:
Procedure.i RegKeyExists(exePath$)

  Protected Key.l = #HKEY_CURRENT_USER
  Protected Path.s = "Software\Microsoft\Windows\CurrentVersion\Run"
  Protected Value.s = "TEST"
  Protected String.s = Chr(34)+exePath$+Chr(34)
  Protected CurKey.l
 
      Define res.l=RegOpenKeyEx_(Key,@Path,0,#KEY_ALL_ACCESS,@CurKey)
      If res<>#ERROR_SUCCESS
        RegCloseKey_(CurKey)
        ProcedureReturn 0
      Else
        RegCloseKey_(CurKey)
        ProcedureReturn 1       
      EndIf
EndProcedure


Top
 Profile  
Reply with quote  
 Post subject: Re: How to check if a register key exists?
PostPosted: Wed Jan 13, 2021 8:02 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 139
Location: Spain
I've figured out why happen this (this key already exists :lol: )

Then perhaps I must read the inside key value? :?

I see an: RegSetValueEx_ but not a: RegGetValueEx_

Any help apreciate


Top
 Profile  
Reply with quote  
 Post subject: Re: How to check if a register key exists?
PostPosted: Wed Jan 13, 2021 8:23 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 139
Location: Spain
Nevermind, I already found: RegQueryValueEx_
Thanks anyway :wink:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye