Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Mar 1st, 2008, 3:11 PM   #1
KuraKai
Newbie
 
Join Date: Mar 2008
Posts: 25
Rep Power: 0 KuraKai is on a distinguished road
RegQueryValue Issues

I am trying to read from the registry and there is issues with trying to query it, it can get to where the value is located but it can't find the value for some odd reason. Here is the code I am currently running.

C++ Syntax (Toggle Plain Text)
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include "windows.h"
  4. #include "winnt.h"
  5. #include "winreg.h"
  6.  
  7. using namespace std;
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11. HKEY MyKey;
  12.  
  13. char szBuff[80];
  14. LONG cb;
  15.  
  16. if (RegOpenKey(HKEY_CURRENT_USER, "Software\\Random\\Program", &MyKey) == ERROR_SUCCESS)
  17. {
  18. cout << "Program is installed\n";
  19. cb = sizeof(szBuff);
  20.  
  21. //Debug info, this normally isn't here!
  22. printf("%d",RegQueryValue(MyKey, "hexData", szBuff, &cb) );
  23. cout << '\n';
  24.  
  25. if(RegQueryValue(MyKey, "hexData, szBuff, &cb) == ERROR_SUCCESS)
  26. {
  27. cout << "Program has been run once\n";
  28. printf(szBuff);
  29. }
  30.  
  31. RegCloseKey(MyKey);
  32. }
  33.  
  34. system("PAUSE");
  35. return EXIT_SUCCESS;
  36. }
  37.  

The value that it should be printing out 0611623CA8EFE3D880FF72E0F9A5AACDE5D9C171EAE2C6FDB6888BF7B5386DEE , however it can't find it even though it should be there. Any help with this?
KuraKai is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LWP form Data array issues Johnmcter Perl