- Added test for unimplemented EnumWindowStations and EnumDesktops functions.

- Small window station cleanup.

svn path=/trunk/; revision=6757
This commit is contained in:
Filip Navara 2003-11-23 11:39:48 +00:00
parent 83c21d74b3
commit 9daca17473
18 changed files with 1533 additions and 1057 deletions

View file

@ -0,0 +1,35 @@
#include <windows.h>
#include <stdio.h>
BOOL CALLBACK
EnumDesktopProc(LPWSTR lpszWindowStation, LPARAM lParam)
{
printf("\t%S\n", lpszWindowStation);
return TRUE;
}
BOOL CALLBACK
EnumWindowStationProc(LPWSTR lpszWindowStation, LPARAM lParam)
{
HWINSTA hWinSta;
printf("%S\n", lpszWindowStation);
hWinSta = OpenWindowStationW(lpszWindowStation, FALSE,
WINSTA_ENUMDESKTOPS);
if (hWinSta == NULL)
{
printf("\tCan't open window station.\n");
return TRUE;
}
EnumDesktopsW(hWinSta, EnumDesktopProc, 0xdede);
return TRUE;
}
int main()
{
EnumWindowStationsW(EnumWindowStationProc, 0xbadbed);
return 0;
}

View file

@ -0,0 +1,21 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = enumws
TARGET_SDKLIBS = user32.a
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CFLAGS = -Wall -Werror
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -92,14 +92,12 @@ NtUserBuildMenuItemList(
ULONG nBufSize, ULONG nBufSize,
DWORD Reserved); DWORD Reserved);
NTSTATUS STDCALL
DWORD
STDCALL
NtUserBuildNameList( NtUserBuildNameList(
DWORD Unknown0, HWINSTA hWinSta,
DWORD Unknown1, ULONG dwSize,
DWORD Unknown2, PVOID lpBuffer,
DWORD Unknown3); PULONG pRequiredSize);
NTSTATUS NTSTATUS
STDCALL STDCALL

View file

@ -77,7 +77,11 @@ typedef struct _DESKTOP_OBJECT
/* Pointer to the active queue. */ /* Pointer to the active queue. */
PVOID ActiveMessageQueue; PVOID ActiveMessageQueue;
/* Rectangle of the work area */ /* Rectangle of the work area */
struct RECT* WorkArea; #ifdef __WIN32K__
RECT WorkArea;
#else
LONG WorkArea[4];
#endif
/* Handle of the desktop window. */ /* Handle of the desktop window. */
HANDLE DesktopWindow; HANDLE DesktopWindow;
HANDLE PrevActiveWindow; HANDLE PrevActiveWindow;

View file

