mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-02 22:28:14 +00:00
[idd] helper: implement registry storage for default refresh
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
|
||||
#define LGIDD_REGKEY L"SOFTWARE\\LookingGlass\\IDD"
|
||||
|
||||
const DWORD DEFAULT_REFRESH = 120;
|
||||
|
||||
CRegistrySettings::CRegistrySettings() : hKey(nullptr) {}
|
||||
|
||||
CRegistrySettings::~CRegistrySettings()
|
||||
@@ -136,3 +138,25 @@ std::wstring DisplayMode::toString()
|
||||
serialized.push_back('*');
|
||||
return serialized;
|
||||
}
|
||||
|
||||
std::optional<DWORD> CRegistrySettings::getDefaultRefresh()
|
||||
{
|
||||
DWORD result, cbData = sizeof result;
|
||||
|
||||
LSTATUS status = RegGetValue(hKey, nullptr, L"DefaultRefresh", RRF_RT_REG_DWORD, nullptr, &result, &cbData);
|
||||
switch (status)
|
||||
{
|
||||
case ERROR_SUCCESS:
|
||||
return result;
|
||||
case ERROR_FILE_NOT_FOUND:
|
||||
return DEFAULT_REFRESH;
|
||||
default:
|
||||
DEBUG_ERROR_HR(status, "RegGetValue(Modes) length computation");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
LSTATUS CRegistrySettings::setDefaultRefresh(DWORD refresh)
|
||||
{
|
||||
return RegSetValueEx(hKey, L"DefaultRefresh", 0, REG_DWORD, (LPBYTE) &refresh, sizeof(DWORD));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user