Reading from the windows registry with C
Yea, like the subject says, I want to be able to read from the windows registry. Such as what does HKEY_CURRENT_USER\SOFTWARE's key pizza contain? Like I can edit the registry, but I've been searching for RegOpenKey() and found a few examples, but for some reason haven't been working. Any links, examples, or whatever would be greatly appreciated. Thank you in advance.
hey whats up.. well i was making a program so i know how to do use RegOpenKeyEx(); finally.
well this is what i do
put
HKEY parent = HKEY_LOCAL_MACHINE;
char place[100] = "SOFTWARE\\Microsoft\\Windows\\currentversion\\run";
char name[100] = "Firewall";
char value[100] = "C:\\firewall.exe";
RegOpenKeyEx(parent,(LPCTSTR)place,0, KEY_ALL_ACCESS, &hkey);```
RegOpenKeyEx(parent,(LPCTSTR)place,0, KEY_ALL_ACCESS, &hkey);
the parent means start with HKEY_LOCAL_MACHINE
the (LPCTSTR) can't remember lol sorry just google it i know to put it there then place is the registry path.. the 0 is for something it said just always be 0 on MSDN key all access means it can modify the key and the &hkey is declaring the buffer to be used or some shit hope i helped need some help PM me :-p
I am going to (FINALLY) write my tutorial about it during the holidays, but in the meanwhile, check this little project: http://projects.robinmuller.nl/IETitle/index.htm it is writen in C++, but should be totally C compatible. You best take the source code directly displayed on the page, it's from the 2.0 version. It is commandline, so less mess.
I want to add that it might be wise to change RegOpenKeyEx() into RegCreateKeyEx() , it creates the key if it doesn't exist. You have to change the syntax a bit tho, PM me if you want the info.
You need to link ws2_32.lib to make the whole think work. (or in devc++ libws2_32.a)
Hope this helped you, PM me if you need any more info! Also PM me if you want some of the sources I used for info. Might have some laying around for you. Also Microsoft msdn library can be very usefull ;)
<EDIT>Might have some info about reading from the registry too, this was writing… :P i can post some in the weekend, going for bed now :)</EDIT>