Signed-off-by: Paul Gofman pgofman@codeweavers.com --- The failing case is similar to the previous patch but now getting GL drawable in winex11.drv faile due to WindowFromDC() fails through GetDCHook() which can't get_dc_ptr() on the context. Also, SetHookFlags() is already using get_dc_obj() so maybe doing the same in SetDCHook() and GetDCHook() makes sense regardless.
dlls/win32u/dc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 9c09bf66e03..cb38c4161ee 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -1007,13 +1007,18 @@ BOOL WINAPI NtGdiGetTransform( HDC hdc, DWORD which, XFORM *xform ) */ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData ) { - DC *dc = get_dc_ptr( hdc ); + DC *dc = get_dc_obj( hdc );
if (!dc) return FALSE; + if (dc->attr->disabled) + { + GDI_ReleaseObj( hdc ); + return 0; + }
dc->dwHookData = dwHookData; dc->hookProc = hookProc; - release_dc_ptr( dc ); + GDI_ReleaseObj( hdc ); return TRUE; }
@@ -1025,13 +1030,18 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData ) */ DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc ) { - DC *dc = get_dc_ptr( hdc ); + DC *dc = get_dc_obj( hdc ); DWORD_PTR ret;
if (!dc) return 0; + if (dc->attr->disabled) + { + GDI_ReleaseObj( hdc ); + return 0; + } if (proc) *proc = dc->hookProc; ret = dc->dwHookData; - release_dc_ptr( dc ); + GDI_ReleaseObj( hdc ); return ret; }