1
0
Fork 0
This commit is contained in:
gmh5225 2022-06-07 18:06:34 +08:00
parent 25ef085966
commit 0d2c5b2c91
No known key found for this signature in database
GPG Key ID: 3BBC731F40B2CEC1
1 changed files with 2 additions and 3 deletions

View File

@ -76,7 +76,7 @@ static bool isValidLocale(const QString & locale)
static void enableHighDpiScaling()
{
// https://www.vergiliusproject.com/kernels/x64/Windows%2010%20%7C%202016/2009%2020H2%20(October%202020%20Update)/_KUSER_SHARED_DATA
uint32_t NtBuildNumber = *(uint32_t*)(0x7FFE0000 + 0x260);
unsigned int NtBuildNumber = *(unsigned int*)(0x7FFE0000 + 0x260);
if(NtBuildNumber == 0 /* pre Windows-10 */ || NtBuildNumber < 15063)
{
// old windows version
@ -88,13 +88,12 @@ static void enableHighDpiScaling()
static auto user32 = LoadLibraryW(L"user32.dll");
if(user32)
{
typedef BOOL(*pfnSetProcessDpiAwarenessContext)(int value);
typedef unsigned int(*pfnSetProcessDpiAwarenessContext)(int value);
static auto pSetProcessDpiAwarenessContext = (pfnSetProcessDpiAwarenessContext)GetProcAddress(user32, "SetProcessDpiAwarenessContext");
if(pSetProcessDpiAwarenessContext)
{
pSetProcessDpiAwarenessContext(/*DPI_AWARENESS_CONTEXT_SYSTEM_AWARE*/-2);
}
}
}
}