Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] trying to get value from registy

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri May 08, 2009 5:23 am    Post subject: [C++] trying to get value from registy Reply with quote

what function is available for me to get a value from a registry key?!
RegGetValueA can't help me since it for windows xp 64bit edition and above
but i'm using 32bit xp
i tried using RegQueryValueEx but it doesn't returning any value :\
any other suggestions? thx
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Fri May 08, 2009 2:44 pm    Post subject: Reply with quote

hello 1gaz,
the following link to NtQueryValueKey is the Native alternative to RegQueryValueEx and seeing as how i do not see any warnings about using this API on msdn's site, i think this API in all likelyhood will not change with future versions of windows..http://msdn.microsoft.com/en-us/library/dd445601.aspx

hope this helps Very Happy

regards BanMe

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri May 08, 2009 2:54 pm    Post subject: Reply with quote

isn't it some kernel mode api or something?
how can i use it?! should i include other library? cuz my compiler can't recognize this function
btw my name is 1Qaz not gaz lol every1 think it's gaz
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri May 08, 2009 3:15 pm    Post subject: Reply with quote

Hmmm you're using Microsoft right?

Here's a function I just quickly put together, not tested but should work:

Code:
__checkReturn BOOL ReadRegistryData(__in HKEY hKey, __in DWORD dwType, __in_z LPCTSTR lpcszSubKey, __in_z LPCTSTR lpcszKeyName, __out LPVOID lpData)
{
   BOOL   bRET = FALSE;
   HKEY   hSubKey;
   DWORD   dwDisp, dwData;

   RegCreateKeyEx(hKey, lpcszSubKey, 0, 0, 0, KEY_READ, 0, &hSubKey, &dwDisp);
   if (hSubKey != NULL)
      if (RegQueryValueEx(hSubKey, lpcszKeyName, 0, &dwType, (LPBYTE)lpData, &dwData) == ERROR_SUCCESS)
         if (RegCloseKey(hSubKey) == ERROR_SUCCESS)
            bRET = TRUE;
   return bRET;
}

_________________
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Fri May 08, 2009 3:47 pm    Post subject: Reply with quote

sorry for the misinterpretation or your name.. Sad

NtQueryValueKey is not a kernelmode API.. in fact the website explicitly states that this API is not to be used from kernel mode..lurc's implementation is prolly as simple as it gets and it entirly usable..but to use the API NtQueryValueKey you simply have to include ntdll.lib into your project.. this lib file can be found within the DDK..

Regards BanMe

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sat May 09, 2009 1:00 am    Post subject: Reply with quote

thank you both 2 ways are good for me now
btw lurc what's the meaning of __checkReturn ?!
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat May 09, 2009 8:13 am    Post subject: Reply with quote

__checkReturn is a SAL Annotation that tells the caller of the function that the return of the function must not be ignored for the safety of his/her own program.

SAL Annotations - http://msdn.microsoft.com/en-us/library/ms235402(VS.80).aspx

_________________
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sat May 09, 2009 8:27 am    Post subject: Reply with quote

that's great thanks
i'v been looking for this for a long time :]
+rep
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites