[User32]
[reactos.git] / reactos / dll / win32 / user32 / windows / nonclient.c
index 6e20986..5460748 100644 (file)
@@ -5,19 +5,18 @@
  * Copyright (C) 2003 ReactOS Team
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /* INCLUDES *******************************************************************/
@@ -490,6 +489,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
    }
 
    ReleaseDC(hWnd, hDC);
+   DeleteObject(hRgn); // We use DCX_KEEPCLIPRGN
 
    return 0;
 }
@@ -1058,14 +1058,11 @@ DefWndTrackScrollBar(HWND hWnd, WPARAM wParam, POINT Point)
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
-/*
- * @implemented
- */
 BOOL WINAPI
-AdjustWindowRectEx(LPRECT lpRect,
-                  DWORD dwStyle,
-                  BOOL bMenu,
-                  DWORD dwExStyle)
+RealAdjustWindowRectEx(LPRECT lpRect,
+                       DWORD dwStyle,
+                       BOOL bMenu,
+                       DWORD dwExStyle)
 {
    SIZE BorderSize;
 
@@ -1089,6 +1086,38 @@ AdjustWindowRectEx(LPRECT lpRect,
    return TRUE;
 }
 
+/*
+ * @implemented
+ */
+BOOL WINAPI
+AdjustWindowRectEx(LPRECT lpRect,
+                  DWORD dwStyle,
+                  BOOL bMenu,
+                  DWORD dwExStyle)
+{
+   BOOL Hook, Ret = FALSE;
+
+   LOADUSERAPIHOOK
+
+   Hook = BeginIfHookedUserApiHook();
+
+     /* Bypass SEH and go direct. */
+   if (!Hook) return RealAdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+
+   _SEH2_TRY
+   {
+      Ret = guah.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+   }
+   _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+   {
+   }
+   _SEH2_END;
+
+   EndUserApiHook();
+
+   return Ret;
+}
+
 
 /*
  * @implemented
@@ -1110,7 +1139,27 @@ AdjustWindowRect(LPRECT lpRect,
 BOOL WINAPI
 DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
 {
- return NtUserDrawCaption(hWnd, hDC, lprc, uFlags);
+   BOOL Hook, Ret = FALSE;
+
+   LOADUSERAPIHOOK
+
+   Hook = BeginIfHookedUserApiHook();
+
+   /* Bypass SEH and go direct. */
+   if (!Hook) return NtUserDrawCaption(hWnd, hDC, lprc, uFlags);
+
+   _SEH2_TRY
+   {
+      Ret = guah.DrawCaption(hWnd, hDC, lprc, uFlags);
+   }
+   _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+   {
+   }
+   _SEH2_END;
+
+   EndUserApiHook();
+
+   return Ret;
 }
 
 /*