| View previous topic :: View next topic |
| Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri May 08, 2009 5:23 am Post subject: [C++] trying to get value from registy |
|
|
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 |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri May 08, 2009 2:54 pm Post subject: |
|
|
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri May 08, 2009 3:15 pm Post subject: |
|
|
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 |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sat May 09, 2009 1:00 am Post subject: |
|
|
thank you both 2 ways are good for me now
btw lurc what's the meaning of __checkReturn ?!
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat May 09, 2009 8:13 am Post subject: |
|
|
__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 |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sat May 09, 2009 8:27 am Post subject: |
|
|
that's great thanks
i'v been looking for this for a long time :]
+rep
|
|
| Back to top |
|
 |
|