Guest User

[C++] Add program to Startup Example

a guest
Jun 16th, 2011
1,083
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×