From c440af11bd53afda74635be679c89e1014c4fe81 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 2 Apr 2018 11:19:17 +0200 Subject: [PATCH] user32: Support forcing the DPI awareness through the image file execution options. Signed-off-by: Alexandre Julliard --- dlls/user32/user_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 057c7aa0aa4..418359a9ce2 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -219,11 +219,23 @@ static const WCHAR *get_default_desktop(void) static void dpiaware_init(void) { WCHAR buffer[256]; + DWORD option; static const WCHAR dpiAwareW[] = {'d','p','i','A','w','a','r','e',0}; static const WCHAR dpiAwarenessW[] = {'d','p','i','A','w','a','r','e','n','e','s','s',0}; static const WCHAR namespace2005W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}; static const WCHAR namespace2016W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','6','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}; + if (!LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName, + dpiAwarenessW, REG_DWORD, &option, sizeof(option), NULL )) + { + TRACE( "got option %x\n", option ); + if (option <= 2) + { + SetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~(ULONG_PTR)option ); + return; + } + } + if (QueryActCtxSettingsW( 0, NULL, namespace2016W, dpiAwarenessW, buffer, ARRAY_SIZE(buffer), NULL )) { static const WCHAR unawareW[] = {'u','n','a','w','a','r','e',0}; -- 2.11.4.GIT