-# $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 = ../..
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
#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);
+
+
#define IS_ATOM(x) \
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
+
+VOID
+UserSetupInternalPos(VOID);
-/* $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
hDesktop = CreateDesktopW(DesktopNameU.Buffer,
NULL,
- pDevmode,
+ (LPDEVMODEW)pDevmode,
dwFlags,
dwDesiredAccess,
lpsa);
#include <windows.h>
#include <debug.h>
#include <user32/callback.h>
+#include <window.h>
#ifdef DBG
/* To make the linker happy */
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
-HANDLE ProcessHeap;
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;
- ProcessHeap = RtlGetProcessHeap();
-
/* Set up the kernel callbacks. */
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
(PVOID)User32CallWindowProcFromKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
(PVOID)User32SendNCCALCSIZEMessageForKernel;
+ UserSetupInternalPos();
+
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
return(Status);
-/* $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
*/
#include <windows.h>
-WINBOOL STDCALL
-ScreenToClient(HWND hWnd, LPPOINT lpPoint)
-{
-}
-
WINBOOL
STDCALL
AnyPopup(VOID)
return FALSE;
}
-
-
-int
-STDCALL
-MapWindowPoints(
- HWND hWndFrom,
- HWND hWndTo,
- LPPOINT lpPoints,
- UINT cPoints)
-{
- return 0;
-}
-
WINBOOL
STDCALL
MessageBeep(
* 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
lpwh->ofsData = 0;
}
GlobalUnlock(hwh);
- return SendMessage(hDest, WM_WINHELP, hWnd, (LPARAM)hwh);
+ return SendMessage(hDest, WM_WINHELP, (WPARAM)hWnd, (LPARAM)hwh);
}
WINBOOL
* 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
WINBOOL STDCALL
DestroyAcceleratorTable(HACCEL hAccel)
{
- User32FreeHeap(hAccel);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, hAccel);
return(TRUE);
}
{
LPWSTR lpTableNameW;
HACCEL Res;
- lpTableNameW = User32ConvertString(lpTableName);
+ UNICODE_STRING lpTableNameString;
+ RtlCreateUnicodeStringFromAsciiz(&lpTableNameString, (LPSTR)lpTableName);
+ lpTableNameW = lpTableNameString.Buffer;
Res = LoadAcceleratorsW(hInstance, lpTableNameW);
- User32FreeString(lpTableName);
+ RtlFreeUnicodeString(&lpTableNameString);
return(Res);
}
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);
}
* 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
{
LPWSTR lpszWName;
HANDLE Handle;
+ UNICODE_STRING NameString;
if (HIWORD(lpszName))
- {
- lpszWName = User32ConvertString(lpszName);
+ {
+ RtlCreateUnicodeStringFromAsciiz(&NameString, (LPSTR)lpszName);
+ lpszWName = NameString.Buffer;
Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
cyDesired, fuLoad);
- User32FreeString(lpszWName);
+ RtlFreeUnicodeString(&NameString);
}
else
{
* 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
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
-/* $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
#include <window.h>
#include <debug.h>
#include <user32/wininternal.h>
+#include <string.h>
/* GLOBALS *******************************************************************/
RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
};
+static ATOM AtomInternalPos;
+
/* FUNCTIONS *****************************************************************/
+VOID
+UserSetupInternalPos(VOID)
+{
+ LPSTR Str = "SysIP";
+ AtomInternalPos = GlobalAddAtomA(Str);
+}
+
/* ReactOS extension */
HPEN STDCALL
GetSysColorPen(int nIndex)
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
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));
}
}
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)
{
+ 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)
{
+ /* FIXME: Implement this. */
+ return(0);
}
LRESULT
DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
{
+ /* FIXME: Implement this. */
+ return(0);
}
VOID
DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
{
/* FIXME: Implement this. */
+ return(0);
}
LRESULT STDCALL
LPARAM lParam)
{
LRESULT Result;
- static ATOM WindowTextAtom = 0;
+ static LPSTR WindowTextAtom = 0;
PSTR WindowText;
switch (Msg)
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);
}
{
return(0);
}
- return(wcslen(WindowText));
+ return(strlen(WindowText));
}
case WM_GETTEXT:
}
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)
{
- WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomW");
+ WindowTextAtom =
+ (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");
}
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);
}
if (WindowTextAtom != 0 &&
(WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
{
- User32FreeHeap(WindowText);
+ RtlFreeHeap(GetProcessHeap(), 0, WindowText);
}
if (WindowTextAtom != 0)
{
- GlobalDeleteAtom(WindowTextAtom);
+ GlobalDeleteAtom((ATOM)(ULONG)WindowTextAtom);
}
/* FIXME: Destroy scroll bars here as well. */
return(0);
LPARAM lParam)
{
LRESULT Result;
- static ATOM WindowTextAtom = 0;
+ static LPWSTR WindowTextAtom = 0;
PWSTR WindowText;
switch (Msg)
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);
}
{
if (WindowTextAtom != 0)
{
- WindowTextAtom = GlobalAddAtom(L"USER32!WindowTextAtomW");
+ WindowTextAtom =
+ (LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");
}
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);
}
if (WindowTextAtom != 0 &&
(WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
{
- User32FreeHeap(WindowText);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
}
if (WindowTextAtom != 0)
{
- GlobalDeleteAtom(WindowTextAtom);
+ GlobalDeleteAtom((ATOM)(DWORD)WindowTextAtom);
}
/* FIXME: Destroy scroll bars here as well. */
return(0);
* 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
POPUP_MENU* Menu;
ULONG i;
- if ((*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
+ if ((ULONG)(*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
{
return(NULL);
}
-/* $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
*/
#include <windows.h>
#include <user32.h>
+#include <string.h>
#include <debug.h>
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;
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);
BOOLEAN Result;
UINT Atom;
- Result = RtlCreateUnicodeStringFromAsciiz(&String, lpString);
+ Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
if (!Result)
{
return(0);
* 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
GetPropA(HWND hWnd, LPCSTR lpString)
{
PWSTR lpWString;
+ UNICODE_STRING UString;
HANDLE Ret;
if (HIWORD(lpString))
{
- lpWString = User32ConvertString(lpString);
+ RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
+ lpWString = UString.Buffer;
if (lpWString == NULL)
{
return(FALSE);
}
Ret = GetPropW(hWnd, lpWString);
- User32FreeString(lpWString);
+ RtlFreeUnicodeString(&UString);
}
else
{
- Ret = GetPropW(hWnd, lpString);
+ Ret = GetPropW(hWnd, (LPWSTR)lpString);
}
return(Ret);
}
}
else
{
- Atom = LOWORD(lpString);
+ Atom = LOWORD((DWORD)lpString);
}
return(NtUserGetProp(hWnd, Atom));
}
RemovePropA(HWND hWnd, LPCSTR lpString)
{
PWSTR lpWString;
+ UNICODE_STRING UString;
HANDLE Ret;
if (HIWORD(lpString))
{
- lpWString = User32ConvertString(lpString);
+ RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
+ lpWString = UString.Buffer;
if (lpWString == NULL)
{
return(FALSE);
}
Ret = RemovePropW(hWnd, lpWString);
- User32FreeString(lpWString);
+ RtlFreeUnicodeString(&UString);
}
else
{
}
else
{
- Atom = LOWORD(lpString);
+ Atom = LOWORD((DWORD)lpString);
}
return(NtUserRemoveProp(hWnd, Atom));
}
SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
{
PWSTR lpWString;
+ UNICODE_STRING UString;
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);
- User32FreeString(lpWString);
+ RtlFreeUnicodeString(&UString);
}
else
{
- Ret = SetPropW(hWnd, lpString, hData);
+ Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
}
return(Ret);
}
}
else
{
- Atom = LOWORD(lpString);
+ Atom = LOWORD((DWORD)lpString);
}
return(NtUserSetProp(hWnd, Atom, hData));
* 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
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
* 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
LPCSTR lpCurrentChar,
DWORD dwFlags)
{
+ return (LPSTR)NULL;
}
LPWSTR
-/* $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
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
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
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
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
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
-GetClientRect(HWND hWnd,
- LPRECT lpRect)
+GetClientRect(HWND hWnd, LPRECT lpRect)
{
return FALSE;
}
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 */