More user fixes.
authorDavid Welch <welch@cwcom.net>
Tue, 17 Sep 2002 23:46:23 +0000 (23:46 +0000)
committerDavid Welch <welch@cwcom.net>
Tue, 17 Sep 2002 23:46:23 +0000 (23:46 +0000)
svn path=/trunk/; revision=3517

17 files changed:
reactos/lib/user32/Makefile
reactos/lib/user32/include/user32.h
reactos/lib/user32/include/window.h
reactos/lib/user32/misc/desktop.c
reactos/lib/user32/misc/dllmain.c
reactos/lib/user32/misc/stubs.c
reactos/lib/user32/misc/winhelp.c
reactos/lib/user32/windows/accel.c
reactos/lib/user32/windows/bitmap.c
reactos/lib/user32/windows/cursor.c
reactos/lib/user32/windows/defwnd.c
reactos/lib/user32/windows/menu.c
reactos/lib/user32/windows/message.c
reactos/lib/user32/windows/prop.c
reactos/lib/user32/windows/rect.c
reactos/lib/user32/windows/text.c
reactos/lib/user32/windows/window.c

index bc9ff6c..bbaba20 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.5 2002/09/08 10:23:09 chorns Exp $
+# $Id: Makefile,v 1.6 2002/09/17 23:46:22 dwelch Exp $
 
 PATH_TO_TOP = ../..
 
 
 PATH_TO_TOP = ../..
 
@@ -10,7 +10,7 @@ TARGET_BASE = 0x77e70000
 
 TARGET_SDKLIBS = ntdll.a kernel32.a gdi32.a
 
 
 TARGET_SDKLIBS = ntdll.a kernel32.a gdi32.a
 
-TARGET_CFLAGS = -I./include -DUNICODE -DDBG
+TARGET_CFLAGS = -I./include -DUNICODE -DDBG -Wall -Werror
 
 TARGET_OBJECTS = $(TARGET_NAME).o
 
 
 TARGET_OBJECTS = $(TARGET_NAME).o
 
index 23732f4..8d31631 100644 (file)
@@ -7,14 +7,5 @@
 #include <windows.h>
 #include <win32k/win32k.h>
 
 #include <windows.h>
 #include <win32k/win32k.h>
 
