passing NULL to non-pointer argument 3 of 'LONG RegOpenKeyExW(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY)' [-Wconversion-null]|
for these statements:
RegOpenKeyEx(HKEY_CURRENT_USER, sKeyPath, NULL, KEY_ALL_ACCESS, &hKey);
RegSetValueEx(hKey, L"LegacyDefaultPrinterMode", NULL, REG_DWORD, (const BYTE*)&value, sizeof(value));
This is the complete code:
Code: Select all
HKEY hKey;
LPCWSTR sKeyPath;
sKeyPath = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\";
RegOpenKeyEx(HKEY_CURRENT_USER, sKeyPath, NULL, KEY_ALL_ACCESS, &hKey);
DWORD value = 0x00000001;
RegSetValueEx(hKey, L"LegacyDefaultPrinterMode", NULL, REG_DWORD, (const BYTE*)&value, sizeof(value));
RegCloseKey(hKey);