reactos/reactos/lib/user32/windows/window.c

1622 lines
30 KiB
C
Raw Normal View History

/* $Id: window.c,v 1.52 2003/08/07 04:03:24 royce Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/window.c
* PURPOSE: Window management
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:
* 06-06-2001 CSH Created
*/
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <user32.h>
#include <window.h>
#include <user32/callback.h>
#include <user32/regcontrol.h>
#define NDEBUG
#include <debug.h>
static BOOL ControlsInitCalled = FALSE;
/* FUNCTIONS *****************************************************************/
ULONG
WinHasThickFrameStyle(ULONG Style, ULONG ExStyle)
{
return((Style & WS_THICKFRAME) &&
(!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
}
NTSTATUS STDCALL
User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
WNDPROC Proc;
DPRINT("User32SendNCCALCSIZEMessageForKernel.\n");
CallbackArgs = (PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
if (CallbackArgs->Validate)
{
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE,
TRUE,
(LPARAM)&CallbackArgs->Params);
Result.Params = CallbackArgs->Params;
}
else
{
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE,
FALSE, (LPARAM)&CallbackArgs->Rect);
Result.Rect = CallbackArgs->Rect;
}
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS CallbackArgs;
SENDGETMINMAXINFO_CALLBACK_RESULT Result;
WNDPROC Proc;
DPRINT("User32SendGETMINAXINFOMessageForKernel.\n");
CallbackArgs = (PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO,
0, (LPARAM)&CallbackArgs->MinMaxInfo);
Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
}
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
NTSTATUS STDCALL
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendCREATEMessageForKernel.\n");
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
CallbackArgs = (PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
(LPARAM)&CallbackArgs->CreateStruct);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
}
NTSTATUS STDCALL
User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendNCCREATEMessageForKernel.\n");
CallbackArgs = (PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
(LPARAM)&CallbackArgs->CreateStruct);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendWINDOWPOSCHANGINGMessageForKernel.\n");
CallbackArgs = (PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGING, 0,
(LPARAM)&CallbackArgs->WindowPos);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendWINDOWPOSCHANGEDMessageForKernel.\n");
CallbackArgs = (PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGED, 0,
(LPARAM)&CallbackArgs->WindowPos);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDSTYLECHANGING_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendSTYLECHANGINGMessageForKernel.\n");
CallbackArgs = (PSENDSTYLECHANGING_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle,
(LPARAM)&CallbackArgs->Style);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDSTYLECHANGED_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendSTYLECHANGEDGMessageForKernel.\n");
CallbackArgs = (PSENDSTYLECHANGED_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
/* FIXME: handle ANSI windows vs Unicode windows */
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle,
(LPARAM)&CallbackArgs->Style);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDASYNCPROC_CALLBACK_ARGUMENTS CallbackArgs;
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
DPRINT("User32CallSendAsyncProcKernel()\n");
CallbackArgs = (PSENDASYNCPROC_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
return(STATUS_INFO_LENGTH_MISMATCH);
}
2002-07-04 David Welch <welch@computer2.darkstar.org> * subsys/win32k/include/callback.h: Fixed callback argument definitions. * subsys/win32k/ntuser/winpos.c: Implemented some more of the windows sizing/moving code. * subsys/win32k/ntuser/painting.c: Implemented some more of the window painting code. * subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP. * subsys/win32k/objects/region.c: Added stubs for some more region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the process desktop handle as well. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/se/token.c: Don't call the ZwXXX variant of system calls when in system context. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/Makefile: Added file with MDA output code. * ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for debug output. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/windows/defwnd.c: Implemented some more of the default window handler. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/misc/stubs.c: Removed some stubs to seperate files. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/user32.def: Export ScreenToClient otherwise we get problems when code in user32 tries to call it. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/region.h: Added prototypes for some missing region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/ntuser.h: Added prototypes for some missing NtUserXXX functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/wininternal.h: Added some constants for private GetDCEx styles that WINE needs. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/callback.h: Fixed callbacks for messages with parameters. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/napi/win32.h (W32THREAD): Added pointer to the thread's desktop. * include/napi/win32.h (W32PROCESS): Removed handle table, added a pointer to the process's window station. * subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference a process's window station on the first win32k system call. Reference a thread's desktop on the first win32k system call. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/messages.h: Added some missing WM_XXX constants. 2002-07-04 David Welch <welch@computer2.darkstar.org> * drivers/dd/ide/makefile: Compiling with debugging messages needs libgcc to be linked in. 2002-07-04 David Welch <welch@computer2.darkstar.org> * iface/addsys/genw32k.c: Generate a variable with the number of system calls. * iface/native/genntdll.c: Generate a proper stack frame for the user system call stubs. * ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for the handler for system calls. 2002-07-04 David Welch <welch@computer2.darkstar.org> * Makefile: Build the GUI startup application. * subsys/system/gstart/gstart.c: Application to start up the GUI. svn path=/trunk/; revision=3179
2002-07-04 19:56:38 +00:00
CallbackArgs->Callback(CallbackArgs->Wnd, CallbackArgs->Msg,
CallbackArgs->Context, CallbackArgs->Result);
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
{
PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs;
LRESULT Result;
CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
return(STATUS_INFO_LENGTH_MISMATCH);
}
if (CallbackArgs->Proc == NULL)
{
/* FIXME: handle ANSI windows vs Unicode windows */
CallbackArgs->Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd,
GWL_WNDPROC);
}
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * tools/helper.mk: Make an import library a proper target depending on the .def file. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began implementation. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/misc/object.c (ObmCreateHandle): Return the correct handle value. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * subsys/win32k/makefile: Make win32k depend on the file containing the service table. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet, KePushAndStackSwitchAndSysRet): Push one value only. * ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved these functions to a new file. Restore the old trap frame after returning from a callback. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW): Convert message to Unicode or ASCII if necessary. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE callbacks. * lib/user32/windows/window.c (User32SendCREATEMessageForKernel, User32SendNCCREATEMessageForKernel): Implemented. * subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage): Implemented. 2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * include/structs.h: Added Unicode and ASCII versions of CREATESTRUCT. svn path=/trunk/; revision=3118
2002-06-18 21:51:11 +00:00
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
CallbackArgs->Msg, CallbackArgs->wParam,
CallbackArgs->lParam);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
static void NC_AdjustRectOuter95 (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
{
int adjust;
if(style & WS_ICONIC) return;
if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
WS_EX_STATICEDGE)
{
adjust = 1; /* for the outer frame always present */
}
else
{
adjust = 0;
if ((exStyle & WS_EX_DLGMODALFRAME) ||
(style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */
}
if (style & WS_THICKFRAME)
adjust += ( GetSystemMetrics (SM_CXFRAME)
- GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
if ((style & (WS_BORDER|WS_DLGFRAME)) ||
(exStyle & WS_EX_DLGMODALFRAME))
adjust++; /* The other border */
InflateRect (rect, adjust, adjust);
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (exStyle & WS_EX_TOOLWINDOW)
rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
else
rect->top -= GetSystemMetrics(SM_CYCAPTION);
}
if (menu) rect->top -= GetSystemMetrics(SM_CYMENU);
}
static void
NC_AdjustRectInner95 (LPRECT rect, DWORD style, DWORD exStyle)
{
if(style & WS_ICONIC) return;
if (exStyle & WS_EX_CLIENTEDGE)
InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
if (style & WS_VSCROLL)
{
if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
rect->left -= GetSystemMetrics(SM_CXVSCROLL);
else
rect->right += GetSystemMetrics(SM_CXVSCROLL);
}
if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRect(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu)
{
return(AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0));
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRectEx(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu,
DWORD dwExStyle)
{
dwStyle &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD);
dwExStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
if (dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
NC_AdjustRectOuter95( lpRect, dwStyle, bMenu, dwExStyle );
NC_AdjustRectInner95( lpRect, dwStyle, dwExStyle );
lpRect->right += 2;
lpRect->bottom += 2;
return TRUE;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
AllowSetForegroundWindow(DWORD dwProcessId)
{
UNIMPLEMENTED;
return(FALSE);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
AnimateWindow(HWND hwnd,
DWORD dwTime,
DWORD dwFlags)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
UINT STDCALL
ArrangeIconicWindows(HWND hWnd)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
HDWP STDCALL
BeginDeferWindowPos(int nNumWindows)
{
UNIMPLEMENTED;
return (HDWP)0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
BringWindowToTop(HWND hWnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WORD STDCALL
CascadeWindows(HWND hwndParent,
UINT wHow,
CONST RECT *lpRect,
UINT cKids,
const HWND *lpKids)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
HWND STDCALL
ChildWindowFromPoint(HWND hWndParent,
POINT Point)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @unimplemented
*/
HWND STDCALL
ChildWindowFromPointEx(HWND hwndParent,
POINT pt,
UINT uFlags)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @implemented
*/
WINBOOL STDCALL
CloseWindow(HWND hWnd)
{
SendMessageA(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
return (WINBOOL)(hWnd);
}
/*
* @implemented
*/
HWND STDCALL
CreateWindowExA(DWORD dwExStyle,
LPCSTR lpClassName,
LPCSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam)
{
UNICODE_STRING WindowName;
UNICODE_STRING ClassName;
HWND Handle;
INT sw;
/* Register built-in controls if not already done */
if (! ControlsInitCalled)
{
ControlsInit();
ControlsInitCalled = TRUE;
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);
ClassName.Buffer = (LPWSTR)lpClassName;
}
else
{
if (!RtlCreateUnicodeStringFromAsciiz(&(ClassName), (PCSZ)lpClassName))
{
SetLastError(ERROR_OUTOFMEMORY);
return (HWND)0;
}
}
if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName))
{
if (!IS_ATOM(lpClassName))
{
RtlFreeUnicodeString(&ClassName);
}
SetLastError(ERROR_OUTOFMEMORY);
return (HWND)0;
}
/* Fixup default coordinates. */
sw = SW_SHOW;
if (x == (LONG) CW_USEDEFAULT || nWidth == (LONG) CW_USEDEFAULT)
{
if (dwStyle & (WS_CHILD | WS_POPUP))
{
if (x == (LONG) CW_USEDEFAULT)
{
x = y = 0;
}
if (nWidth == (LONG) CW_USEDEFAULT)
{
nWidth = nHeight = 0;
}
}
else
{
STARTUPINFOA info;
GetStartupInfoA(&info);
if (x == (LONG) CW_USEDEFAULT)
{
if (y != (LONG) CW_USEDEFAULT)
{
sw = y;
}
x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0;
y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
}
if (nWidth == (LONG) CW_USEDEFAULT)
{
if (info.dwFlags & STARTF_USESIZE)
{
nWidth = info.dwXSize;
nHeight = info.dwYSize;
}
else
{
RECT r;
SystemParametersInfoA(SPI_GETWORKAREA, 0, &r, 0);
nWidth = (((r.right - r.left) * 3) / 4) - x;
nHeight = (((r.bottom - r.top) * 3) / 4) - y;
}
}
}
}
Handle = NtUserCreateWindowEx(dwExStyle,
&ClassName,
&WindowName,
dwStyle,
x,
y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam,
sw);
RtlFreeUnicodeString(&WindowName);
if (!IS_ATOM(lpClassName))
{
RtlFreeUnicodeString(&ClassName);
}
return Handle;
}
/*
* @implemented
*/
HWND STDCALL
CreateWindowExW(DWORD dwExStyle,
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam)
{
UNICODE_STRING WindowName;
UNICODE_STRING ClassName;
HANDLE Handle;
UINT sw;
/* Register built-in controls if not already done */
if (! ControlsInitCalled)
{
ControlsInit();
ControlsInitCalled = TRUE;
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);
ClassName.Buffer = (LPWSTR)lpClassName;
}
else
{
RtlInitUnicodeString(&ClassName, lpClassName);
}
RtlInitUnicodeString(&WindowName, lpWindowName);
/* Fixup default coordinates. */
sw = SW_SHOW;
if (x == (LONG) CW_USEDEFAULT || nWidth == (LONG) CW_USEDEFAULT)
{
if (dwStyle & (WS_CHILD | WS_POPUP))
{
if (x == (LONG) CW_USEDEFAULT)
{
x = y = 0;
}
if (nWidth == (LONG) CW_USEDEFAULT)
{
nWidth = nHeight = 0;
}
}
else
{
STARTUPINFOW info;
GetStartupInfoW(&info);
if (x == (LONG) CW_USEDEFAULT)
{
if (y != (LONG) CW_USEDEFAULT)
{
sw = y;
}
x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0;
y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
}
if (nWidth == (LONG) CW_USEDEFAULT)
{
if (info.dwFlags & STARTF_USESIZE)
{
nWidth = info.dwXSize;
nHeight = info.dwYSize;
}
else
{
RECT r;
SystemParametersInfoW(SPI_GETWORKAREA, 0, &r, 0);
nWidth = (((r.right - r.left) * 3) / 4) - x;
nHeight = (((r.bottom - r.top) * 3) / 4) - y;
}
}
}
}
Handle = NtUserCreateWindowEx(dwExStyle,
&ClassName,
&WindowName,
dwStyle,
x,
y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam,
0);
return (HWND)Handle;
}
/*
* @unimplemented
*/
HDWP STDCALL
DeferWindowPos(HDWP hWinPosInfo,
HWND hWnd,
HWND hWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT uFlags)
{
2003-08-04 16:56:49 +00:00
return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
}
/*
* @implemented
*/
WINBOOL STDCALL
DestroyWindow(HWND hWnd)
{
return NtUserDestroyWindow(hWnd);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
EndDeferWindowPos(HDWP hWinPosInfo)
{
UNIMPLEMENTED;
return FALSE;
}
WINBOOL
STATIC
User32EnumWindows (
HDESK hDesktop,
HWND hWndparent,
ENUMWINDOWSPROC lpfn,
LPARAM lParam,
DWORD dwThreadId,
BOOL bChildren )
{
DWORD i, dwCount = 0;
HWND* pHwnd = NULL;
HANDLE hHeap;
if ( !lpfn )
{
SetLastError ( ERROR_INVALID_PARAMETER );
return FALSE;
}
/* FIXME instead of always making two calls, should we use some
sort of persistent buffer and only grow it ( requiring a 2nd
call ) when the buffer wasn't already big enough? */
/* first get how many window entries there are */
SetLastError(0);
dwCount = NtUserBuildHwndList (
hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, 0 );
if ( !dwCount || GetLastError() )
return FALSE;
/* allocate buffer to receive HWND handles */
hHeap = GetProcessHeap();
pHwnd = HeapAlloc ( hHeap, 0, sizeof(HWND)*(dwCount+1) );
if ( !pHwnd )
{
SetLastError ( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
/* now call kernel again to fill the buffer this time */
dwCount = NtUserBuildHwndList (
hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, dwCount );
if ( !dwCount || GetLastError() )
{
if ( pHwnd )
HeapFree ( hHeap, 0, pHwnd );
return FALSE;
}
/* call the user's callback function until we're done or
they tell us to quit */
for ( i = 0; i < dwCount; i++ )
{
/* FIXME I'm only getting NULLs from Thread Enumeration, and it's
* probably because I'm not doing it right in NtUserBuildHwndList.
* Once that's fixed, we shouldn't have to check for a NULL HWND
* here
*/
if ( !(ULONG)pHwnd[i] ) /* don't enumerate a NULL HWND */
continue;
if ( !(*lpfn)( pHwnd[i], lParam ) )
break;
}
if ( pHwnd )
HeapFree ( hHeap, 0, pHwnd );
return TRUE;
}
/*
* @implemented
*/
WINBOOL
STDCALL
EnumChildWindows(
HWND hWndParent,
ENUMWINDOWSPROC lpEnumFunc,
LPARAM lParam)
{
if ( !hWndParent )
hWndParent = GetDesktopWindow();
return User32EnumWindows ( NULL, hWndParent, lpEnumFunc, lParam, 0, FALSE );
}
/*
* @implemented
*/
WINBOOL
STDCALL
EnumThreadWindows(DWORD dwThreadId,
ENUMWINDOWSPROC lpfn,
LPARAM lParam)
{
if ( !dwThreadId )
dwThreadId = GetCurrentThreadId();
return User32EnumWindows ( NULL, NULL, lpfn, lParam, dwThreadId, FALSE );
}
/*
* @implemented
*/
WINBOOL STDCALL
EnumWindows(ENUMWINDOWSPROC lpEnumFunc,
LPARAM lParam)
{
return User32EnumWindows ( NULL, NULL, lpEnumFunc, lParam, 0, FALSE );
}
/*
* @implemented
*/
WINBOOL
STDCALL
EnumDesktopWindows(
HDESK hDesktop,
ENUMWINDOWSPROC lpfn,
LPARAM lParam)
{
return User32EnumWindows ( hDesktop, NULL, lpfn, lParam, 0, FALSE );
}
/*
* @implemented
*/
HWND STDCALL
FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName)
{
//FIXME: FindWindow does not search children, but FindWindowEx does.
// what should we do about this?
return FindWindowExA (NULL, NULL, lpClassName, lpWindowName);
}
/*
* @unimplemented
*/
HWND STDCALL
FindWindowExA(HWND hwndParent,
HWND hwndChildAfter,
LPCSTR lpszClass,
LPCSTR lpszWindow)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @implemented
*/
HWND STDCALL
FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName)
{
/*
There was a FIXME here earlier, but I think it is just a documentation unclarity.
FindWindow only searches top level windows. What they mean is that child
windows of other windows than the desktop can be searched.
FindWindowExW never does a recursive search.
/ Joakim
*/
return FindWindowExW (NULL, NULL, lpClassName, lpWindowName);
}
/*
* @implemented
*/
HWND STDCALL
FindWindowExW(HWND hwndParent,
HWND hwndChildAfter,
LPCWSTR lpszClass,
LPCWSTR lpszWindow)
{
UNICODE_STRING ucClassName;
UNICODE_STRING ucWindowName;
if (IS_ATOM(lpszClass))
{
RtlInitUnicodeString(&ucClassName, NULL);
ucClassName.Buffer = (LPWSTR)lpszClass;
}
else
{
RtlInitUnicodeString(&ucClassName, lpszClass);
}
// Window names can't be atoms, and if lpszWindow = NULL,
// RtlInitUnicodeString will clear it
RtlInitUnicodeString(&ucWindowName, lpszWindow);
return NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, &ucWindowName);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetAltTabInfoA(HWND hwnd,
int iItem,
PALTTABINFO pati,
LPSTR pszItemText,
UINT cchItemText)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetAltTabInfoW(HWND hwnd,
int iItem,
PALTTABINFO pati,
LPWSTR pszItemText,
UINT cchItemText)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
HWND STDCALL
GetAncestor(HWND hwnd, UINT gaFlags)
{
return(NtUserGetAncestor(hwnd, gaFlags));
}
/*
* @implemented
*/
WINBOOL STDCALL
GetClientRect(HWND hWnd, LPRECT lpRect)
{
return(NtUserGetClientRect(hWnd, lpRect));
}
/*
* @implemented
*/
HWND STDCALL
GetDesktopWindow(VOID)
{
return NtUserGetDesktopWindow();
}
/*
* @unimplemented
*/
HWND STDCALL
GetForegroundWindow(VOID)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetGUIThreadInfo(DWORD idThread,
LPGUITHREADINFO lpgui)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
HWND STDCALL
GetLastActivePopup(HWND hWnd)
{
2003-08-04 16:56:49 +00:00
return NtUserGetLastActivePopup(hWnd);
}
/*
* @implemented
*/
HWND STDCALL
GetParent(HWND hWnd)
{
2003-08-04 16:56:49 +00:00
return NtUserGetParent(hWnd);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetProcessDefaultLayout(DWORD *pdwDefaultLayout)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetTitleBarInfo(HWND hwnd,
PTITLEBARINFO pti)
{
UNIMPLEMENTED;
return FALSE;
}
/*
2003-08-04 16:56:49 +00:00
* @implemented
*/
HWND STDCALL
GetTopWindow(HWND hWnd)
{
2003-08-04 16:56:49 +00:00
if (!hWnd) hWnd = GetDesktopWindow();
return GetWindow( hWnd, GW_CHILD );
}
/*
2003-08-04 16:56:49 +00:00
* @implemented
*/
HWND STDCALL
GetWindow(HWND hWnd,
UINT uCmd)
{
2003-08-04 16:56:49 +00:00
return NtUserGetWindow(hWnd, uCmd);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetWindowInfo(HWND hwnd,
PWINDOWINFO pwi)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
UINT STDCALL
GetWindowModuleFileName(HWND hwnd,
LPSTR lpszFileName,
UINT cchFileNameMax)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
UINT STDCALL
GetWindowModuleFileNameA(HWND hwnd,
LPSTR lpszFileName,
UINT cchFileNameMax)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
UINT STDCALL
GetWindowModuleFileNameW(HWND hwnd,
LPWSTR lpszFileName,
UINT cchFileNameMax)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
GetWindowPlacement(HWND hWnd,
WINDOWPLACEMENT *lpwndpl)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
GetWindowRect(HWND hWnd,
LPRECT lpRect)
{
return(NtUserGetWindowRect(hWnd, lpRect));
}
/*
* @implemented
*/
int STDCALL
GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
{
return(SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString));
}
/*
* @implemented
*/
int STDCALL
GetWindowTextLengthA(HWND hWnd)
{
return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0));
}
/*
* @unimplemented
*/
int STDCALL
GetWindowTextLengthW(HWND hWnd)
{
UNIMPLEMENTED;
return 0;
}
/*
* @implemented
*/
int STDCALL
GetWindowTextW(
HWND hWnd,
LPWSTR lpString,
int nMaxCount)
{
return(SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString));
}
DWORD STDCALL
GetWindowThreadProcessId(HWND hWnd,
LPDWORD lpdwProcessId)
{
return NtUserGetWindowThreadProcessId(hWnd, lpdwProcessId);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
IsChild(HWND hWndParent,
HWND hWnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
IsIconic(HWND hWnd)
{
return (NtUserGetWindowLong( hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE) != 0;
}
/*
* @implemented
*/
WINBOOL STDCALL
IsWindow(HWND hWnd)
{
DWORD WndProc = NtUserGetWindowLong(hWnd, GWL_WNDPROC, FALSE);
return (0 != WndProc || ERROR_INVALID_HANDLE != GetLastError());
}
/*
* @unimplemented
*/
WINBOOL STDCALL
IsWindowUnicode(HWND hWnd)
{
#ifdef TODO
UNIMPLEMENTED;
#endif
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
IsWindowVisible(HWND hWnd)
{
while (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD)
{
if (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE))
{
return(FALSE);
}
hWnd = GetAncestor(hWnd, GA_PARENT);
}
return(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE);
}
/*
* @implemented
*/
WINBOOL STDCALL
IsZoomed(HWND hWnd)
{
ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE);
return (uStyle & WS_MAXIMIZE);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
LockSetForegroundWindow(UINT uLockCode)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
MoveWindow(HWND hWnd,
int X,
int Y,
int nWidth,
int nHeight,
WINBOOL bRepaint)
{
return NtUserMoveWindow(hWnd, X, Y, nWidth, nHeight, bRepaint);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
OpenIcon(HWND hWnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
HWND STDCALL
RealChildWindowFromPoint(HWND hwndParent,
POINT ptParentClientCoords)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @unimplemented
*/
UINT
RealGetWindowClass(HWND hwnd,
PVOID pszType,
UINT cchType)
{
/*
* FIXME - I don't think this function should exist...
* see RealGetWindowClassA & RealGetWindowClassW
*/
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
SetForegroundWindow(HWND hWnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
SetLayeredWindowAttributes(HWND hwnd,
COLORREF crKey,
BYTE bAlpha,
DWORD dwFlags)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
HWND STDCALL
SetParent(HWND hWndChild,
HWND hWndNewParent)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
SetProcessDefaultLayout(DWORD dwDefaultLayout)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
SetWindowPlacement(HWND hWnd,
CONST WINDOWPLACEMENT *lpwndpl)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
SetWindowPos(HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags)
{
return NtUserSetWindowPos(hWnd,hWndInsertAfter, X, Y, cx, cy, uFlags);
}
/*
* @implemented
*/
WINBOOL STDCALL
SetWindowTextA(HWND hWnd,
LPCSTR lpString)
{
return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
}
/*
* @implemented
*/
WINBOOL STDCALL
SetWindowTextW(HWND hWnd,
LPCWSTR lpString)
{
return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
ShowOwnedPopups(HWND hWnd,
WINBOOL fShow)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
WINBOOL STDCALL
ShowWindow(HWND hWnd,
int nCmdShow)
{
return NtUserShowWindow(hWnd, nCmdShow);
}
/*
* @unimplemented
*/
WINBOOL STDCALL
ShowWindowAsync(HWND hWnd,
int nCmdShow)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
WORD STDCALL
TileWindows(HWND hwndParent,
UINT wHow,
CONST RECT *lpRect,
UINT cKids,
const HWND *lpKids)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
WINBOOL STDCALL
UpdateLayeredWindow(HWND hwnd,
HDC hdcDst,
POINT *pptDst,
SIZE *psize,
HDC hdcSrc,
POINT *pptSrc,
COLORREF crKey,
BLENDFUNCTION *pblend,
DWORD dwFlags)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
HWND STDCALL
WindowFromPoint(POINT Point)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @implemented
*/
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 = FromOffset.x - ToOffset.x;
YMove = FromOffset.y - ToOffset.y;
for (i = 0; i < cPoints; i++)
{
lpPoints[i].x += XMove;
lpPoints[i].y += YMove;
}
return(MAKELONG(LOWORD(XMove), LOWORD(YMove)));
}
/*
* @implemented
*/
WINBOOL STDCALL
ScreenToClient(HWND hWnd, LPPOINT lpPoint)
{
return(MapWindowPoints(NULL, hWnd, lpPoint, 1));
}
/*
* @implemented
*/
WINBOOL STDCALL
ClientToScreen(HWND hWnd, LPPOINT lpPoint)
{
return (MapWindowPoints( hWnd, NULL, lpPoint, 1 ));
}
WINBOOL
STDCALL
SetWindowContextHelpId(HWND hwnd,
DWORD dwContextHelpId)
{
UNIMPLEMENTED;
return(FALSE);
}
/*
* @unimplemented
*/
DWORD
STDCALL
GetWindowContextHelpId(HWND hwnd)
{
UNIMPLEMENTED;
return(0);
}
/* EOF */