-extern HANDLE ProcessHeap;
-VOID
-User32FreeHeap(PVOID Block);
-PVOID
-User32AllocHeap(ULONG Size);
-VOID
-User32ConvertUnicodeString(PWSTR SrcString, PSTR DestString, ULONG DestSize);
-PWSTR
-User32ConvertString(PCSTR String);
-VOID
-User32FreeString(PWSTR String);
+
+
index 87ef77e..02eb0eb 100644 (file)
@@ -8,3 +8,6 @@
 
 #define IS_ATOM(x) \
   (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
 
 #define IS_ATOM(x) \
   (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
+
+VOID
+UserSetupInternalPos(VOID);
index a6fe1b6..4db10d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: desktop.c,v 1.6 2002/09/08 10:23:10 chorns Exp $
+/* $Id: desktop.c,v 1.7 2002/09/17 23:46:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -81,7 +81,7 @@ CreateDesktopA(LPCSTR lpszDesktop,
   
   hDesktop = CreateDesktopW(DesktopNameU.Buffer,
                            NULL,
   
   hDesktop = CreateDesktopW(DesktopNameU.Buffer,
                            NULL,
-                           pDevmode,
+                           (LPDEVMODEW)pDevmode,
                            dwFlags,
                            dwDesiredAccess,
                            lpsa);
                            dwFlags,
                            dwDesiredAccess,
                            lpsa);
index 077df95..eddbc97 100644 (file)
@@ -1,6 +1,7 @@
 #include <windows.h>
 #include <debug.h>
 #include <user32/callback.h>
 #include <windows.h>
 #include <debug.h>
 #include <user32/callback.h>
+#include <window.h>
 
 #ifdef DBG
 
 
 #ifdef DBG
 
@@ -12,55 +13,13 @@ DWORD DebugTraceLevel = MIN_TRACE;
 /* To make the linker happy */
 VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
 
 /* To make the linker happy */
 VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
 
-HANDLE ProcessHeap;
 HWINSTA ProcessWindowStation;
 
 HWINSTA ProcessWindowStation;
 
-PVOID
-User32AllocHeap(ULONG Size)
-{
-  return(RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, Size));
-}
-
-VOID
-User32FreeHeap(PVOID Block)
-{
-  RtlFreeHeap(ProcessHeap, 0, Block);
-}
-
-PWSTR
-User32ConvertString(PCSTR String)
-{
-  ANSI_STRING InString;
-  UNICODE_STRING OutString;
-  RtlInitAnsiString(&InString, String);
-  RtlAnsiStringToUnicodeString(&OutString, &InString, TRUE);
-  return(OutString.Buffer);
-}
-
-VOID
-User32ConvertUnicodeString(PWSTR SrcString, PSTR DestString, ULONG DestSize)
-{
-  UNICODE_STRING InString;
-  ANSI_STRING OutString;
-  RtlInitUnicodeString(&InString, SrcString);
-  OutString.Buffer = DestString;
-  OutString.MaximumLength = DestSize;
-  RtlUnicodeStringToAnsiString(&OutString, &InString, FALSE);
-}
-
-VOID
-User32FreeString(PWSTR String)
-{
-  RtlFreeHeap(RtlGetProcessHeap(), 0, String);
-}
-
 DWORD
 Init(VOID)
 {
   DWORD Status;
 
 DWORD
 Init(VOID)
 {
   DWORD Status;
 
-  ProcessHeap = RtlGetProcessHeap();
-
   /* Set up the kernel callbacks. */
   NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
     (PVOID)User32CallWindowProcFromKernel;
   /* Set up the kernel callbacks. */
   NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
     (PVOID)User32CallWindowProcFromKernel;
@@ -75,6 +34,8 @@ Init(VOID)
   NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
     (PVOID)User32SendNCCALCSIZEMessageForKernel;
 
   NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
     (PVOID)User32SendNCCALCSIZEMessageForKernel;
 
+  UserSetupInternalPos();
+
   GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
 
   return(Status);
   GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
 
   return(Status);
index 00fca0f..fc91aab 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.14 2002/09/08 10:23:10 chorns Exp $
+/* $Id: stubs.c,v 1.15 2002/09/17 23:46:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  */
 #include <windows.h>
 
  */
 #include <windows.h>
 
-WINBOOL STDCALL 
-ScreenToClient(HWND hWnd, LPPOINT lpPoint)
-{
-}
-
 WINBOOL
 STDCALL
 AnyPopup(VOID)
 WINBOOL
 STDCALL
 AnyPopup(VOID)
@@ -289,19 +284,6 @@ LockWorkStation(VOID)
   return FALSE;
 }
 
   return FALSE;
 }
 
-
-
-int
-STDCALL
-MapWindowPoints(
-  HWND hWndFrom,
-  HWND hWndTo,
-  LPPOINT lpPoints,
-  UINT cPoints)
-{
-  return 0;
-}
-
 WINBOOL
 STDCALL
 MessageBeep(
 WINBOOL
 STDCALL
 MessageBeep(
index e9f6568..6e83a2e 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: winhelp.c,v 1.1 2002/08/27 06:40:15 robd Exp $
+/* $Id: winhelp.c,v 1.2 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/misc/winhelp.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/misc/winhelp.c
@@ -123,7 +123,7 @@ WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
                lpwh->ofsData = 0;
        }
        GlobalUnlock(hwh);
                lpwh->ofsData = 0;
        }
        GlobalUnlock(hwh);
-       return SendMessage(hDest, WM_WINHELP, hWnd, (LPARAM)hwh);
+       return SendMessage(hDest, WM_WINHELP, (WPARAM)hWnd, (LPARAM)hwh);
 }
 
 WINBOOL
 }
 
 WINBOOL
index cdd383c..a7192f7 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: accel.c,v 1.3 2002/09/08 10:23:11 chorns Exp $
+/* $Id: accel.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -67,7 +67,7 @@ CreateAcceleratorTableW(LPACCEL lpaccl,
 WINBOOL STDCALL
 DestroyAcceleratorTable(HACCEL hAccel)
 {
 WINBOOL STDCALL
 DestroyAcceleratorTable(HACCEL hAccel)
 {
-  User32FreeHeap(hAccel);
+  RtlFreeHeap(RtlGetProcessHeap(), 0, hAccel);
   return(TRUE);
 }
 
   return(TRUE);
 }
 
@@ -77,9 +77,11 @@ LoadAcceleratorsA(HINSTANCE hInstance,
 {
   LPWSTR lpTableNameW;
   HACCEL Res;
 {
   LPWSTR lpTableNameW;
   HACCEL Res;
-  lpTableNameW = User32ConvertString(lpTableName);
+  UNICODE_STRING lpTableNameString;
+  RtlCreateUnicodeStringFromAsciiz(&lpTableNameString, (LPSTR)lpTableName);
+  lpTableNameW = lpTableNameString.Buffer;
   Res = LoadAcceleratorsW(hInstance, lpTableNameW);
   Res = LoadAcceleratorsW(hInstance, lpTableNameW);
-  User32FreeString(lpTableName);
+  RtlFreeUnicodeString(&lpTableNameString);
   return(Res);
 }
 
   return(Res);
 }
 
@@ -103,7 +105,7 @@ LoadAcceleratorsW(HINSTANCE hInstance,
       Mem = LoadResource(hInstance, Rsrc);
       Size = SizeofResource(hInstance, Rsrc);
       AccelTableRsrc = LockResource(Mem);
       Mem = LoadResource(hInstance, Rsrc);
       Size = SizeofResource(hInstance, Rsrc);
       AccelTableRsrc = LockResource(Mem);
-      AccelTable = User32AllocHeap(Size);
+      AccelTable = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
       memcpy(AccelTable, AccelTableRsrc, Size);
       return((HACCEL)AccelTable);
     }
       memcpy(AccelTable, AccelTableRsrc, Size);
       return((HACCEL)AccelTable);
     }
index 5da0840..ab5aaff 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bitmap.c,v 1.4 2002/09/08 10:23:11 chorns Exp $
+/* $Id: bitmap.c,v 1.5 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -44,13 +44,15 @@ LoadImageA(HINSTANCE hinst,
 {
   LPWSTR lpszWName;
   HANDLE Handle;
 {
   LPWSTR lpszWName;
   HANDLE Handle;
+  UNICODE_STRING NameString;
 
   if (HIWORD(lpszName))
 
   if (HIWORD(lpszName))
-    {
-      lpszWName = User32ConvertString(lpszName);
+    {      
+      RtlCreateUnicodeStringFromAsciiz(&NameString, (LPSTR)lpszName);
+      lpszWName = NameString.Buffer;
       Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
                          cyDesired, fuLoad);
       Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
                          cyDesired, fuLoad);
-      User32FreeString(lpszWName);
+      RtlFreeUnicodeString(&NameString);
     }
   else
     {
     }
   else
     {
index 7357e2b..307d4d4 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: cursor.c,v 1.3 2002/09/08 10:23:12 chorns Exp $
+/* $Id: cursor.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/cursor.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/cursor.c
@@ -121,8 +121,13 @@ LoadCursorA(HINSTANCE hInstance,
 HCURSOR STDCALL
 LoadCursorFromFileA(LPCSTR lpFileName)
 {
 HCURSOR STDCALL
 LoadCursorFromFileA(LPCSTR lpFileName)
 {
-  return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0, 
-                   LR_LOADFROMFILE | LR_DEFAULTSIZE));
+  UNICODE_STRING FileName;
+  HCURSOR Result;
+  RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
+  Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0, 
+                     LR_LOADFROMFILE | LR_DEFAULTSIZE);
+  RtlFreeUnicodeString(&FileName);
+  return(Result);
 }
 
 HCURSOR STDCALL
 }
 
 HCURSOR STDCALL
index 94ab84a..cf3f71e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: defwnd.c,v 1.9 2002/09/08 10:23:12 chorns Exp $
+/* $Id: defwnd.c,v 1.10 2002/09/17 23:46:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -16,6 +16,7 @@
 #include <window.h>
 #include <debug.h>
 #include <user32/wininternal.h>
 #include <window.h>
 #include <debug.h>
 #include <user32/wininternal.h>
+#include <string.h>
 
 /* GLOBALS *******************************************************************/
 
 
 /* GLOBALS *******************************************************************/
 
@@ -60,8 +61,17 @@ static COLORREF SysColours[] =
     RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
   };
 
     RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
   };
 
+static ATOM AtomInternalPos;
+
 /* FUNCTIONS *****************************************************************/
 
 /* FUNCTIONS *****************************************************************/
 
+VOID
+UserSetupInternalPos(VOID)
+{
+  LPSTR Str = "SysIP";
+  AtomInternalPos = GlobalAddAtomA(Str);
+}
+
 /* ReactOS extension */
 HPEN STDCALL
 GetSysColorPen(int nIndex)
 /* ReactOS extension */
 HPEN STDCALL
 GetSysColorPen(int nIndex)
@@ -100,6 +110,24 @@ DefFrameProcW(HWND hWnd,
 BOOL 
 DefWndRedrawIconTitle(HWND hWnd)
 {
 BOOL 
 DefWndRedrawIconTitle(HWND hWnd)
 {
+  PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd, 
+                                             (LPSTR)(DWORD)AtomInternalPos);
+  if (lpPos != NULL)
+    {
+      if (lpPos->IconTitle != NULL)
+       {
+         SendMessageA(lpPos->IconTitle, WM_SHOWWINDOW, TRUE, 0);
+         InvalidateRect(lpPos->IconTitle, NULL, TRUE);
+         return(TRUE);
+       }
+    }
+  return(FALSE);
+}
+
+BOOL
+UserHasMenu(HWND hWnd, ULONG Style)
+{
+  return(!(Style & WS_CHILD) && GetWindowLong(hWnd, GWL_ID) != 0);
 }
 
 ULONG
 }
 
 ULONG
@@ -292,8 +320,9 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
       if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
       else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
       SetBkMode( hdc, TRANSPARENT );
       if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
       else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
       SetBkMode( hdc, TRANSPARENT );
-      DrawTextA( hdc, buffer, -1, &r,
-                DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
+      /*DrawTextA( hdc, buffer, -1, &r,
+       DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );*/
+      TextOutA(hdc, r.left, r.top, buffer, strlen(buffer));
     }
 }
 
     }
 }
 
