From 09feaad3e1dc9bbf686ecdc674d68053ed39c79a Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 14 Dec 2003 12:39:32 +0000 Subject: [PATCH] - Separation of clipboard routines in win32k. - Call NtUser* for clipboard functions in user32. - Minor correction for SetCaretBlinkTime. - Removed empty userobj.c file. svn path=/trunk/; revision=7018 --- reactos/lib/user32/windows/caret.c | 4 +- reactos/lib/user32/windows/clipboard.c | 239 ++++++++-------------- reactos/subsys/win32k/include/clipboard.h | 9 + reactos/subsys/win32k/makefile | 16 +- reactos/subsys/win32k/ntuser/clipboard.c | 174 ++++++++++++++++ reactos/subsys/win32k/ntuser/misc.c | 5 +- reactos/subsys/win32k/ntuser/stubs.c | 144 +------------ reactos/subsys/win32k/ntuser/userobj.c | 36 ---- reactos/subsys/win32k/ntuser/window.c | 14 +- 9 files changed, 288 insertions(+), 353 deletions(-) create mode 100644 reactos/subsys/win32k/include/clipboard.h create mode 100644 reactos/subsys/win32k/ntuser/clipboard.c delete mode 100644 reactos/subsys/win32k/ntuser/userobj.c diff --git a/reactos/lib/user32/windows/caret.c b/reactos/lib/user32/windows/caret.c index 5601b216c08..c0e402e92ef 100644 --- a/reactos/lib/user32/windows/caret.c +++ b/reactos/lib/user32/windows/caret.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: caret.c,v 1.4 2003/10/17 20:50:59 weiden Exp $ +/* $Id: caret.c,v 1.5 2003/12/14 12:39:32 navaraf Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/caret.c @@ -120,7 +120,7 @@ HideCaret(HWND hWnd) WINBOOL STDCALL SetCaretBlinkTime(UINT uMSeconds) { - return (WINBOOL)NtUserCallOneParam(ONEPARAM_ROUTINE_SETCARETBLINKTIME, (DWORD)uMSeconds); + return (WINBOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME); } diff --git a/reactos/lib/user32/windows/clipboard.c b/reactos/lib/user32/windows/clipboard.c index 29f80754e6f..0987ab5c695 100644 --- a/reactos/lib/user32/windows/clipboard.c +++ b/reactos/lib/user32/windows/clipboard.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: clipboard.c,v 1.5 2003/07/10 21:04:31 chorns Exp $ +/* $Id: clipboard.c,v 1.6 2003/12/14 12:39:32 navaraf Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -31,251 +31,190 @@ #include #include #include +#include /* FUNCTIONS *****************************************************************/ /* - * @unimplemented + * @implemented */ -WINBOOL -STDCALL +WINBOOL STDCALL +OpenClipboard(HWND hWndNewOwner) +{ + return NtUserOpenClipboard(hWndNewOwner, 0); +} + +/* + * @implemented + */ +WINBOOL STDCALL CloseClipboard(VOID) { - UNIMPLEMENTED; - return FALSE; + return NtUserCloseClipboard(); } - /* - * @unimplemented + * @implemented */ -int -STDCALL +INT STDCALL CountClipboardFormats(VOID) { - UNIMPLEMENTED; - return 0; + return NtUserCountClipboardFormats(); } - /* - * @unimplemented + * @implemented */ -WINBOOL -STDCALL +WINBOOL STDCALL EmptyClipboard(VOID) { - UNIMPLEMENTED; - return FALSE; + return NtUserEmptyClipboard(); } - /* - * @unimplemented + * @implemented */ -UINT -STDCALL -EnumClipboardFormats( - UINT format) +UINT STDCALL +EnumClipboardFormats(UINT format) { - UNIMPLEMENTED; - return 0; + return (UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS); } - /* - * @unimplemented + * @implemented */ -HANDLE -STDCALL -GetClipboardData( - UINT uFormat) +HANDLE STDCALL +GetClipboardData(UINT uFormat) { - UNIMPLEMENTED; - return (HANDLE)0; + return NtUserGetClipboardData(uFormat, 0); } - /* - * @unimplemented + * @implemented */ -int -STDCALL -GetClipboardFormatNameA( - UINT format, - LPSTR lpszFormatName, - int cchMaxCount) +INT STDCALL +GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount) { - UNIMPLEMENTED; - return 0; + LPWSTR lpBuffer; + INT Length; + + lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR)); + if (!lpBuffer) + { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } + Length = NtUserGetClipboardFormatName(format, lpBuffer, cchMaxCount); + HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length); + HEAP_free(lpBuffer); + + return Length; } - /* - * @unimplemented + * @implemented */ -int -STDCALL -GetClipboardFormatNameW( - UINT format, - LPWSTR lpszFormatName, - int cchMaxCount) +INT STDCALL +GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount) { - UNIMPLEMENTED; - return 0; + return NtUserGetClipboardFormatName(format, lpszFormatName, cchMaxCount); } - /* - * @unimplemented + * @implemented */ -HWND -STDCALL +HWND STDCALL GetClipboardOwner(VOID) { - UNIMPLEMENTED; - return (HWND)0; + return NtUserGetClipboardOwner(); } - /* - * @unimplemented + * @implemented */ -DWORD -STDCALL +DWORD STDCALL GetClipboardSequenceNumber(VOID) { - UNIMPLEMENTED; - return 0; + return NtUserGetClipboardSequenceNumber(); } - /* - * @unimplemented + * @implemented */ -HWND -STDCALL +HWND STDCALL GetClipboardViewer(VOID) { - UNIMPLEMENTED; - return (HWND)0; + return NtUserGetClipboardViewer(); } - /* - * @unimplemented + * @implemented */ -HWND -STDCALL +HWND STDCALL GetOpenClipboardWindow(VOID) { - UNIMPLEMENTED; - return (HWND)0; + return NtUserGetOpenClipboardWindow(); } - /* - * @unimplemented + * @implemented */ -int -STDCALL -GetPriorityClipboardFormat( - UINT *paFormatPriorityList, - int cFormats) +INT STDCALL +GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats) { - UNIMPLEMENTED; - return 0; + return NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats); } - /* - * @unimplemented + * @implemented */ -WINBOOL -STDCALL -IsClipboardFormatAvailable( - UINT format) +WINBOOL STDCALL +IsClipboardFormatAvailable(UINT format) { - UNIMPLEMENTED; - return FALSE; + return NtUserIsClipboardFormatAvailable(format); } - /* - * @unimplemented + * @implemented */ -WINBOOL -STDCALL -OpenClipboard( - HWND hWndNewOwner) +UINT STDCALL +RegisterClipboardFormatA(LPCSTR lpszFormat) { - UNIMPLEMENTED; - return FALSE; + return RegisterWindowMessageA(lpszFormat); } - /* - * @unimplemented + * @implemented */ -UINT -STDCALL -RegisterClipboardFormatA( - LPCSTR lpszFormat) +UINT STDCALL +RegisterClipboardFormatW(LPCWSTR lpszFormat) { - UNIMPLEMENTED; - return 0; + return RegisterClipboardFormatW(lpszFormat); } - /* - * @unimplemented + * @implemented */ -UINT -STDCALL -RegisterClipboardFormatW( - LPCWSTR lpszFormat) +HANDLE STDCALL +SetClipboardData(UINT uFormat, HANDLE hMem) { - UNIMPLEMENTED; - return 0; + return NtUserSetClipboardData(uFormat, hMem, 0); } - /* - * @unimplemented + * @implemented */ -HANDLE -STDCALL -SetClipboardData( - UINT uFormat, - HANDLE hMem) +HWND STDCALL +SetClipboardViewer(HWND hWndNewViewer) { - UNIMPLEMENTED; - return (HANDLE)0; + return NtUserSetClipboardViewer(hWndNewViewer); } - /* - * @unimplemented + * @implemented */ -HWND -STDCALL -SetClipboardViewer( - HWND hWndNewViewer) +WINBOOL STDCALL +ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext) { - UNIMPLEMENTED; - return (HWND)0; -} - - -/* - * @unimplemented - */ -WINBOOL -STDCALL -ChangeClipboardChain( - HWND hWndRemove, - HWND hWndNewNext) -{ - UNIMPLEMENTED; - return FALSE; + return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); } diff --git a/reactos/subsys/win32k/include/clipboard.h b/reactos/subsys/win32k/include/clipboard.h new file mode 100644 index 00000000000..c932ec086ab --- /dev/null +++ b/reactos/subsys/win32k/include/clipboard.h @@ -0,0 +1,9 @@ +#ifndef _WIN32K_CLIPBOARD_H +#define _WIN32K_CLIPBOARD_H + +#include + +UINT FASTCALL +IntEnumClipboardFormats(UINT format); + +#endif /* _WIN32K_CLIPBOARD_H */ diff --git a/reactos/subsys/win32k/makefile b/reactos/subsys/win32k/makefile index b0659357d0a..c822c70d06b 100644 --- a/reactos/subsys/win32k/makefile +++ b/reactos/subsys/win32k/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.88 2003/12/07 23:02:57 gvg Exp $ +# $Id: makefile,v 1.89 2003/12/14 12:39:32 navaraf Exp $ PATH_TO_TOP = ../.. @@ -49,13 +49,13 @@ MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o LDR_OBJECTS = ldr/loader.o -NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/focus.o \ - ntuser/desktop.o ntuser/guicheck.o ntuser/hook.o ntuser/hotkey.o ntuser/input.o \ - ntuser/keyboard.o ntuser/menu.o ntuser/message.o ntuser/metric.o \ - ntuser/misc.o ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o \ - ntuser/scrollbar.o ntuser/stubs.o ntuser/timer.o ntuser/userobj.o \ - ntuser/vis.o ntuser/windc.o ntuser/window.o ntuser/winlock.o \ - ntuser/winpos.o ntuser/winsta.o +NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o \ + ntuser/clipboard.o ntuser/focus.o ntuser/desktop.o ntuser/guicheck.o \ + ntuser/hook.o ntuser/hotkey.o ntuser/input.o ntuser/keyboard.o \ + ntuser/menu.o ntuser/message.o ntuser/metric.o ntuser/misc.o \ + ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o ntuser/scrollbar.o \ + ntuser/stubs.o ntuser/timer.o ntuser/vis.o ntuser/windc.o \ + ntuser/window.o ntuser/winlock.o ntuser/winpos.o ntuser/winsta.o OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \ objects/color.o objects/coord.o objects/dc.o \ diff --git a/reactos/subsys/win32k/ntuser/clipboard.c b/reactos/subsys/win32k/ntuser/clipboard.c new file mode 100644 index 00000000000..191a6d0e26b --- /dev/null +++ b/reactos/subsys/win32k/ntuser/clipboard.c @@ -0,0 +1,174 @@ +/* + * ReactOS W32 Subsystem + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Clipboard routines + * FILE: subsys/win32k/ntuser/clipboard.c + * PROGRAMER: Filip Navara + */ + +#include +#define NDEBUG +#include + +#if 0 +PW32THREAD ClipboardThread; +HWND ClipboardWindow; +#endif + +UINT FASTCALL +IntEnumClipboardFormats(UINT format) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL STDCALL +NtUserOpenClipboard(HWND hWnd, DWORD Unknown1) +{ +#if 0 + if (ClipboardThread && ClipboardThread != PsGetWin32Thread()) + { + SetLastWin32Error(ERROR_LOCKED); + return FALSE; + } + ClipboardWindow = hWnd; + ClipboardThread = PsGetWin32Thread(); + return TRUE; +#else + UNIMPLEMENTED + return FALSE; +#endif +} + +BOOL STDCALL +NtUserCloseClipboard(VOID) +{ +#if 0 + if (ClipboardThread && ClipboardThread != PsGetWin32Thread()) + { + SetLastWin32Error(ERROR_LOCKED); + return FALSE; + } + ClipboardWindow = 0; + ClipboardThread = NULL; + return TRUE; +#else + UNIMPLEMENTED + return FALSE; +#endif +} + +/* + * @unimplemented + */ +HWND STDCALL +NtUserGetOpenClipboardWindow(VOID) +{ + UNIMPLEMENTED + return 0; +} + +BOOL STDCALL +NtUserChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext) +{ + UNIMPLEMENTED + return 0; +} + +DWORD STDCALL +NtUserCountClipboardFormats(VOID) +{ + UNIMPLEMENTED + return 0; +} + +DWORD STDCALL +NtUserEmptyClipboard(VOID) +{ + UNIMPLEMENTED + return 0; +} + +HANDLE STDCALL +NtUserGetClipboardData(UINT uFormat, DWORD Unknown1) +{ + UNIMPLEMENTED + return 0; +} + +INT STDCALL +NtUserGetClipboardFormatName(UINT format, LPWSTR lpszFormatName, + INT cchMaxCount) +{ + UNIMPLEMENTED + return 0; +} + +HWND STDCALL +NtUserGetClipboardOwner(VOID) +{ + UNIMPLEMENTED + return 0; +} + +DWORD STDCALL +NtUserGetClipboardSequenceNumber(VOID) +{ + UNIMPLEMENTED + return 0; +} + +HWND STDCALL +NtUserGetClipboardViewer(VOID) +{ + UNIMPLEMENTED + return 0; +} + +INT STDCALL +NtUserGetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats) +{ + UNIMPLEMENTED + return 0; +} + +WINBOOL STDCALL +NtUserIsClipboardFormatAvailable(UINT format) +{ + UNIMPLEMENTED + return 0; +} + +HANDLE STDCALL +NtUserSetClipboardData(UINT uFormat, HANDLE hMem, DWORD Unknown2) +{ + UNIMPLEMENTED + return 0; +} + +HWND STDCALL +NtUserSetClipboardViewer(HWND hWndNewViewer) +{ + UNIMPLEMENTED + return 0; +} + +/* EOF */ diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index b32a277d96d..9cb86126cf3 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.33 2003/12/13 15:49:32 weiden Exp $ +/* $Id: misc.c,v 1.34 2003/12/14 12:39:32 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -22,6 +22,7 @@ #include #include #include +#include #define NDEBUG #include @@ -156,6 +157,8 @@ NtUserCallOneParam( case ONEPARAM_ROUTINE_SETCARETBLINKTIME: return (DWORD)IntSetCaretBlinkTime((UINT)Param); + case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS: + return (DWORD)IntEnumClipboardFormats((UINT)Param); } DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param=0x%x\n", Routine, Param); diff --git a/reactos/subsys/win32k/ntuser/stubs.c b/reactos/subsys/win32k/ntuser/stubs.c index b441ad29f8b..d46be1b36b3 100644 --- a/reactos/subsys/win32k/ntuser/stubs.c +++ b/reactos/subsys/win32k/ntuser/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.41 2003/12/07 12:59:34 chorns Exp $ +/* $Id: stubs.c,v 1.42 2003/12/14 12:39:32 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -111,17 +111,6 @@ NtUserCallMsgFilter( return 0; } -DWORD -STDCALL -NtUserChangeClipboardChain( - DWORD Unknown0, - DWORD Unknown1) -{ - UNIMPLEMENTED - - return 0; -} - LONG STDCALL NtUserChangeDisplaySettings( @@ -136,15 +125,6 @@ NtUserChangeDisplaySettings( return 0; } -DWORD -STDCALL -NtUserCloseClipboard(VOID) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserConvertMemHandle( @@ -156,15 +136,6 @@ NtUserConvertMemHandle( return 0; } -DWORD -STDCALL -NtUserCountClipboardFormats(VOID) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserCreateLocalMemHandle( @@ -273,15 +244,6 @@ NtUserDrawCaptionTemp( return 0; } -DWORD -STDCALL -NtUserEmptyClipboard(VOID) -{ - UNIMPLEMENTED - - return 0; -} - WINBOOL STDCALL NtUserEnumDisplayDevices ( @@ -367,56 +329,6 @@ NtUserGetAsyncKeyState( return 0; } -DWORD -STDCALL -NtUserGetClipboardData( - DWORD Unknown0, - DWORD Unknown1) -{ - UNIMPLEMENTED - - return 0; -} - -DWORD -STDCALL -NtUserGetClipboardFormatName( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) -{ - UNIMPLEMENTED - - return 0; -} - -DWORD -STDCALL -NtUserGetClipboardOwner(VOID) -{ - UNIMPLEMENTED - - return 0; -} - -DWORD -STDCALL -NtUserGetClipboardSequenceNumber(VOID) -{ - UNIMPLEMENTED - - return 0; -} - -DWORD -STDCALL -NtUserGetClipboardViewer(VOID) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserGetComboBoxInfo( @@ -523,17 +435,6 @@ NtUserGetMouseMovePointsEx( return 0; } -DWORD -STDCALL -NtUserGetPriorityClipboardFormat( - DWORD Unknown0, - DWORD Unknown1) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserGetTitleBarInfo( @@ -589,16 +490,6 @@ NtUserInitTask( return 0; } -DWORD -STDCALL -NtUserIsClipboardFormatAvailable( - DWORD Unknown0) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserLoadKeyboardLayoutEx( @@ -691,17 +582,6 @@ NtUserNotifyWinEvent( return 0; } -DWORD -STDCALL -NtUserOpenClipboard( - DWORD Unknown0, - DWORD Unknown1) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserQueryUserCounters( @@ -753,28 +633,6 @@ NtUserSendInput( return 0; } -DWORD -STDCALL -NtUserSetClipboardData( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) -{ - UNIMPLEMENTED - - return 0; -} - -DWORD -STDCALL -NtUserSetClipboardViewer( - DWORD Unknown0) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserSetConsoleReserveKeys( diff --git a/reactos/subsys/win32k/ntuser/userobj.c b/reactos/subsys/win32k/ntuser/userobj.c deleted file mode 100644 index 8a35cfb2d04..00000000000 --- a/reactos/subsys/win32k/ntuser/userobj.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ReactOS W32 Subsystem - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id: userobj.c,v 1.3 2003/11/23 12:24:21 weiden Exp $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: USER Object counter - * FILE: subsys/win32k/ntuser/userobj.c - * PROGRAMER: - * - */ - -#undef WIN32_LEAN_AND_MEAN -#include -#define NDEBUG -#include -#include - - -/* EOF */ diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 01524426435..d34af861744 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.160 2003/12/14 11:36:43 gvg Exp $ +/* $Id: window.c,v 1.161 2003/12/14 12:39:32 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1930,18 +1930,6 @@ NtUserGetLastActivePopup(HWND hWnd) #endif } - -/* - * @unimplemented - */ -DWORD STDCALL -NtUserGetOpenClipboardWindow(VOID) -{ - UNIMPLEMENTED - - return 0; -} - /* * NtUserGetParent *