This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 10th, 2013  |  syntax: C  |  size: 0.49 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. TCHAR szPath[MAX_PATH];
  2. GetModuleFileName(NULL,szPath,MAX_PATH);
  3. HKEY hKey;
  4. subValue = "OnlineCG";
  5. RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey);
  6. long retval = RegQueryValueExA(hKey, subValue, NULL, NULL, NULL, NULL);
  7. if(retval == ERROR_FILE_NOT_FOUND)
  8. {
  9.     RegCloseKey(hKey);
  10. }
  11. else
  12. {
  13.     const DWORD cbData = sizeof(TCHAR) * (lstrlen(szPath) + 1);
  14.     RegSetValueEx(hKey, subValue ,0,REG_SZ,(LPBYTE)szPath,cbData);
  15.     RegCloseKey(hKey);
  16. }
clone this paste RAW Paste Data