@@ -450,21 +479,342 @@ DefWndPaintNC(HWND hWnd, HRGN clip)
 LRESULT
 DefWndHitTestNC(HWND hWnd, POINT Point)
 {
 LRESULT
 DefWndHitTestNC(HWND hWnd, POINT Point)
 {
+  RECT WindowRect;
+  ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
+  ULONG ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
+
+  GetWindowRect(hWnd, &WindowRect);
+
+  if (!PtInRect(&WindowRect, Point))
+    {
+      return(HTNOWHERE);
+    }
+  if (Style & WS_MINIMIZE)
+    {
+      return(HTCAPTION);
+    }
+  if (UserHasThickFrameStyle(Style, ExStyle))
+    {
+      InflateRect(&WindowRect, -GetSystemMetrics(SM_CXFRAME),
+                 -GetSystemMetrics(SM_CYFRAME));
+      if (!PtInRect(&WindowRect, Point))
+       {
+         if (Point.y < WindowRect.top)
+           {
+             if (Point.x < (WindowRect.left + GetSystemMetrics(SM_CXSIZE)))
+               {
+                 return(HTTOPLEFT);
+               }
+             if (Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXSIZE)))
+               {
+                 return(HTTOPRIGHT);
+               }
+             return(HTTOP);
+           }
+         if (Point.y >= WindowRect.bottom)
+           {
+             if (Point.x < (WindowRect.left + GetSystemMetrics(SM_CXSIZE)))
+               {
+                 return(HTBOTTOMLEFT);
+               }
+             if (Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXSIZE)))
+               {
+                 return(HTBOTTOMRIGHT);
+               }
+             return(HTBOTTOM);
+           }
+         if (Point.x < WindowRect.left)
+           {
+             if (Point.y < (WindowRect.top + GetSystemMetrics(SM_CYSIZE)))
+               {
+                 return(HTTOPLEFT);
+               }
+             if (Point.y >= (WindowRect.bottom - GetSystemMetrics(SM_CYSIZE)))
+               {
+                 return(HTBOTTOMLEFT);
+               }
+             return(HTLEFT);
+           }
+         if (Point.x >= WindowRect.right)
+           {
+             if (Point.y < (WindowRect.top + GetSystemMetrics(SM_CYSIZE)))
+               {
+                 return(HTTOPRIGHT);
+               }
+             if (Point.y >= (WindowRect.bottom - GetSystemMetrics(SM_CYSIZE)))
+               {
+                 return(HTBOTTOMRIGHT);
+               }
+             return(HTRIGHT);
+           }
+       }      
+    }
+  else 
+    {
+      if (UserHasDlgFrameStyle(Style, ExStyle))
+       {
+         InflateRect(&WindowRect, -GetSystemMetrics(SM_CXDLGFRAME),
+                     -GetSystemMetrics(SM_CYDLGFRAME));
+       }
+      else if (UserHasThinFrameStyle(Style, ExStyle))
+       {
+         InflateRect(&WindowRect, -GetSystemMetrics(SM_CXBORDER),
+                     -GetSystemMetrics(SM_CYBORDER));
+       }
+      if (!PtInRect(&WindowRect, Point))
+       {
+         return(HTBORDER);
+       }
+    }
+
+  if ((Style & WS_CAPTION) == WS_CAPTION)
+    {
+      WindowRect.top += GetSystemMetrics(SM_CYCAPTION) - 
+       GetSystemMetrics(SM_CYBORDER);
+      if (!PtInRect(&WindowRect, Point))
+       {
+         if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW))
+           {
+             WindowRect.left += GetSystemMetrics(SM_CXSIZE);
+           }
+         if (Point.x <= WindowRect.left)
+           {
+             return(HTSYSMENU);
+           }
+
+         if (Style & WS_MAXIMIZEBOX)
+           {
+             WindowRect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
+           }
+         if (Point.x >= WindowRect.right)
+           {
+             return(HTMAXBUTTON);
+           }
+
+         if (Style & WS_MINIMIZEBOX)
+           {
+             WindowRect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
+           }
+         if (Point.x >= WindowRect.right)
+           {
+             return(HTMINBUTTON);
+           }
+         return(HTCAPTION);
+       }
+    }
+
+  ScreenToClient(hWnd, &Point);
+  GetClientRect(hWnd, &WindowRect);
+
+  if (PtInRect(&WindowRect, Point))
+    {
+      return(HTCLIENT);
+    }
+
+  if (Style & WS_VSCROLL)
+    {
+      WindowRect.right += GetSystemMetrics(SM_CXVSCROLL);
+      if (PtInRect(&WindowRect, Point))
+       {
+         return(HTVSCROLL);
+       }
+    }
+
+  if (Style & WS_HSCROLL)
+    {
+      WindowRect.bottom += GetSystemMetrics(SM_CYHSCROLL);
+      if (PtInRect(&WindowRect, Point))
+       {
+         if ((Style & WS_VSCROLL) &&
+             (Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXVSCROLL))))
+           {
+             return(HTSIZE);
+           }
+         return(HTHSCROLL);
+       }
+    }
+
+  if (UserHasMenu(hWnd, Style))
+    {
+      if (Point.y < 0 && Point.x >= 0 && Point.x <= WindowRect.right)
+       {
+         return(HTMENU);
+       }
+    }
+
+  return(HTNOWHERE);
+}
+
+VOID
+DefWndTrackMinMaxBox(HWND hWnd, WPARAM wParam)
+{
+  HDC hDC = GetWindowDC(hWnd);
+  BOOL Pressed = TRUE;
+  MSG Msg;
+
+  SetCapture(hWnd);
+
+  if (wParam == HTMINBUTTON)
+    {
+      UserDrawMinButton(hWnd, hDC, TRUE);
+    }
+  else
+    {
+      UserDrawMaxButton(hWnd, hDC, TRUE);
+    }
+
+  for(;;)
+    {
+      BOOL OldState = Pressed;      
+
+      GetMessageA(hWnd, &Msg, 0, 0);
+      if (Msg.message == WM_LBUTTONUP)
+       {
+         break;
+       }
+      if (Msg.message != WM_MOUSEMOVE)
+       {
+         continue;
+       }
+
+      Pressed = DefWndHitTestNC(hWnd, Msg.pt) == wParam;
+      if (Pressed != OldState)
+       {
+         if (wParam == HTMINBUTTON)
+           {
+             UserDrawMinButton(hWnd, hDC, Pressed);
+           }
+         else
+           {
+             UserDrawMaxButton(hWnd, hDC, Pressed);
+           }
+       }
+    }
+
+  if (Pressed)
+    {
+      if (wParam == HTMINBUTTON)
+       {
+         UserDrawMinButton(hWnd, hDC, FALSE);
+       }
+      else
+       {
+         UserDrawMaxButton(hWnd, hDC, FALSE);
+       }
+    }
+
+  ReleaseCapture();
+  ReleaseDC(hWnd, hDC);
+
+  if (!Pressed)
+    {
+      return;
+    }
+
+  if (wParam == HTMINBUTTON)
+    {
+      SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 
+                  MAKELONG(Msg.pt.x, Msg.pt.y));
+    }
+  else
+    {
+      SendMessageA(hWnd, WM_SYSCOMMAND, 
+                  IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE, 
+                  MAKELONG(Msg.pt.x, Msg.pt.y));
+    }
+}
+
+VOID
+DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down)
+{
+  RECT Rect;
+  HDC hDcMem;
+  HBITMAP hSavedBitmap;
+
+  UserGetInsideRectNC(hWnd, &Rect);
+  hDcMem = CreateCompatibleDC(hDC);
+  hSavedBitmap = SelectObject(hDcMem, hbitmapClose);
+  BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE),
+        GetSystemMetrics(SM_CYSIZE), hDcMem, 
+        (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ? 
+        GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY);
+  SelectObject(hDcMem, hSavedBitmap);
+  DeleteDC(hDcMem);
 }
 
 LRESULT
 DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 }
 
 LRESULT
 DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+  switch (wParam)