@ -7,18 +7,16 @@
#include <internal/ps.h> #include <internal/ps.h>
#include "msgqueue.h" #include "msgqueue.h"
#define PROCESS_WINDOW_STATION() \ #define PROCESS_WINDOW_STATION() \
((HWINSTA)(IoGetCurrentProcess()->Win32WindowStation)) ((HWINSTA)(IoGetCurrentProcess()->Win32WindowStation))
#define SET_PROCESS_WINDOW_STATION(WinSta) \ #define SET_PROCESS_WINDOW_STATION(WinSta) \
((IoGetCurrentProcess()->Win32WindowStation) = (PVOID)(WinSta)) ((IoGetCurrentProcess()->Win32WindowStation) = (PVOID)(WinSta))
WINSTATION_OBJECT *InputWindowStation; #define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
//FAST_MUTEX InputWindowStationLock; #define WINSTA_ROOT_NAME_LENGTH 23
extern HDC ScreenDeviceContext;
extern WINSTATION_OBJECT *InputWindowStation;
NTSTATUS FASTCALL NTSTATUS FASTCALL
InitWindowStationImpl(VOID); InitWindowStationImpl(VOID);
@ -26,41 +24,49 @@ InitWindowStationImpl(VOID);
NTSTATUS FASTCALL NTSTATUS FASTCALL
CleanupWindowStationImpl(VOID); CleanupWindowStationImpl(VOID);
NTSTATUS STDCALL NTSTATUS FASTCALL
ValidateWindowStationHandle(HWINSTA WindowStation, InitDesktopImpl(VOID);
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
PWINSTATION_OBJECT *Object);
NTSTATUS STDCALL NTSTATUS FASTCALL
ValidateDesktopHandle(HDESK Desktop, CleanupDesktopImpl(VOID);
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess, NTSTATUS FASTCALL
PDESKTOP_OBJECT *Object); IntValidateWindowStationHandle(
LRESULT CALLBACK HWINSTA WindowStation,
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); KPROCESSOR_MODE AccessMode,
PDESKTOP_OBJECT FASTCALL ACCESS_MASK DesiredAccess,
IntGetActiveDesktop(VOID); PWINSTATION_OBJECT *Object);
PDESKTOP_OBJECT FASTCALL
IntGetDesktopObject ( HDESK hDesk );
PUSER_MESSAGE_QUEUE FASTCALL
IntGetFocusMessageQueue(VOID);
VOID FASTCALL
IntInitializeDesktopGraphics(VOID);
VOID FASTCALL
IntEndDesktopGraphics(VOID);
HDC FASTCALL
IntGetScreenDC(VOID);
VOID STDCALL
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
struct _WINDOW_OBJECT* STDCALL
IntGetCaptureWindow(VOID);
VOID STDCALL
IntSetCaptureWindow(struct _WINDOW_OBJECT* Window);
BOOL FASTCALL BOOL FASTCALL
IntGetWindowStationObject(PWINSTATION_OBJECT Object); IntGetWindowStationObject(PWINSTATION_OBJECT Object);
LRESULT CALLBACK
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
HDC FASTCALL
IntGetScreenDC(VOID);
VOID FASTCALL
IntInitializeDesktopGraphics(VOID);
VOID FASTCALL
IntEndDesktopGraphics(VOID);
struct _WINDOW_OBJECT* FASTCALL
IntGetCaptureWindow(VOID);
VOID FASTCALL
IntSetCaptureWindow(struct _WINDOW_OBJECT* Window);
PUSER_MESSAGE_QUEUE FASTCALL
IntGetFocusMessageQueue(VOID);
VOID FASTCALL
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
PDESKTOP_OBJECT FASTCALL
IntGetActiveDesktop(VOID);
#endif /* _WIN32K_WINSTA_H */ #endif /* _WIN32K_WINSTA_H */
/* EOF */ /* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: dllmain.c,v 1.52 2003/11/19 13:19:40 weiden Exp $ /* $Id: dllmain.c,v 1.53 2003/11/23 11:39:48 navaraf Exp $
* *
* Entry Point for win32k.sys * Entry Point for win32k.sys
*/ */
@ -77,10 +77,10 @@ Win32kProcessCallback (struct _EPROCESS *Process,
if (Process->Win32WindowStation != NULL) if (Process->Win32WindowStation != NULL)
{ {
Status = Status =
ValidateWindowStationHandle(Process->Win32WindowStation, IntValidateWindowStationHandle(Process->Win32WindowStation,
UserMode, UserMode,
GENERIC_ALL, GENERIC_ALL,
&Win32Process->WindowStation); &Win32Process->WindowStation);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint("Win32K: Failed to reference a window station for " DbgPrint("Win32K: Failed to reference a window station for "
@ -217,6 +217,13 @@ DllMain (
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
Status = InitDesktopImpl();
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to initialize window station implementation!\n");
return STATUS_UNSUCCESSFUL;
}
Status = InitWindowImpl(); Status = InitWindowImpl();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.82 2003/11/02 16:33:51 ekohl Exp $ # $Id: makefile,v 1.83 2003/11/23 11:39:48 navaraf Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -53,7 +53,7 @@ NTUSER_OBJECTS = ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/guicheck
ntuser/menu.o ntuser/message.o ntuser/metric.o ntuser/misc.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/msgqueue.o ntuser/painting.o ntuser/prop.o ntuser/scrollbar.o \
ntuser/stubs.o ntuser/timer.o ntuser/userobj.o ntuser/vis.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/windc.o ntuser/window.o ntuser/winlock.o ntuser/winpos.o \
ntuser/winsta.o ntuser/winsta.o
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \ OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \

View file

@ -1,4 +1,4 @@
/* $Id: caret.c,v 1.7 2003/11/22 11:49:09 weiden Exp $ /* $Id: caret.c,v 1.8 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -56,10 +56,10 @@ IntSetCaretBlinkTime(UINT uMSeconds)
NTSTATUS Status; NTSTATUS Status;
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
SetLastNtError(Status); SetLastNtError(Status);
@ -155,10 +155,10 @@ IntGetCaretBlinkTime(VOID)
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
UINT Ret; UINT Ret;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
SetLastNtError(Status); SetLastNtError(Status);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: class.c,v 1.39 2003/11/11 20:28:21 gvg Exp $ /* $Id: class.c,v 1.40 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -99,10 +99,10 @@ ClassReferenceClassByName(PWNDCLASS_OBJECT *Class,
return(STATUS_INVALID_PARAMETER); return(STATUS_INVALID_PARAMETER);
} }
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Validation of window station handle (0x%X) failed\n", DPRINT("Validation of window station handle (0x%X) failed\n",
@ -218,7 +218,7 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject,
{ {
DPRINT("About to open window station handle (0x%X)\n", DPRINT("About to open window station handle (0x%X)\n",
PROCESS_WINDOW_STATION()); PROCESS_WINDOW_STATION());
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -399,7 +399,7 @@ NtUserRegisterClassExWOW(
RTL_ATOM Atom; RTL_ATOM Atom;
DPRINT("About to open window station handle (0x%X)\n", DPRINT("About to open window station handle (0x%X)\n",
PROCESS_WINDOW_STATION()); PROCESS_WINDOW_STATION());
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.31 2003/10/04 16:04:01 weiden Exp $ /* $Id: menu.c,v 1.32 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1108,7 +1108,7 @@ NtUserCheckMenuItem(
/* /*
* @implemented * @unimplemented
*/ */
HMENU STDCALL HMENU STDCALL
NtUserCreateMenu(VOID) NtUserCreateMenu(VOID)
@ -1116,7 +1116,7 @@ NtUserCreateMenu(VOID)
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
HANDLE Handle; HANDLE Handle;
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: metric.c,v 1.14 2003/09/08 18:50:00 weiden Exp $ /* $Id: metric.c,v 1.15 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -73,10 +73,10 @@ NtUserGetSystemMetrics(ULONG Index)
case SM_CXDOUBLECLK: case SM_CXDOUBLECLK:
case SM_CYDOUBLECLK: case SM_CYDOUBLECLK:
case SM_SWAPBUTTON: case SM_SWAPBUTTON:
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return 0xFFFFFFFF; return 0xFFFFFFFF;

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.27 2003/11/22 11:01:28 navaraf Exp $ /* $Id: misc.c,v 1.28 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -137,10 +137,10 @@ NtUserCallOneParam(
return Result; return Result;
case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON: case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return (DWORD)FALSE; return (DWORD)FALSE;
@ -216,10 +216,10 @@ NtUserCallTwoParam(
case TWOPARAM_ROUTINE_CURSORPOSITION: case TWOPARAM_ROUTINE_CURSORPOSITION:
if(!Param1) if(!Param1)
return (DWORD)FALSE; return (DWORD)FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return (DWORD)FALSE; return (DWORD)FALSE;
@ -321,10 +321,10 @@ NtUserSystemParametersInfo(
case SPI_SETDOUBLECLKHEIGHT: case SPI_SETDOUBLECLKHEIGHT:
case SPI_SETDOUBLECLICKTIME: case SPI_SETDOUBLECLICKTIME:
{ {
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return (DWORD)FALSE; return (DWORD)FALSE;
@ -441,10 +441,10 @@ NtUserGetDoubleClickTime(VOID)
NTSTATUS Status; NTSTATUS Status;
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return (DWORD)FALSE; return (DWORD)FALSE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: msgqueue.c,v 1.35 2003/11/22 12:22:07 weiden Exp $ /* $Id: msgqueue.c,v 1.36 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -35,6 +35,7 @@
#include <include/callback.h> #include <include/callback.h>
#include <include/window.h> #include <include/window.h>
#include <include/winpos.h> #include <include/winpos.h>
#include <include/winsta.h>
#include <include/class.h> #include <include/class.h>
#include <include/object.h> #include <include/object.h>
#include <include/input.h> #include <include/input.h>

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.38 2003/11/22 11:01:28 navaraf Exp $ /* $Id: stubs.c,v 1.39 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -65,20 +65,6 @@ NtUserBlockInput(
} }
DWORD
STDCALL
NtUserBuildNameList(
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3)
{
UNIMPLEMENTED
return 0;
}
DWORD DWORD
STDCALL STDCALL
NtUserCallHwnd( NtUserCallHwnd(

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.142 2003/11/21 21:12:08 navaraf Exp $ /* $Id: window.c,v 1.143 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -441,64 +441,6 @@ DestroyThreadWindows(struct _ETHREAD *Thread)
} }
HWND STDCALL
IntCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
PWNDCLASS_OBJECT DesktopClass,
ULONG Width, ULONG Height)
{
PWSTR WindowName;
HWND Handle;
PWINDOW_OBJECT WindowObject;
/* Create the window object. */
WindowObject = (PWINDOW_OBJECT)ObmCreateObject(WindowStation->HandleTable,
&Handle,
otWindow,
sizeof(WINDOW_OBJECT));
if (!WindowObject)
{
return((HWND)0);
}
/*
* Fill out the structure describing it.
*/
WindowObject->Class = DesktopClass;
WindowObject->ExStyle = 0;
WindowObject->Style = WS_VISIBLE;
WindowObject->Flags = 0;
WindowObject->Parent = NULL;
WindowObject->Owner = NULL;
WindowObject->IDMenu = 0;
WindowObject->Instance = NULL;
WindowObject->Self = Handle;
WindowObject->MessageQueue = NULL;
WindowObject->ExtraData = NULL;
WindowObject->ExtraDataSize = 0;
WindowObject->WindowRect.left = 0;
WindowObject->WindowRect.top = 0;
WindowObject->WindowRect.right = Width;
WindowObject->WindowRect.bottom = Height;
WindowObject->ClientRect = WindowObject->WindowRect;
WindowObject->UserData = 0;
/*FIXME: figure out what the correct strange value is and what to do with it (and how to set the wndproc values correctly) */
WindowObject->WndProcA = DesktopClass->lpfnWndProcA;
WindowObject->WndProcW = DesktopClass->lpfnWndProcW;
WindowObject->OwnerThread = PsGetCurrentThread();
WindowObject->FirstChild = NULL;
WindowObject->LastChild = NULL;
WindowObject->PrevSibling = NULL;
WindowObject->NextSibling = NULL;
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
WindowName = ExAllocatePool(NonPagedPool, sizeof(L"DESKTOP"));
wcscpy(WindowName, L"DESKTOP");
RtlInitUnicodeString(&WindowObject->WindowName, WindowName);
return(Handle);
}
HWND FASTCALL HWND FASTCALL
IntGetActiveWindow(VOID) IntGetActiveWindow(VOID)
@ -655,6 +597,64 @@ IntGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid)
} }
HWND STDCALL
IntCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
PWNDCLASS_OBJECT DesktopClass,
ULONG Width, ULONG Height)
{
PWSTR WindowName;
HWND Handle;
PWINDOW_OBJECT WindowObject;
/* Create the window object. */
WindowObject = (PWINDOW_OBJECT)ObmCreateObject(WindowStation->HandleTable,
&Handle,
otWindow,
sizeof(WINDOW_OBJECT));
if (!WindowObject)
{
return((HWND)0);
}
/*
* Fill out the structure describing it.
*/
WindowObject->Class = DesktopClass;
WindowObject->ExStyle = 0;
WindowObject->Style = WS_VISIBLE;
WindowObject->Flags = 0;
WindowObject->Parent = NULL;
WindowObject->Owner = NULL;
WindowObject->IDMenu = 0;
WindowObject->Instance = NULL;
WindowObject->Self = Handle;
WindowObject->MessageQueue = NULL;
WindowObject->ExtraData = NULL;
WindowObject->ExtraDataSize = 0;
WindowObject->WindowRect.left = 0;
WindowObject->WindowRect.top = 0;
WindowObject->WindowRect.right = Width;
WindowObject->WindowRect.bottom = Height;
WindowObject->ClientRect = WindowObject->WindowRect;
WindowObject->UserData = 0;
/*FIXME: figure out what the correct strange value is and what to do with it (and how to set the wndproc values correctly) */
WindowObject->WndProcA = DesktopClass->lpfnWndProcA;
WindowObject->WndProcW = DesktopClass->lpfnWndProcW;
WindowObject->OwnerThread = PsGetCurrentThread();
WindowObject->FirstChild = NULL;
WindowObject->LastChild = NULL;
WindowObject->PrevSibling = NULL;
WindowObject->NextSibling = NULL;
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
WindowName = ExAllocatePool(NonPagedPool, sizeof(L"DESKTOP"));
wcscpy(WindowName, L"DESKTOP");
RtlInitUnicodeString(&WindowObject->WindowName, WindowName);
return(Handle);
}
VOID FASTCALL VOID FASTCALL
IntInitDesktopWindow(ULONG Width, ULONG Height) IntInitDesktopWindow(ULONG Width, ULONG Height)
{ {
@ -1236,9 +1236,11 @@ NtUserBuildHwndList(
KIRQL OldIrql; KIRQL OldIrql;
PWINDOW_OBJECT Child, WndDesktop; PWINDOW_OBJECT Child, WndDesktop;
#if 0
if ( hDesktop ) if ( hDesktop )
DesktopObject = IntGetDesktopObject ( hDesktop ); DesktopObject = IntGetDesktopObject ( hDesktop );
else else
#endif
DesktopObject = IntGetActiveDesktop(); DesktopObject = IntGetActiveDesktop();
if (!DesktopObject) if (!DesktopObject)
{ {
@ -1387,10 +1389,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
/* Check the window station. */ /* Check the window station. */
DPRINT("IoGetCurrentProcess() %X\n", IoGetCurrentProcess()); DPRINT("IoGetCurrentProcess() %X\n", IoGetCurrentProcess());
DPRINT("PROCESS_WINDOW_STATION %X\n", PROCESS_WINDOW_STATION()); DPRINT("PROCESS_WINDOW_STATION %X\n", PROCESS_WINDOW_STATION());
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&WindowName); RtlFreeUnicodeString(&WindowName);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: winpos.c,v 1.45 2003/11/21 17:01:16 navaraf Exp $ /* $Id: winpos.c,v 1.46 2003/11/23 11:39:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -36,7 +36,6 @@
#include <include/class.h> #include <include/class.h>
#include <include/error.h> #include <include/error.h>
#include <include/winsta.h> #include <include/winsta.h>
#include <windows.h>
#include <include/winpos.h> #include <include/winpos.h>
#include <include/rect.h> #include <include/rect.h>
#include <include/callback.h> #include <include/callback.h>

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: cursoricon.c,v 1.24 2003/11/21 22:46:27 weiden Exp $ */ /* $Id: cursoricon.c,v 1.25 2003/11/23 11:39:48 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
@ -105,14 +105,14 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
goto done; goto done;
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */ /* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
dc = DC_LockDc(ScreenDeviceContext); dc = DC_LockDc(IntGetScreenDC());
if(!dc) if(!dc)
goto done; goto done;
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DevInfo = dc->DevInfo; DevInfo = dc->DevInfo;
DC_UnlockDc(ScreenDeviceContext); DC_UnlockDc(IntGetScreenDC());
if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange)) if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
{ {
@ -459,7 +459,7 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect)
NTSTATUS Status; NTSTATUS Status;
HICON Ret; HICON Ret;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -535,7 +535,7 @@ NtUserGetIconInfo(
NTSTATUS Status; NTSTATUS Status;
BOOL Ret = FALSE; BOOL Ret = FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -596,7 +596,7 @@ NtUserGetIconSize(
NTSTATUS Status; NTSTATUS Status;
BOOL Ret = FALSE; BOOL Ret = FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -686,7 +686,7 @@ NtUserGetCursorInfo(
return FALSE; return FALSE;
} }
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -733,7 +733,7 @@ NtUserClipCursor(
RECT Rect; RECT Rect;
PWINDOW_OBJECT DesktopWindow = NULL; PWINDOW_OBJECT DesktopWindow = NULL;
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -789,7 +789,7 @@ NtUserDestroyCursor(
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
NTSTATUS Status; NTSTATUS Status;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -826,7 +826,7 @@ NtUserFindExistingCursorIcon(
NTSTATUS Status; NTSTATUS Status;
HICON Ret = (HICON)0; HICON Ret = (HICON)0;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -870,7 +870,7 @@ NtUserGetClipCursor(
if(!lpRect) if(!lpRect)
return FALSE; return FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -924,7 +924,7 @@ NtUserSetCursor(
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
NTSTATUS Status; NTSTATUS Status;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -963,7 +963,7 @@ NtUserSetCursorIconContents(
NTSTATUS Status; NTSTATUS Status;
BOOL Ret = FALSE; BOOL Ret = FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -1037,7 +1037,7 @@ NtUserSetCursorIconData(
POINT SafeHotspot; POINT SafeHotspot;
BOOL Ret = FALSE; BOOL Ret = FALSE;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
@ -1155,7 +1155,7 @@ NtUserDrawIconEx(
INT nStretchMode; INT nStretchMode;
#endif #endif
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);