Guest User

[C++] Add program to Startup Example

a guest
Jun 16th, 2011
1,078
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //virus.cpp
  2.  
  3. #include <windows.h>
  4. //#include <string>
  5.  
  6. int main(int argc, char *argv[]){
  7.     HKEY hkey;
  8.     char szBuf[] = "C:\\Windows\\notepad.exe";
  9.    
  10.     RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\Run", 0, KEY_SET_VALUE, &hkey);
  11.     RegSetValueEx (hkey, "notepad.exe", 0, REG_SZ, (LPBYTE) szBuf, strlen(szBuf) + 1);
  12.     RegCloseKey(hkey);
  13.  
  14.     MessageBox(NULL,"Notepad added to startup...","Info",MB_OK);
  15.     return 0;
  16. }
RAW Paste Data