+    {
+    case HTCAPTION:
+      {
+       HWND hTopWnd = GetAncestor(hWnd, GA_ROOT);
+       if (SetActiveWindow(hTopWnd) || GetActiveWindow() == hTopWnd)
+         {
+           SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam);
+         }
+       break;
+      }
+    case HTSYSMENU:
+      {
+       if (GetWindowLong(hWnd, GWL_STYLE) & WS_SYSMENU)
+         {
+           if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZE))
+             {
+               HDC hDC = GetWindowDC(hWnd);
+               DefWndDrawSysButton(hWnd, hDC, TRUE);
+               ReleaseDC(hWnd, hDC);
+             }
+           SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, 
+                        lParam);
+         }
+       break;
+      }
+
+    case HTMENU:
+      SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam);
+      break;
+
+    case HTHSCROLL:
+      SendMessageA(hWnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam);
+      break;
+
+    case HTVSCROLL:
+      SendMessageA(hWnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam);
+      break;
+
+    case HTMINBUTTON:
+    case HTMAXBUTTON:
+      DefWndTrackMinMaxBox(hWnd, wParam);
+      break;
+
+    case HTLEFT:
+    case HTRIGHT:
+    case HTTOP:
+    case HTBOTTOM:
+    case HTTOPLEFT:
+    case HTTOPRIGHT:
+    case HTBOTTOMLEFT:
+    case HTBOTTOMRIGHT:
+      SendMessageA(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam);
+      break;
+    }
+  return(0);
 }
 
 LRESULT
 DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 }
 
 LRESULT
 DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+  /* FIXME: Implement this. */
