hi
the problem is not how to write in the registry but it seems a funcion error or some crap like that... I wrote my insertkey(..) function that fails writting the valuedata (it writes only c:\F instead c:\File.exe)
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int insertkey(char key[], char valuename[], char valuedata[]);
int main(void)
{
..
..
insertkey("SYSTEM\\List\\",
"C:\\file.exe",
"C:\\file.exe")
..
..
}
int insertkey(char key[], char valuename[], char valuedata[])
{
HKEY hKey;
DWORD dwDisposition;
RegCreateKeyEx(HKEY_LOCAL_MACHINE, key, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
RegSetValueEx(hKey, valuename, 0, REG_SZ, (LPBYTE)valuedata, sizeof(valuedata));
RegCloseKey(hKey);
return 0;
}
at the end i have the key, the valuename but the value data is not c:\file.exe but it is c:\f
i think the problem is char valuedata[] because the regsetvalueex wants a DWORD but how to give to the funcion a DWORD? I never did that...