* Made a start on a few user32 stubs

* Various other small changes

svn path=/trunk/; revision=5691
This commit is contained in:
Andrew Greenwood 2003-08-20 03:07:33 +00:00
parent 675c971445
commit 05bd5fcc78
6 changed files with 174 additions and 137 deletions

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.33 2003/08/19 01:31:15 weiden Exp $
/* $Id: stubs.c,v 1.34 2003/08/20 03:07:33 silverblade Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -11,6 +11,10 @@
*/
#include <windows.h>
#include <debug.h>
#include <string.h>
typedef UINT *LPUINT;
#include <mmsystem.h>
/*
* @unimplemented
@ -246,15 +250,26 @@ LockWorkStation(VOID)
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL
MessageBeep(
UINT uType)
{
UNIMPLEMENTED;
return FALSE;
CHAR EventName[64];
switch(uType)
{
case 0xFFFFFFFF : return Beep(500, 100); // Beep through speaker
case MB_ICONASTERISK : strcpy(EventName, "SystemAsterisk"); break;
case MB_ICONEXCLAMATION : strcpy(EventName, "SystemExclamation"); break;
case MB_ICONHAND : strcpy(EventName, "SystemHand"); break;
case MB_ICONQUESTION : strcpy(EventName, "SystemQuestion"); break;
case MB_OK : strcpy(EventName, "SystemDefault"); break;
}
// return PlaySoundA((LPCSTR) &EventName, NULL, SND_ALIAS | SND_NOWAIT | SND_NOSTOP | SND_ASYNC);
return FALSE;
}
@ -640,7 +655,7 @@ RegisterShellHookWindow(HWND hWnd)
}
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL
@ -649,8 +664,17 @@ EndTask(
WINBOOL fShutDown,
WINBOOL fForce)
{
UNIMPLEMENTED;
return FALSE;
SendMessageW(hWnd, WM_CLOSE, 0, 0);
if (IsWindow(hWnd))
{
if (fForce)
return DestroyWindow(hWnd);
else
return FALSE;
}
return TRUE;
}
/*

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.37 2003/08/20 01:05:10 silverblade Exp $
/* $Id: class.c,v 1.38 2003/08/20 03:07:33 silverblade Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -372,7 +372,7 @@ GetClassNameW(
/*
* @unimplemented
* @implemented
*/
WORD
STDCALL
@ -383,8 +383,10 @@ GetClassWord(
* NOTE: Obsoleted in 32-bit windows
*/
{
UNIMPLEMENTED;
return 0;
if ((nIndex < 0) && (nIndex != GCW_ATOM))
return 0;
return (WORD) NtUserGetClassLong ( hWnd, nIndex, TRUE );
}
@ -695,7 +697,7 @@ SetClassLongW(
/*
* @unimplemented
* @implemented
*/
WORD
STDCALL
@ -707,8 +709,10 @@ SetClassWord(
* NOTE: Obsoleted in 32-bit windows
*/
{
UNIMPLEMENTED;
return 0;
if ((nIndex < 0) && (nIndex != GCW_ATOM))
return 0;
return (WORD) NtUserSetClassLong ( hWnd, nIndex, wNewWord, TRUE );
}

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.71 2003/08/20 01:41:01 silverblade Exp $
/* $Id: defwnd.c,v 1.72 2003/08/20 03:07:33 silverblade Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -451,7 +451,10 @@ DrawCaption(
#endif
// If DC_GRADIENT is specified, a Win 98/2000 style caption gradient should
// be painted. For now, that flag is ignored.
// be painted. For now, that flag is ignored:
// Windows 98/Me, Windows 2000/XP: When this flag is set, the function uses
// COLOR_GRADIENTACTIVECAPTION (if the DC_ACTIVE flag was set) or
// COLOR_GRADIENTINACTIVECAPTION for the title-bar color.
// Draw the caption background
if (uFlags & DC_INBUTTON)
@ -489,7 +492,11 @@ DrawCaption(
if ((uFlags & DC_TEXT) && (GetWindowTextW( hWnd, buffer, sizeof(buffer)/sizeof(buffer[0]) )))
{
r.left += GetSystemMetrics(SM_CXSIZE) + Padding;
// Duplicate odd behaviour from Windows:
if ((! uFlags & DC_SMALLCAP) || (uFlags & DC_ICON) || (uFlags & DC_INBUTTON) ||
(! uFlags & DC_ACTIVE))
r.left += GetSystemMetrics(SM_CXSIZE) + Padding;
r.right = (lprc->right - lprc->left);
nclm.cbSize = sizeof(nclm);
@ -501,8 +508,8 @@ DrawCaption(
SetTextColor(MemDC, SysColours[ uFlags & DC_ACTIVE ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT]);
SetBkMode( MemDC, TRANSPARENT );
// if (GetWindowLongW(hWnd, GWL_STYLE) & WS_EX_TOOLWINDOW)
if (uFlags & DC_SMALLCAP)
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_EX_TOOLWINDOW)
// if (uFlags & DC_SMALLCAP) // incorrect
hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont);
else
hFont = CreateFontIndirectW(&nclm.lfCaptionFont);

View 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.
*/
/* $Id: draw.c,v 1.25 2003/08/20 00:41:04 silverblade Exp $
/* $Id: draw.c,v 1.26 2003/08/20 03:07:33 silverblade Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -1684,7 +1684,7 @@ DrawAnimatedRects(
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL
@ -2009,7 +2009,7 @@ WINBOOL INTERNAL_DrawState(
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL
@ -2030,7 +2030,7 @@ DrawStateA(
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL

View 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.
*/
/* $Id: input.c,v 1.13 2003/08/17 22:45:40 silverblade Exp $
/* $Id: input.c,v 1.14 2003/08/20 03:07:33 silverblade Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -36,7 +36,7 @@
/*
* @unimplemented
* @implemented
*/
WINBOOL
STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.68 2003/08/19 01:31:15 weiden Exp $
/* $Id: window.c,v 1.69 2003/08/20 03:07:33 silverblade Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -46,7 +46,7 @@ User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
if (CallbackArgs->Validate)
@ -81,7 +81,7 @@ User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO,
@ -106,7 +106,7 @@ User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
@ -130,7 +130,7 @@ User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
@ -154,7 +154,7 @@ User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLengt
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGING, 0,
@ -178,7 +178,7 @@ User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGED, 0,
@ -202,7 +202,7 @@ User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle,
@ -226,7 +226,7 @@ User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle,
@ -266,7 +266,7 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
}
if (CallbackArgs->Proc == NULL)
{
CallbackArgs->Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
CallbackArgs->Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE);
}
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
CallbackArgs->Msg, CallbackArgs->wParam,
@ -330,18 +330,6 @@ NC_AdjustRectInner95 (LPRECT rect, DWORD style, DWORD exStyle)
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRect(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu)
{
return(AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0));
}
/*
* @implemented
*/
@ -364,6 +352,18 @@ AdjustWindowRectEx(LPRECT lpRect,
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRect(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu)
{
return(AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0));
}
/*
* @unimplemented
*/
@ -375,36 +375,6 @@ AllowSetForegroundWindow(DWORD dwProcessId)
}
/*
* @implemented
*/
WINBOOL STDCALL
AnimateWindow(HWND hwnd,
DWORD dwTime,
DWORD dwFlags)
{
/* FIXME Add animation code */
/* If trying to show/hide and it's already *
* shown/hidden or invalid window, fail with *
* invalid parameter */
BOOL visible;
visible = IsWindowVisible(hwnd);
if(!IsWindow(hwnd) ||
(visible && !(dwFlags & AW_HIDE)) ||
(!visible && (dwFlags & AW_HIDE)))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
return TRUE;
}
/*
* @unimplemented
*/
@ -788,6 +758,27 @@ EndDeferWindowPos(HDWP hWinPosInfo)
}
/*
* @implemented
*/
HWND STDCALL
GetDesktopWindow(VOID)
{
return NtUserGetDesktopWindow();
}
/*
* @unimplemented
*/
HWND STDCALL
GetForegroundWindow(VOID)
{
UNIMPLEMENTED;
return (HWND)0;
}
WINBOOL
STATIC
User32EnumWindows (
@ -913,18 +904,6 @@ EnumDesktopWindows(
}
/*
* @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
*/
@ -939,27 +918,6 @@ FindWindowExA(HWND hwndParent,
}
/*
* @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
*/
@ -991,6 +949,41 @@ FindWindowExW(HWND hwndParent,
return NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, &ucWindowName);
}
/*
* @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);
}
/*
* @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);
}
/*
* @unimplemented
*/
@ -1041,27 +1034,6 @@ GetClientRect(HWND hWnd, LPRECT lpRect)
}
/*
* @implemented
*/
HWND STDCALL
GetDesktopWindow(VOID)
{
return NtUserGetDesktopWindow();
}
/*
* @unimplemented
*/
HWND STDCALL
GetForegroundWindow(VOID)
{
UNIMPLEMENTED;
return (HWND)0;
}
/*
* @unimplemented
*/
@ -1121,10 +1093,10 @@ GetTitleBarInfo(HWND hwnd,
* @implemented
*/
HWND STDCALL
GetTopWindow(HWND hWnd)
GetWindow(HWND hWnd,
UINT uCmd)
{
if (!hWnd) hWnd = GetDesktopWindow();
return GetWindow( hWnd, GW_CHILD );
return NtUserGetWindow(hWnd, uCmd);
}
@ -1132,10 +1104,10 @@ GetTopWindow(HWND hWnd)
* @implemented
*/
HWND STDCALL
GetWindow(HWND hWnd,
UINT uCmd)
GetTopWindow(HWND hWnd)
{
return NtUserGetWindow(hWnd, uCmd);
if (!hWnd) hWnd = GetDesktopWindow();
return GetWindow( hWnd, GW_CHILD );
}
@ -1376,6 +1348,36 @@ MoveWindow(HWND hWnd,
}
/*
* @implemented
*/
WINBOOL STDCALL
AnimateWindow(HWND hwnd,
DWORD dwTime,
DWORD dwFlags)
{
/* FIXME Add animation code */
/* If trying to show/hide and it's already *
* shown/hidden or invalid window, fail with *
* invalid parameter */
BOOL visible;
visible = IsWindowVisible(hwnd);
// if(!IsWindow(hwnd) ||
// (visible && !(dwFlags & AW_HIDE)) ||
// (!visible && (dwFlags & AW_HIDE)))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
// ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
return TRUE;
}
/*
* @unimplemented
*/