[C++] Add program to Startup Example


SUBMITTED BY: Guest

DATE: Nov. 12, 2013, 2:47 a.m.

FORMAT: Text only

SIZE: 506 Bytes

HITS: 953

  1. //virus.cpp
  2. #include <windows.h>
  3. //#include <string>
  4. int main(int argc, char *argv[]){
  5. HKEY hkey;
  6. char szBuf[] = "C:\\Windows\\notepad.exe";
  7. RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\Run", 0, KEY_SET_VALUE, &hkey);
  8. RegSetValueEx (hkey, "notepad.exe", 0, REG_SZ, (LPBYTE) szBuf, strlen(szBuf) + 1);
  9. RegCloseKey(hkey);
  10. MessageBox(NULL,"Notepad added to startup...","Info",MB_OK);
  11. return 0;
  12. }

comments powered by Disqus