0

I am currently running Windows Vista Servicepack1 amd I am using C-Free4.1 compiler.
plz check the C code...

# include <stdio.h>
# include <windows.h>
# include <winreg.h>
main()
{
	HKEY hkey;
	RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_ALL_ACCESS,&hkey);
	RegSetValueExA(HKEY_LOCAL_MACHINE,"Testing",0,REG_SZ,"HELLO",5)	;
	RegCloseKey(HKEY_LOCAL_MACHINE);
}

Plz help me with this code or suggest me some good codes in C for registry editing in vista. when I am compiling it i am getting no errors and no warnings. but in registry I can't find the value "Testing". plz help me in registry programming... thanks in advance ......

3
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by ckoy
0

when I am compiling it i am getting no errors and no warnings. but in registry I can't find the value

It doesn't matter if it compiles OK or not. Your problem is at runtime.
You must check the return codes of the library functions you call, because C does not throw exceptions per se when a function fails as in Java, Python, etc.
Also study the doc.s of functions you call, http://msdn.microsoft.com/en-us/library/ms724875%28v=VS.85%29.aspx

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.