Добавление в автозагрузку

пример для реестра:
    HKEY hKey; 
   
char szPath[0x100];
   
GetModuleFileName(NULL, szPath, sizeof(szPath));
   
RegCreateKeyEx(HKEY_LOCAL_MACHINE,
                    
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",
                    
NULL,
                    
"",
                    
REG_OPTION_NON_VOLATILE,
                    
KEY_SET_VALUE,
                    
NULL,
                    &
hKey,
                    
NULL);

   
if (hKey)
   {
       
RegSetValueEx(hKey, "My program", NULL, REG_SZ, (LPBYTE)szPath, strlen(szPath));
       
RegCloseKey(hKey);
   }