Author: jimtabor
Date: Thu Nov 24 18:18:28 2016
New Revision: 73372

URL: http://svn.reactos.org/svn/reactos?rev=73372&view=rev
Log:
[Win32SS]
- HAX : Fix paint message spam. See CORE-12169 and related issues.

Modified:
    trunk/reactos/win32ss/user/ntuser/message.c
    trunk/reactos/win32ss/user/ntuser/painting.c
    trunk/reactos/win32ss/user/ntuser/painting.h

Modified: trunk/reactos/win32ss/user/ntuser/message.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/message.c?rev=73372&r1=73371&r2=73372&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Thu Nov 24 
18:18:28 2016
@@ -789,8 +789,8 @@
     {
         Window->state2 &= ~WNDS2_WMPAINTSENT;
         /* send a WM_ERASEBKGND if the non-client area is still invalid */
-        ERR("Message WM_PAINT\n");
-        co_IntPaintWindows( Window, RDW_NOCHILDREN, FALSE );
+        ERR("Message WM_PAINT count %d Internal Paint Set? 
%s\n",Window->head.pti->cPaintsReady, Window->state & WNDS_INTERNALPAINT ? 
"TRUE" : "FALSE");
+        IntPaintWindow( Window );
     }
 
     return retval;

Modified: trunk/reactos/win32ss/user/ntuser/painting.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painting.c?rev=73372&r1=73371&r2=73372&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/painting.c        [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/painting.c        [iso-8859-1] Thu Nov 24 
18:18:28 2016
@@ -1157,6 +1157,36 @@
    return Window;
 }
 
+//
+// Hax around internal painting of windows.
+//
+VOID FASTCALL
+IntPaintWindow( PWND Window )
+{
+   // Handle normal painting.
+   co_IntPaintWindows( Window, RDW_NOCHILDREN, FALSE );
+
+   // Hack to prevent more spamming from misbehaving application.
+   // Handle it like a begin/end paint
+   if (Window->hrgnUpdate != NULL)
+   {
+      ERR("HAX hrgnUpdate not NULL! Dec Paint Count!\n");
+      MsqDecPaintCountQueue(Window->head.pti);
+      IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
+      GreDeleteObject(Window->hrgnUpdate);
+      Window->state &= ~WNDS_UPDATEDIRTY;
+      Window->hrgnUpdate = NULL;
+   }
+   else
+   {
+      if (!(Window->state & WNDS_INTERNALPAINT))
+      {
+         ERR("HAX WNDS_INTERNALPAINT not set! Dec Paint Count!\n");
+         MsqDecPaintCountQueue(Window->head.pti);
+      }
+   }
+}
+
 BOOL FASTCALL
 IntGetPaintMessage(
    PWND Window,

Modified: trunk/reactos/win32ss/user/ntuser/painting.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painting.h?rev=73372&r1=73371&r2=73372&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/painting.h        [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/painting.h        [iso-8859-1] Thu Nov 24 
18:18:28 2016
@@ -40,3 +40,4 @@
 BOOL UserDrawCaption(PWND,HDC,RECTL*,HFONT,HICON,const PUNICODE_STRING,UINT);
 VOID FASTCALL UpdateThreadWindows(PWND,PTHREADINFO,HRGN);
 VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags);
+VOID FASTCALL IntPaintWindow(PWND);


Reply via email to