[idd] driver: cleanup duplicated string constant

This commit is contained in:
Geoffrey McRae
2025-09-13 14:00:59 +10:00
committed by Geoffrey McRae
parent 13ae3441cf
commit b6ceb72855

View File

@@ -4,7 +4,8 @@
#include <wdf.h> #include <wdf.h>
CSettings g_settings; CSettings g_settings;
static const std::wstring subKey = L"SOFTWARE\\LookingGlass\\IDD";
#define LGIDD_REGKEY L"SOFTWARE\\LookingGlass\\IDD"
static const DWORD DefaultDisplayModes[][3] = static const DWORD DefaultDisplayModes[][3] =
{ {
@@ -79,7 +80,7 @@ void CSettings::SetExtraMode(const DisplayMode& mode)
DWORD disp = 0; DWORD disp = 0;
LONG ec = RegCreateKeyExW( LONG ec = RegCreateKeyExW(
HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE,
L"Software\\LookingGlass\\IDD", LGIDD_REGKEY,
0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE, KEY_SET_VALUE,
NULL, &hKey, &disp); NULL, &hKey, &disp);
@@ -102,7 +103,7 @@ bool CSettings::GetExtraMode(DisplayMode& mode)
HKEY hKey = nullptr; HKEY hKey = nullptr;
LONG ec = RegOpenKeyExW( LONG ec = RegOpenKeyExW(
HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE,
L"Software\\LookingGlass\\IDD", LGIDD_REGKEY,
0, 0,
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
&hKey &hKey
@@ -137,7 +138,7 @@ bool CSettings::GetExtraMode(DisplayMode& mode)
bool CSettings::ReadModesValue(std::vector<std::wstring> &out) const bool CSettings::ReadModesValue(std::vector<std::wstring> &out) const
{ {
HKEY hKey = nullptr; HKEY hKey = nullptr;
LONG st = RegOpenKeyExW(HKEY_LOCAL_MACHINE, subKey.c_str(), 0, KEY_QUERY_VALUE, &hKey); LONG st = RegOpenKeyExW(HKEY_LOCAL_MACHINE, LGIDD_REGKEY, 0, KEY_QUERY_VALUE, &hKey);
if (st != ERROR_SUCCESS) if (st != ERROR_SUCCESS)
return false; return false;