RegCreateKeyEx( //打开指定键
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0,
NULL,
REG_OPTION_NON_VOLATILE,
NULL,
NULL,
&hKey,
&dwErr);
GetModuleFileName(NULL,szExeName,sizeof(szExeName));
//得到本程序的完整存放路径
if(AutoRun==1)
{
RegSetValueEx( //禁止本程序的自动运行
hKey,
"CDOOR",
0,
REG_SZ,
(unsigned char *)"",
sizeof(szExeName));
AutoRun=0; //自动运行标志清0
}
else
{
RegSetValueEx( //将本程序设为自动运行
hKey,
"CDOOR",
0,
REG_SZ,
(BYTE *)szExeName,
sizeof(szExeName));
AutoRun=1; //自动运行标志置位
}
RegCloseKey(hKey);
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0,
NULL,
REG_OPTION_NON_VOLATILE,
NULL,
NULL,
&hKey,
&dwErr);
GetModuleFileName(NULL,szExeName,sizeof(szExeName));
//得到本程序的完整存放路径
if(AutoRun==1)
{
RegSetValueEx( //禁止本程序的自动运行
hKey,
"CDOOR",
0,
REG_SZ,
(unsigned char *)"",
sizeof(szExeName));
AutoRun=0; //自动运行标志清0
}
else
{
RegSetValueEx( //将本程序设为自动运行
hKey,
"CDOOR",
0,
REG_SZ,
(BYTE *)szExeName,
sizeof(szExeName));
AutoRun=1; //自动运行标志置位
}
RegCloseKey(hKey);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货