ReactOS  0.4.13-dev-39-g8b6696f
painting.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Win32k subsystem
4  * PURPOSE: Window painting function
5  * FILE: win32ss/user/ntuser/painting.c
6  * PROGRAMER: Filip Navara (xnavara@volny.cz)
7  */
8 
9 #include <win32k.h>
10 DBG_DEFAULT_CHANNEL(UserPainting);
11 
13  LPCWSTR lpString, UINT count);
14 
15 /* PRIVATE FUNCTIONS **********************************************************/
16 
36 {
37  PWND ParentWnd;
38 
39  if (Child->ExStyle & WS_EX_REDIRECTED)
40  return TRUE;
41 
42  ParentWnd = Child->spwndParent;
43  while (ParentWnd != NULL)
44  {
45  if (!(ParentWnd->style & WS_VISIBLE) ||
46  (ParentWnd->style & WS_MINIMIZE) ||
47  !RECTL_bIntersectRect(WindowRect, WindowRect, &ParentWnd->rcClient) )
48  {
49  return FALSE;
50  }
51 
52  if (ParentWnd->ExStyle & WS_EX_REDIRECTED)
53  return TRUE;
54 
55  ParentWnd = ParentWnd->spwndParent;
56  }
57 
58  return TRUE;
59 }
60 
63 {
64  RECTL ParentRect, Rect;
65  BOOL Start, Ret = TRUE;
66  PWND ParentWnd = Child;
67  PREGION Rgn = NULL;
68 
69  if (ParentWnd->style & WS_CHILD)
70  {
71  do
72  ParentWnd = ParentWnd->spwndParent;
73  while (ParentWnd->style & WS_CHILD);
74  }
75 
76  // No pending nonclient paints.
77  if (!(ParentWnd->state & WNDS_SYNCPAINTPENDING)) Recurse = FALSE;
78 
79  Start = TRUE;
80  ParentWnd = Child->spwndParent;
81  while (ParentWnd)
82  {
83  if (ParentWnd->style & WS_CLIPCHILDREN)
84  break;
85 
86  if (ParentWnd->hrgnUpdate != 0)
87  {
88  if (Recurse)
89  {
90  Ret = FALSE;
91  break;
92  }
93  // Start with child clipping.
94  if (Start)
95  {
96  Start = FALSE;
97 
98  Rect = Child->rcWindow;
99 
100  if (!IntIntersectWithParents(Child, &Rect)) break;
101 
103 
104  if (Child->hrgnClip)
105  {
106  PREGION RgnClip = REGION_LockRgn(Child->hrgnClip);
107  IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
108  REGION_UnlockRgn(RgnClip);
109  }
110  }
111 
112  ParentRect = ParentWnd->rcWindow;
113 
114  if (!IntIntersectWithParents(ParentWnd, &ParentRect)) break;
115 
116  IntInvalidateWindows( ParentWnd,
117  Rgn,
119  }
120  ParentWnd = ParentWnd->spwndParent;
121  }
122 
123  if (Rgn) REGION_Delete(Rgn);
124 
125  return Ret;
126 }
127 
128 /*
129  Synchronize painting to the top-level windows of other threads.
130 */
133 {
134  PTHREADINFO ptiCur, ptiWnd;
137  BOOL bSend = TRUE;
138 
139  ptiWnd = Wnd->head.pti;
141  /*
142  Not the current thread, Wnd is in send Nonclient paint also in send erase background and it is visiable.
143  */
144  if ( Wnd->head.pti != ptiCur &&
145  Wnd->state & WNDS_SENDNCPAINT &&
147  Wnd->style & WS_VISIBLE)
148  {
149  // For testing, if you see this, break out the Champagne and have a party!
150  TRACE("SendSyncPaint Wnd in State!\n");
151  if (!IsListEmpty(&ptiWnd->SentMessagesListHead))
152  {
153  // Scan sent queue messages to see if we received sync paint messages.
154  Entry = ptiWnd->SentMessagesListHead.Flink;
156  do
157  {
158  ERR("LOOP it\n");
159  if (Message->Msg.message == WM_SYNCPAINT &&
160  Message->Msg.hwnd == UserHMGetHandle(Wnd))
161  { // Already received so exit out.
162  ERR("SendSyncPaint Found one in the Sent Msg Queue!\n");
163  bSend = FALSE;
164  break;
165  }
166  Entry = Message->ListEntry.Flink;
168  }
169  while (Entry != &ptiWnd->SentMessagesListHead);
170  }
171  if (bSend)
172  {
173  TRACE("Sending WM_SYNCPAINT\n");
174  // This message has no parameters. But it does! Pass Flags along.
177  }
178  }
179 
180  // Send to all the children if this is the desktop window.
181  if (UserIsDesktopWindow(Wnd))
182  {
183  if ( Flags & RDW_ALLCHILDREN ||
184  ( !(Flags & RDW_NOCHILDREN) && Wnd->style & WS_CLIPCHILDREN))
185  {
186  PWND spwndChild = Wnd->spwndChild;
187  while(spwndChild)
188  {
189  if ( spwndChild->style & WS_CHILD &&
190  spwndChild->head.pti != ptiCur)
191  {
192  spwndChild = spwndChild->spwndNext;
193  continue;
194  }
195  IntSendSyncPaint( spwndChild, Flags );
196  spwndChild = spwndChild->spwndNext;
197  }
198  }
199  }
200 }
201 
202 /*
203  * @name IntCalcWindowRgn
204  *
205  * Get a window or client region.
206  */
207 
208 HRGN FASTCALL
210 {
211  HRGN hRgnWindow;
212 
213  if (Client)
214  {
215  hRgnWindow = NtGdiCreateRectRgn(
216  Wnd->rcClient.left,
217  Wnd->rcClient.top,
218  Wnd->rcClient.right,
219  Wnd->rcClient.bottom);
220  }
221  else
222  {
223  hRgnWindow = NtGdiCreateRectRgn(
224  Wnd->rcWindow.left,
225  Wnd->rcWindow.top,
226  Wnd->rcWindow.right,
227  Wnd->rcWindow.bottom);
228  }
229 
230  if (Wnd->hrgnClip != NULL && !(Wnd->style & WS_MINIMIZE))
231  {
232  NtGdiOffsetRgn(hRgnWindow,
233  -Wnd->rcWindow.left,
234  -Wnd->rcWindow.top);
235  NtGdiCombineRgn(hRgnWindow, hRgnWindow, Wnd->hrgnClip, RGN_AND);
236  NtGdiOffsetRgn(hRgnWindow,
237  Wnd->rcWindow.left,
238  Wnd->rcWindow.top);
239  }
240 
241  return hRgnWindow;
242 }
243 
244 /*
245  * @name IntGetNCUpdateRgn
246  *
247  * Get non-client update region of a window and optionally validate it.
248  *
249  * @param Window
250  * Pointer to window to get the NC update region from.
251  * @param Validate
252  * Set to TRUE to force validating the NC update region.
253  *
254  * @return
255  * Handle to NC update region. The caller is responsible for deleting
256  * it.
257  */
258 
259 HRGN FASTCALL
261 {
262  HRGN hRgnNonClient;
263  HRGN hRgnWindow;
264  UINT RgnType, NcType;
265  RECT update;
266 
267  if (Window->hrgnUpdate != NULL &&
268  Window->hrgnUpdate != HRGN_WINDOW)
269  {
270  hRgnNonClient = IntCalcWindowRgn(Window, FALSE);
271 
272  /*
273  * If region creation fails it's safe to fallback to whole
274  * window region.
275  */
276  if (hRgnNonClient == NULL)
277  {
278  return HRGN_WINDOW;
279  }
280 
281  hRgnWindow = IntCalcWindowRgn(Window, TRUE);
282  if (hRgnWindow == NULL)
283  {
284  GreDeleteObject(hRgnNonClient);
285  return HRGN_WINDOW;
286  }
287 
288  NcType = IntGdiGetRgnBox(hRgnNonClient, &update);
289 
290  RgnType = NtGdiCombineRgn(hRgnNonClient, hRgnNonClient, hRgnWindow, RGN_DIFF);
291 
292  if (RgnType == ERROR)
293  {
294  GreDeleteObject(hRgnWindow);
295  GreDeleteObject(hRgnNonClient);
296  return HRGN_WINDOW;
297  }
298  else if (RgnType == NULLREGION)
299  {
300  GreDeleteObject(hRgnWindow);
301  GreDeleteObject(hRgnNonClient);
302  Window->state &= ~WNDS_UPDATEDIRTY;
303  return NULL;
304  }
305 
306  /*
307  * Remove the nonclient region from the standard update region if
308  * we were asked for it.
309  */
310 
311  if (Validate)
312  {
313  if (NtGdiCombineRgn(Window->hrgnUpdate, Window->hrgnUpdate, hRgnWindow, RGN_AND) == NULLREGION)
314  {
316  GreDeleteObject(Window->hrgnUpdate);
317  Window->state &= ~WNDS_UPDATEDIRTY;
318  Window->hrgnUpdate = NULL;
319  if (!(Window->state & WNDS_INTERNALPAINT))
320  MsqDecPaintCountQueue(Window->head.pti);
321  }
322  }
323 
324  /* check if update rgn contains complete nonclient area */
325  if (NcType == SIMPLEREGION)
326  {
327  RECT window;
329 
330  if (IntEqualRect( &window, &update ))
331  {
332  GreDeleteObject(hRgnNonClient);
333  hRgnNonClient = HRGN_WINDOW;
334  }
335  }
336 
337  GreDeleteObject(hRgnWindow);
338 
339  return hRgnNonClient;
340  }
341  else
342  {
343  return Window->hrgnUpdate;
344  }
345 }
346 
349 {
350  pWnd->state &= ~WNDS_SENDNCPAINT;
351 
352  if ( pWnd == GetW32ThreadInfo()->MessageQueue->spwndActive &&
353  !(pWnd->state & WNDS_ACTIVEFRAME))
354  {
355  pWnd->state |= WNDS_ACTIVEFRAME;
356  pWnd->state &= ~WNDS_NONCPAINT;
357  hRgn = HRGN_WINDOW;
358  }
359 
361  {
363  hRgn = HRGN_WINDOW;
364  }
365 
367 }
368 
371 {
372  for (pWnd = pWnd->spwndChild; pWnd; pWnd = pWnd->spwndNext)
373  {
374  if ((pWnd->hrgnUpdate == NULL) && (pWnd->state & WNDS_SENDNCPAINT))
375  {
377  UserRefObjectCo(pWnd, &Ref);
379  UserDerefObjectCo(pWnd);
380  }
381  }
382 }
383 
384 /*
385  * IntPaintWindows
386  *
387  * Internal function used by IntRedrawWindow.
388  */
389 
392 {
393  HDC hDC;
394  HWND hWnd = Wnd->head.h;
395  HRGN TempRegion = NULL;
396 
397  Wnd->state &= ~WNDS_PAINTNOTPROCESSED;
398 
399  if (Wnd->state & WNDS_SENDNCPAINT ||
401  {
402  if (!(Wnd->style & WS_VISIBLE))
403  {
405  return;
406  }
407  else
408  {
409  if (Wnd->hrgnUpdate == NULL)
410  {
412  }
413 
414  if (Wnd->head.pti == PsGetCurrentThreadWin32Thread())
415  {
416  if (Wnd->state & WNDS_SENDNCPAINT)
417  {
418  TempRegion = IntGetNCUpdateRgn(Wnd, TRUE);
419 
420  IntSendNCPaint(Wnd, TempRegion);
421 
422  if (TempRegion > HRGN_WINDOW && GreIsHandleValid(TempRegion))
423  {
424  /* NOTE: The region can already be deleted! */
425  GreDeleteObject(TempRegion);
426  }
427  }
428 
429  if (Wnd->state & WNDS_SENDERASEBACKGROUND)
430  {
432  if (Wnd->hrgnUpdate)
433  {
434  hDC = UserGetDCEx( Wnd,
435  Wnd->hrgnUpdate,
437 
438  if (Wnd->head.pti->ppi != pti->ppi)
439  {
440  ERR("Sending DC to another Process!!!\n");
441  }
442 
444  // Kill the loop, so Clear before we send.
446  {
448  }
449  UserReleaseDC(Wnd, hDC, FALSE);
450  }
451  }
452  }
453 
454  }
455  }
456 
457  /*
458  * Check that the window is still valid at this point
459  */
460  if (!IntIsWindow(hWnd))
461  {
462  return;
463  }
464 
465  /*
466  * Paint child windows.
467  */
468 
469  if (!(Flags & RDW_NOCHILDREN) &&
470  !(Wnd->style & WS_MINIMIZE) &&
471  ( Flags & RDW_ALLCHILDREN ||
472  (Flags & RDW_CLIPCHILDREN && Wnd->style & WS_CLIPCHILDREN) ) )
473  {
474  HWND *List, *phWnd;
476 
477  if ((List = IntWinListChildren(Wnd)))
478  {
479  for (phWnd = List; *phWnd; ++phWnd)
480  {
481  if ((Wnd = UserGetWindowObject(*phWnd)) == NULL)
482  continue;
483 
484  if (Wnd->head.pti != pti && Wnd->style & WS_CHILD)
485  continue;
486 
487  if (Wnd->style & WS_VISIBLE)
488  {
490  UserRefObjectCo(Wnd, &Ref);
492  UserDerefObjectCo(Wnd);
493  }
494  }
496  }
497  }
498 }
499 
500 /*
501  * IntUpdateWindows
502  *
503  * Internal function used by IntRedrawWindow, simplecall.
504  */
505 
508 {
509  HWND hWnd = Wnd->head.h;
510 
511  if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
512  {
513  if (Wnd->hrgnUpdate)
514  {
515  if (!IntValidateParents(Wnd, Recurse))
516  {
517  return;
518  }
519  }
520 
521  if (Wnd->state & WNDS_INTERNALPAINT)
522  {
523  Wnd->state &= ~WNDS_INTERNALPAINT;
524 
525  if (Wnd->hrgnUpdate == NULL)
526  MsqDecPaintCountQueue(Wnd->head.pti);
527  }
528 
530  Wnd->state &= ~WNDS_UPDATEDIRTY;
531 
532  Wnd->state2 |= WNDS2_WMPAINTSENT;
534 
535  if (Wnd->state & WNDS_PAINTNOTPROCESSED)
536  {
538  UserRefObjectCo(Wnd, &Ref);
540  UserDerefObjectCo(Wnd);
541  }
542  }
543 
544  // Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.
545  Flags = (Flags & RDW_NOCHILDREN) ? RDW_NOCHILDREN : RDW_ALLCHILDREN; // All children is the default.
546 
547  /*
548  * Update child windows.
549  */
550 
551  if (!(Flags & RDW_NOCHILDREN) &&
552  (Flags & RDW_ALLCHILDREN) &&
553  !UserIsDesktopWindow(Wnd))
554  {
555  PWND Child;
556 
557  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
558  {
559  /* transparent window, check for non-transparent sibling to paint first, then skip it */
560  if ( Child->ExStyle & WS_EX_TRANSPARENT &&
561  ( Child->hrgnUpdate != NULL || Child->state & WNDS_INTERNALPAINT ) )
562  {
563  PWND Next = Child->spwndNext;
564  while (Next)
565  {
566  if ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT ) break;
567 
568  Next = Next->spwndNext;
569  }
570 
571  if (Next) continue;
572  }
573 
574  if (Child->style & WS_VISIBLE)
575  {
577  UserRefObjectCo(Child, &Ref);
580  }
581  }
582  }
583 }
584 
587 {
588  // If transparent and any sibling windows below needs to be painted, leave.
589  if (pWnd->ExStyle & WS_EX_TRANSPARENT)
590  {
591  PWND Next = pWnd->spwndNext;
592 
593  while(Next)
594  {
595  if ( Next->head.pti == pWnd->head.pti &&
596  ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT) )
597  {
598  return;
599  }
600 
601  Next = Next->spwndNext;
602  }
603  }
605 }
606 
609 {
610  PWND Parent = pWnd;
611  // Find parent, if it needs to be painted, leave.
612  while(TRUE)
613  {
614  if ((Parent = Parent->spwndParent) == NULL) break;
615  if ( Parent->style & WS_CLIPCHILDREN ) break;
616  if ( Parent->hrgnUpdate != NULL || Parent->state & WNDS_INTERNALPAINT ) return;
617  }
618 
619  IntSendSyncPaint(pWnd, Flags);
621 }
622 
623 /*
624  * IntInvalidateWindows
625  *
626  * Internal function used by IntRedrawWindow, UserRedrawDesktop,
627  * co_WinPosSetWindowPos, co_UserRedrawWindow.
628  */
631 {
632  INT RgnType = NULLREGION;
633  BOOL HadPaintMessage;
634 
635  TRACE("IntInvalidateWindows start Rgn %p\n",Rgn);
636 
637  if ( Rgn > PRGN_WINDOW )
638  {
639  /*
640  * If the nonclient is not to be redrawn, clip the region to the client
641  * rect
642  */
643  if ((Flags & RDW_INVALIDATE) != 0 && (Flags & RDW_FRAME) == 0)
644  {
645  PREGION RgnClient;
646 
647  RgnClient = IntSysCreateRectpRgnIndirect(&Wnd->rcClient);
648  if (RgnClient)
649  {
650  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClient, RGN_AND);
651  REGION_Delete(RgnClient);
652  }
653  }
654 
655  /*
656  * Clip the given region with window rectangle (or region)
657  */
658 
659  if (!Wnd->hrgnClip || (Wnd->style & WS_MINIMIZE))
660  {
661  PREGION RgnWindow = IntSysCreateRectpRgnIndirect(&Wnd->rcWindow);
662  if (RgnWindow)
663  {
664  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnWindow, RGN_AND);
665  REGION_Delete(RgnWindow);
666  }
667  }
668  else
669  {
670  PREGION RgnClip = REGION_LockRgn(Wnd->hrgnClip);
671  if (RgnClip)
672  {
673  REGION_bOffsetRgn(Rgn,
674  -Wnd->rcWindow.left,
675  -Wnd->rcWindow.top);
676  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
677  REGION_bOffsetRgn(Rgn,
678  Wnd->rcWindow.left,
679  Wnd->rcWindow.top);
680  REGION_UnlockRgn(RgnClip);
681  }
682  }
683  }
684  else
685  {
686  RgnType = NULLREGION;
687  }
688 
689  /*
690  * Save current state of pending updates
691  */
692 
693  HadPaintMessage = IntIsWindowDirty(Wnd);
694 
695  /*
696  * Update the region and flags
697  */
698 
699  // The following flags are used to invalidate the window.
701  {
702  if (Flags & RDW_INTERNALPAINT)
703  {
704  Wnd->state |= WNDS_INTERNALPAINT;
705  }
706 
707  if (Flags & RDW_INVALIDATE )
708  {
709  PREGION RgnUpdate;
710 
711  Wnd->state &= ~WNDS_NONCPAINT;
712 
713  /* If not the same thread set it dirty. */
714  if (Wnd->head.pti != PsGetCurrentThreadWin32Thread())
715  {
716  Wnd->state |= WNDS_UPDATEDIRTY;
717  if (Wnd->state2 & WNDS2_WMPAINTSENT)
719  }
720 
721  if (Flags & RDW_FRAME)
722  Wnd->state |= WNDS_SENDNCPAINT;
723 
724  if (Flags & RDW_ERASE)
726 
727  if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
728  {
729  if (Wnd->hrgnUpdate == NULL)
730  {
731  Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
733  }
734 
735  if (Wnd->hrgnUpdate != HRGN_WINDOW)
736  {
737  RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
738  if (RgnUpdate)
739  {
740  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_OR);
741  REGION_UnlockRgn(RgnUpdate);
742  if (RgnType == NULLREGION)
743  {
746  Wnd->hrgnUpdate = NULL;
747  }
748  }
749  }
750  }
751 
752  Flags |= RDW_ERASE|RDW_FRAME; // For children.
753 
754  }
755 
756  if (!HadPaintMessage && IntIsWindowDirty(Wnd))
757  {
758  MsqIncPaintCountQueue(Wnd->head.pti);
759  }
760 
761  } // The following flags are used to validate the window.
763  {
764  if (Wnd->state & WNDS_UPDATEDIRTY && !(Flags & RDW_NOUPDATEDIRTY))
765  return;
766 
768  {
769  Wnd->state &= ~WNDS_INTERNALPAINT;
770  }
771 
772  if (Flags & RDW_VALIDATE)
773  {
774  if (Flags & RDW_NOFRAME)
775  Wnd->state &= ~WNDS_SENDNCPAINT;
776 
777  if (Flags & RDW_NOERASE)
779 
780  if (Wnd->hrgnUpdate > HRGN_WINDOW && RgnType != NULLREGION && Rgn > PRGN_WINDOW)
781  {
782  PREGION RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
783 
784  if (RgnUpdate)
785  {
786  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_DIFF);
787  REGION_UnlockRgn(RgnUpdate);
788 
789  if (RgnType == NULLREGION)
790  {
793  Wnd->hrgnUpdate = NULL;
794  }
795  }
796  }
797  // If update is null, do not erase.
798  if (Wnd->hrgnUpdate == NULL)
799  {
801  }
802  }
803 
804  if (HadPaintMessage && !IntIsWindowDirty(Wnd))
805  {
806  MsqDecPaintCountQueue(Wnd->head.pti);
807  }
808  }
809 
810  /*
811  * Process children if needed
812  */
813 
814  if (!(Flags & RDW_NOCHILDREN) &&
815  !(Wnd->style & WS_MINIMIZE) &&
816  ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)))
817  {
818  PWND Child;
819 
820  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
821  {
822  if (Child->style & WS_VISIBLE)
823  {
824  /*
825  * Recursive call to update children hrgnUpdate
826  */
827  PREGION RgnTemp = IntSysCreateRectpRgn(0, 0, 0, 0);
828  if (RgnTemp)
829  {
830  if (Rgn > PRGN_WINDOW) IntGdiCombineRgn(RgnTemp, Rgn, 0, RGN_COPY);
831  IntInvalidateWindows(Child, ((Rgn > PRGN_WINDOW)?RgnTemp:Rgn), Flags);
832  REGION_Delete(RgnTemp);
833  }
834  }
835  }
836  }
837  TRACE("IntInvalidateWindows exit\n");
838 }
839 
840 /*
841  * IntIsWindowDrawable
842  *
843  * Remarks
844  * Window is drawable when it is visible and all parents are not
845  * minimized.
846  */
847 
850 {
851  PWND WndObject;
852 
853  for (WndObject = Wnd; WndObject != NULL; WndObject = WndObject->spwndParent)
854  {
855  if ( WndObject->state2 & WNDS2_INDESTROY ||
856  WndObject->state & WNDS_DESTROYED ||
857  !WndObject ||
858  !(WndObject->style & WS_VISIBLE) ||
859  ((WndObject->style & WS_MINIMIZE) && (WndObject != Wnd)))
860  {
861  return FALSE;
862  }
863  }
864 
865  return TRUE;
866 }
867 
868 /*
869  * IntRedrawWindow
870  *
871  * Internal version of NtUserRedrawWindow that takes WND as
872  * first parameter.
873  */
874 
877  PWND Window,
878  const RECTL* UpdateRect,
879  PREGION UpdateRgn,
880  ULONG Flags)
881 {
882  PREGION TmpRgn = NULL;
883  TRACE("co_UserRedrawWindow start Rgn %p\n",UpdateRgn);
884 
885  /*
886  * Step 1.
887  * Validation of passed parameters.
888  */
889 
891  {
892  return TRUE; // Just do nothing!!!
893  }
894 
895  if (Window == NULL)
896  {
898  }
899 
900  /*
901  * Step 2.
902  * Transform the parameters UpdateRgn and UpdateRect into
903  * a region hRgn specified in screen coordinates.
904  */
905 
906  if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
907  {
908  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
909  * so use a copy instead */
910  if (UpdateRgn)
911  {
912  TmpRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
913 
914  if (UpdateRgn > PRGN_WINDOW)
915  {
916  IntGdiCombineRgn(TmpRgn, UpdateRgn, NULL, RGN_COPY);
917  }
918 
919  if (Window != UserGetDesktopWindow())
920  {
921  REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top);
922  }
923  }
924  else
925  {
926  if (UpdateRect != NULL)
927  {
928  if (Window == UserGetDesktopWindow())
929  {
931  }
932  else
933  {
934  TmpRgn = IntSysCreateRectpRgn(Window->rcClient.left + UpdateRect->left,
935  Window->rcClient.top + UpdateRect->top,
936  Window->rcClient.left + UpdateRect->right,
937  Window->rcClient.top + UpdateRect->bottom);
938  }
939  }
940  else
941  {
944  {
945  if (!RECTL_bIsEmptyRect(&Window->rcWindow))
946  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcWindow);
947  }
948  else
949  {
950  if (!RECTL_bIsEmptyRect(&Window->rcClient))
951  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcClient);
952  }
953  }
954  }
955  }
956 
957  /* Fixes test RDW_INTERNALPAINT behavior */
958  if (TmpRgn == NULL)
959  {
960  TmpRgn = PRGN_WINDOW; // Need a region so the bits can be set!!!
961  }
962 
963  /*
964  * Step 3.
965  * Adjust the window update region depending on hRgn and flags.
966  */
967 
969  TmpRgn != NULL)
970  {
972  }
973 
974  /*
975  * Step 4.
976  * Repaint and erase windows if needed.
977  */
978 
979  if (Flags & RDW_UPDATENOW)
980  {
982  }
983  else if (Flags & RDW_ERASENOW)
984  {
985  if ((Flags & (RDW_NOCHILDREN|RDW_ALLCHILDREN)) == 0)
987 
989  }
990 
991  /*
992  * Step 5.
993  * Cleanup ;-)
994  */
995 
996  if (TmpRgn > PRGN_WINDOW)
997  {
998  REGION_Delete(TmpRgn);
999  }
1000  TRACE("co_UserRedrawWindow exit\n");
1001 
1002  return TRUE;
1003 }
1004 
1005 VOID FASTCALL
1006 PaintSuspendedWindow(PWND pwnd, HRGN hrgnOrig)
1007 {
1008  if (pwnd->hrgnUpdate)
1009  {
1010  HDC hDC;
1012  HRGN hrgnTemp;
1013  RECT Rect;
1014  INT type;
1015  PREGION prgn;
1016 
1017  if (pwnd->hrgnUpdate > HRGN_WINDOW)
1018  {
1019  hrgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1020  type = NtGdiCombineRgn( hrgnTemp, pwnd->hrgnUpdate, 0, RGN_COPY);
1021  if (type == ERROR)
1022  {
1023  GreDeleteObject(hrgnTemp);
1024  hrgnTemp = HRGN_WINDOW;
1025  }
1026  }
1027  else
1028  {
1029  hrgnTemp = GreCreateRectRgnIndirect(&pwnd->rcWindow);
1030  }
1031 
1032  if ( hrgnOrig &&
1033  hrgnTemp > HRGN_WINDOW &&
1034  NtGdiCombineRgn(hrgnTemp, hrgnTemp, hrgnOrig, RGN_AND) == NULLREGION)
1035  {
1036  GreDeleteObject(hrgnTemp);
1037  return;
1038  }
1039 
1041 
1042  Rect = pwnd->rcWindow;
1043  RECTL_vOffsetRect(&Rect, -pwnd->rcWindow.left, -pwnd->rcWindow.top);
1044 
1045  // Clear out client area!
1047 
1048  NC_DoNCPaint(pwnd, hDC, Flags); // Redraw without MENUs.
1049 
1050  UserReleaseDC(pwnd, hDC, FALSE);
1051 
1052  prgn = REGION_LockRgn(hrgnTemp);
1054  REGION_UnlockRgn(prgn);
1055 
1056  // Set updates for this window.
1058 
1059  // DCX_KEEPCLIPRGN is set. Check it anyway.
1060  if (hrgnTemp > HRGN_WINDOW && GreIsHandleValid(hrgnTemp)) GreDeleteObject(hrgnTemp);
1061  }
1062 }
1063 
1064 VOID FASTCALL
1066 {
1067  PaintSuspendedWindow( pWnd, hRgn );
1068 
1069  if (!(pWnd->style & WS_CLIPCHILDREN))
1070  return;
1071 
1072  pWnd = pWnd->spwndChild; // invalidate children if any.
1073  while (pWnd)
1074  {
1075  UpdateTheadChildren( pWnd, hRgn );
1076  pWnd = pWnd->spwndNext;
1077  }
1078 }
1079 
1080 VOID FASTCALL
1082 {
1083  PWND pwndTemp;
1084 
1085  for ( pwndTemp = pWnd;
1086  pwndTemp;
1087  pwndTemp = pwndTemp->spwndNext )
1088  {
1089  if (pwndTemp->head.pti == pti)
1090  {
1092  }
1093  else
1094  {
1095  if (IsThreadSuspended(pwndTemp->head.pti) || MsqIsHung(pwndTemp->head.pti))
1096  {
1097  UpdateTheadChildren(pwndTemp, hRgn);
1098  }
1099  else
1101  }
1102  }
1103 }
1104 
1105 BOOL FASTCALL
1107 {
1108  return ( Wnd->style & WS_VISIBLE &&
1109  ( Wnd->hrgnUpdate != NULL ||
1110  Wnd->state & WNDS_INTERNALPAINT ) );
1111 }
1112 
1113 /*
1114  Conditions to paint any window:
1115 
1116  1. Update region is not null.
1117  2. Internal paint flag is set.
1118  3. Paint count is not zero.
1119 
1120  */
1121 PWND FASTCALL
1123 {
1124  PWND hChild;
1125  PWND TempWindow;
1126 
1127  for (; Window != NULL; Window = Window->spwndNext)
1128  {
1130  {
1131  if (IntIsWindowDirty(Window))
1132  {
1133  /* Make sure all non-transparent siblings are already drawn. */
1134  if (Window->ExStyle & WS_EX_TRANSPARENT)
1135  {
1136  for (TempWindow = Window->spwndNext; TempWindow != NULL;
1137  TempWindow = TempWindow->spwndNext)
1138  {
1139  if (!(TempWindow->ExStyle & WS_EX_TRANSPARENT) &&
1140  IntWndBelongsToThread(TempWindow, Thread) &&
1141  IntIsWindowDirty(TempWindow))
1142  {
1143  return TempWindow;
1144  }
1145  }
1146  }
1147  return Window;
1148  }
1149  }
1150  /* find a child of the specified window that needs repainting */
1151  if (Window->spwndChild)
1152  {
1153  hChild = IntFindWindowToRepaint(Window->spwndChild, Thread);
1154  if (hChild != NULL)
1155  return hChild;
1156  }
1157  }
1158  return Window;
1159 }
1160 
1161 //
1162 // Internal painting of windows.
1163 //
1164 VOID FASTCALL
1166 {
1167  // Handle normal painting.
1169 }
1170 
1171 BOOL FASTCALL
1173  PWND Window,
1174  UINT MsgFilterMin,
1175  UINT MsgFilterMax,
1177  MSG *Message,
1178  BOOL Remove)
1179 {
1180  PWND PaintWnd, StartWnd;
1181 
1182  if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
1183  (MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
1184  return FALSE;
1185 
1186  if (Thread->TIF_flags & TIF_SYSTEMTHREAD )
1187  {
1188  ERR("WM_PAINT is in a System Thread!\n");
1189  }
1190 
1191  StartWnd = UserGetDesktopWindow();
1192  PaintWnd = IntFindWindowToRepaint(StartWnd, Thread);
1193 
1194  Message->hwnd = PaintWnd ? UserHMGetHandle(PaintWnd) : NULL;
1195 
1196  if (Message->hwnd == NULL && Thread->cPaintsReady)
1197  {
1198  // Find note in window.c:"PAINTING BUG".
1199  ERR("WARNING SOMETHING HAS GONE WRONG: Thread marked as containing dirty windows, but no dirty windows found! Counts %u\n",Thread->cPaintsReady);
1200  /* Hack to stop spamming the debug log ! */
1201  Thread->cPaintsReady = 0;
1202  return FALSE;
1203  }
1204 
1205  if (Message->hwnd == NULL)
1206  return FALSE;
1207 
1208  if (!(Window == NULL ||
1209  PaintWnd == Window ||
1210  IntIsChildWindow(Window, PaintWnd))) /* check that it is a child of the specified parent */
1211  return FALSE;
1212 
1213  if (PaintWnd->state & WNDS_INTERNALPAINT)
1214  {
1215  PaintWnd->state &= ~WNDS_INTERNALPAINT;
1216  if (!PaintWnd->hrgnUpdate)
1218  }
1219  PaintWnd->state2 &= ~WNDS2_STARTPAINT;
1220  PaintWnd->state &= ~WNDS_UPDATEDIRTY;
1221 
1222  Window = PaintWnd;
1223  while (Window && !UserIsDesktopWindow(Window))
1224  {
1225  // Role back and check for clip children, do not set if any.
1226  if (Window->spwndParent && !(Window->spwndParent->style & WS_CLIPCHILDREN))
1227  {
1228  PaintWnd->state2 |= WNDS2_WMPAINTSENT;
1229  }
1230  Window = Window->spwndParent;
1231  }
1232 
1233  Message->wParam = Message->lParam = 0;
1234  Message->message = WM_PAINT;
1235  return TRUE;
1236 }
1237 
1238 BOOL
1239 FASTCALL
1241  PWND pwnd,
1242  HDC hdcBlt,
1243  UINT nFlags)
1244 {
1245  HDC hdcSrc;
1246  INT cx, cy, xSrc, ySrc;
1247 
1248  if ( nFlags & PW_CLIENTONLY)
1249  {
1250  cx = pwnd->rcClient.right - pwnd->rcClient.left;
1251  cy = pwnd->rcClient.bottom - pwnd->rcClient.top;
1252  xSrc = pwnd->rcClient.left - pwnd->rcWindow.left;
1253  ySrc = pwnd->rcClient.top - pwnd->rcWindow.top;
1254  }
1255  else
1256  {
1257  cx = pwnd->rcWindow.right - pwnd->rcWindow.left;
1258  cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top;
1259  xSrc = 0;
1260  ySrc = 0;
1261  }
1262 
1263  // TODO: Setup Redirection for Print.
1264  return FALSE;
1265 
1266  /* Update the window just incase. */
1268 
1270  /* Print window to printer context. */
1271  NtGdiBitBlt( hdcBlt,
1272  0,
1273  0,
1274  cx,
1275  cy,
1276  hdcSrc,
1277  xSrc,
1278  ySrc,
1279  SRCCOPY,
1280  0,
1281  0);
1282 
1283  UserReleaseDC( pwnd, hdcSrc, FALSE);
1284 
1285  // TODO: Release Redirection from Print.
1286 
1287  return TRUE;
1288 }
1289 
1290 BOOL
1291 FASTCALL
1292 IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
1293 {
1294  DWORD_PTR FlashState;
1295  UINT uCount = pfwi->uCount;
1296  BOOL Activate = FALSE, Ret = FALSE;
1297 
1298  ASSERT(pfwi);
1299 
1300  FlashState = (DWORD_PTR)UserGetProp(pWnd, AtomFlashWndState, TRUE);
1301 
1302  if (FlashState == FLASHW_FINISHED)
1303  {
1304  // Cycle has finished, kill timer and set this to Stop.
1305  FlashState |= FLASHW_KILLSYSTIMER;
1306  pfwi->dwFlags = FLASHW_STOP;
1307  }
1308  else
1309  {
1310  if (FlashState)
1311  {
1312  if (pfwi->dwFlags == FLASHW_SYSTIMER)
1313  {
1314  // Called from system timer, restore flags, counts and state.
1315  pfwi->dwFlags = LOWORD(FlashState);
1316  uCount = HIWORD(FlashState);
1317  FlashState = MAKELONG(LOWORD(FlashState),0);
1318  }
1319  else
1320  {
1321  // Clean out the trash! Fix SeaMonkey crash after restart.
1322  FlashState = 0;
1323  }
1324  }
1325 
1326  if (FlashState == 0)
1327  { // First time in cycle, setup flash state.
1328  if ( pWnd->state & WNDS_ACTIVEFRAME ||
1329  (pfwi->dwFlags & FLASHW_CAPTION && pWnd->style & (WS_BORDER|WS_DLGFRAME)))
1330  {
1331  FlashState = FLASHW_STARTED|FLASHW_ACTIVE;
1332  }
1333  }
1334 
1335  // Set previous window state.
1336  Ret = !!(FlashState & FLASHW_ACTIVE);
1337 
1338  if ( (pfwi->dwFlags & FLASHW_TIMERNOFG) == FLASHW_TIMERNOFG &&
1339  gpqForeground == pWnd->head.pti->MessageQueue )
1340  {
1341  // Flashing until foreground, set this to Stop.
1342  pfwi->dwFlags = FLASHW_STOP;
1343  }
1344  }
1345 
1346  // Toggle activate flag.
1347  if ( pfwi->dwFlags == FLASHW_STOP )
1348  {
1349  if (gpqForeground && gpqForeground->spwndActive == pWnd)
1350  Activate = TRUE;
1351  else
1352  Activate = FALSE;
1353  }
1354  else
1355  {
1356  Activate = (FlashState & FLASHW_ACTIVE) == 0;
1357  }
1358 
1359  if ( pfwi->dwFlags == FLASHW_STOP || pfwi->dwFlags & FLASHW_CAPTION )
1360  {
1361  co_IntSendMessage(UserHMGetHandle(pWnd), WM_NCACTIVATE, Activate, 0);
1362  }
1363 
1364  // FIXME: Check for a Stop Sign here.
1365  if ( pfwi->dwFlags & FLASHW_TRAY )
1366  {
1367  // Need some shell work here too.
1368  TRACE("FIXME: Flash window no Tray support!\n");
1369  }
1370 
1371  if ( pfwi->dwFlags == FLASHW_STOP )
1372  {
1373  if (FlashState & FLASHW_KILLSYSTIMER)
1374  {
1376  }
1377 
1379  }
1380  else
1381  { // Have a count and started, set timer.
1382  if ( uCount )
1383  {
1384  FlashState |= FLASHW_COUNT;
1385 
1386  if (!(Activate ^ !!(FlashState & FLASHW_STARTED)))
1387  uCount--;
1388 
1389  if (!(FlashState & FLASHW_KILLSYSTIMER))
1390  pfwi->dwFlags |= FLASHW_TIMER;
1391  }
1392 
1393  if (pfwi->dwFlags & FLASHW_TIMER)
1394  {
1395  FlashState |= FLASHW_KILLSYSTIMER;
1396 
1397  IntSetTimer( pWnd,
1399  pfwi->dwTimeout ? pfwi->dwTimeout : gpsi->dtCaretBlink,
1401  TMRF_SYSTEM );
1402  }
1403 
1404  if (FlashState & FLASHW_COUNT && uCount == 0)
1405  {
1406  // Keep spinning? Nothing else to do.
1407  FlashState = FLASHW_FINISHED;
1408  }
1409  else
1410  {
1411  // Save state and flags so this can be restored next time through.
1412  FlashState ^= (FlashState ^ -!!(Activate)) & FLASHW_ACTIVE;
1413  FlashState ^= (FlashState ^ pfwi->dwFlags) & (FLASHW_MASK & ~FLASHW_TIMER);
1414  }
1415  FlashState = MAKELONG(LOWORD(FlashState),uCount);
1416  UserSetProp(pWnd, AtomFlashWndState, (HANDLE)FlashState, TRUE);
1417  }
1418  return Ret;
1419 }
1420 
1421 HDC FASTCALL
1423 {
1424  RECT Rect;
1425  INT type;
1426  BOOL Erase = FALSE;
1427 
1429 
1430  Window->state2 |= WNDS2_STARTPAINT;
1431  Window->state &= ~WNDS_PAINTNOTPROCESSED;
1432 
1433  if (Window->state & WNDS_SENDNCPAINT)
1434  {
1435  HRGN hRgn;
1436  // Application can keep update dirty.
1437  do
1438  {
1439  Window->state &= ~WNDS_UPDATEDIRTY;
1443  {
1444  /* NOTE: The region can already be deleted! */
1446  }
1447  }
1448  while(Window->state & WNDS_UPDATEDIRTY);
1449  }
1450  else
1451  {
1452  Window->state &= ~WNDS_UPDATEDIRTY;
1453  }
1454 
1455  RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1456 
1457  if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1458  {
1459  ERR("BP: Another thread invalidated this window\n");
1460  }
1461 
1462  Ps->hdc = UserGetDCEx( Window,
1463  Window->hrgnUpdate,
1465  if (!Ps->hdc)
1466  {
1467  return NULL;
1468  }
1469 
1470  // If set, always clear flags out due to the conditions later on for sending the message.
1471  if (Window->state & WNDS_SENDERASEBACKGROUND)
1472  {
1474  Erase = TRUE;
1475  }
1476 
1477  if (Window->hrgnUpdate != NULL)
1478  {
1479  MsqDecPaintCountQueue(Window->head.pti);
1481  /* The region is part of the dc now and belongs to the process! */
1482  Window->hrgnUpdate = NULL;
1483  }
1484  else
1485  {
1486  if (Window->state & WNDS_INTERNALPAINT)
1487  MsqDecPaintCountQueue(Window->head.pti);
1488  }
1489 
1490  type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1491 
1493 
1494  Window->state &= ~WNDS_INTERNALPAINT;
1495 
1496  if ( Erase && // Set to erase,
1497  type != NULLREGION && // don't erase if the clip box is empty,
1498  (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1499  RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1500  {
1502  if ( Ps->fErase )
1503  {
1505  }
1506  }
1507  else
1508  {
1509  Ps->fErase = FALSE;
1510  }
1511 
1513 
1514  return Ps->hdc;
1515 }
1516 
1517 BOOL FASTCALL
1519 {
1520  HDC hdc = NULL;
1521 
1522  hdc = Ps->hdc;
1523 
1524  UserReleaseDC(Wnd, hdc, TRUE);
1525 
1526  if (Wnd->state2 & WNDS2_ENDPAINTINVALIDATE)
1527  {
1528  ERR("EP: Another thread invalidated this window\n");
1530  }
1531 
1533 
1534  co_UserShowCaret(Wnd);
1535 
1536  return TRUE;
1537 }
1538 
1539 BOOL FASTCALL
1540 IntFillWindow(PWND pWndParent,
1541  PWND pWnd,
1542  HDC hDC,
1543  HBRUSH hBrush)
1544 {
1545  RECT Rect, Rect1;
1546  INT type;
1547 
1548  if (!pWndParent)
1549  pWndParent = pWnd;
1550 
1551  type = GdiGetClipBox(hDC, &Rect);
1552 
1553  IntGetClientRect(pWnd, &Rect1);
1554 
1555  if ( type != NULLREGION && // Clip box is not empty,
1556  (!(pWnd->pcls->style & CS_PARENTDC) || // not parent dc or
1557  RECTL_bIntersectRect( &Rect, &Rect, &Rect1) ) ) // intersecting.
1558  {
1559  POINT ppt;
1560  INT x = 0, y = 0;
1561 
1562  if (!UserIsDesktopWindow(pWndParent))
1563  {
1564  x = pWndParent->rcClient.left - pWnd->rcClient.left;
1565  y = pWndParent->rcClient.top - pWnd->rcClient.top;
1566  }
1567 
1568  GreSetBrushOrg(hDC, x, y, &ppt);
1569 
1570  if ( hBrush < (HBRUSH)CTLCOLOR_MAX )
1571  hBrush = GetControlColor( pWndParent, pWnd, hDC, HandleToUlong(hBrush) + WM_CTLCOLORMSGBOX);
1572 
1573  FillRect(hDC, &Rect, hBrush);
1574 
1575  GreSetBrushOrg(hDC, ppt.x, ppt.y, NULL);
1576 
1577  return TRUE;
1578  }
1579  else
1580  return FALSE;
1581 }
1582 
1583 /* PUBLIC FUNCTIONS ***********************************************************/
1584 
1585 /*
1586  * NtUserBeginPaint
1587  *
1588  * Status
1589  * @implemented
1590  */
1591 
1592 HDC APIENTRY
1594 {
1595  PWND Window = NULL;
1596  PAINTSTRUCT Ps;
1597  NTSTATUS Status;
1598  HDC hDC;
1601 
1602  TRACE("Enter NtUserBeginPaint\n");
1604 
1605  if (!(Window = UserGetWindowObject(hWnd)))
1606  {
1607  RETURN( NULL);
1608  }
1609 
1610  UserRefObjectCo(Window, &Ref);
1611 
1612  hDC = IntBeginPaint(Window, &Ps);
1613 
1614  Status = MmCopyToCaller(UnsafePs, &Ps, sizeof(PAINTSTRUCT));
1615  if (! NT_SUCCESS(Status))
1616  {
1618  RETURN(NULL);
1619  }
1620 
1621  RETURN(hDC);
1622 
1623 CLEANUP:
1625 
1626  TRACE("Leave NtUserBeginPaint, ret=%p\n",_ret_);
1627  UserLeave();
1628  END_CLEANUP;
1629 
1630 }
1631 
1632 /*
1633  * NtUserEndPaint
1634  *
1635  * Status
1636  * @implemented
1637  */
1638 
1639 BOOL APIENTRY
1641 {
1643  PWND Window = NULL;
1644  PAINTSTRUCT Ps;
1647 
1648  TRACE("Enter NtUserEndPaint\n");
1650 
1651  if (!(Window = UserGetWindowObject(hWnd)))
1652  {
1653  RETURN(FALSE);
1654  }
1655 
1656  UserRefObjectCo(Window, &Ref); // Here for the exception.
1657 
1658  _SEH2_TRY
1659  {
1660  ProbeForRead(pUnsafePs, sizeof(*pUnsafePs), 1);
1661  RtlCopyMemory(&Ps, pUnsafePs, sizeof(PAINTSTRUCT));
1662  }
1664  {
1666  }
1667  _SEH2_END
1668  if (!NT_SUCCESS(Status))
1669  {
1670  RETURN(FALSE);
1671  }
1672 
1673  RETURN(IntEndPaint(Window, &Ps));
1674 
1675 CLEANUP:
1677 
1678  TRACE("Leave NtUserEndPaint, ret=%i\n",_ret_);
1679  UserLeave();
1680  END_CLEANUP;
1681 }
1682 
1683 /*
1684  * FillWindow: Called from User; Dialog, Edit and ListBox procs during a WM_ERASEBKGND.
1685  */
1686 /*
1687  * @implemented
1688  */
1689 BOOL APIENTRY
1691  HWND hWnd,
1692  HDC hDC,
1693  HBRUSH hBrush)
1694 {
1695  BOOL ret = FALSE;
1696  PWND pWnd, pWndParent = NULL;
1698 
1699  TRACE("Enter NtUserFillWindow\n");
1701 
1702  if (!hDC)
1703  {
1704  goto Exit;
1705  }
1706 
1707  if (!(pWnd = UserGetWindowObject(hWnd)))
1708  {
1709  goto Exit;
1710  }
1711 
1712  if (hWndParent && !(pWndParent = UserGetWindowObject(hWndParent)))
1713  {
1714  goto Exit;
1715  }
1716 
1717  UserRefObjectCo(pWnd, &Ref);
1718  ret = IntFillWindow( pWndParent, pWnd, hDC, hBrush );
1719  UserDerefObjectCo(pWnd);
1720 
1721 Exit:
1722  TRACE("Leave NtUserFillWindow, ret=%i\n",ret);
1723  UserLeave();
1724  return ret;
1725 }
1726 
1727 /*
1728  * @implemented
1729  */
1730 BOOL APIENTRY
1731 NtUserFlashWindowEx(IN PFLASHWINFO pfwi)
1732 {
1733  PWND pWnd;
1734  FLASHWINFO finfo = {0};
1735  BOOL Ret = FALSE;
1736 
1738 
1739  _SEH2_TRY
1740  {
1741  ProbeForRead(pfwi, sizeof(FLASHWINFO), 1);
1742  RtlCopyMemory(&finfo, pfwi, sizeof(FLASHWINFO));
1743  }
1745  {
1747  _SEH2_YIELD(goto Exit);
1748  }
1749  _SEH2_END
1750 
1751  if (!( pWnd = ValidateHwndNoErr(finfo.hwnd)) ||
1752  finfo.cbSize != sizeof(FLASHWINFO) ||
1753  finfo.dwFlags & ~(FLASHW_ALL|FLASHW_TIMER|FLASHW_TIMERNOFG) )
1754  {
1756  goto Exit;
1757  }
1758 
1759  Ret = IntFlashWindowEx(pWnd, &finfo);
1760 
1761 Exit:
1762  UserLeave();
1763  return Ret;
1764 }
1765 
1766 /*
1767  GetUpdateRgn, this fails the same as the old one.
1768  */
1769 INT FASTCALL
1771 {
1772  int RegionType;
1773  BOOL Type;
1774  RECTL Rect;
1775 
1777 
1778  if (bErase)
1779  {
1781  UserRefObjectCo(Window, &Ref);
1784  }
1785 
1786  Window->state &= ~WNDS_UPDATEDIRTY;
1787 
1788  if (Window->hrgnUpdate == NULL)
1789  {
1790  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1791  return NULLREGION;
1792  }
1793 
1794  Rect = Window->rcClient;
1796 
1797  if (Window->hrgnUpdate == HRGN_WINDOW)
1798  {
1799  // Trap it out.
1800  ERR("GURn: Caller is passing Window Region 1\n");
1801  if (!Type)
1802  {
1803  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1804  return NULLREGION;
1805  }
1806 
1808 
1810  {
1812  -Window->rcClient.left,
1813  -Window->rcClient.top);
1814  }
1816  }
1817  else
1818  {
1819  HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1820 
1821  RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1822 
1823  if (RegionType == ERROR || RegionType == NULLREGION)
1824  {
1825  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1826  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1827  return RegionType;
1828  }
1829 
1831  {
1833  -Window->rcClient.left,
1834  -Window->rcClient.top);
1835  }
1836  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1837  }
1838  return RegionType;
1839 }
1840 
1841 BOOL FASTCALL
1843 {
1844  INT RegionType;
1845  BOOL Ret = TRUE;
1846 
1847  if (bErase)
1848  {
1850  UserRefObjectCo(Window, &Ref);
1853  }
1854 
1855  Window->state &= ~WNDS_UPDATEDIRTY;
1856 
1857  if (Window->hrgnUpdate == NULL)
1858  {
1859  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1860  Ret = FALSE;
1861  }
1862  else
1863  {
1864  /* Get the update region bounding box. */
1865  if (Window->hrgnUpdate == HRGN_WINDOW)
1866  {
1867  *pRect = Window->rcClient;
1868  ERR("GURt: Caller is retrieving Window Region 1\n");
1869  }
1870  else
1871  {
1872  RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1873 
1874  if (RegionType != ERROR && RegionType != NULLREGION)
1875  RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1876  }
1877 
1878  if (IntIntersectWithParents(Window, pRect))
1879  {
1881  {
1882  RECTL_vOffsetRect(pRect,
1883  -Window->rcClient.left,
1884  -Window->rcClient.top);
1885  }
1886  if (Window->pcls->style & CS_OWNDC)
1887  {
1888  HDC hdc;
1889  //DWORD layout;
1891  //layout = NtGdiSetLayout(hdc, -1, 0);
1892  //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1893  GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1894  //NtGdiSetLayout(hdc, -1, layout);
1896  }
1897  }
1898  else
1899  {
1900  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1901  }
1902  }
1903  return Ret;
1904 }
1905 
1906 /*
1907  * NtUserGetUpdateRgn
1908  *
1909  * Status
1910  * @implemented
1911  */
1912 
1913 INT APIENTRY
1915 {
1917  PWND Window;
1918  INT ret;
1919 
1920  TRACE("Enter NtUserGetUpdateRgn\n");
1922 
1923  if (!(Window = UserGetWindowObject(hWnd)))
1924  {
1925  RETURN(ERROR);
1926  }
1927 
1928  ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
1929 
1930  RETURN(ret);
1931 
1932 CLEANUP:
1933  TRACE("Leave NtUserGetUpdateRgn, ret=%i\n",_ret_);
1934  UserLeave();
1935  END_CLEANUP;
1936 }
1937 
1938 /*
1939  * NtUserGetUpdateRect
1940  *
1941  * Status
1942  * @implemented
1943  */
1944 
1945 BOOL APIENTRY
1947 {
1948  PWND Window;
1949  RECTL Rect;
1950  NTSTATUS Status;
1951  BOOL Ret;
1953 
1954  TRACE("Enter NtUserGetUpdateRect\n");
1956 
1957  if (!(Window = UserGetWindowObject(hWnd)))
1958  {
1959  RETURN(FALSE);
1960  }
1961 
1962  Ret = co_UserGetUpdateRect(Window, &Rect, bErase);
1963 
1964  if (UnsafeRect != NULL)
1965  {
1966  Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECTL));
1967  if (!NT_SUCCESS(Status))
1968  {
1970  RETURN(FALSE);
1971  }
1972  }
1973 
1974  RETURN(Ret);
1975 
1976 CLEANUP:
1977  TRACE("Leave NtUserGetUpdateRect, ret=%i\n",_ret_);
1978  UserLeave();
1979  END_CLEANUP;
1980 }
1981 
1982 /*
1983  * NtUserRedrawWindow
1984  *
1985  * Status
1986  * @implemented
1987  */
1988 
1989 BOOL APIENTRY
1991  HWND hWnd,
1992  CONST RECT *lprcUpdate,
1993  HRGN hrgnUpdate,
1994  UINT flags)
1995 {
1996  RECTL SafeUpdateRect;
1997  PWND Wnd;
1998  BOOL Ret;
2001  PREGION RgnUpdate = NULL;
2003 
2004  TRACE("Enter NtUserRedrawWindow\n");
2006 
2007  if (!(Wnd = UserGetWindowObject(hWnd ? hWnd : IntGetDesktopWindow())))
2008  {
2009  RETURN( FALSE);
2010  }
2011 
2012  if (lprcUpdate)
2013  {
2014  _SEH2_TRY
2015  {
2016  ProbeForRead(lprcUpdate, sizeof(RECTL), 1);
2017  RtlCopyMemory(&SafeUpdateRect, lprcUpdate, sizeof(RECTL));
2018  }
2020  {
2022  }
2023  _SEH2_END
2024  if (!NT_SUCCESS(Status))
2025  {
2027  RETURN( FALSE);
2028  }
2029  }
2030 
2034  {
2035  /* RedrawWindow fails only in case that flags are invalid */
2037  RETURN( FALSE);
2038  }
2039 
2040  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
2041  * so it will be copied.
2042  */
2043  if (hrgnUpdate > HRGN_WINDOW)
2044  {
2045  RgnUpdate = REGION_LockRgn(hrgnUpdate);
2046  if (!RgnUpdate)
2047  {
2049  RETURN(FALSE);
2050  }
2051  REGION_UnlockRgn(RgnUpdate);
2052  }
2053  else if (hrgnUpdate == HRGN_WINDOW) // Trap it out.
2054  {
2055  ERR("NTRW: Caller is passing Window Region 1\n");
2056  }
2057 
2058  UserRefObjectCo(Wnd, &Ref);
2059 
2060  Ret = co_UserRedrawWindow( Wnd,
2061  lprcUpdate ? &SafeUpdateRect : NULL,
2062  RgnUpdate,
2063  flags);
2064 
2065  UserDerefObjectCo(Wnd);
2066 
2067  RETURN( Ret);
2068 
2069 CLEANUP:
2070  TRACE("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
2071  UserLeave();
2072  END_CLEANUP;
2073 }
2074 
2075 BOOL
2077  PWND pWnd,
2078  HDC hDc,
2079  const PUNICODE_STRING Text,
2080  const RECTL *lpRc,
2081  UINT uFlags,
2082  HFONT hFont)
2083 {
2084  HFONT hOldFont = NULL;
2085  COLORREF OldTextColor;
2086  NONCLIENTMETRICSW nclm;
2087  NTSTATUS Status;
2088  BOOLEAN bDeleteFont = FALSE;
2089  SIZE Size;
2090  BOOL Ret = TRUE;
2091  ULONG fit = 0, Length;
2092  RECTL r = *lpRc;
2093 
2094  TRACE("UserDrawCaptionText: %wZ\n", Text);
2095 
2096  nclm.cbSize = sizeof(nclm);
2097  if (!UserSystemParametersInfo(SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0))
2098  {
2099  ERR("UserSystemParametersInfo() failed!\n");
2100  return FALSE;
2101  }
2102 
2103  if (!hFont)
2104  {
2105  if(uFlags & DC_SMALLCAP)
2106  Status = TextIntCreateFontIndirect(&nclm.lfSmCaptionFont, &hFont);
2107  else
2108  Status = TextIntCreateFontIndirect(&nclm.lfCaptionFont, &hFont);
2109 
2110  if(!NT_SUCCESS(Status))
2111  {
2112  ERR("TextIntCreateFontIndirect() failed! Status: 0x%x\n", Status);
2113  return FALSE;
2114  }
2115 
2116  bDeleteFont = TRUE;
2117  }
2118 
2120 
2121  hOldFont = NtGdiSelectFont(hDc, hFont);
2122 
2123  if(uFlags & DC_INBUTTON)
2124  OldTextColor = IntGdiSetTextColor(hDc, IntGetSysColor(COLOR_BTNTEXT));
2125  else
2126  OldTextColor = IntGdiSetTextColor(hDc,
2128 
2129  // Adjust for system menu.
2130  if (pWnd && pWnd->style & WS_SYSMENU)
2131  {
2132  r.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2133  if ((pWnd->style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW))
2134  {
2135  r.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
2136  r.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
2137  }
2138  }
2139 
2140  GreGetTextExtentExW(hDc, Text->Buffer, Text->Length/sizeof(WCHAR), r.right - r.left, &fit, 0, &Size, 0);
2141 
2142  Length = (Text->Length/sizeof(WCHAR) == fit ? fit : fit+1);
2143 
2144  if (Text->Length/sizeof(WCHAR) > Length)
2145  {
2146  Ret = FALSE;
2147  }
2148 
2149  if (Ret)
2150  { // Faster while in setup.
2151  UserExtTextOutW( hDc,
2152  lpRc->left,
2153  lpRc->top + (lpRc->bottom - lpRc->top - Size.cy) / 2, // DT_SINGLELINE && DT_VCENTER
2154  ETO_CLIPPED,
2155  (RECTL *)lpRc,
2156  Text->Buffer,
2157  Length);
2158  }
2159  else
2160  {
2161  DrawTextW( hDc,
2162  Text->Buffer,
2163  Text->Length/sizeof(WCHAR),
2164  (RECTL *)&r,
2166  }
2167 
2168  IntGdiSetTextColor(hDc, OldTextColor);
2169 
2170  if (hOldFont)
2171  NtGdiSelectFont(hDc, hOldFont);
2172 
2173  if (bDeleteFont)
2175 
2176  return Ret;
2177 }
2178 
2179 //
2180 // This draws Buttons, Icons and Text...
2181 //
2183  PWND pWnd,
2184  HDC hDc,
2185  RECTL *lpRc,
2186  HFONT hFont,
2187  HICON hIcon,
2188  const PUNICODE_STRING Str,
2189  UINT uFlags)
2190 {
2191  BOOL Ret = FALSE;
2192  HBRUSH hBgBrush, hOldBrush = NULL;
2193  RECTL Rect = *lpRc;
2194  BOOL HasIcon;
2195 
2196  RECTL_vMakeWellOrdered(lpRc);
2197 
2198  /* Determine whether the icon needs to be displayed */
2199  if (!hIcon && pWnd != NULL)
2200  {
2201  HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2202  (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2203  }
2204  else
2205  HasIcon = (hIcon != NULL);
2206 
2207  // Draw the caption background
2208  if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2209  {
2210  static GRADIENT_RECT gcap = {0, 1};
2211  TRIVERTEX Vertices[2];
2212  COLORREF Colors[2];
2213 
2216 
2219 
2220  Vertices[0].x = Rect.left;
2221  Vertices[0].y = Rect.top;
2222  Vertices[0].Red = (WORD)Colors[0]<<8;
2223  Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2224  Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2225  Vertices[0].Alpha = 0;
2226 
2227  Vertices[1].x = Rect.right;
2228  Vertices[1].y = Rect.bottom;
2229  Vertices[1].Red = (WORD)Colors[1]<<8;
2230  Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2231  Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2232  Vertices[1].Alpha = 0;
2233 
2234  if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2235  {
2236  ERR("GreGradientFill() failed!\n");
2237  goto cleanup;
2238  }
2239  }
2240  else
2241  {
2242  if(uFlags & DC_INBUTTON)
2243  hBgBrush = IntGetSysColorBrush(COLOR_3DFACE);
2244  else if(uFlags & DC_ACTIVE)
2246  else
2248 
2249  hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2250 
2251  if(!hOldBrush)
2252  {
2253  ERR("NtGdiSelectBrush() failed!\n");
2254  goto cleanup;
2255  }
2256 
2257  if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2258  Rect.right - Rect.left,
2259  Rect.bottom - Rect.top,
2260  PATCOPY))
2261  {
2262  ERR("NtGdiPatBlt() failed!\n");
2263  goto cleanup;
2264  }
2265  }
2266 
2267  /* Draw icon */
2268  if (HasIcon)
2269  {
2270  PCURICON_OBJECT pIcon = NULL;
2271 
2272  if (hIcon)
2273  {
2274  pIcon = UserGetCurIconObject(hIcon);
2275  }
2276  else if (pWnd)
2277  {
2278  pIcon = NC_IconForWindow(pWnd);
2279  // FIXME: NC_IconForWindow should reference it for us */
2280  if (pIcon)
2281  UserReferenceObject(pIcon);
2282  }
2283 
2284  if (pIcon)
2285  {
2288  LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2289  LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2290  UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2291  UserDereferenceObject(pIcon);
2292  }
2293  else
2294  {
2295  HasIcon = FALSE;
2296  }
2297  }
2298 
2299  if (HasIcon)
2300  Rect.left += Rect.bottom - Rect.top;
2301 
2302  if((uFlags & DC_TEXT))
2303  {
2304  BOOL Set = FALSE;
2305  Rect.left += 2;
2306 
2307  if (Str)
2308  Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2309  else if (pWnd != NULL) // FIXME: Windows does not do that
2310  {
2311  UNICODE_STRING ustr;
2312  ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2313  ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2315  Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2316  }
2317  if (pWnd)
2318  {
2319  if (Set)
2321  else
2323  }
2324  }
2325 
2326  Ret = TRUE;
2327 
2328 cleanup:
2329  if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2330 
2331  return Ret;
2332 }
2333 
2334 INT
2335 FASTCALL
2337 {
2338  HWND hWnd, hWndDesktop;
2339  DWORD Ret;
2340 
2341  Ret = IntGdiRealizePalette(hdc);
2342  if (Ret) // There was a change.
2343  {
2345  if (hWnd) // Send broadcast if dc is associated with a window.
2346  { // FYI: Thread locked in CallOneParam.
2347  hWndDesktop = IntGetDesktopWindow();
2348  if ( hWndDesktop != hWnd )
2349  {
2350  PWND pWnd = UserGetWindowObject(hWndDesktop);
2351  ERR("RealizePalette Desktop.");
2352  hdc = UserGetWindowDC(pWnd);
2354  UserReleaseDC(pWnd,hdc,FALSE);
2355  }
2357  }
2358  }
2359  return Ret;
2360 }
2361 
2362 BOOL
2363 APIENTRY
2365  HWND hWnd,
2366  HDC hDC,
2367  LPCRECT lpRc,
2368  HFONT hFont,
2369  HICON hIcon,
2370  const PUNICODE_STRING str,
2371  UINT uFlags)
2372 {
2373  PWND pWnd = NULL;
2374  UNICODE_STRING SafeStr = {0};
2376  RECTL SafeRect;
2377  BOOL Ret;
2378 
2380 
2381  if (hWnd != NULL)
2382  {
2383  if(!(pWnd = UserGetWindowObject(hWnd)))
2384  {
2385  UserLeave();
2386  return FALSE;
2387  }
2388  }
2389 
2390  _SEH2_TRY
2391  {
2392  ProbeForRead(lpRc, sizeof(RECTL), sizeof(ULONG));
2393  RtlCopyMemory(&SafeRect, lpRc, sizeof(RECTL));
2394  if (str != NULL)
2395  {
2396  SafeStr = ProbeForReadUnicodeString(str);
2397  if (SafeStr.Length != 0)
2398  {
2399  ProbeForRead( SafeStr.Buffer,
2400  SafeStr.Length,
2401  sizeof(WCHAR));
2402  }
2403  }
2404  }
2406  {
2408  }
2409  _SEH2_END;
2410 
2411  if (Status != STATUS_SUCCESS)
2412  {
2414  UserLeave();
2415  return FALSE;
2416  }
2417 
2418  if (str != NULL)
2419  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, &SafeStr, uFlags);
2420  else
2421  {
2422  if ( RECTL_bIsEmptyRect(&SafeRect) && hFont == 0 && hIcon == 0 )
2423  {
2424  Ret = TRUE;
2425  if (uFlags & DC_DRAWCAPTIONMD)
2426  {
2427  ERR("NC Caption Mode\n");
2428  UserDrawCaptionBar(pWnd, hDC, uFlags);
2429  goto Exit;
2430  }
2431  else if (uFlags & DC_DRAWFRAMEMD)
2432  {
2433  ERR("NC Paint Mode\n");
2434  NC_DoNCPaint(pWnd, hDC, uFlags); // Update Menus too!
2435  goto Exit;
2436  }
2437  }
2438  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, NULL, uFlags);
2439  }
2440 Exit:
2441  UserLeave();
2442  return Ret;
2443 }
2444 
2445 BOOL
2446 APIENTRY
2448  HDC hDC,
2449  LPCRECT lpRc,
2450  UINT uFlags)
2451 {
2452  return NtUserDrawCaptionTemp(hWnd, hDC, lpRc, 0, 0, NULL, uFlags);
2453 }
2454 
2455 INT FASTCALL
2457 {
2458  POINT pt;
2459  RECT rc;
2460 
2461  if (Window->hrgnUpdate)
2462  {
2463  if (Window->hrgnUpdate == HRGN_WINDOW)
2464  {
2465  return NtGdiIntersectClipRect(hDC, 0, 0, 0, 0);
2466  }
2467  else
2468  {
2469  INT ret = ERROR;
2470  HRGN hrgn = NtGdiCreateRectRgn(0,0,0,0);
2471 
2472  if ( hrgn && GreGetDCPoint( hDC, GdiGetDCOrg, &pt) )
2473  {
2475  {
2476  NtGdiOffsetRgn(hrgn, pt.x, pt.y);
2477  }
2478  else
2479  {
2480  HRGN hrgnScreen;
2482  hrgnScreen = NtGdiCreateRectRgn(0,0,0,0);
2483  NtGdiCombineRgn(hrgnScreen, hrgnScreen, pm->hrgnMonitor, RGN_OR);
2484 
2485  NtGdiCombineRgn(hrgn, hrgnScreen, NULL, RGN_COPY);
2486 
2487  GreDeleteObject(hrgnScreen);
2488  }
2489 
2490  NtGdiCombineRgn(hrgn, hrgn, Window->hrgnUpdate, RGN_DIFF);
2491 
2492  NtGdiOffsetRgn(hrgn, -pt.x, -pt.y);
2493 
2495 
2497  }
2498  return ret;
2499  }
2500  }
2501  else
2502  {
2503  return GdiGetClipBox( hDC, &rc);
2504  }
2505 }
2506 
2507 INT
2508 APIENTRY
2510  HDC hDC,
2511  HWND hWnd)
2512 {
2513  INT ret = ERROR;
2514  PWND pWnd;
2515 
2516  TRACE("Enter NtUserExcludeUpdateRgn\n");
2518 
2519  pWnd = UserGetWindowObject(hWnd);
2520 
2521  if (hDC && pWnd)
2522  ret = co_UserExcludeUpdateRgn(hDC, pWnd);
2523 
2524  TRACE("Leave NtUserExcludeUpdateRgn, ret=%i\n", ret);
2525 
2526  UserLeave();
2527  return ret;
2528 }
2529 
2530 BOOL
2531 APIENTRY
2533  HWND hWnd,
2534  CONST RECT *lpUnsafeRect,
2535  BOOL bErase)
2536 {
2537  UINT flags = RDW_INVALIDATE | (bErase ? RDW_ERASE : 0);
2538  if (!hWnd)
2539  {
2541  lpUnsafeRect = NULL;
2542  }
2543  return NtUserRedrawWindow(hWnd, lpUnsafeRect, NULL, flags);
2544 }
2545 
2546 BOOL
2547 APIENTRY
2549  HWND hWnd,
2550  HRGN hRgn,
2551  BOOL bErase)
2552 {
2553  if (!hWnd)
2554  {
2556  return FALSE;
2557  }
2558  return NtUserRedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase? RDW_ERASE : 0));
2559 }
2560 
2561 BOOL
2562 APIENTRY
2564  HWND hwnd,
2565  HDC hdcBlt,
2566  UINT nFlags)
2567 {
2568  PWND Window;
2569  BOOL Ret = FALSE;
2570 
2572 
2573  if (hwnd)
2574  {
2575  if (!(Window = UserGetWindowObject(hwnd)) ||
2577  {
2578  goto Exit;
2579  }
2580 
2581  if ( Window )
2582  {
2583  /* Validate flags and check it as a mask for 0 or 1. */
2584  if ( (nFlags & PW_CLIENTONLY) == nFlags)
2585  Ret = IntPrintWindow( Window, hdcBlt, nFlags);
2586  else
2588  }
2589  }
2590 Exit:
2591  UserLeave();
2592  return Ret;
2593 }
2594 
2595 /* ValidateRect gets redirected to NtUserValidateRect:
2596  http://blog.csdn.net/ntdll/archive/2005/10/19/509299.aspx */
2597 BOOL
2598 APIENTRY
2600  HWND hWnd,
2601  const RECT *lpRect)
2602 {
2604  if (!hWnd)
2605  {
2607  lpRect = NULL;
2608  }
2609  return NtUserRedrawWindow(hWnd, lpRect, NULL, flags);
2610 }
2611 
2612 /* EOF */
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1203
#define WM_SYNCPAINT
Definition: winuser.h:1672
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
UINT_PTR FASTCALL IntSetTimer(PWND Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type)
Definition: timer.c:177
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1292
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IN
Definition: typedefs.h:38
DWORD ExStyle
Definition: ntuser.h:668
static HICON
Definition: imagelist.c:84
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1153
#define TRUE
Definition: types.h:120
INT FASTCALL co_UserExcludeUpdateRgn(HDC hDC, PWND Window)
Definition: painting.c:2456
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
Definition: client.c:29
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1122
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
#define CLEANUP
Definition: ntuser.h:5
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1141
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:608
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4334
BOOL FASTCALL IntPrintWindow(PWND pwnd, HDC hdcBlt, UINT nFlags)
Definition: painting.c:1240
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: cliprgn.c:291
long y
Definition: polytest.cpp:48
BOOL FASTCALL IntGetPaintMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove)
Definition: painting.c:1172
Type
Definition: Type.h:6
#define DWORD_PTR
Definition: treelist.c:76
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:924
struct _Entry Entry
Definition: kefuncs.h:640
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL APIENTRY NtUserInvalidateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
Definition: painting.c:2548
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:1990
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
long x
Definition: polytest.cpp:48
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:31
#define PRGN_WINDOW
Definition: painting.h:12
static HTREEITEM hChild
Definition: treeview.c:381
#define pt(x, y)
Definition: drawing.c:79
NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont)
Definition: freetype.c:1710
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
#define ERROR(name)
Definition: error_private.h:53
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
GLuint GLuint GLsizei count
Definition: gl.h:1545
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
BOOL FASTCALL MsqIsHung(PTHREADINFO pti)
Definition: msgqueue.c:2194
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static LPMONITOREX pm
Definition: localmon.c:42
BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
Definition: timer.c:573
LONG NTSTATUS
Definition: precomp.h:26
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1874
#define HandleToUlong(h)
Definition: basetsd.h:79
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define NULLREGION
Definition: wingdi.h:360
#define FLASHW_SYSTIMER
Definition: painting.h:4
LONG top
Definition: windef.h:292
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
long bottom
Definition: polytest.cpp:53
static HRGN hRgn
Definition: mapping.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define WS_DLGFRAME
Definition: pedump.c:626
INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode)
Definition: dcutil.c:124
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define COLOR_INACTIVECAPTION
Definition: winuser.h:906
#define COLOR_CAPTIONTEXT
Definition: winuser.h:912
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:946
#define SM_CYSMICON
Definition: winuser.h:1003
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
UINT_PTR WPARAM
Definition: windef.h:207
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2730
#define WS_CHILD
Definition: pedump.c:617
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:716
RECT rcClient
Definition: ntuser.h:681
BOOL APIENTRY NtUserValidateRect(HWND hWnd, const RECT *lpRect)
Definition: painting.c:2599
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:291
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
VOID FASTCALL PaintSuspendedWindow(PWND pwnd, HRGN hrgnOrig)
Definition: painting.c:1006
UINT uFlags
Definition: api.c:60
#define CS_OWNDC
Definition: winuser.h:650
static HDC hdcSrc
Definition: xlate.c:32
#define WNDS2_STARTPAINT
Definition: ntuser.h:611
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define DT_NOPREFIX
Definition: winuser.h:537
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2380
#define FASTCALL
Definition: nt_native.h:50
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:242
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define COLOR_WINDOW
Definition: winuser.h:908
PSERVERINFO gpsi
Definition: main.c:27
int32_t INT
Definition: typedefs.h:56
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define DCX_INTERSECTRGN
Definition: winuser.h:2083
HFONT hFont
Definition: main.c:53
static BOOL Set
Definition: pageheap.c:10
#define DCX_WINDOW
Definition: winuser.h:2074
BOOL APIENTRY NtUserDrawCaptionTemp(HWND hWnd, HDC hDC, LPCRECT lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING str, UINT uFlags)
Definition: painting.c:2364
_SEH2_TRY
Definition: create.c:4250
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
#define DC_ICON
Definition: winuser.h:429
PPROCESSINFO ppi
Definition: win32.h:87
#define FLASHW_KILLSYSTIMER
Definition: painting.h:8
#define RGN_AND
Definition: wingdi.h:355
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:595
#define WM_NCPAINT
Definition: winuser.h:1669
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
Definition: window.c:29
LONG y
Definition: wingdi.h:2763
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2429
#define COLOR_3DFACE
Definition: winuser.h:919
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:935
UINT style
Definition: ntuser.h:548
#define DC_NC
Definition: winuser.h:440
#define DT_LEFT
Definition: winuser.h:534
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WS_MINIMIZE
Definition: pedump.c:622
BOOL UserDrawCaptionText(PWND pWnd, HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, UINT uFlags, HFONT hFont)
Definition: painting.c:2076
#define RDW_NOUPDATEDIRTY
Definition: painting.h:16
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:586
long LONG
Definition: pedump.c:60
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
LIST_ENTRY SentMessagesListHead
Definition: win32.h:99
BOOL FASTCALL IntIsWindowDrawable(PWND Wnd)
Definition: painting.c:849
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
HRGN FASTCALL IntGetNCUpdateRgn(PWND Window, BOOL Validate)
Definition: painting.c:260
long top
Definition: polytest.cpp:53
#define TRANSPARENT
Definition: wingdi.h:949
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1021
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
INT FASTCALL UserRealizePalette(HDC hdc)
Definition: painting.c:2336
THRDESKHEAD head
Definition: ntuser.h:659
const WCHAR * str
Definition: object.h:3
#define DC_DRAWFRAMEMD
Definition: undocuser.h:151
#define MAKELONG(a, b)
Definition: typedefs.h:248
unsigned char BOOLEAN
#define DT_END_ELLIPSIS
Definition: winuser.h:529
BOOL APIENTRY NtUserEndPaint(HWND hWnd, CONST PAINTSTRUCT *pUnsafePs)
Definition: painting.c:1640
VOID CALLBACK SystemTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: timer.c:280
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:66
smooth NULL
Definition: ftsmooth.c:416
HRGN hrgnClip
Definition: ntuser.h:697
#define HRGN_WINDOW
Definition: ntuser.h:329
#define COLOR_ACTIVECAPTION
Definition: winuser.h:905
#define RGN_OR
Definition: wingdi.h:358
__kernel_entry W32KAPI BOOL APIENTRY NtGdiBitBlt(_In_ HDC hdcDst, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_opt_ HDC hdcSrc, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD rop4, _In_ DWORD crBackColor, _In_ FLONG fl)
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1791
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1742
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1770
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
__kernel_entry W32KAPI BOOL APIENTRY NtGdiSetRectRgn(_In_ HRGN hrgn, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: region.c:4071
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:893
BOOL NTAPI GreGradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
Definition: fillshap.c:871
#define ETO_CLIPPED
Definition: wingdi.h:647
struct _WND * spwndNext
Definition: ntuser.h:675
Definition: region.h:7
HDC APIENTRY NtUserBeginPaint(HWND hWnd, PAINTSTRUCT *UnsafePs)
Definition: painting.c:1593
#define DT_VCENTER
Definition: winuser.h:543
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
LARGE_UNICODE_STRING strName
Definition: ntuser.h:700
long left
Definition: polytest.cpp:53
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define WS_EX_REDIRECTED
Definition: undocuser.h:25
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2509
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:660
BOOL FASTCALL IntFillWindow(PWND pWndParent, PWND pWnd, HDC hDC, HBRUSH hBrush)
Definition: painting.c:1540
#define DC_ACTIVE
Definition: winuser.h:427
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
INT APIENTRY NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
Definition: painting.c:1914
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define FLASHW_FINISHED
Definition: painting.h:5
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define SM_CYCAPTION
Definition: winuser.h:953
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
LIST_ENTRY List
Definition: psmgr.c:57
#define TMRF_SYSTEM
Definition: timer.h:20
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG x
Definition: wingdi.h:2762
DWORD COLORREF
Definition: windef.h:285
static void Exit(void)
Definition: sock.c:1331
#define RDW_ERASE
Definition: winuser.h:1197
Colors
Definition: ansiprsr.h:4
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2481
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:610
INT APIENTRY NtUserExcludeUpdateRgn(HDC hDC, HWND hWnd)
Definition: painting.c:2509
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
#define WM_PALETTECHANGED
Definition: winuser.h:1838
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
HRGN hrgnUpdate
Definition: ntuser.h:685
unsigned short WORD
Definition: ntddk_ex.h:93
BOOL FASTCALL IntValidateParents(PWND Child, BOOL Recurse)
Definition: painting.c:62
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:507
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define GreSetRectRgnIndirect(hRgn, prc)
Definition: region.h:99
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:934
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1422
#define CLIPRGN
Definition: precomp.h:18
INT APIENTRY IntGdiGetRgnBox(HRGN hRgn, PRECTL pRect)
Definition: region.c:2583
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
BOOL APIENTRY NtUserFillWindow(HWND hWndParent, HWND hWnd, HDC hDC, HBRUSH hBrush)
Definition: painting.c:1690
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:223
Definition: partlist.h:33
int Window
Definition: x11stubs.h:26
GLbitfield flags
Definition: glext.h:7161
#define WM_PAINT
Definition: winuser.h:1602
#define SM_CXSMICON
Definition: winuser.h:1002
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
CHAR Message[80]
Definition: alive.c:5
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3984
BOOL APIENTRY NtUserPrintWindow(HWND hwnd, HDC hdcBlt, UINT nFlags)
Definition: painting.c:2563
#define ID_EVENT_SYSTIMER_FLASHWIN
Definition: timer.h:28
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:630
#define RDW_VALIDATE
Definition: winuser.h:1204
int ret
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:596
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:609
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HDC hdc
Definition: main.c:9
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
#define FLASHW_ACTIVE
Definition: painting.h:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274
static HRGN hrgn
Definition: win.c:55
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:924
#define DI_NORMAL
Definition: wingdi.h:72
#define RDW_NOERASE
Definition: winuser.h:1201
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:255
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
RECT rcWindow
Definition: ntuser.h:680
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
Definition: caret.c:269
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
VOID FASTCALL IntSendChildNCPaint(PWND pWnd)
Definition: painting.c:370
Definition: typedefs.h:117
static IHTMLWindow2 * window
Definition: events.c:77
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
uint32_t DWORD_PTR
Definition: typedefs.h:63
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
#define RDW_NOFRAME
Definition: winuser.h:1202
#define WNDS2_FORCEFULLNCPAINTCLIPRGN
Definition: ntuser.h:632
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
BOOL FASTCALL GreSetBrushOrg(HDC, INT, INT, LPPOINT)
Definition: dcutil.c:231
#define CTLCOLOR_MAX
Definition: winuser.h:948
#define PATCOPY
Definition: wingdi.h:334
Status
Definition: gdiplustypes.h:24
#define RGN_COPY
Definition: wingdi.h:356
#define SIMPLEREGION
Definition: wingdi.h:361
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1081
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1338
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:879
#define DCX_CACHE
Definition: winuser.h:2075
#define DT_SINGLELINE
Definition: winuser.h:540
BOOL APIENTRY NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
Definition: painting.c:1946
#define DC_NOSENDMSG
Definition: undocuser.h:146
_SEH2_END
Definition: create.c:4424
#define WS_BORDER
Definition: pedump.c:625
COLOR16 Alpha
Definition: wingdi.h:2767
#define DC_SMALLCAP
Definition: winuser.h:428
#define WS_MINIMIZEBOX
Definition: pedump.c:631
BOOL FASTCALL IsThreadSuspended(PTHREADINFO pti)
Definition: msgqueue.c:2206
#define RGN_DIFF
Definition: wingdi.h:357
unsigned short USHORT
Definition: pedump.c:61
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
HICON hIcon
Definition: msconfig.c:44
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1547
DWORD state
Definition: ntuser.h:665
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1065
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
BOOL FASTCALL IntIsWindowDirty(PWND Wnd)
Definition: painting.c:1106
#define min(a, b)
Definition: monoChain.cc:55
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1518
unsigned int UINT
Definition: ndis.h:50
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_NONCPAINT
Definition: ntuser.h:581
VOID FASTCALL IntPaintWindow(PWND Window)
Definition: painting.c:1165
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
UINT FASTCALL IntGdiRealizePalette(HDC)
Definition: palette.c:728
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define FLASHW_STARTED
Definition: painting.h:6
#define MAXUSHORT
Definition: typedefs.h:81
#define ProbeForReadUnicodeString(Ptr)
Definition: probe.h:77
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:501
#define WNDS2_CAPTIONTEXTTRUNCATED
Definition: ntuser.h:634
#define RDW_UPDATENOW
Definition: winuser.h:1206
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2395
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
Definition: monitor.c:102
_Out_opt_ int * cx
Definition: commctrl.h:570
#define RDW_ERASENOW
Definition: winuser.h:1205
COLOR16 Red
Definition: wingdi.h:2764
COLOR16 Blue
Definition: wingdi.h:2766
#define SM_CXSIZE
Definition: winuser.h:981
#define RDW_CLIPCHILDREN
Definition: painting.h:15
struct _WND * spwndParent
Definition: ntuser.h:677
HRGN FASTCALL IntCalcWindowRgn(PWND Wnd, BOOL Client)
Definition: painting.c:209
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:583
#define HIWORD(l)
Definition: typedefs.h:246
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
DWORD state2
Definition: ntuser.h:666
BOOL APIENTRY NtUserFlashWindowEx(IN PFLASHWINFO pfwi)
Definition: painting.c:1731
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LONG bottom
Definition: windef.h:294
#define FLASHW_MASK
Definition: painting.h:3
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:716
char * cleanup(char *str)
Definition: wpickclick.c:99
#define COLOR_BTNTEXT
Definition: winuser.h:923
#define FLASHW_COUNT
Definition: painting.h:7
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:882
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
Definition: caret.c:234
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
COLOR16 Green
Definition: wingdi.h:2765
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define USERTAG_WINDOWLIST
Definition: tags.h:297
RegionType
DBG_DEFAULT_CHANNEL(UserPainting)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
struct _WND * spwndChild
Definition: ntuser.h:678
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define HWND_BROADCAST
Definition: winuser.h:1190
BOOL FASTCALL co_UserGetUpdateRect(PWND Window, PRECT pRect, BOOL bErase)
Definition: painting.c:1842
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2471
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
#define WNDS_DESTROYED
Definition: ntuser.h:604
ATOM AtomFlashWndState
Definition: ntuser.c:22
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
#define LOWORD(l)
Definition: pedump.c:82
BOOL APIENTRY NtUserInvalidateRect(HWND hWnd, CONST RECT *lpUnsafeRect, BOOL bErase)
Definition: painting.c:2532
BOOL FASTCALL GreGetTextExtentExW(HDC hDC, LPCWSTR String, ULONG Count, ULONG MaxExtent, PULONG Fit, PULONG Dx, LPSIZE pSize, FLONG fl)
Definition: text.c:93
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define CONST
Definition: pedump.c:81
#define DC_TEXT
Definition: winuser.h:430
#define SRCCOPY
Definition: wingdi.h:332
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
base of all file and directory entries
Definition: entries.h:82
#define CS_PARENTDC
Definition: winuser.h:651
#define RETURN(rrr)
Definition: decompress.c:40
#define APIENTRY
Definition: api.h:79
struct Rect Rect
#define DC_DRAWCAPTIONMD
Definition: undocuser.h:149
#define END_CLEANUP
Definition: ntuser.h:6
#define WNDS2_INDESTROY
Definition: ntuser.h:616
char * Text
Definition: combotst.c:136
#define RDW_INVALIDATE
Definition: winuser.h:1200
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2182
BOOL APIENTRY NtUserDrawCaption(HWND hWnd, HDC hDC, LPCRECT lpRc, UINT uFlags)
Definition: painting.c:2447
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697
PCLS pcls
Definition: ntuser.h:684
DWORD style
Definition: ntuser.h:670
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120
#define DC_INBUTTON
Definition: winuser.h:431