mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
moved desktop code to desktop.c
svn path=/trunk/; revision=6904
This commit is contained in:
parent
62acb5b575
commit
7c98a98880
15 changed files with 800 additions and 713 deletions
|
@ -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: mouse.c,v 1.46 2003/11/21 16:36:26 weiden Exp $
|
/* $Id: mouse.c,v 1.47 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include "include/msgqueue.h"
|
#include "include/msgqueue.h"
|
||||||
#include "include/object.h"
|
#include "include/object.h"
|
||||||
#include "include/winsta.h"
|
#include "include/winsta.h"
|
||||||
|
#include "include/desktop.h"
|
||||||
#include "include/window.h"
|
#include "include/window.h"
|
||||||
#include "include/cursoricon.h"
|
#include "include/cursoricon.h"
|
||||||
#include "include/callback.h"
|
#include "include/callback.h"
|
||||||
|
|
39
reactos/subsys/win32k/include/desktop.h
Normal file
39
reactos/subsys/win32k/include/desktop.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef _WIN32K_DESKTOP_H
|
||||||
|
#define _WIN32K_DESKTOP_H
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include <internal/ex.h>
|
||||||
|
#include <internal/ps.h>
|
||||||
|
#include "msgqueue.h"
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
|
extern PDESKTOP_OBJECT InputDesktop;
|
||||||
|
extern HDESK InputDesktopHandle;
|
||||||
|
extern PWNDCLASS_OBJECT DesktopWindowClass;
|
||||||
|
extern HDC ScreenDeviceContext;
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
InitDesktopImpl(VOID);
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
CleanupDesktopImpl(VOID);
|
||||||
|
|
||||||
|
LRESULT CALLBACK
|
||||||
|
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
HDC FASTCALL
|
||||||
|
IntGetScreenDC(VOID);
|
||||||
|
|
||||||
|
PUSER_MESSAGE_QUEUE FASTCALL
|
||||||
|
IntGetFocusMessageQueue(VOID);
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
|
||||||
|
|
||||||
|
PDESKTOP_OBJECT FASTCALL
|
||||||
|
IntGetActiveDesktop(VOID);
|
||||||
|
|
||||||
|
#endif /* _WIN32K_DESKTOP_H */
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -24,12 +24,6 @@ InitWindowStationImpl(VOID);
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CleanupWindowStationImpl(VOID);
|
CleanupWindowStationImpl(VOID);
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
InitDesktopImpl(VOID);
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
CleanupDesktopImpl(VOID);
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
IntValidateWindowStationHandle(
|
IntValidateWindowStationHandle(
|
||||||
HWINSTA WindowStation,
|
HWINSTA WindowStation,
|
||||||
|
@ -40,34 +34,17 @@ IntValidateWindowStationHandle(
|
||||||
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);
|
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntInitializeDesktopGraphics(VOID);
|
IntInitializeDesktopGraphics(VOID);
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntEndDesktopGraphics(VOID);
|
IntEndDesktopGraphics(VOID);
|
||||||
|
|
||||||
/*
|
BOOL FASTCALL
|
||||||
struct _WINDOW_OBJECT* FASTCALL
|
IntGetFullWindowStationName(
|
||||||
IntGetCaptureWindow(VOID);
|
OUT PUNICODE_STRING FullName,
|
||||||
|
IN PUNICODE_STRING WinStaName,
|
||||||
VOID FASTCALL
|
IN OPTIONAL PUNICODE_STRING DesktopName);
|
||||||
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 */
|
||||||
|
|
||||||
|
|
|
@ -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.57 2003/12/07 12:59:34 chorns Exp $
|
/* $Id: dllmain.c,v 1.58 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* Entry Point for win32k.sys
|
* Entry Point for win32k.sys
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
|
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/menu.h>
|
#include <include/menu.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.86 2003/12/07 12:59:34 chorns Exp $
|
# $Id: makefile,v 1.87 2003/12/07 19:29:33 weiden Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o
|
||||||
LDR_OBJECTS = ldr/loader.o
|
LDR_OBJECTS = ldr/loader.o
|
||||||
|
|
||||||
NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/focus.o \
|
NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/focus.o \
|
||||||
ntuser/guicheck.o ntuser/hook.o ntuser/hotkey.o ntuser/input.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/keyboard.o ntuser/menu.o ntuser/message.o ntuser/metric.o \
|
||||||
ntuser/misc.o ntuser/msgqueue.o ntuser/painting.o ntuser/prop.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/scrollbar.o ntuser/stubs.o ntuser/timer.o ntuser/userobj.o \
|
||||||
|
|
|
@ -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: callback.c,v 1.16 2003/11/23 12:24:20 weiden Exp $
|
/* $Id: callback.c,v 1.17 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#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 <include/desktop.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
#include <user32/callback.h>
|
#include <user32/callback.h>
|
||||||
|
|
731
reactos/subsys/win32k/ntuser/desktop.c
Normal file
731
reactos/subsys/win32k/ntuser/desktop.c
Normal file
|
@ -0,0 +1,731 @@
|
||||||
|
/*
|
||||||
|
* 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: desktop.c,v 1.1 2003/12/07 19:29:33 weiden Exp $
|
||||||
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: Desktops
|
||||||
|
* FILE: subsys/win32k/ntuser/desktop.c
|
||||||
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
|
* REVISION HISTORY:
|
||||||
|
* 06-06-2001 CSH Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
|
#define __WIN32K__
|
||||||
|
#define NTOS_MODE_KERNEL
|
||||||
|
#include <ntos.h>
|
||||||
|
#include <ddk/ntddmou.h>
|
||||||
|
#include <win32k/win32k.h>
|
||||||
|
#include <include/winsta.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
|
#include <include/object.h>
|
||||||
|
#include <include/window.h>
|
||||||
|
#include <include/error.h>
|
||||||
|
#include <include/cursoricon.h>
|
||||||
|
#include <include/hotkey.h>
|
||||||
|
#include <include/color.h>
|
||||||
|
#include <include/mouse.h>
|
||||||
|
#include <include/callback.h>
|
||||||
|
#include <include/guicheck.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
/* Currently active desktop */
|
||||||
|
PDESKTOP_OBJECT InputDesktop = NULL;
|
||||||
|
HDESK InputDesktopHandle = NULL;
|
||||||
|
PWNDCLASS_OBJECT DesktopWindowClass;
|
||||||
|
HDC ScreenDeviceContext = NULL;
|
||||||
|
|
||||||
|
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
InitDesktopImpl(VOID)
|
||||||
|
{
|
||||||
|
WNDCLASSEXW wcx;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the desktop window class
|
||||||
|
*/
|
||||||
|
wcx.style = 0;
|
||||||
|
wcx.lpfnWndProc = IntDesktopWindowProc;
|
||||||
|
wcx.cbClsExtra = wcx.cbWndExtra = 0;
|
||||||
|
wcx.hInstance = wcx.hIcon = wcx.hCursor = NULL;
|
||||||
|
wcx.hbrBackground = NULL;
|
||||||
|
wcx.lpszMenuName = NULL;
|
||||||
|
wcx.lpszClassName = L"DesktopWindowClass";
|
||||||
|
DesktopWindowClass = IntCreateClass(&wcx, TRUE, IntDesktopWindowProc,
|
||||||
|
(RTL_ATOM)32880);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
CleanupDesktopImpl(VOID)
|
||||||
|
{
|
||||||
|
/* FIXME: Unregister the desktop window class */
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
LRESULT CALLBACK
|
||||||
|
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_NCCREATE:
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
return NtUserPaintDesktop((HDC)wParam);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IntValidateDesktopHandle
|
||||||
|
*
|
||||||
|
* Validates the desktop handle.
|
||||||
|
*
|
||||||
|
* Remarks
|
||||||
|
* If the function succeeds, the handle remains referenced. If the
|
||||||
|
* fucntion fails, last error is set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
IntValidateDesktopHandle(
|
||||||
|
HDESK Desktop,
|
||||||
|
KPROCESSOR_MODE AccessMode,
|
||||||
|
ACCESS_MASK DesiredAccess,
|
||||||
|
PDESKTOP_OBJECT *Object)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = ObReferenceObjectByHandle(
|
||||||
|
Desktop,
|
||||||
|
DesiredAccess,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
AccessMode,
|
||||||
|
(PVOID*)Object,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
SetLastNtError(Status);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
PDESKTOP_OBJECT FASTCALL
|
||||||
|
IntGetActiveDesktop(VOID)
|
||||||
|
{
|
||||||
|
return InputDesktop;
|
||||||
|
}
|
||||||
|
|
||||||
|
PUSER_MESSAGE_QUEUE FASTCALL
|
||||||
|
IntGetFocusMessageQueue(VOID)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
|
||||||
|
if (!pdo)
|
||||||
|
{
|
||||||
|
DPRINT("No active desktop\n");
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
return (PUSER_MESSAGE_QUEUE)pdo->ActiveMessageQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
|
||||||
|
if (!pdo)
|
||||||
|
{
|
||||||
|
DPRINT("No active desktop\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pdo->ActiveMessageQueue = NewQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserCreateDesktop
|
||||||
|
*
|
||||||
|
* Creates a new desktop.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* lpszDesktopName
|
||||||
|
* Name of the new desktop.
|
||||||
|
*
|
||||||
|
* dwFlags
|
||||||
|
* Interaction flags.
|
||||||
|
*
|
||||||
|
* dwDesiredAccess
|
||||||
|
* Requested type of access.
|
||||||
|
*
|
||||||
|
* lpSecurity
|
||||||
|
* Security descriptor.
|
||||||
|
*
|
||||||
|
* hWindowStation
|
||||||
|
* Handle to window station on which to create the desktop.
|
||||||
|
*
|
||||||
|
* Return Value
|
||||||
|
* If the function succeeds, the return value is a handle to the newly
|
||||||
|
* created desktop. If the specified desktop already exists, the function
|
||||||
|
* succeeds and returns a handle to the existing desktop. When you are
|
||||||
|
* finished using the handle, call the CloseDesktop function to close it.
|
||||||
|
* If the function fails, the return value is NULL.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
HDESK STDCALL
|
||||||
|
NtUserCreateDesktop(
|
||||||
|
PUNICODE_STRING lpszDesktopName,
|
||||||
|
DWORD dwFlags,
|
||||||
|
ACCESS_MASK dwDesiredAccess,
|
||||||
|
LPSECURITY_ATTRIBUTES lpSecurity,
|
||||||
|
HWINSTA hWindowStation)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
PDESKTOP_OBJECT DesktopObject;
|
||||||
|
UNICODE_STRING DesktopName;
|
||||||
|
NTSTATUS Status;
|
||||||
|
HDESK Desktop;
|
||||||
|
|
||||||
|
Status = IntValidateWindowStationHandle(
|
||||||
|
hWindowStation,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&WinStaObject);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Failed validation of window station handle (0x%X)\n",
|
||||||
|
hWindowStation);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
||||||
|
lpszDesktopName))
|
||||||
|
{
|
||||||
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to open already existing desktop
|
||||||
|
*/
|
||||||
|
|
||||||
|
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
|
||||||
|
|
||||||
|
/* Initialize ObjectAttributes for the desktop object */
|
||||||
|
InitializeObjectAttributes(
|
||||||
|
&ObjectAttributes,
|
||||||
|
&DesktopName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = ObOpenObjectByName(
|
||||||
|
&ObjectAttributes,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
NULL,
|
||||||
|
UserMode,
|
||||||
|
dwDesiredAccess,
|
||||||
|
NULL,
|
||||||
|
&Desktop);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
||||||
|
ExFreePool(DesktopName.Buffer);
|
||||||
|
return Desktop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* No existing desktop found, try to create new one
|
||||||
|
*/
|
||||||
|
|
||||||
|
Status = ObCreateObject(
|
||||||
|
ExGetPreviousMode(),
|
||||||
|
ExDesktopObjectType,
|
||||||
|
&ObjectAttributes,
|
||||||
|
ExGetPreviousMode(),
|
||||||
|
NULL,
|
||||||
|
sizeof(DESKTOP_OBJECT),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
(PVOID*)&DesktopObject);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Failed creating desktop (%wZ)\n", &DesktopName);
|
||||||
|
ExFreePool(DesktopName.Buffer);
|
||||||
|
SetLastNtError(STATUS_UNSUCCESSFUL);
|
||||||
|
return((HDESK)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Set correct dimensions. */
|
||||||
|
DesktopObject->WorkArea.left = 0;
|
||||||
|
DesktopObject->WorkArea.top = 0;
|
||||||
|
DesktopObject->WorkArea.right = 640;
|
||||||
|
DesktopObject->WorkArea.bottom = 480;
|
||||||
|
|
||||||
|
/* Initialize some local (to win32k) desktop state. */
|
||||||
|
DesktopObject->ActiveMessageQueue = NULL;
|
||||||
|
DesktopObject->DesktopWindow = IntCreateDesktopWindow(
|
||||||
|
DesktopObject->WindowStation,
|
||||||
|
DesktopWindowClass,
|
||||||
|
DesktopObject->WorkArea.right,
|
||||||
|
DesktopObject->WorkArea.bottom);
|
||||||
|
|
||||||
|
DPRINT("Created Desktop Window: %08x\n", DesktopObject->DesktopWindow);
|
||||||
|
|
||||||
|
Status = ObInsertObject(
|
||||||
|
(PVOID)DesktopObject,
|
||||||
|
NULL,
|
||||||
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
&Desktop);
|
||||||
|
|
||||||
|
ObDereferenceObject(DesktopObject);
|
||||||
|
ExFreePool(DesktopName.Buffer);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Failed to create desktop handle\n");
|
||||||
|
SetLastNtError(STATUS_UNSUCCESSFUL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Desktop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserOpenDesktop
|
||||||
|
*
|
||||||
|
* Opens an existing desktop.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* lpszDesktopName
|
||||||
|
* Name of the existing desktop.
|
||||||
|
*
|
||||||
|
* dwFlags
|
||||||
|
* Interaction flags.
|
||||||
|
*
|
||||||
|
* dwDesiredAccess
|
||||||
|
* Requested type of access.
|
||||||
|
*
|
||||||
|
* Return Value
|
||||||
|
* Handle to the desktop or zero on failure.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
HDESK STDCALL
|
||||||
|
NtUserOpenDesktop(
|
||||||
|
PUNICODE_STRING lpszDesktopName,
|
||||||
|
DWORD dwFlags,
|
||||||
|
ACCESS_MASK dwDesiredAccess)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
UNICODE_STRING DesktopName;
|
||||||
|
NTSTATUS Status;
|
||||||
|
HDESK Desktop;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validate the window station handle and compose the fully
|
||||||
|
* qualified desktop name
|
||||||
|
*/
|
||||||
|
|
||||||
|
Status = IntValidateWindowStationHandle(
|
||||||
|
PROCESS_WINDOW_STATION(),
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&WinStaObject);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Failed validation of window station handle (0x%X)\n",
|
||||||
|
PROCESS_WINDOW_STATION());
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
||||||
|
lpszDesktopName))
|
||||||
|
{
|
||||||
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
|
DPRINT("Trying to open desktop station (%wZ)\n", &DesktopName);
|
||||||
|
|
||||||
|
/* Initialize ObjectAttributes for the desktop object */
|
||||||
|
InitializeObjectAttributes(
|
||||||
|
&ObjectAttributes,
|
||||||
|
&DesktopName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = ObOpenObjectByName(
|
||||||
|
&ObjectAttributes,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
NULL,
|
||||||
|
UserMode,
|
||||||
|
dwDesiredAccess,
|
||||||
|
NULL,
|
||||||
|
&Desktop);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
ExFreePool(DesktopName.Buffer);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
||||||
|
ExFreePool(DesktopName.Buffer);
|
||||||
|
|
||||||
|
return Desktop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserOpenInputDesktop
|
||||||
|
*
|
||||||
|
* Opens the input (interactive) desktop.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* dwFlags
|
||||||
|
* Interaction flags.
|
||||||
|
*
|
||||||
|
* fInherit
|
||||||
|
* Inheritance option.
|
||||||
|
*
|
||||||
|
* dwDesiredAccess
|
||||||
|
* Requested type of access.
|
||||||
|
*
|
||||||
|
* Return Value
|
||||||
|
* Handle to the input desktop or zero on failure.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
HDESK STDCALL
|
||||||
|
NtUserOpenInputDesktop(
|
||||||
|
DWORD dwFlags,
|
||||||
|
BOOL fInherit,
|
||||||
|
ACCESS_MASK dwDesiredAccess)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT Object;
|
||||||
|
NTSTATUS Status;
|
||||||
|
HDESK Desktop;
|
||||||
|
|
||||||
|
DPRINT("About to open input desktop\n");
|
||||||
|
|
||||||
|
/* Get a pointer to the desktop object */
|
||||||
|
|
||||||
|
Status = IntValidateDesktopHandle(
|
||||||
|
InputDesktop,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&Object);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Validation of input desktop handle (0x%X) failed\n", InputDesktop);
|
||||||
|
return (HDESK)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a new handle to the object */
|
||||||
|
|
||||||
|
Status = ObOpenObjectByPointer(
|
||||||
|
Object,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
dwDesiredAccess,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
UserMode,
|
||||||
|
&Desktop);
|
||||||
|
|
||||||
|
ObDereferenceObject(Object);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Successfully opened input desktop\n");
|
||||||
|
return (HDESK)Desktop;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return (HDESK)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserCloseDesktop
|
||||||
|
*
|
||||||
|
* Closes a desktop handle.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* hDesktop
|
||||||
|
* Handle to the desktop.
|
||||||
|
*
|
||||||
|
* Return Value
|
||||||
|
* Status
|
||||||
|
*
|
||||||
|
* Remarks
|
||||||
|
* The desktop handle can be created with NtUserCreateDesktop or
|
||||||
|
* NtUserOpenDesktop. This function will fail if any thread in the calling
|
||||||
|
* process is using the specified desktop handle or if the handle refers
|
||||||
|
* to the initial desktop of the calling process.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtUserCloseDesktop(HDESK hDesktop)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT Object;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("About to close desktop handle (0x%X)\n", hDesktop);
|
||||||
|
|
||||||
|
Status = IntValidateDesktopHandle(
|
||||||
|
hDesktop,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&Object);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(Object);
|
||||||
|
|
||||||
|
DPRINT("Closing desktop handle (0x%X)\n", hDesktop);
|
||||||
|
|
||||||
|
Status = ZwClose(hDesktop);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserPaintDesktop
|
||||||
|
*
|
||||||
|
* The NtUserPaintDesktop function fills the clipping region in the
|
||||||
|
* specified device context with the desktop pattern or wallpaper. The
|
||||||
|
* function is provided primarily for shell desktops.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* hdc
|
||||||
|
* Handle to the device context.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtUserPaintDesktop(HDC hDC)
|
||||||
|
{
|
||||||
|
HWND hwnd = IntGetDesktopWindow();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for an owning thread, otherwise don't paint anything
|
||||||
|
* (non-desktop mode)
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (NtUserGetWindowThreadProcessId(hwnd, NULL))
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
HBRUSH PreviousBrush;
|
||||||
|
|
||||||
|
NtUserGetClientRect(hwnd, &Rect);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Paint desktop background
|
||||||
|
*/
|
||||||
|
|
||||||
|
PreviousBrush = NtGdiSelectObject(hDC, NtGdiGetSysColorBrush(COLOR_BACKGROUND));
|
||||||
|
NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY);
|
||||||
|
NtGdiSelectObject(hDC, PreviousBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserSwitchDesktop
|
||||||
|
*
|
||||||
|
* Sets the current input (interactive) desktop.
|
||||||
|
*
|
||||||
|
* Parameters
|
||||||
|
* hDesktop
|
||||||
|
* Handle to desktop.
|
||||||
|
*
|
||||||
|
* Return Value
|
||||||
|
* Status
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtUserSwitchDesktop(HDESK hDesktop)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT DesktopObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("About to switch desktop (0x%X)\n", hDesktop);
|
||||||
|
|
||||||
|
Status = IntValidateDesktopHandle(
|
||||||
|
hDesktop,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&DesktopObject);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Fail if the desktop belong to an invisible window station */
|
||||||
|
/* FIXME: Fail if the process is associated with a secured
|
||||||
|
desktop such as Winlogon or Screen-Saver */
|
||||||
|
/* FIXME: Connect to input device */
|
||||||
|
|
||||||
|
/* Set the active desktop in the desktop's window station. */
|
||||||
|
DesktopObject->WindowStation->ActiveDesktop = DesktopObject;
|
||||||
|
|
||||||
|
/* Set the global state. */
|
||||||
|
InputDesktop = DesktopObject;
|
||||||
|
InputDesktopHandle = hDesktop;
|
||||||
|
InputWindowStation = DesktopObject->WindowStation;
|
||||||
|
|
||||||
|
ObDereferenceObject(DesktopObject);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserResolveDesktopForWOW
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
DWORD STDCALL
|
||||||
|
NtUserResolveDesktopForWOW(DWORD Unknown0)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserGetThreadDesktop
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
HDESK STDCALL
|
||||||
|
NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NtUserSetThreadDesktop
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtUserSetThreadDesktop(HDESK hDesktop)
|
||||||
|
{
|
||||||
|
PDESKTOP_OBJECT DesktopObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Validate the new desktop. */
|
||||||
|
Status = IntValidateDesktopHandle(
|
||||||
|
hDesktop,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&DesktopObject);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for setting the same desktop as before. */
|
||||||
|
if (DesktopObject == PsGetWin32Thread()->Desktop)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(DesktopObject);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Should check here to see if the thread has any windows. */
|
||||||
|
|
||||||
|
if (PsGetWin32Thread()->Desktop != NULL)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(PsGetWin32Thread()->Desktop);
|
||||||
|
}
|
||||||
|
|
||||||
|
PsGetWin32Thread()->Desktop = DesktopObject;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -16,11 +16,12 @@
|
||||||
* 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: focus.c,v 1.3 2003/12/02 19:58:54 navaraf Exp $
|
* $Id: focus.c,v 1.4 2003/12/07 19:29:33 weiden Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
#include <include/focus.h>
|
#include <include/focus.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/winpos.h>
|
#include <include/winpos.h>
|
||||||
|
|
|
@ -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: input.c,v 1.23 2003/11/30 20:03:47 navaraf Exp $
|
/* $Id: input.c,v 1.24 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#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 <include/desktop.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
#include <ddk/ntddmou.h>
|
#include <ddk/ntddmou.h>
|
||||||
#include <include/mouse.h>
|
#include <include/mouse.h>
|
||||||
|
|
|
@ -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.39 2003/11/30 20:03:47 navaraf Exp $
|
/* $Id: msgqueue.c,v 1.40 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/winpos.h>
|
#include <include/winpos.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/desktop.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>
|
||||||
|
|
|
@ -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.151 2003/12/07 10:31:22 navaraf Exp $
|
/* $Id: window.c,v 1.152 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
#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 <include/desktop.h>
|
||||||
#include <include/winpos.h>
|
#include <include/winpos.h>
|
||||||
#include <include/callback.h>
|
#include <include/callback.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
|
|
|
@ -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.50 2003/12/02 19:58:54 navaraf Exp $
|
/* $Id: winpos.c,v 1.51 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#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 <include/desktop.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>
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
* 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: winsta.c,v 1.49 2003/11/30 20:03:47 navaraf Exp $
|
* $Id: winsta.c,v 1.50 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Window stations and Desktops
|
* PURPOSE: Window stations
|
||||||
* FILE: subsys/win32k/ntuser/winsta.c
|
* FILE: subsys/win32k/ntuser/winsta.c
|
||||||
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
* REVISION HISTORY:
|
* REVISION HISTORY:
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include <ddk/ntddmou.h>
|
#include <ddk/ntddmou.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
|
@ -58,16 +59,10 @@
|
||||||
|
|
||||||
/* Currently active window station */
|
/* Currently active window station */
|
||||||
PWINSTATION_OBJECT InputWindowStation = NULL;
|
PWINSTATION_OBJECT InputWindowStation = NULL;
|
||||||
/* Currently active desktop */
|
|
||||||
STATIC PDESKTOP_OBJECT InputDesktop = NULL;
|
|
||||||
STATIC HDESK InputDesktopHandle = NULL;
|
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
STATIC PWNDCLASS_OBJECT DesktopWindowClass;
|
|
||||||
HDC ScreenDeviceContext = NULL;
|
|
||||||
|
|
||||||
/* INITALIZATION FUNCTIONS ****************************************************/
|
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
|
@ -103,35 +98,6 @@ CleanupWindowStationImpl(VOID)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
InitDesktopImpl(VOID)
|
|
||||||
{
|
|
||||||
WNDCLASSEXW wcx;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the desktop window class
|
|
||||||
*/
|
|
||||||
wcx.style = 0;
|
|
||||||
wcx.lpfnWndProc = IntDesktopWindowProc;
|
|
||||||
wcx.cbClsExtra = wcx.cbWndExtra = 0;
|
|
||||||
wcx.hInstance = wcx.hIcon = wcx.hCursor = NULL;
|
|
||||||
wcx.hbrBackground = NULL;
|
|
||||||
wcx.lpszMenuName = NULL;
|
|
||||||
wcx.lpszClassName = L"DesktopWindowClass";
|
|
||||||
DesktopWindowClass = IntCreateClass(&wcx, TRUE, IntDesktopWindowProc,
|
|
||||||
(RTL_ATOM)32880);
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
CleanupDesktopImpl(VOID)
|
|
||||||
{
|
|
||||||
/* FIXME: Unregister the desktop window class */
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -228,58 +194,6 @@ IntGetWindowStationObject(PWINSTATION_OBJECT Object)
|
||||||
return NT_SUCCESS(Status);
|
return NT_SUCCESS(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
|
||||||
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (msg)
|
|
||||||
{
|
|
||||||
case WM_CREATE:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_NCCREATE:
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
|
||||||
return NtUserPaintDesktop((HDC)wParam);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IntValidateDesktopHandle
|
|
||||||
*
|
|
||||||
* Validates the desktop handle.
|
|
||||||
*
|
|
||||||
* Remarks
|
|
||||||
* If the function succeeds, the handle remains referenced. If the
|
|
||||||
* fucntion fails, last error is set.
|
|
||||||
*/
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
IntValidateDesktopHandle(
|
|
||||||
HDESK Desktop,
|
|
||||||
KPROCESSOR_MODE AccessMode,
|
|
||||||
ACCESS_MASK DesiredAccess,
|
|
||||||
PDESKTOP_OBJECT *Object)
|
|
||||||
{
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(
|
|
||||||
Desktop,
|
|
||||||
DesiredAccess,
|
|
||||||
ExDesktopObjectType,
|
|
||||||
AccessMode,
|
|
||||||
(PVOID*)Object,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
SetLastNtError(Status);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntInitializeDesktopGraphics(VOID)
|
IntInitializeDesktopGraphics(VOID)
|
||||||
{
|
{
|
||||||
|
@ -322,36 +236,6 @@ IntGetScreenDC(VOID)
|
||||||
return ScreenDeviceContext;
|
return ScreenDeviceContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
PDESKTOP_OBJECT FASTCALL
|
|
||||||
IntGetActiveDesktop(VOID)
|
|
||||||
{
|
|
||||||
return InputDesktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
PUSER_MESSAGE_QUEUE FASTCALL
|
|
||||||
IntGetFocusMessageQueue(VOID)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
|
|
||||||
if (!pdo)
|
|
||||||
{
|
|
||||||
DPRINT("No active desktop\n");
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
return (PUSER_MESSAGE_QUEUE)pdo->ActiveMessageQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID FASTCALL
|
|
||||||
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
|
|
||||||
if (!pdo)
|
|
||||||
{
|
|
||||||
DPRINT("No active desktop\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pdo->ActiveMessageQueue = NewQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -893,560 +777,6 @@ NtUserSetWindowStationUser(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserCreateDesktop
|
|
||||||
*
|
|
||||||
* Creates a new desktop.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* lpszDesktopName
|
|
||||||
* Name of the new desktop.
|
|
||||||
*
|
|
||||||
* dwFlags
|
|
||||||
* Interaction flags.
|
|
||||||
*
|
|
||||||
* dwDesiredAccess
|
|
||||||
* Requested type of access.
|
|
||||||
*
|
|
||||||
* lpSecurity
|
|
||||||
* Security descriptor.
|
|
||||||
*
|
|
||||||
* hWindowStation
|
|
||||||
* Handle to window station on which to create the desktop.
|
|
||||||
*
|
|
||||||
* Return Value
|
|
||||||
* If the function succeeds, the return value is a handle to the newly
|
|
||||||
* created desktop. If the specified desktop already exists, the function
|
|
||||||
* succeeds and returns a handle to the existing desktop. When you are
|
|
||||||
* finished using the handle, call the CloseDesktop function to close it.
|
|
||||||
* If the function fails, the return value is NULL.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
HDESK STDCALL
|
|
||||||
NtUserCreateDesktop(
|
|
||||||
PUNICODE_STRING lpszDesktopName,
|
|
||||||
DWORD dwFlags,
|
|
||||||
ACCESS_MASK dwDesiredAccess,
|
|
||||||
LPSECURITY_ATTRIBUTES lpSecurity,
|
|
||||||
HWINSTA hWindowStation)
|
|
||||||
{
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
PDESKTOP_OBJECT DesktopObject;
|
|
||||||
UNICODE_STRING DesktopName;
|
|
||||||
NTSTATUS Status;
|
|
||||||
HDESK Desktop;
|
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
|
||||||
hWindowStation,
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Failed validation of window station handle (0x%X)\n",
|
|
||||||
hWindowStation);
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
|
||||||
lpszDesktopName))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Try to open already existing desktop
|
|
||||||
*/
|
|
||||||
|
|
||||||
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
|
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for the desktop object */
|
|
||||||
InitializeObjectAttributes(
|
|
||||||
&ObjectAttributes,
|
|
||||||
&DesktopName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
|
||||||
&ObjectAttributes,
|
|
||||||
ExDesktopObjectType,
|
|
||||||
NULL,
|
|
||||||
UserMode,
|
|
||||||
dwDesiredAccess,
|
|
||||||
NULL,
|
|
||||||
&Desktop);
|
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
|
||||||
ExFreePool(DesktopName.Buffer);
|
|
||||||
return Desktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* No existing desktop found, try to create new one
|
|
||||||
*/
|
|
||||||
|
|
||||||
Status = ObCreateObject(
|
|
||||||
ExGetPreviousMode(),
|
|
||||||
ExDesktopObjectType,
|
|
||||||
&ObjectAttributes,
|
|
||||||
ExGetPreviousMode(),
|
|
||||||
NULL,
|
|
||||||
sizeof(DESKTOP_OBJECT),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
(PVOID*)&DesktopObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Failed creating desktop (%wZ)\n", &DesktopName);
|
|
||||||
ExFreePool(DesktopName.Buffer);
|
|
||||||
SetLastNtError(STATUS_UNSUCCESSFUL);
|
|
||||||
return((HDESK)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Set correct dimensions. */
|
|
||||||
DesktopObject->WorkArea.left = 0;
|
|
||||||
DesktopObject->WorkArea.top = 0;
|
|
||||||
DesktopObject->WorkArea.right = 640;
|
|
||||||
DesktopObject->WorkArea.bottom = 480;
|
|
||||||
|
|
||||||
/* Initialize some local (to win32k) desktop state. */
|
|
||||||
DesktopObject->ActiveMessageQueue = NULL;
|
|
||||||
DesktopObject->DesktopWindow = IntCreateDesktopWindow(
|
|
||||||
DesktopObject->WindowStation,
|
|
||||||
DesktopWindowClass,
|
|
||||||
DesktopObject->WorkArea.right,
|
|
||||||
DesktopObject->WorkArea.bottom);
|
|
||||||
|
|
||||||
DPRINT("Created Desktop Window: %08x\n", DesktopObject->DesktopWindow);
|
|
||||||
|
|
||||||
Status = ObInsertObject(
|
|
||||||
(PVOID)DesktopObject,
|
|
||||||
NULL,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
&Desktop);
|
|
||||||
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
ExFreePool(DesktopName.Buffer);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Failed to create desktop handle\n");
|
|
||||||
SetLastNtError(STATUS_UNSUCCESSFUL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Desktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserOpenDesktop
|
|
||||||
*
|
|
||||||
* Opens an existing desktop.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* lpszDesktopName
|
|
||||||
* Name of the existing desktop.
|
|
||||||
*
|
|
||||||
* dwFlags
|
|
||||||
* Interaction flags.
|
|
||||||
*
|
|
||||||
* dwDesiredAccess
|
|
||||||
* Requested type of access.
|
|
||||||
*
|
|
||||||
* Return Value
|
|
||||||
* Handle to the desktop or zero on failure.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
HDESK STDCALL
|
|
||||||
NtUserOpenDesktop(
|
|
||||||
PUNICODE_STRING lpszDesktopName,
|
|
||||||
DWORD dwFlags,
|
|
||||||
ACCESS_MASK dwDesiredAccess)
|
|
||||||
{
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
UNICODE_STRING DesktopName;
|
|
||||||
NTSTATUS Status;
|
|
||||||
HDESK Desktop;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Validate the window station handle and compose the fully
|
|
||||||
* qualified desktop name
|
|
||||||
*/
|
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
|
||||||
PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Failed validation of window station handle (0x%X)\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
|
||||||
lpszDesktopName))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
DPRINT("Trying to open desktop station (%wZ)\n", &DesktopName);
|
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for the desktop object */
|
|
||||||
InitializeObjectAttributes(
|
|
||||||
&ObjectAttributes,
|
|
||||||
&DesktopName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
|
||||||
&ObjectAttributes,
|
|
||||||
ExDesktopObjectType,
|
|
||||||
NULL,
|
|
||||||
UserMode,
|
|
||||||
dwDesiredAccess,
|
|
||||||
NULL,
|
|
||||||
&Desktop);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
ExFreePool(DesktopName.Buffer);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
|
||||||
ExFreePool(DesktopName.Buffer);
|
|
||||||
|
|
||||||
return Desktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserOpenInputDesktop
|
|
||||||
*
|
|
||||||
* Opens the input (interactive) desktop.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* dwFlags
|
|
||||||
* Interaction flags.
|
|
||||||
*
|
|
||||||
* fInherit
|
|
||||||
* Inheritance option.
|
|
||||||
*
|
|
||||||
* dwDesiredAccess
|
|
||||||
* Requested type of access.
|
|
||||||
*
|
|
||||||
* Return Value
|
|
||||||
* Handle to the input desktop or zero on failure.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
HDESK STDCALL
|
|
||||||
NtUserOpenInputDesktop(
|
|
||||||
DWORD dwFlags,
|
|
||||||
BOOL fInherit,
|
|
||||||
ACCESS_MASK dwDesiredAccess)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT Object;
|
|
||||||
NTSTATUS Status;
|
|
||||||
HDESK Desktop;
|
|
||||||
|
|
||||||
DPRINT("About to open input desktop\n");
|
|
||||||
|
|
||||||
/* Get a pointer to the desktop object */
|
|
||||||
|
|
||||||
Status = IntValidateDesktopHandle(
|
|
||||||
InputDesktop,
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&Object);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of input desktop handle (0x%X) failed\n", InputDesktop);
|
|
||||||
return (HDESK)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new handle to the object */
|
|
||||||
|
|
||||||
Status = ObOpenObjectByPointer(
|
|
||||||
Object,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
dwDesiredAccess,
|
|
||||||
ExDesktopObjectType,
|
|
||||||
UserMode,
|
|
||||||
&Desktop);
|
|
||||||
|
|
||||||
ObDereferenceObject(Object);
|
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Successfully opened input desktop\n");
|
|
||||||
return (HDESK)Desktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return (HDESK)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserCloseDesktop
|
|
||||||
*
|
|
||||||
* Closes a desktop handle.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* hDesktop
|
|
||||||
* Handle to the desktop.
|
|
||||||
*
|
|
||||||
* Return Value
|
|
||||||
* Status
|
|
||||||
*
|
|
||||||
* Remarks
|
|
||||||
* The desktop handle can be created with NtUserCreateDesktop or
|
|
||||||
* NtUserOpenDesktop. This function will fail if any thread in the calling
|
|
||||||
* process is using the specified desktop handle or if the handle refers
|
|
||||||
* to the initial desktop of the calling process.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL STDCALL
|
|
||||||
NtUserCloseDesktop(HDESK hDesktop)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT Object;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
DPRINT("About to close desktop handle (0x%X)\n", hDesktop);
|
|
||||||
|
|
||||||
Status = IntValidateDesktopHandle(
|
|
||||||
hDesktop,
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&Object);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(Object);
|
|
||||||
|
|
||||||
DPRINT("Closing desktop handle (0x%X)\n", hDesktop);
|
|
||||||
|
|
||||||
Status = ZwClose(hDesktop);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserPaintDesktop
|
|
||||||
*
|
|
||||||
* The NtUserPaintDesktop function fills the clipping region in the
|
|
||||||
* specified device context with the desktop pattern or wallpaper. The
|
|
||||||
* function is provided primarily for shell desktops.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* hdc
|
|
||||||
* Handle to the device context.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL STDCALL
|
|
||||||
NtUserPaintDesktop(HDC hDC)
|
|
||||||
{
|
|
||||||
HWND hwnd = IntGetDesktopWindow();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check for an owning thread, otherwise don't paint anything
|
|
||||||
* (non-desktop mode)
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (NtUserGetWindowThreadProcessId(hwnd, NULL))
|
|
||||||
{
|
|
||||||
RECT Rect;
|
|
||||||
HBRUSH PreviousBrush;
|
|
||||||
|
|
||||||
NtUserGetClientRect(hwnd, &Rect);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Paint desktop background
|
|
||||||
*/
|
|
||||||
|
|
||||||
PreviousBrush = NtGdiSelectObject(hDC, NtGdiGetSysColorBrush(COLOR_BACKGROUND));
|
|
||||||
NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY);
|
|
||||||
NtGdiSelectObject(hDC, PreviousBrush);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserSwitchDesktop
|
|
||||||
*
|
|
||||||
* Sets the current input (interactive) desktop.
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
* hDesktop
|
|
||||||
* Handle to desktop.
|
|
||||||
*
|
|
||||||
* Return Value
|
|
||||||
* Status
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL STDCALL
|
|
||||||
NtUserSwitchDesktop(HDESK hDesktop)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT DesktopObject;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
DPRINT("About to switch desktop (0x%X)\n", hDesktop);
|
|
||||||
|
|
||||||
Status = IntValidateDesktopHandle(
|
|
||||||
hDesktop,
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&DesktopObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Fail if the desktop belong to an invisible window station */
|
|
||||||
/* FIXME: Fail if the process is associated with a secured
|
|
||||||
desktop such as Winlogon or Screen-Saver */
|
|
||||||
/* FIXME: Connect to input device */
|
|
||||||
|
|
||||||
/* Set the active desktop in the desktop's window station. */
|
|
||||||
DesktopObject->WindowStation->ActiveDesktop = DesktopObject;
|
|
||||||
|
|
||||||
/* Set the global state. */
|
|
||||||
InputDesktop = DesktopObject;
|
|
||||||
InputDesktopHandle = hDesktop;
|
|
||||||
InputWindowStation = DesktopObject->WindowStation;
|
|
||||||
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserResolveDesktopForWOW
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
DWORD STDCALL
|
|
||||||
NtUserResolveDesktopForWOW(DWORD Unknown0)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserGetThreadDesktop
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
HDESK STDCALL
|
|
||||||
NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NtUserSetThreadDesktop
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL STDCALL
|
|
||||||
NtUserSetThreadDesktop(HDESK hDesktop)
|
|
||||||
{
|
|
||||||
PDESKTOP_OBJECT DesktopObject;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
/* Validate the new desktop. */
|
|
||||||
Status = IntValidateDesktopHandle(
|
|
||||||
hDesktop,
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&DesktopObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for setting the same desktop as before. */
|
|
||||||
if (DesktopObject == PsGetWin32Thread()->Desktop)
|
|
||||||
{
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Should check here to see if the thread has any windows. */
|
|
||||||
|
|
||||||
if (PsGetWin32Thread()->Desktop != NULL)
|
|
||||||
{
|
|
||||||
ObDereferenceObject(PsGetWin32Thread()->Desktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
PsGetWin32Thread()->Desktop = DesktopObject;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NtUserBuildNameList
|
* NtUserBuildNameList
|
||||||
*
|
*
|
||||||
|
|
|
@ -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.27 2003/12/03 21:38:14 gvg Exp $ */
|
/* $Id: cursoricon.c,v 1.28 2003/12/07 19:29:33 weiden Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include <win32k/bitmaps.h>
|
#include <win32k/bitmaps.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/mouse.h>
|
#include <include/mouse.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
|
|
|
@ -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: dc.c,v 1.106 2003/12/03 21:37:34 gvg Exp $
|
/* $Id: dc.c,v 1.107 2003/12/07 19:29:33 weiden Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
#include <include/eng.h>
|
#include <include/eng.h>
|
||||||
#include <include/palette.h>
|
#include <include/palette.h>
|
||||||
#include <include/guicheck.h>
|
#include <include/guicheck.h>
|
||||||
|
#include <include/desktop.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
|
Loading…
Reference in a new issue