Editing Windows Registry

Reply

Join Date: Jul 2007
Posts: 126
Reputation: krnekhelesh is an unknown quantity at this point 
Solved Threads: 3
krnekhelesh's Avatar
krnekhelesh krnekhelesh is offline Offline
Junior Poster

Editing Windows Registry

 
0
  #1
Nov 25th, 2007
I want to create a C++ Program to edit the Windows Registry. For example to change the home page of internet explorer. But I don't know how to read or edit the help.

I am doing this program just for my own self and is not a part of homework.
Ubuntu Linux User #25732
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 126
Reputation: krnekhelesh is an unknown quantity at this point 
Solved Threads: 3
krnekhelesh's Avatar
krnekhelesh krnekhelesh is offline Offline
Junior Poster

Re: Editing Windows Registry

 
0
  #2
Nov 25th, 2007
I got the following source from the internet... but I don't know how to manipulate it for my convience

  1. #include <windows.h>
  2. #include <iostream>
  3.  
  4. int main () {
  5.  
  6. HKEY hKey; // Declare a key to store the result
  7. DWORD buffersize = 1024; // Declare the size of the data buffer
  8. char* lpData = new char[buffersize];// Declare the buffer
  9.  
  10. /* Open the Registry Key at the location
  11. HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
  12. with read only access
  13. */
  14.  
  15. RegOpenKeyEx (HKEY_CURRENT_USER,
  16. "Software\\Microsoft\\Internet Explorer\\Main",NULL,KEY_READ,&hKey);
  17.  
  18. // Query the registry value
  19. RegQueryValueEx(hKey,"Start Page",NULL,NULL,(LPBYTE) lpData,&buffersize);
  20.  
  21. // Print out the registry value
  22. std::cout << "Registry Key Open: memory location=" << hKey << "\n";
  23. std::cout << "Your Internet Start Page is " << lpData << "\n\n";
  24.  
  25. // Close the Registry Key
  26. RegCloseKey (hKey);
  27.  
  28. // Pause the system so there is time to read what is going on
  29. system("Pause");
  30.  
  31. delete lpData;
  32. }
Last edited by krnekhelesh; Nov 25th, 2007 at 5:34 am. Reason: code error
Ubuntu Linux User #25732
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 126
Reputation: krnekhelesh is an unknown quantity at this point 
Solved Threads: 3
krnekhelesh's Avatar
krnekhelesh krnekhelesh is offline Offline
Junior Poster

Re: Editing Windows Registry

 
0
  #3
Nov 25th, 2007
but the thing is it edits reads only strings... I want to read a value which has binary values.... How do I do that?
Ubuntu Linux User #25732
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: Editing Windows Registry

 
0
  #4
Nov 25th, 2007
you still use RegQueryValueEx.
  1. LONG WINAPI RegQueryValueEx( HKEY hKey, LPCTSTR lpValueName,
  2. LPDWORD lpReserved,
  3. LPDWORD lpType, // will be set to the type of data
  4. // (eg. REG_BINARY if value was binary)
  5. LPBYTE lpData, LPDWORD lpcbData );
see http://msdn2.microsoft.com/en-us/library/ms724884.aspx for the registry value types.
Last edited by vijayan121; Nov 25th, 2007 at 6:33 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC