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
| #include <iostream>
using namespace std;
#include <windows.h>
int main()
{
int choix = 0;
cout << "choisi ton choix: \n1 = Mon_interface.exe \n2 = explorer.exe" << endl;
cin >> choix;
// Pour CreateProcess().
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si,sizeof(STARTUPINFO));
// Pour base de régistre.
char* adresseShell_new = "C:\\WINDOWS\\test_explorer.exe"; // adresse du nouveau Shell
char* adresseShell_old = "Explorer.exe"; // Pour le remettre à l'explorer.exe.
if(choix == 1)
{
CreateProcess(NULL,"c:\\WINDOWS\\system32\\Mon_interface.exe",
NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,
"c:\\WINDOWS\\system32",&si,&pi);
}
else if(choix == 2)
{
HKEY key;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, KEY_ALL_ACCESS, &key);
// Mettre le Shell à explorer.exe pour que le bureau et tout l'interface explorer s'affiche.
RegSetValueEx(key, "Shell", 0, REG_SZ, (BYTE*)adresseShell_old, strlen(adresseShell_old)+1);
// ouvrir le processus explorer.exe
CreateProcess(NULL,"c:\\WINDOWS\\explorer.exe",
NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,
"c:\\WINDOWS",&si,&pi);
Sleep(2000); // pause 2 secondes.
// Mettre le nouveau Shell pour le prochain démarrage de windows.
RegSetValueEx(key, "Shell", 0, REG_SZ, (BYTE*)adresseShell_new, strlen(adresseShell_new)+1);
RegCloseKey(key);
}
else
{
cout << "choix incorecte" << endl;
}
return 0;
} |
Partager