来自http://tunps.com/selfcopy-c-code
/*code by tunpishuangvc++ 2008编译通过使用“使用多字节字符集”,而非Unicode功能: 将当前正在运行的进程exe镜像复制到%systemroot%目录下*/#include <windows.h>#include <stdio.h>int main(){ char filename[256]; char sysdir[256]; int ret; GetModuleFileName(0,filename,256); GetSystemDirectory(sysdir,256); ret=CopyFile(filename,strcat(sysdir,"\\hacker.exe"),FALSE); if(ret) { printf("%s copied to %s\n",filename,sysdir); } else { printf("copy failed!\n"); } return 0;} |