Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force an application to use DPI virtualization on Windows 7/8

Is there a way to force an application to use DPI virtualization in Windows 8.1? I have an application that wrongly declares to be DPI aware, and displays too small on my high DPI screen (don't have the source). It would be sufficient if it was scaled up 2x by Windows.

I tried editing the .exe's manifest, and setting <dpiAware>false</dpiAware>, but it had no effect. (It might have made the few pieces of the application that used a larger (appropriate) font use a small font (in pixels), like I'd expect for DPI virtualization, I'm not entirely sure... but it certainly did not activate the DWM scaling.)

What can I do? I read that other settings in the manifest may affect DPI virtualization other than dpiAware, is this true? The app might be setting DPI awareness at runtime via API, how can I find out if this is the case?

(Posting this here and not on superuser because there is no user-facing setting for this, and I expect the answer to be something along the lines of "edit the manifest such-and-such" or "inject a DLL/attach a debugger and do this". Also the fact that I don't have the source is secondary, I also have in-house apps where I have the source and would like to fix, and I'm asking for the more general solution that would fix both cases. I hope that's OK.)

like image 968
jdm Avatar asked Feb 28 '14 21:02

jdm


1 Answers

I just released a DLL that hooks and redirects calls to SetProcessDPIAware. For applications that disable DPI scaling through code, this is a fast and easy fix (compared to binary patching). Just load the offending application with a tool like CFF Explorer and add this DLL to the import table. (Alternatively, it could be injected dynamically at application launch.)

Note that the current release only hooks SetProcessDPIAware and leaves SetProcessDPIAwareness untouched. If that's an issue, feel free to ping me and I'll hook both.

DPIMangler: Blog post, source code.

like image 188
George Avatar answered Oct 07 '22 01:10

George