Ejecutar un exe al iniciar windows sin meterlo en el startup C++
Es una manera muy simple de poder ejecutar porgramas
nada mas encender el pc.
El usuario que lo ejecuta tiene que tener poder administrativo.
#include <windows.h>
#include <string>
int main(){
HKEY hkey;
std::string path = "C:\ejemplo.exe";
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", &hkey);
RegSetValueEx(hkey, "Ejemplo", 0, REG_SZ, (BYTE*)path.c_str(), (path.size() +1) * sizeof(wchar_t));
}
nada mas encender el pc.
El usuario que lo ejecuta tiene que tener poder administrativo.
#include <windows.h>
#include <string>
int main(){
HKEY hkey;
std::string path = "C:\ejemplo.exe";
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", &hkey);
RegSetValueEx(hkey, "Ejemplo", 0, REG_SZ, (BYTE*)path.c_str(), (path.size() +1) * sizeof(wchar_t));
}
Simplemente abre el registro de windows que hace que los programas
se ejecuten y le añade tu programa o virus.
Codigo en C++
Fuente del codigo: fuente
Comentarios
Publicar un comentario