On Wed, Oct 12, 2022 at 3:08 AM Zebediah Figura <zfigura(a)codeweavers.com> wrote:
On 10/3/22 07:45, Jinoh Kang wrote:
@@ -5326,14 +5326,17 @@ BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown */ ULONG WINAPI NtUserGetProcessDpiAwarenessContext( HANDLE process ) { + DPI_AWARENESS val; + if (process && process != GetCurrentProcess()) { WARN( "not supported on other process %p\n", process ); return NTUSER_DPI_UNAWARE; }
- if (!dpi_awareness) return NTUSER_DPI_UNAWARE; - return dpi_awareness; + val = ReadAcquire( &dpi_awareness ); + if (!val) return NTUSER_DPI_UNAWARE; + return val;
Why does this need acquire semantics?
It was intended to ensure that loads by two successive NtUserGetProcessDpiAwarenessContext() calls don't get reordered with each other. If you think this won't be a problem (i.e. such reordering cannot actually happen in C++ memory model, or the user is responsible for serializing access), I'll downgrade it to ReadNoFence.