mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 05:34:20 +01:00
Global (Windows): prefers NTAPI for querying registry values
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "displayserver.h"
|
||||
#include "common/windows/unicode.h"
|
||||
#include "common/edidHelper.h"
|
||||
#include "common/windows/registry.h"
|
||||
#include "common/windows/unicode.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellscalingapi.h>
|
||||
@@ -49,8 +50,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
.id = path->targetInfo.id,
|
||||
},
|
||||
};
|
||||
uint8_t edidData[1024];
|
||||
DWORD edidLength = 0;
|
||||
FF_LIST_AUTO_DESTROY edid = ffListCreate(sizeof(uint8_t));
|
||||
|
||||
if(DisplayConfigGetDeviceInfo(&targetName.header) == ERROR_SUCCESS)
|
||||
{
|
||||
@@ -69,16 +69,17 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
}
|
||||
wcscpy(pRegPath, L"Device Parameters");
|
||||
|
||||
edidLength = ARRAY_SIZE(edidData);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, regPath, L"EDID", RRF_RT_REG_BINARY, NULL, edidData, &edidLength) == ERROR_SUCCESS &&
|
||||
edidLength > 0 && edidLength % 128 == 0)
|
||||
FF_AUTO_CLOSE_FD HANDLE hKey = NULL;
|
||||
if (ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, regPath, &hKey, NULL) &&
|
||||
ffRegReadData(hKey, L"EDID", &edid, NULL) &&
|
||||
ffEdidIsValid(edid.data, edid.length))
|
||||
{
|
||||
ffEdidGetName(edidData, &name);
|
||||
ffEdidGetPhysicalSize(edidData, &physicalWidth, &physicalHeight);
|
||||
ffEdidGetName(edid.data, &name);
|
||||
ffEdidGetPhysicalSize(edid.data, &physicalWidth, &physicalHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
edidLength = 0;
|
||||
ffListClear(&edid);
|
||||
if (targetName.flags.friendlyNameFromEdid)
|
||||
ffStrbufSetWS(&name, targetName.monitorFriendlyDeviceName);
|
||||
else
|
||||
@@ -209,8 +210,8 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
else
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNKNOWN;
|
||||
}
|
||||
if (edidLength > 0)
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
if (edid.length > 0)
|
||||
ffEdidGetSerialAndManufactureDate(edid.data, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
display->drrStatus = path->flags & DISPLAYCONFIG_PATH_BOOST_REFRESH_RATE ? FF_DISPLAY_DRR_STATUS_ENABLED : FF_DISPLAY_DRR_STATUS_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user