#include
Int _tmain (int arg c, _TCHAR * argv [])
{
Hkeys hkeys=nullptr;
//open the registry
If (ERROR_SUCCESS!=RegOpenKeyExW (HKEY_LOCAL_MACHINE, L "SOFTWARE \ \ Microsoft \ \ Windows \ \ CurrentVersion \ \ Run", NULL, KEY_WRITE | KEY_WOW64_64KEY, & amp; Hkeys))
{
return 1;
}
//modify the registry
Would be szName [MAXBYTE]=L "ZS_TOMMOROW_Say";
Would be szValue [MAXBYTE]=L "I Love You";
RegSetValueExW (hkeys, szName, 0, REG_SZ, szValue (BYTE *), wcslen (szValue) * 2);
return 0;
}
No display error code,, but why no success is added to the registry??????? Great god urgent urgent
CodePudding user response:
Use GetLastError get the error code, may be a permissions problem, try to run as an administrator