This is a program that is supposed to run on startup when the computer turns on...
What I did was I put the name of the program in the RunOnce Registry key attached below... when u double click the key, it puts the program name in the registry telling it to run the program on boot once and after that the key is deleted from the registry. The program was placed in my C:/Windows folder which is where the RunOnce key says to look... If it cant find the program, itll just skip it and load everything else.
thing is the program does get found, it does start... but it only prints/couts the first line onto the screen, opens another program aka system("\"C:/Program Files/Alwil Software/Avast5/AvastUI.exe\""); and then it never moves, it does nothing after that... it just stays on the screen showing cout<<"Opening Avast5\n"; It wont cout/print anything thing else after the system command... WHY? What have I done wrong? Why does the program not continue printing the rest of stuff/continue moving :S
If u want to see what I mean, doubleclick RunOnce.REG (dont worry it deletes itself after 1 boot). Copy patcherscript.exe to C:/Windows. and reboot... the program will then run and GET STUCK and delete the RunOnce =(
Note: if u are going to help... the RunOnce.cpp needs to be changed/rename/change extension to .REG so itll be RunOnce.REG not .cpp
U can edit it in a text file such as notepad just to see that it is not harmful/ search up RunOnce if u are scared to help but I need it
//PatcherScript
#include <iostream>
#include <windows.h>
using namespace std;
char x,y,z;
void RegRun();
void saymsg();
void getinput();
void askagain();
void start();
int main()
{
cout<<"Opening Avast5\n";
system("\"C:/Program Files/Alwil Software/Avast5/AvastUI.exe\"");
cout<<"Due to Tampering Laws, the following has to be done manually:\n\n";
Sleep(2000);
cout<<"In the Avast Window that is open, go to MAINTENANCE\n\n";
Sleep(7000);
cout<<"Press SUBSCRIPTION & Then Insert TRIAL License File:\n\n";
Sleep(5000);
cout<<"Insert the one in the folder where I am Located aka ~/Desktop/Avast5 :)\n";
Sleep(7000);
cout<<"Confirm it by pressing yes\n\n";
Sleep(5000);
cout<<"Go to Settings at the Very Top-Right\n\n";
Sleep(5000);
cout<<"Go to TroubleShooting at the left panel and uncheck:\n\n";
cout<<"Self Defense Module, Confirm it by pressing YES\n";
Sleep(7000);
cout<<"When done:\n\n";
system("Pause");
cout<<"System Registry must be Edited Once more to add a New Key!\n";
start();
cout<<"Editing Finished According To User:\n";
system("shutdown -r");
cout<<"Restarting Computer in 60 Seconds\n";
return 0;
}
//Functions(1) Defined After Main and Before Main as Prototypes... Taken from old project "test cases.cpp" & Modified to Suit...
void RegRun()
{
system("C:/Windows/RunOnce2.reg");
}
void saymsg()
{
cout<<"Did you press yes to edit the registry this time?\n";
}
void getinput()
{
cin>>x;
cin.ignore();
switch(x)
{
case '1': false;
break;
case '2': askagain();
break;
default: cout<<"You entered A letter or character that is not in the menu\n";
cout<<"Please try again!\n";
cout<<"Did you press yes to allow registry editing? y = 1 n = 2\n";
getinput();
}
}
void askagain()
{
cout<<"Would you like to try editing the registry again?? 1 = Yes , 2 = No just exit!\n";
cin>>y;
cin.ignore();
switch(y){
case '1':
RegRun();
saymsg();
getinput();
break;
case '2': exit(0); // want to make the program terminate... tried return 0 but it failed...
break;
default: cout<<"You entered A letter or character that is not in the menu\n";
cout<<"Please try again!\n";
askagain();
break;
}
}
void start()
{
RegRun();
cout<<"Did you press yes to allow registry editing? y = 1 n = 2\n";
getinput();
}