+  return(0);
 }
 
 LRESULT
 DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
 {
 }
 
 LRESULT
 DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
 {
+  /* FIXME: Implement this. */
+  return(0);
 }
 
 VOID
 }
 
 VOID
@@ -624,6 +974,7 @@ LRESULT
 DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
 {
   /* FIXME: Implement this. */
 DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
 {
   /* FIXME: Implement this. */
+  return(0);
 }
 
 LRESULT STDCALL
 }
 
 LRESULT STDCALL
@@ -1022,7 +1373,7 @@ DefWindowProcA(HWND hWnd,
               LPARAM lParam)
 {
   LRESULT Result;
               LPARAM lParam)
 {
   LRESULT Result;
-  static ATOM WindowTextAtom = 0;
+  static LPSTR WindowTextAtom = 0;
   PSTR WindowText;
 
   switch (Msg)
   PSTR WindowText;
 
   switch (Msg)
@@ -1032,8 +1383,10 @@ DefWindowProcA(HWND hWnd,
        CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
        if (HIWORD(Cs->lpszName))
          {
        CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
        if (HIWORD(Cs->lpszName))
          {
-           WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomA");
-           WindowText = User32AllocHeap(strlen(Cs->lpszName) * sizeof(CHAR));
+           WindowTextAtom = 
+             (LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA");
+           WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
+                                        strlen(Cs->lpszName) * sizeof(CHAR));
            strcpy(WindowText, Cs->lpszName);
            SetPropA(hWnd, WindowTextAtom, WindowText);
          }
            strcpy(WindowText, Cs->lpszName);
            SetPropA(hWnd, WindowTextAtom, WindowText);
          }
@@ -1057,7 +1410,7 @@ DefWindowProcA(HWND hWnd,
          {
            return(0);
          }
          {
            return(0);
          }
-       return(wcslen(WindowText));
+       return(strlen(WindowText));
       }
 
     case WM_GETTEXT:
       }
 
     case WM_GETTEXT:
@@ -1071,22 +1424,24 @@ DefWindowProcA(HWND hWnd,
              }
            return(0);
          }
              }
            return(0);
          }
