i new in program , i need help,, how to add registry value in HKLM.
this is my code
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
HKEY hkey;
LONG lreg;
LONG lres;
DWORD dwvalue = 0;
printf("change registry key \n");
lreg= RegCreateKeyEx(HKEY_LOCAL_MACHINE, /* reg key */
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background", /* key to set */
0,NULL,REG_OPTION_VOLATILE,KEY_ALL_ACCESS,
NULL,&hkey,NULL);
if(lreg ==ERROR_SUCCESS) {
printf("success\n");}
{
lres = RegSetValueEx(hkey,"whatever",0,REG_DWORD,(BYTE*)&dwvalue, sizeof(dwvalue)); /* what ever just trying only */
if(lres ==ERROR_SUCCESS){
printf("sucess");
}
}
RegCloseKey(hkey);
system("PAUSE>nul");
return 0;
}
please help me