1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
/*
* startservices.cpp
*
* Created: Jun 18, 2010
* Author: Ryan Caywood
*/
#include <conio.h>
#include <prockill.cpp>
#include <iostream>
#include <windows.h>
using namespace std;
string choice,
done = "Done",
error = "The service is already started.",
startMsg1 = "\nStarting Shell Hardware Detection ... ",
startMsg2 = "\nStarting Removable Storage ... ",
startMsg3 = "\nStarting Themes ... ",
startMsg4 = "\nStarting MSI Server ... ",
startMsg5 = "\nStarting Network Connection Manager ... ",
startMsg6 = "\nStarting TimeSync ... ",
startMsg7 = "\nStarting UPnP Discovery ... ",
startMsg8 = "\nStarting UPnP Host ... ",
startMsg9 = "\nStarting Wireless Auto-Config ... ";
char
s1[50] = "net start ShellHWDetection >nul 2>nul",
s2[50] = "net start NtmsSvc >nul 2>nul",
s3[50] = "net start Themes >nul 2>nul",
s4[50] = "net start MSIServer >nul 2>nul",
s5[50] = "net start Netman >nul 2>nul",
s6[50] = "net start W32Time >nul 2>nul",
s7[50] = "net start SSDPSRV >nul 2>nul",
s8[50] = "net start upnphost >nul 2>nul",
s9[50] = "net start WZCSVC >nul 2>nul";
int main() {
cout << "Starting services and programs ...\n";
cout << startMsg1;
if (system(s1) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg2;
if (system(s2) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg3;
if (system(s3) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg4;
if (system(s4) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg5;
if (system(s5) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg6;
if (system(s6) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg7;
if (system(s7) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg8;
if (system(s8) == 2) { cerr << error; }
else { cout << done; }
cout << startMsg9;
if (system(s9) == 2) { cerr << error; }
else { cout << done; }
cout << "\nStarting PowerStrip ... ";
if (ShellExecute(GetDesktopWindow(), "open",
"C:\\Program Files\\PowerStrip\\PStrip.exe", NULL, NULL,
SW_SHOWNORMAL)) cout << "Started.";
else cerr<< "Error";
cout << "\nKilling PowerStrip in 10 seconds (or less) ... ";
Sleep(10000);
if (KILL_PROC_BY_NAME("PStrip.exe") == 0) cout << "Killed";
else cerr << "Error";
cout << endl << "\nAll done!" << endl;
Sleep(2000);
return 0;
}
|