-       strncpy(lParam, WindowText, wParam);
-       return(min(wParam, wcslen(WindowText)));
+       strncpy((LPSTR)lParam, WindowText, wParam);
+       return(min(wParam, strlen(WindowText)));
       }
 
     case WM_SETTEXT:
       {
        if (WindowTextAtom != 0)
          {
       }
 
     case WM_SETTEXT:
       {
        if (WindowTextAtom != 0)
          {
-           WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomW");      
+           WindowTextAtom = 
+             (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");       
          }
        if (WindowTextAtom != 0 &&
            (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
          {
          }
        if (WindowTextAtom != 0 &&
            (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
          {
-           User32FreeHeap(WindowText);
+           RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
          }
          }
-       WindowText = User32AllocHeap(strlen((PSTR)lParam) * sizeof(CHAR));
+       WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
+                                    strlen((PSTR)lParam) * sizeof(CHAR));
        strcpy(WindowText, (PSTR)lParam);
        SetPropA(hWnd, WindowTextAtom, WindowText);
       }
        strcpy(WindowText, (PSTR)lParam);
        SetPropA(hWnd, WindowTextAtom, WindowText);
       }
@@ -1096,11 +1451,11 @@ DefWindowProcA(HWND hWnd,
        if (WindowTextAtom != 0 &&
            (WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
          {
        if (WindowTextAtom != 0 &&
            (WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
          {
-           User32FreeHeap(WindowText);
+           RtlFreeHeap(GetProcessHeap(), 0, WindowText);
          }
        if (WindowTextAtom != 0)
          {
          }
        if (WindowTextAtom != 0)
          {
-           GlobalDeleteAtom(WindowTextAtom);
+           GlobalDeleteAtom((ATOM)(ULONG)WindowTextAtom);
          }
        /* FIXME: Destroy scroll bars here as well. */
        return(0);
          }
        /* FIXME: Destroy scroll bars here as well. */
        return(0);
@@ -1121,7 +1476,7 @@ DefWindowProcW(HWND hWnd,
               LPARAM lParam)
 {
   LRESULT Result;
               LPARAM lParam)
 {
   LRESULT Result;
-  static ATOM WindowTextAtom = 0;
+  static LPWSTR WindowTextAtom = 0;
   PWSTR WindowText;
 
   switch (Msg)
   PWSTR WindowText;
 
   switch (Msg)
@@ -1131,8 +1486,10 @@ DefWindowProcW(HWND hWnd,
        CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
        if (HIWORD(Cs->lpszName))
          {
        CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
        if (HIWORD(Cs->lpszName))
          {
-           WindowTextAtom = GlobalAddAtomW(L"USER32!WindowTextAtomW");
-           WindowText = User32AllocHeap(wcslen(Cs->lpszName) * sizeof(WCHAR));
+           WindowTextAtom = 
+             (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW");
+           WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
+                                        wcslen(Cs->lpszName) * sizeof(WCHAR));
            wcscpy(WindowText, Cs->lpszName);
            SetPropW(hWnd, WindowTextAtom, WindowText);
          }
            wcscpy(WindowText, Cs->lpszName);
            SetPropW(hWnd, WindowTextAtom, WindowText);
          }
@@ -1178,14 +1535,16 @@ DefWindowProcW(HWND hWnd,
       {
        if (WindowTextAtom != 0)
          {
       {
        if (WindowTextAtom != 0)
          {
-           WindowTextAtom = GlobalAddAtom(L"USER32!WindowTextAtomW");      
+           WindowTextAtom = 
+             (LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");      
          }
        if (WindowTextAtom != 0 &&
            (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
          {
          }
        if (WindowTextAtom != 0 &&
            (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
          {
-           User32FreeHeap(WindowText);
+           RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
          }
          }
-       WindowText = User32AllocHeap(wcslen((PWSTR)lParam) * sizeof(WCHAR));
+       WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
+                                    wcslen((PWSTR)lParam) * sizeof(WCHAR));
        wcscpy(WindowText, (PWSTR)lParam);
        SetPropW(hWnd, WindowTextAtom, WindowText);
       }
        wcscpy(WindowText, (PWSTR)lParam);
        SetPropW(hWnd, WindowTextAtom, WindowText);
       }
@@ -1195,11 +1554,11 @@ DefWindowProcW(HWND hWnd,
        if (WindowTextAtom != 0 &&
            (WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
          {
        if (WindowTextAtom != 0 &&
            (WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
          {
-           User32FreeHeap(WindowText);
+           RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
          }
        if (WindowTextAtom != 0)
          {
          }
        if (WindowTextAtom != 0)
          {
-           GlobalDeleteAtom(WindowTextAtom);
+           GlobalDeleteAtom((ATOM)(DWORD)WindowTextAtom);
          }
        /* FIXME: Destroy scroll bars here as well. */
        return(0);
          }
        /* FIXME: Destroy scroll bars here as well. */
        return(0);
index ed423c9..34efa3e 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: menu.c,v 1.5 2002/09/08 10:23:12 chorns Exp $
+/* $Id: menu.c,v 1.6 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/menu.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/menu.c
@@ -72,7 +72,7 @@ MenuFindItem(HMENU* hMenu, UINT* nPos, UINT wFlags)
   POPUP_MENU* Menu;
   ULONG i;
 
   POPUP_MENU* Menu;
   ULONG i;
 
-  if ((*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
+  if ((ULONG)(*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
     {
       return(NULL);
     }
     {
       return(NULL);
     }
index 51c35b0..3fa3f69 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: message.c,v 1.10 2002/09/08 10:23:12 chorns Exp $
+/* $Id: message.c,v 1.11 2002/09/17 23:46:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -10,6 +10,7 @@
  */
 #include <windows.h>
 #include <user32.h>
  */
 #include <windows.h>
 #include <user32.h>
+#include <string.h>
 #include <debug.h>
 
 LPARAM
 #include <debug.h>
 
 LPARAM
@@ -73,7 +74,7 @@ User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
        LPSTR TempString;
        LPSTR InString;
        InString = (LPSTR)lParam;
        LPSTR TempString;
        LPSTR InString;
        InString = (LPSTR)lParam;
-       TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(lParam));
+       TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(InString));
        strcpy(TempString, InString);
        RtlInitAnsiString(&AnsiString, TempString);
        UnicodeString.Length = wParam;
        strcpy(TempString, InString);
        RtlInitAnsiString(&AnsiString, TempString);
        UnicodeString.Length = wParam;
@@ -109,7 +110,7 @@ User32ConvertToAsciiMessage(UINT* Msg, WPARAM* wParam, LPARAM* lParam)
        ANSI_STRING AString;
 
        CsW = (CREATESTRUCTW*)(*lParam);
        ANSI_STRING AString;
 
        CsW = (CREATESTRUCTW*)(*lParam);
-       CsA = User32AllocHeap(sizeof(CREATESTRUCTA));
+       CsA = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(CREATESTRUCTA));
        memcpy(CsA, CsW, sizeof(CREATESTRUCTW));
 
        RtlInitUnicodeString(&UString, CsW->lpszName);
        memcpy(CsA, CsW, sizeof(CREATESTRUCTW));
 
        RtlInitUnicodeString(&UString, CsW->lpszName);
@@ -476,7 +477,7 @@ RegisterWindowMessageA(LPCSTR lpString)
   BOOLEAN Result;
   UINT Atom;
 
   BOOLEAN Result;
   UINT Atom;
 
-  Result = RtlCreateUnicodeStringFromAsciiz(&String, lpString);
+  Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
   if (!Result)
     {
       return(0);
   if (!Result)
     {
       return(0);
index ef180dc..efff72e 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: prop.c,v 1.4 2002/09/08 10:23:12 chorns Exp $
+/* $Id: prop.c,v 1.5 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -63,20 +63,22 @@ HANDLE STDCALL
 GetPropA(HWND hWnd, LPCSTR lpString)
 {
   PWSTR lpWString;
 GetPropA(HWND hWnd, LPCSTR lpString)
 {
   PWSTR lpWString;
+  UNICODE_STRING UString;
   HANDLE Ret;
   if (HIWORD(lpString))
     {
   HANDLE Ret;
   if (HIWORD(lpString))
     {
-      lpWString = User32ConvertString(lpString);
+      RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
+      lpWString = UString.Buffer;
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = GetPropW(hWnd, lpWString);
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = GetPropW(hWnd, lpWString);
-      User32FreeString(lpWString);
+      RtlFreeUnicodeString(&UString);
     }
   else
     {
     }
   else
     {
-      Ret = GetPropW(hWnd, lpString);
+      Ret = GetPropW(hWnd, (LPWSTR)lpString);
     }  
   return(Ret);
 }
     }  
   return(Ret);
 }
@@ -91,7 +93,7 @@ GetPropW(HWND hWnd, LPCWSTR lpString)
     }
   else
     {
     }
   else
     {
-      Atom = LOWORD(lpString);
+      Atom = LOWORD((DWORD)lpString);
     }
   return(NtUserGetProp(hWnd, Atom));
 }
     }
   return(NtUserGetProp(hWnd, Atom));
 }
@@ -100,17 +102,19 @@ HANDLE STDCALL
 RemovePropA(HWND hWnd, LPCSTR lpString)
 {
   PWSTR lpWString;
 RemovePropA(HWND hWnd, LPCSTR lpString)
 {
   PWSTR lpWString;
+  UNICODE_STRING UString;
   HANDLE Ret;
 
   if (HIWORD(lpString))
     {
   HANDLE Ret;
 
   if (HIWORD(lpString))
     {
-      lpWString = User32ConvertString(lpString);
+      RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
+      lpWString = UString.Buffer;
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = RemovePropW(hWnd, lpWString);
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = RemovePropW(hWnd, lpWString);
-      User32FreeString(lpWString);
+      RtlFreeUnicodeString(&UString);
     }
   else
     {
     }
   else
     {
@@ -130,7 +134,7 @@ RemovePropW(HWND hWnd,
     }
   else
     {
     }
   else
     {
-      Atom = LOWORD(lpString);
+      Atom = LOWORD((DWORD)lpString);
     }
   return(NtUserRemoveProp(hWnd, Atom));
 }
     }
   return(NtUserRemoveProp(hWnd, Atom));
 }
@@ -139,21 +143,23 @@ WINBOOL STDCALL
 SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
 {
   PWSTR lpWString;
 SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
 {
   PWSTR lpWString;
+  UNICODE_STRING UString;
   BOOL Ret;
   
   if (HIWORD(lpString))
     {
   BOOL Ret;
   
   if (HIWORD(lpString))
     {
-      lpWString = User32ConvertString(lpString);
+      RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
+      lpWString = UString.Buffer;
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = SetPropW(hWnd, lpWString, hData);
       if (lpWString == NULL)
        {
          return(FALSE);
        }
       Ret = SetPropW(hWnd, lpWString, hData);
-      User32FreeString(lpWString);
+      RtlFreeUnicodeString(&UString);
     }
   else
     {
     }
   else
     {
-      Ret = SetPropW(hWnd, lpString, hData);
+      Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
     }
   return(Ret);
 }
     }
   return(Ret);
 }
@@ -168,7 +174,7 @@ SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
     }
   else
     {
     }
   else
     {
-      Atom = LOWORD(lpString);
+      Atom = LOWORD((DWORD)lpString);
     }
   
   return(NtUserSetProp(hWnd, Atom, hData));
     }
   
   return(NtUserSetProp(hWnd, Atom, hData));
index 746b898..ccd0d41 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: rect.c,v 1.10 2002/09/08 10:23:12 chorns Exp $
+/* $Id: rect.c,v 1.11 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -87,6 +87,7 @@ IntersectRect(LPRECT lprcDst,
   lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
   lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
   lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
   lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
   lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
   lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
+  return(TRUE);
 }
 
 WINBOOL STDCALL
 }
 
 WINBOOL STDCALL
index 44793ec..bb2e481 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: text.c,v 1.3 2002/09/08 10:23:12 chorns Exp $
+/* $Id: text.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -83,6 +83,7 @@ CharNextExA(
   LPCSTR lpCurrentChar,
   DWORD dwFlags)
 {
   LPCSTR lpCurrentChar,
   DWORD dwFlags)
 {
+  return (LPSTR)NULL;
 }
 
 LPWSTR
 }
 
 LPWSTR
index 422ffae..21b10af 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.13 2002/09/08 10:23:12 chorns Exp $
+/* $Id: window.c,v 1.14 2002/09/17 23:46:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -50,8 +50,7 @@ User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
       Result.Rect = CallbackArgs->Rect;
     }
   DbgPrint("Returning result %d.\n", Result);
       Result.Rect = CallbackArgs->Rect;
     }
   DbgPrint("Returning result %d.\n", Result);
-  ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
-  /* Doesn't return. */
+  return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
 }
 
 NTSTATUS STDCALL
 }
 
 NTSTATUS STDCALL
@@ -75,8 +74,7 @@ User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
                                  0, (LPARAM)&CallbackArgs->MinMaxInfo);
   Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
   DbgPrint("Returning result %d.\n", Result);
                                  0, (LPARAM)&CallbackArgs->MinMaxInfo);
   Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
   DbgPrint("Returning result %d.\n", Result);
-  ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
-  /* Doesn't return. */
+  return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
 }
 
 NTSTATUS STDCALL
 }
 
 NTSTATUS STDCALL
@@ -99,8 +97,7 @@ User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0, 
                           (LPARAM)&CallbackArgs->CreateStruct);
   DbgPrint("Returning result %d.\n", Result);
   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0, 
                           (LPARAM)&CallbackArgs->CreateStruct);
   DbgPrint("Returning result %d.\n", Result);
-  ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
-  /* Doesn't return. */
+  return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
 }
 
 NTSTATUS STDCALL
 }
 
 NTSTATUS STDCALL
@@ -123,8 +120,7 @@ User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0, 
                           (LPARAM)&CallbackArgs->CreateStruct);
   DbgPrint("Returning result %d.\n", Result);
   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0, 
                           (LPARAM)&CallbackArgs->CreateStruct);
   DbgPrint("Returning result %d.\n", Result);
-  ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
-  /* Doesn't return. */
+  return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
 }
 
 NTSTATUS STDCALL
 }
 
 NTSTATUS STDCALL
@@ -164,8 +160,7 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
   Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd, 
                           CallbackArgs->Msg, CallbackArgs->wParam, 
                           CallbackArgs->lParam);
   Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd, 
                           CallbackArgs->Msg, CallbackArgs->wParam, 
                           CallbackArgs->lParam);
-  ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
-  /* Doesn't return. */
+  return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
 }
 
 WINBOOL STDCALL
 }
 
 WINBOOL STDCALL
@@ -582,8 +577,7 @@ GetAncestor(HWND hwnd, UINT gaFlags)
 }
 
 WINBOOL STDCALL
 }
 
 WINBOOL STDCALL
