Running the command prompt as administrator isn't helping. The following gives the error message: The system cannot find the file specified.
dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_SET_VALUE, &hRegKey);
if ( dwResult == ERROR_SUCCESS ) {
OutputDebugString(_T("RegOpenKeyEx worked"));
RegCloseKey(hRegKey);
} else {
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
dwResult, LANG_NEUTRAL, szErrText, sizeof(szErrText), NULL);
OutputDebugString(_T("RegOpenKeyEx failed"));
OutputDebugString(szErrText);
return FALSE;
}