SHARE
TWEET

Untitled

a guest Apr 10th, 2013 32 Never
  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. }
RAW Paste Data
Top