-GetClientRect(HWND hWnd,
-             LPRECT lpRect)
+GetClientRect(HWND hWnd, LPRECT lpRect)
 {
   return FALSE;
 }
 {
   return FALSE;
 }
@@ -918,4 +912,30 @@ WindowFromPoint(POINT Point)
   return (HWND)0;
 }
 
   return (HWND)0;
 }
 
+int STDCALL
+MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
+{
+  POINT FromOffset, ToOffset;
+  LONG XMove, YMove;
+  ULONG i;
+
+  NtUserGetClientOrigin(hWndFrom, &FromOffset);
+  NtUserGetClientOrigin(hWndTo, &ToOffset);
+  XMove = ToOffset.x - FromOffset.x;
+  YMove = ToOffset.y - FromOffset.y;
+  for (i = 0; i < cPoints; i++)
+    {
+      lpPoints[i].x += XMove;
+      lpPoints[i].y += YMove;
+    }
+  return(MAKELONG(LOWORD(XMove), LOWORD(YMove))); 
+}
+
+
+WINBOOL STDCALL 
+ScreenToClient(HWND hWnd, LPPOINT lpPoint)
+{
+  return(MapWindowPoints(NULL, hWnd, lpPoint, 1));
+}
+
 /* EOF */
 /* EOF */