Move desktop window proc from WIN32K to CSRSS

svn path=/trunk/; revision=6908
This commit is contained in:
Gé van Geldorp
2003-12-07 23:02:57 +00:00
parent bfcd20af5e
commit 89d0892531
30 changed files with 873 additions and 517 deletions
+1 -1
View File
@@ -563,7 +563,7 @@ NtUserGetWindow 2
NtUserGetLastActivePopup 1 NtUserGetLastActivePopup 1
NtUserGetShellWindow 0 NtUserGetShellWindow 0
NtUserDereferenceWndProcHandle 2 NtUserDereferenceWndProcHandle 2
NtUserGraphicsDone 0 NtUserManualGuiCheck 1
# DirectDraw system calls # DirectDraw system calls
NtGdiD3dContextCreate 4 NtGdiD3dContextCreate 4
NtGdiD3dContextDestroy 1 NtGdiD3dContextDestroy 1
+38
View File
@@ -496,6 +496,35 @@ typedef struct
HWND WindowHandle; HWND WindowHandle;
} CSRSS_CONSOLE_WINDOW, *PCSRSS_CONSOLE_WINDOW; } CSRSS_CONSOLE_WINDOW, *PCSRSS_CONSOLE_WINDOW;
typedef struct
{
WCHAR DesktopName[1];
} CSRSS_CREATE_DESKTOP_REQUEST, *PCSRSS_CREATE_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_CREATE_DESKTOP_REPLY, *PCSRSS_CREATE_DESKTOP_REPLY;
typedef struct
{
HWND DesktopWindow;
ULONG Width;
ULONG Height;
} CSRSS_SHOW_DESKTOP_REQUEST, *PCSRSS_SHOW_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_SHOW_DESKTOP_REPLY, *PCSRSS_SHOW_DESKTOP_REPLY;
typedef struct
{
HWND DesktopWindow;
} CSRSS_HIDE_DESKTOP_REQUEST, *PCSRSS_HIDE_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_HIDE_DESKTOP_REPLY, *PCSRSS_HIDE_DESKTOP_REPLY;
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST \ #define CSRSS_MAX_WRITE_CONSOLE_REQUEST \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST)) (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
@@ -557,6 +586,9 @@ typedef struct
#define CSRSS_DUPLICATE_HANDLE (0x28) #define CSRSS_DUPLICATE_HANDLE (0x28)
#define CSRSS_SETGET_CONSOLE_HW_STATE (0x29) #define CSRSS_SETGET_CONSOLE_HW_STATE (0x29)
#define CSRSS_GET_CONSOLE_WINDOW (0x2A) #define CSRSS_GET_CONSOLE_WINDOW (0x2A)
#define CSRSS_CREATE_DESKTOP (0x2B)
#define CSRSS_SHOW_DESKTOP (0x2C)
#define CSRSS_HIDE_DESKTOP (0x2D)
/* Keep in sync with definition below. */ /* Keep in sync with definition below. */
#define CSRSS_REQUEST_HEADER_SIZE (sizeof(LPC_MESSAGE) + sizeof(ULONG)) #define CSRSS_REQUEST_HEADER_SIZE (sizeof(LPC_MESSAGE) + sizeof(ULONG))
@@ -607,6 +639,9 @@ typedef struct
CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest; CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest;
CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest; CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest;
CSRSS_CONSOLE_WINDOW ConsoleWindowRequest; CSRSS_CONSOLE_WINDOW ConsoleWindowRequest;
CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest;
CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest;
CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest;
} Data; } Data;
} CSRSS_API_REQUEST, *PCSRSS_API_REQUEST; } CSRSS_API_REQUEST, *PCSRSS_API_REQUEST;
@@ -643,6 +678,9 @@ typedef struct
CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply; CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply;
CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply; CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply;
CSRSS_CONSOLE_WINDOW ConsoleWindowReply; CSRSS_CONSOLE_WINDOW ConsoleWindowReply;
CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply;
CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply;
CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply;
} Data; } Data;
} CSRSS_API_REPLY, *PCSRSS_API_REPLY; } CSRSS_API_REPLY, *PCSRSS_API_REPLY;
+13
View File
@@ -200,5 +200,18 @@ NTSTATUS STDCALL NtWriteRequestData (HANDLE PortHandle,
ULONG BufferLength, ULONG BufferLength,
PULONG ReturnLength); PULONG ReturnLength);
NTSTATUS STDCALL ZwConnectPort(PHANDLE PortHandle,
PUNICODE_STRING PortName,
PSECURITY_QUALITY_OF_SERVICE SecurityQos,
PLPC_SECTION_WRITE SectionInfo,
PLPC_SECTION_READ MapInfo,
PULONG MaxMessageSize,
PVOID ConnectInfo,
PULONG ConnectInfoLength);
NTSTATUS STDCALL ZwRequestWaitReplyPort(HANDLE PortHandle,
PLPC_MESSAGE LpcReply,
PLPC_MESSAGE LpcRequest);
#endif /* __INCLUDE_NAPI_LPC_H */ #endif /* __INCLUDE_NAPI_LPC_H */
+1
View File
@@ -22,6 +22,7 @@ typedef struct _W32PROCESS
WORD GDIObjects; WORD GDIObjects;
WORD UserObjects; WORD UserObjects;
BOOL CreatedWindowOrDC; BOOL CreatedWindowOrDC;
BOOL ManualGuiCheck;
} W32PROCESS, *PW32PROCESS; } W32PROCESS, *PW32PROCESS;
PW32THREAD STDCALL PW32THREAD STDCALL
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: regcontrol.h,v 1.6 2003/11/08 15:39:13 mf Exp $ /* $Id: regcontrol.h,v 1.7 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32 * PROJECT: ReactOS User32
@@ -29,7 +29,7 @@ struct builtin_class_descr
HBRUSH brush; /* brush or system color */ HBRUSH brush; /* brush or system color */
}; };
extern void ControlsInit(void); extern BOOL FASTCALL ControlsInit(LPCWSTR ClassName);
extern const struct builtin_class_descr BUTTON_builtin_class; extern const struct builtin_class_descr BUTTON_builtin_class;
extern const struct builtin_class_descr COMBO_builtin_class; extern const struct builtin_class_descr COMBO_builtin_class;
-4
View File
@@ -1,10 +1,6 @@
#ifndef __WIN32K_MISC_H #ifndef __WIN32K_MISC_H
#define __WIN32K_MISC_H #define __WIN32K_MISC_H
VOID
STDCALL
NtUserGraphicsDone(VOID);
VOID VOID
FASTCALL FASTCALL
DestroyThreadWindows(struct _ETHREAD *Thread); DestroyThreadWindows(struct _ETHREAD *Thread);
+3
View File
@@ -1844,6 +1844,9 @@ typedef struct _WndProcHandle
DWORD STDCALL DWORD STDCALL
NtUserDereferenceWndProcHandle(WNDPROC wpHandle, WndProcHandle *Data); NtUserDereferenceWndProcHandle(WNDPROC wpHandle, WndProcHandle *Data);
VOID STDCALL
NtUserManualGuiCheck(LONG Check);
#endif /* __WIN32K_NTUSER_H */ #endif /* __WIN32K_NTUSER_H */
/* EOF */ /* EOF */
+60 -21
View File
@@ -1,4 +1,4 @@
/* $Id: regcontrol.c,v 1.16 2003/11/26 22:02:38 navaraf Exp $ /* $Id: regcontrol.c,v 1.17 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32 * PROJECT: ReactOS User32
@@ -9,7 +9,8 @@
* NOTES: Adapted from Wine * NOTES: Adapted from Wine
*/ */
#include "windows.h" #include <windows.h>
#include <wchar.h>
#include "user32/regcontrol.h" #include "user32/regcontrol.h"
#include "win32k/ntuser.h" #include "win32k/ntuser.h"
@@ -49,27 +50,65 @@ static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
* *
* Register the classes for the builtin controls * Register the classes for the builtin controls
*/ */
void ControlsInit(void) BOOL FASTCALL
ControlsInit(LPCWSTR ClassName)
{ {
static const struct builtin_class_descr *ClassDescriptions[] =
{
&DIALOG_builtin_class,
&POPUPMENU_builtin_class,
&COMBO_builtin_class,
&COMBOLBOX_builtin_class,
#if 0 #if 0
DbgPrint("ControlsInit()\n"); &DESKTOP_builtin_class,
#endif #endif
&MDICLIENT_builtin_class,
#if 0
&MENU_builtin_class,
&SCROLL_builtin_class,
#endif
&BUTTON_builtin_class,
&LISTBOX_builtin_class,
&EDIT_builtin_class,
&ICONTITLE_builtin_class,
&STATIC_builtin_class
};
unsigned i;
BOOL Register;
RegisterBuiltinClass(&DIALOG_builtin_class); Register = FALSE;
RegisterBuiltinClass(&POPUPMENU_builtin_class); if (IS_ATOM(ClassName))
RegisterBuiltinClass(&COMBO_builtin_class); {
RegisterBuiltinClass(&COMBOLBOX_builtin_class); for (i = 0;
#if 0 ! Register && i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]);
RegisterBuiltinClass(&DESKTOP_builtin_class); i++)
#endif {
RegisterBuiltinClass(&MDICLIENT_builtin_class); if (IS_ATOM(ClassDescriptions[i]->name))
#if 0 {
RegisterBuiltinClass(&MENU_builtin_class); Register = (ClassName == ClassDescriptions[i]->name);
RegisterBuiltinClass(&SCROLL_builtin_class); }
#endif }
RegisterBuiltinClass(&BUTTON_builtin_class); }
RegisterBuiltinClass(&LISTBOX_builtin_class); else
RegisterBuiltinClass(&EDIT_builtin_class); {
RegisterBuiltinClass(&ICONTITLE_builtin_class); for (i = 0;
RegisterBuiltinClass(&STATIC_builtin_class); ! Register && i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]);
i++)
{
if (! IS_ATOM(ClassDescriptions[i]->name))
{
Register = (0 == _wcsicmp(ClassName, ClassDescriptions[i]->name));
}
}
}
if (Register)
{
for (i = 0; i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); i++)
{
RegisterBuiltinClass(ClassDescriptions[i]);
}
}
return Register;
} }
+3 -3
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: misc.c,v 1.2 2003/12/03 21:50:49 gvg Exp $ /* $Id: misc.c,v 1.3 2003/12/07 23:02:57 gvg Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/misc.c * FILE: lib/user32/misc/misc.c
@@ -52,7 +52,7 @@ GetGuiResources(
*/ */
VOID VOID
STDCALL STDCALL
PrivateCsrssGraphicsDone(VOID) PrivateCsrssManualGuiCheck(LONG Check)
{ {
NtUserGraphicsDone(); NtUserManualGuiCheck(Check);
} }
+1 -1
View File
@@ -522,7 +522,7 @@ PostThreadMessageW@16
PrintWindow@12 PrintWindow@12
PrivateCsrssAcquireOrReleaseInputOwnership@4 PrivateCsrssAcquireOrReleaseInputOwnership@4
PrivateCsrssRegisterPrimitive@0 PrivateCsrssRegisterPrimitive@0
PrivateCsrssGraphicsDone@0 PrivateCsrssManualGuiCheck@4
PrivateExtractIconExA@20 PrivateExtractIconExA@20
PrivateExtractIconExW@20 PrivateExtractIconExW@20
PrivateExtractIconsA@32 PrivateExtractIconsA@32
+1 -1
View File
@@ -523,7 +523,7 @@ PostThreadMessageW=PostThreadMessageW@16
PrintWindow=PrintWindow@12 PrintWindow=PrintWindow@12
PrivateCsrssAcquireOrReleaseInputOwnership=PrivateCsrssAcquireOrReleaseInputOwnership@4 PrivateCsrssAcquireOrReleaseInputOwnership=PrivateCsrssAcquireOrReleaseInputOwnership@4
PrivateCsrssRegisterPrimitive=PrivateCsrssRegisterPrimitive@0 PrivateCsrssRegisterPrimitive=PrivateCsrssRegisterPrimitive@0
PrivateCsrssGraphicsDone=PrivateCsrssGraphicsDone@0 PrivateCsrssManualGuiCheck=PrivateCsrssManualGuiCheck@4
PrivateExtractIconExA=PrivateExtractIconExA@20 PrivateExtractIconExA=PrivateExtractIconExA@20
PrivateExtractIconExW=PrivateExtractIconExW@20 PrivateExtractIconExW=PrivateExtractIconExW@20
PrivateExtractIconsA=PrivateExtractIconsA@32 PrivateExtractIconsA=PrivateExtractIconsA@32
+10 -12
View File
@@ -1,4 +1,4 @@
/* $Id: window.c,v 1.84 2003/12/07 18:54:15 navaraf Exp $ /* $Id: window.c,v 1.85 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@@ -21,7 +21,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
static BOOL ControlsInitCalled = FALSE; static BOOL ControlsInitialized = FALSE;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -399,13 +399,6 @@ CreateWindowExA(DWORD dwExStyle,
DbgPrint("[window] CreateWindowExA style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent); DbgPrint("[window] CreateWindowExA style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
#endif #endif
/* Register built-in controls if not already done */
if (! ControlsInitCalled)
{
ControlsInit();
ControlsInitCalled = TRUE;
}
if (IS_ATOM(lpClassName)) if (IS_ATOM(lpClassName))
{ {
RtlInitUnicodeString(&ClassName, NULL); RtlInitUnicodeString(&ClassName, NULL);
@@ -420,6 +413,12 @@ CreateWindowExA(DWORD dwExStyle,
} }
} }
/* Register built-in controls if not already done */
if (! ControlsInitialized)
{
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName)) if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName))
{ {
if (!IS_ATOM(lpClassName)) if (!IS_ATOM(lpClassName))
@@ -543,10 +542,9 @@ CreateWindowExW(DWORD dwExStyle,
UINT sw; UINT sw;
/* Register built-in controls if not already done */ /* Register built-in controls if not already done */
if (! ControlsInitCalled) if (! ControlsInitialized)
{ {
ControlsInit(); ControlsInitialized = ControlsInit(lpClassName);
ControlsInitCalled = TRUE;
} }
if (IS_ATOM(lpClassName)) if (IS_ATOM(lpClassName))
+22
View File
@@ -0,0 +1,22 @@
/* $Id: desktopbg.h,v 1.1 2003/12/07 23:02:57 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: subsys/csrss/include/destkopbg.h
* PURPOSE: CSRSS internal desktop background window interface
*/
#ifndef DESKTOPBG_H_INCLUDED
#define DESKTOPBG_H_INCLUDED
#include "api.h"
/* Api functions */
CSR_API(CsrCreateDesktop);
CSR_API(CsrShowDesktop);
CSR_API(CsrHideDesktop);
#endif /* DESKTOPBG_H_INCLUDED */
/* EOF */
+2 -2
View File
@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 2003/12/02 11:38:46 gvg Exp $ # $Id: Makefile,v 1.2 2003/12/07 23:02:57 gvg Exp $
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
@@ -15,7 +15,7 @@ TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a
TARGET_OBJECTS = dllmain.o conio.o guiconsole.o TARGET_OBJECTS = dllmain.o conio.o guiconsole.o desktopbg.o
TARGET_ENTRY = _DllMain@12 TARGET_ENTRY = _DllMain@12
+261
View File
@@ -0,0 +1,261 @@
/* $Id: desktopbg.c,v 1.1 2003/12/07 23:02:57 gvg Exp $
*
* reactos/subsys/csrss/win32csr/desktopbg.c
*
* Desktop background window functions
*
* ReactOS Operating System
*/
#include <windows.h>
#include <csrss/csrss.h>
#include "api.h"
#include "desktopbg.h"
#define NDEBUG
#include <debug.h>
#define DESKTOP_WINDOW_ATOM 32880
#ifndef WM_APP
#define WM_APP 0x8000
#endif
#define PM_SHOW_DESKTOP (WM_APP + 1)
#define PM_HIDE_DESKTOP (WM_APP + 2)
typedef struct tagDTBG_THREAD_DATA
{
HDESK Desktop;
HANDLE Event;
NTSTATUS Status;
} DTBG_THREAD_DATA, *PDTBG_THREAD_DATA;
static BOOL Initialized = FALSE;
static LRESULT CALLBACK
DtbgWindowProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
LRESULT Result;
PAINTSTRUCT PS;
HBRUSH DesktopBrush;
switch(Msg)
{
case WM_NCCREATE:
Result = (LRESULT) TRUE;
break;
case WM_CREATE:
Result = 0;
break;
case WM_PAINT:
BeginPaint(Wnd, &PS);
DesktopBrush = CreateSolidBrush(RGB(58, 110, 165));
FillRect(PS.hdc, &(PS.rcPaint), DesktopBrush);
DeleteObject(DesktopBrush);
EndPaint(Wnd, &PS);
Result = 0;
break;
case PM_SHOW_DESKTOP:
Result = ! SetWindowPos(Wnd,
NULL, 0, 0,
(int)(short) LOWORD(lParam),
(int)(short) HIWORD(lParam),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOREDRAW);
UpdateWindow(Wnd);
break;
case PM_HIDE_DESKTOP:
Result = ! SetWindowPos(Wnd,
NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
SWP_HIDEWINDOW);
UpdateWindow(Wnd);
break;
default:
Result = 0;
break;
}
return Result;
}
static BOOL FASTCALL
DtbgInit()
{
WNDCLASSEXW Class;
HWINSTA WindowStation;
ATOM ClassAtom;
/* Attach to window station */
WindowStation = OpenWindowStationW(L"WinSta0", FALSE, GENERIC_ALL);
if (NULL == WindowStation)
{
DPRINT1("Win32Csr: failed to open window station\n");
return FALSE;
}
if (! SetProcessWindowStation(WindowStation))
{
DPRINT1("Win32Csr: failed to set process window station\n");
return FALSE;
}
/*
* Create the desktop window class
*/
Class.cbSize = sizeof(WNDCLASSEXW);
Class.style = 0;
Class.lpfnWndProc = DtbgWindowProc;
Class.cbClsExtra = 0;
Class.cbWndExtra = 0;
Class.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
Class.hIcon = NULL;
Class.hCursor = NULL;
Class.hbrBackground = NULL;
Class.lpszMenuName = NULL;
Class.lpszClassName = (LPCWSTR) DESKTOP_WINDOW_ATOM;
ClassAtom = RegisterClassExW(&Class);
if ((ATOM) 0 == ClassAtom)
{
DPRINT1("Win32Csr: Unable to register desktop background class (error %d)\n",
GetLastError());
return FALSE;
}
return TRUE;
}
static DWORD STDCALL
DtbgDesktopThread(PVOID Data)
{
HWND BackgroundWnd;
MSG msg;
PDTBG_THREAD_DATA ThreadData = (PDTBG_THREAD_DATA) Data;
if (! SetThreadDesktop(ThreadData->Desktop))
{
DPRINT1("Win32Csr: failed to set thread desktop\n");
ThreadData->Status = STATUS_UNSUCCESSFUL;
SetEvent(ThreadData->Event);
return 1;
}
BackgroundWnd = CreateWindowW((LPCWSTR) DESKTOP_WINDOW_ATOM,
L"",
WS_POPUP,
0,
0,
0,
0,
NULL,
NULL,
(HINSTANCE) GetModuleHandleW(NULL),
NULL);
if (NULL == BackgroundWnd)
{
DPRINT1("Win32Csr: failed to create desktop background window\n");
ThreadData->Status = STATUS_UNSUCCESSFUL;
SetEvent(ThreadData->Event);
return 1;
}
ThreadData->Status = STATUS_SUCCESS;
SetEvent(ThreadData->Event);
while (GetMessageW(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
return 1;
}
CSR_API(CsrCreateDesktop)
{
HDESK Desktop;
DTBG_THREAD_DATA ThreadData;
HANDLE ThreadHandle;
DPRINT("CsrCreateDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - sizeof(LPC_MESSAGE);
if (! Initialized)
{
Initialized = TRUE;
if (! DtbgInit())
{
return Reply->Status = STATUS_UNSUCCESSFUL;
}
}
Desktop = OpenDesktopW(Request->Data.CreateDesktopRequest.DesktopName,
0, FALSE, GENERIC_ALL);
if (NULL == Desktop)
{
DPRINT1("Win32Csr: failed to open desktop %S\n",
Request->Data.CreateDesktopRequest.DesktopName);
return Reply->Status = STATUS_UNSUCCESSFUL;
}
ThreadData.Desktop = Desktop;
ThreadData.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
if (NULL == ThreadData.Event)
{
DPRINT1("Win32Csr: Failed to create event (error %d)\n", GetLastError());
return Reply->Status = STATUS_UNSUCCESSFUL;
}
ThreadHandle = CreateThread(NULL,
0,
DtbgDesktopThread,
(PVOID) &ThreadData,
0,
NULL);
if (NULL == ThreadHandle)
{
CloseHandle(ThreadData.Event);
DPRINT1("Win32Csr: Failed to create desktop window thread.\n");
return Reply->Status = STATUS_UNSUCCESSFUL;
}
CloseHandle(ThreadHandle);
WaitForSingleObject(ThreadData.Event, INFINITE);
CloseHandle(ThreadData.Event);
Reply->Status = ThreadData.Status;
return Reply->Status;
}
CSR_API(CsrShowDesktop)
{
DPRINT("CsrShowDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - sizeof(LPC_MESSAGE);
Reply->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
PM_SHOW_DESKTOP,
0,
MAKELONG(Request->Data.ShowDesktopRequest.Width,
Request->Data.ShowDesktopRequest.Height))
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
}
CSR_API(CsrHideDesktop)
{
DPRINT("CsrHideDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - sizeof(LPC_MESSAGE);
Reply->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
PM_HIDE_DESKTOP, 0, 0)
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
}
/* EOF */
+9 -1
View File
@@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.1 2003/12/02 11:38:46 gvg Exp $ /* $Id: dllmain.c,v 1.2 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@@ -11,11 +11,15 @@
#include <windows.h> #include <windows.h>
#include "csrplugin.h" #include "csrplugin.h"
#include "conio.h" #include "conio.h"
#include "desktopbg.h"
#include "guiconsole.h" #include "guiconsole.h"
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* Not defined in any header file */
extern VOID STDCALL PrivateCsrssManualGuiCheck(LONG Check);
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
HANDLE Win32CsrApiHeap; HANDLE Win32CsrApiHeap;
@@ -53,6 +57,9 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput), CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput), CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
CSRSS_DEFINE_API(CSRSS_SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty), CSRSS_DEFINE_API(CSRSS_SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
CSRSS_DEFINE_API(CSRSS_CREATE_DESKTOP, CsrCreateDesktop),
CSRSS_DEFINE_API(CSRSS_SHOW_DESKTOP, CsrShowDesktop),
CSRSS_DEFINE_API(CSRSS_HIDE_DESKTOP, CsrHideDesktop),
{ 0, 0, 0, NULL } { 0, 0, 0, NULL }
}; };
@@ -108,6 +115,7 @@ Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions,
CsrExports = *Exports; CsrExports = *Exports;
Win32CsrApiHeap = CsrssApiHeap; Win32CsrApiHeap = CsrssApiHeap;
PrivateCsrssManualGuiCheck(0);
CsrInitConsoleSupport(); CsrInitConsoleSupport();
ThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Console_Api, NULL, 0, NULL); ThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Console_Api, NULL, 0, NULL);
if (NULL == ThreadHandle) if (NULL == ThreadHandle)
+8 -15
View File
@@ -1,4 +1,4 @@
/* $Id: guiconsole.c,v 1.2 2003/12/03 21:50:49 gvg Exp $ /* $Id: guiconsole.c,v 1.3 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@@ -14,7 +14,7 @@
#include "win32csr.h" #include "win32csr.h"
/* Not defined in any header file */ /* Not defined in any header file */
extern VOID STDCALL PrivateCsrssGraphicsDone(VOID); extern VOID STDCALL PrivateCsrssManualGuiCheck(LONG Check);
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
@@ -498,7 +498,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
NotifyWnd = NULL; NotifyWnd = NULL;
DestroyWindow(hWnd); DestroyWindow(hWnd);
PrivateCsrssGraphicsDone(); PrivateCsrssManualGuiCheck(-1);
} }
return 0; return 0;
default: default:
@@ -513,6 +513,8 @@ GuiConsoleGuiThread(PVOID Data)
MSG msg; MSG msg;
PHANDLE GraphicsStartupEvent = (PHANDLE) Data; PHANDLE GraphicsStartupEvent = (PHANDLE) Data;
PrivateCsrssManualGuiCheck(+1);
wc.lpszClassName = L"Win32CsrCreateNotify"; wc.lpszClassName = L"Win32CsrCreateNotify";
wc.lpfnWndProc = GuiConsoleNotifyWndProc; wc.lpfnWndProc = GuiConsoleNotifyWndProc;
wc.style = 0; wc.style = 0;
@@ -525,6 +527,7 @@ GuiConsoleGuiThread(PVOID Data)
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0) if (RegisterClassW(&wc) == 0)
{ {
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0); NtSetEvent(*GraphicsStartupEvent, 0);
return 1; return 1;
} }
@@ -541,6 +544,7 @@ GuiConsoleGuiThread(PVOID Data)
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0) if (RegisterClassW(&wc) == 0)
{ {
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0); NtSetEvent(*GraphicsStartupEvent, 0);
return 1; return 1;
} }
@@ -558,6 +562,7 @@ GuiConsoleGuiThread(PVOID Data)
NULL); NULL);
if (NULL == NotifyWnd) if (NULL == NotifyWnd)
{ {
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0); NtSetEvent(*GraphicsStartupEvent, 0);
return 1; return 1;
} }
@@ -579,21 +584,9 @@ GuiConsoleInitConsoleSupport(VOID)
NTSTATUS Status; NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE GraphicsStartupEvent; HANDLE GraphicsStartupEvent;
HWINSTA WindowStation;
HDESK Desktop; HDESK Desktop;
HANDLE ThreadHandle; HANDLE ThreadHandle;
WindowStation = OpenWindowStationW(L"WinSta0", FALSE, GENERIC_ALL);
if (NULL == WindowStation)
{
DbgPrint("Win32Csr: failed to open window station\n");
return;
}
if (! SetProcessWindowStation(WindowStation))
{
DbgPrint("Win32Csr: failed to set process window station\n");
return;
}
Desktop = OpenDesktopW(L"Default", 0, FALSE, GENERIC_ALL); Desktop = OpenDesktopW(L"Default", 0, FALSE, GENERIC_ALL);
if (NULL == Desktop) if (NULL == Desktop)
{ {
+6
View File
@@ -34,6 +34,12 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
PDESKTOP_OBJECT FASTCALL PDESKTOP_OBJECT FASTCALL
IntGetActiveDesktop(VOID); IntGetActiveDesktop(VOID);
NTSTATUS FASTCALL
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop);
#endif /* _WIN32K_DESKTOP_H */ #endif /* _WIN32K_DESKTOP_H */
/* EOF */ /* EOF */
-5
View File
@@ -118,11 +118,6 @@ IntGetWindowObject (HWND hWnd);
VOID FASTCALL VOID FASTCALL
IntReleaseWindowObject (PWINDOW_OBJECT Window); IntReleaseWindowObject (PWINDOW_OBJECT Window);
HWND STDCALL
IntCreateDesktopWindow (PWINSTATION_OBJECT WindowStation,
PWNDCLASS_OBJECT DesktopClass,
ULONG Width, ULONG Height);
HWND FASTCALL HWND FASTCALL
IntGetActiveWindow (VOID); IntGetActiveWindow (VOID);
+2 -1
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.58 2003/12/07 19:29:33 weiden Exp $ /* $Id: dllmain.c,v 1.59 2003/12/07 23:02:57 gvg Exp $
* *
* Entry Point for win32k.sys * Entry Point for win32k.sys
*/ */
@@ -92,6 +92,7 @@ Win32kProcessCallback (struct _EPROCESS *Process,
} }
Win32Process->CreatedWindowOrDC = FALSE; Win32Process->CreatedWindowOrDC = FALSE;
Win32Process->ManualGuiCheck = FALSE;
} }
else else
{ {
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: makefile,v 1.87 2003/12/07 19:29:33 weiden Exp $ # $Id: makefile,v 1.88 2003/12/07 23:02:57 gvg Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@@ -30,6 +30,7 @@ TARGET_CFLAGS =\
-Wall -Werror -Wall -Werror
# require os code to explicitly request A/W version of structs/functions # require os code to explicitly request A/W version of structs/functions
#TARGET_CFLAGS += -D_DISABLE_TIDENTS -D__USE_W32API
TARGET_CFLAGS += -D_DISABLE_TIDENTS TARGET_CFLAGS += -D_DISABLE_TIDENTS
TARGET_LFLAGS =\ TARGET_LFLAGS =\
+4 -11
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: callback.c,v 1.17 2003/12/07 19:29:33 weiden Exp $ /* $Id: callback.c,v 1.18 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -176,14 +176,6 @@ IntCallWindowProc(WNDPROC Proc,
NTSTATUS Status; NTSTATUS Status;
PVOID ResultPointer; PVOID ResultPointer;
ULONG ResultLength; ULONG ResultLength;
PWINDOW_OBJECT WindowObject = IntGetWindowObject(Wnd);
if (IntIsDesktopWindow(WindowObject))
{
IntReleaseWindowObject(WindowObject);
return(IntDesktopWindowProc(Wnd, Message, wParam, lParam));
}
IntReleaseWindowObject(WindowObject);
Arguments.Proc = Proc; Arguments.Proc = Proc;
Arguments.Wnd = Wnd; Arguments.Wnd = Wnd;
@@ -199,9 +191,10 @@ IntCallWindowProc(WNDPROC Proc,
&ResultLength); &ResultLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(0xFFFFFFFF); return -1;
} }
return(Result);
return Result;
} }
LRESULT STDCALL LRESULT STDCALL
+186 -132
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: desktop.c,v 1.1 2003/12/07 19:29:33 weiden Exp $ * $Id: desktop.c,v 1.2 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -33,6 +33,7 @@
#define NTOS_MODE_KERNEL #define NTOS_MODE_KERNEL
#include <ntos.h> #include <ntos.h>
#include <ddk/ntddmou.h> #include <ddk/ntddmou.h>
#include <csrss/csrss.h>
#include <win32k/win32k.h> #include <win32k/win32k.h>
#include <include/winsta.h> #include <include/winsta.h>
#include <include/desktop.h> #include <include/desktop.h>
@@ -54,7 +55,6 @@
/* Currently active desktop */ /* Currently active desktop */
PDESKTOP_OBJECT InputDesktop = NULL; PDESKTOP_OBJECT InputDesktop = NULL;
HDESK InputDesktopHandle = NULL; HDESK InputDesktopHandle = NULL;
PWNDCLASS_OBJECT DesktopWindowClass;
HDC ScreenDeviceContext = NULL; HDC ScreenDeviceContext = NULL;
/* INITALIZATION FUNCTIONS ****************************************************/ /* INITALIZATION FUNCTIONS ****************************************************/
@@ -62,53 +62,17 @@ HDC ScreenDeviceContext = NULL;
NTSTATUS FASTCALL NTSTATUS FASTCALL
InitDesktopImpl(VOID) InitDesktopImpl(VOID)
{ {
WNDCLASSEXW wcx; return STATUS_SUCCESS;
/*
* 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 NTSTATUS FASTCALL
CleanupDesktopImpl(VOID) CleanupDesktopImpl(VOID)
{ {
/* FIXME: Unregister the desktop window class */ return STATUS_SUCCESS;
return STATUS_SUCCESS;
} }
/* PRIVATE FUNCTIONS **********************************************************/ /* 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 * IntValidateDesktopHandle
* *
@@ -174,7 +138,88 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
/* PUBLIC FUNCTIONS ***********************************************************/ /* PUBLIC FUNCTIONS ***********************************************************/
static NTSTATUS FASTCALL
NotifyCsrss(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
{
NTSTATUS Status;
UNICODE_STRING PortName;
ULONG ConnectInfoLength;
static HANDLE WindowsApiPort = NULL;
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
ConnectInfoLength = 0;
Status = ZwConnectPort(&WindowsApiPort,
&PortName,
NULL,
NULL,
NULL,
NULL,
NULL,
&ConnectInfoLength);
if (! NT_SUCCESS(Status))
{
return Status;
}
Request->Header.DataSize = sizeof(CSRSS_API_REQUEST) - sizeof(LPC_MESSAGE);
Request->Header.MessageSize = sizeof(CSRSS_API_REQUEST);
Status = ZwRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
&Reply->Header);
if (! NT_SUCCESS(Status) || ! NT_SUCCESS(Status = Reply->Status))
{
ZwClose(WindowsApiPort);
return Status;
}
// ZwClose(WindowsApiPort);
return STATUS_SUCCESS;
}
NTSTATUS FASTCALL
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
Request.Type = CSRSS_SHOW_DESKTOP;
Request.Data.ShowDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
Request.Data.ShowDesktopRequest.Width = Width;
Request.Data.ShowDesktopRequest.Height = Height;
return NotifyCsrss(&Request, &Reply);
}
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop)
{
#if 0
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
Request.Type = CSRSS_HIDE_DESKTOP;
Request.Data.HideDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
return NotifyCsrss(&Request, &Reply);
#else
PWINDOW_OBJECT DesktopWindow;
DesktopWindow = IntGetWindowObject(Desktop->DesktopWindow);
if (! DesktopWindow)
{
return ERROR_INVALID_WINDOW_HANDLE;
}
DesktopWindow->Style &= ~WS_VISIBLE;
return STATUS_SUCCESS;
#endif
}
/* /*
<<<<<<< winsta.c
* NtUserCreateDesktop * NtUserCreateDesktop
* *
* Creates a new desktop. * Creates a new desktop.
@@ -214,125 +259,134 @@ NtUserCreateDesktop(
LPSECURITY_ATTRIBUTES lpSecurity, LPSECURITY_ATTRIBUTES lpSecurity,
HWINSTA hWindowStation) HWINSTA hWindowStation)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
PDESKTOP_OBJECT DesktopObject; PDESKTOP_OBJECT DesktopObject;
UNICODE_STRING DesktopName; UNICODE_STRING DesktopName;
NTSTATUS Status; NTSTATUS Status;
HDESK Desktop; HDESK Desktop;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
Status = IntValidateWindowStationHandle( Status = IntValidateWindowStationHandle(
hWindowStation, hWindowStation,
KernelMode, KernelMode,
0, 0,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
DPRINT("Failed validation of window station handle (0x%X)\n", DPRINT1("Failed validation of window station handle (0x%X)\n",
hWindowStation); hWindowStation);
SetLastNtError(Status); SetLastNtError(Status);
return 0; return NULL;
} }
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name, if (! IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
lpszDesktopName)) lpszDesktopName))
{ {
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
ObDereferenceObject(WinStaObject); ObDereferenceObject(WinStaObject);
return 0; return NULL;
} }
ObDereferenceObject(WinStaObject); ObDereferenceObject(WinStaObject);
/* /*
* Try to open already existing desktop * Try to open already existing desktop
*/ */
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName); DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
/* Initialize ObjectAttributes for the desktop object */ /* Initialize ObjectAttributes for the desktop object */
InitializeObjectAttributes( InitializeObjectAttributes(
&ObjectAttributes, &ObjectAttributes,
&DesktopName, &DesktopName,
0, 0,
NULL, NULL,
NULL); NULL);
Status = ObOpenObjectByName( Status = ObOpenObjectByName(
&ObjectAttributes, &ObjectAttributes,
ExDesktopObjectType, ExDesktopObjectType,
NULL, NULL,
UserMode, UserMode,
dwDesiredAccess, dwDesiredAccess,
NULL, NULL,
&Desktop); &Desktop);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName); DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
ExFreePool(DesktopName.Buffer); ExFreePool(DesktopName.Buffer);
return Desktop; return Desktop;
} }
/* /*
* No existing desktop found, try to create new one * No existing desktop found, try to create new one
*/ */
Status = ObCreateObject( Status = ObCreateObject(
ExGetPreviousMode(), ExGetPreviousMode(),
ExDesktopObjectType, ExDesktopObjectType,
&ObjectAttributes, &ObjectAttributes,
ExGetPreviousMode(), ExGetPreviousMode(),
NULL, NULL,
sizeof(DESKTOP_OBJECT), sizeof(DESKTOP_OBJECT),
0, 0,
0, 0,
(PVOID*)&DesktopObject); (PVOID*)&DesktopObject);
if (!NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
DPRINT("Failed creating desktop (%wZ)\n", &DesktopName); DPRINT1("Failed creating desktop (%wZ)\n", &DesktopName);
ExFreePool(DesktopName.Buffer); ExFreePool(DesktopName.Buffer);
SetLastNtError(STATUS_UNSUCCESSFUL); SetLastNtError(STATUS_UNSUCCESSFUL);
return((HDESK)0); return NULL;
} }
/* FIXME: Set correct dimensions. */ /* FIXME: Set correct dimensions. */
DesktopObject->WorkArea.left = 0; DesktopObject->WorkArea.left = 0;
DesktopObject->WorkArea.top = 0; DesktopObject->WorkArea.top = 0;
DesktopObject->WorkArea.right = 640; DesktopObject->WorkArea.right = 640;
DesktopObject->WorkArea.bottom = 480; DesktopObject->WorkArea.bottom = 480;
/* Initialize some local (to win32k) desktop state. */ /* Initialize some local (to win32k) desktop state. */
DesktopObject->ActiveMessageQueue = NULL; 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);
Status = ObInsertObject( ObDereferenceObject(DesktopObject);
(PVOID)DesktopObject, ExFreePool(DesktopName.Buffer);
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
&Desktop);
ObDereferenceObject(DesktopObject); if (! NT_SUCCESS(Status))
ExFreePool(DesktopName.Buffer); {
DPRINT1("Failed to create desktop handle\n");
SetLastNtError(Status);
return NULL;
}
if (!NT_SUCCESS(Status)) Request.Type = CSRSS_CREATE_DESKTOP;
{ memcpy(Request.Data.CreateDesktopRequest.DesktopName, lpszDesktopName->Buffer,
DPRINT("Failed to create desktop handle\n"); lpszDesktopName->Length);
SetLastNtError(STATUS_UNSUCCESSFUL); Request.Data.CreateDesktopRequest.DesktopName[lpszDesktopName->Length / sizeof(WCHAR)] = L'\0';
return 0;
}
return Desktop; Status = NotifyCsrss(&Request, &Reply);
if (! NT_SUCCESS(Status))
{
DPRINT1("Failed to notify CSRSS about new desktop\n");
ZwClose(Desktop);
SetLastNtError(Status);
return NULL;
}
return Desktop;
} }
/* /*
+58 -24
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: guicheck.c,v 1.16 2003/12/03 21:50:50 gvg Exp $ /* $Id: guicheck.c,v 1.17 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -51,6 +51,37 @@ static ULONG NrGuiApplicationsRunning = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static BOOL FASTCALL
AddGuiApp(PW32PROCESS W32Data)
{
W32Data->CreatedWindowOrDC = TRUE;
if (0 == NrGuiApplicationsRunning++)
{
if (! IntInitializeDesktopGraphics())
{
W32Data->CreatedWindowOrDC = FALSE;
NrGuiApplicationsRunning--;
return FALSE;
}
}
return TRUE;
}
static void FASTCALL
RemoveGuiApp(PW32PROCESS W32Data)
{
W32Data->CreatedWindowOrDC = FALSE;
if (0 < NrGuiApplicationsRunning)
{
NrGuiApplicationsRunning--;
}
if (0 == NrGuiApplicationsRunning)
{
IntEndDesktopGraphics();
}
}
BOOL FASTCALL BOOL FASTCALL
IntGraphicsCheck(BOOL Create) IntGraphicsCheck(BOOL Create)
{ {
@@ -59,33 +90,16 @@ IntGraphicsCheck(BOOL Create)
W32Data = PsGetWin32Process(); W32Data = PsGetWin32Process();
if (Create) if (Create)
{ {
if (! W32Data->CreatedWindowOrDC) if (! W32Data->CreatedWindowOrDC && ! W32Data->ManualGuiCheck)
{ {
W32Data->CreatedWindowOrDC = TRUE; return AddGuiApp(W32Data);
if (0 == NrGuiApplicationsRunning++)
{
if (! IntInitializeDesktopGraphics())
{
W32Data->CreatedWindowOrDC = FALSE;
NrGuiApplicationsRunning--;
return FALSE;
}
}
} }
} }
else else
{ {
if (W32Data->CreatedWindowOrDC) if (W32Data->CreatedWindowOrDC && ! W32Data->ManualGuiCheck)
{ {
W32Data->CreatedWindowOrDC = FALSE; RemoveGuiApp(W32Data);
if (0 < NrGuiApplicationsRunning)
{
NrGuiApplicationsRunning--;
}
if (0 == NrGuiApplicationsRunning)
{
IntEndDesktopGraphics();
}
} }
} }
@@ -93,9 +107,29 @@ IntGraphicsCheck(BOOL Create)
} }
VOID STDCALL VOID STDCALL
NtUserGraphicsDone() NtUserManualGuiCheck(LONG Check)
{ {
IntGraphicsCheck(FALSE); PW32PROCESS W32Data;
W32Data = PsGetWin32Process();
if (0 == Check)
{
W32Data->ManualGuiCheck = TRUE;
}
else if (0 < Check)
{
if (! W32Data->CreatedWindowOrDC)
{
AddGuiApp(W32Data);
}
}
else
{
if (W32Data->CreatedWindowOrDC)
{
RemoveGuiApp(W32Data);
}
}
} }
/* EOF */ /* EOF */
+77 -134
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: painting.c,v 1.42 2003/12/07 13:14:22 weiden Exp $ * $Id: painting.c,v 1.43 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -50,14 +50,6 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS ********************************************************************/
/*
* Define this after the desktop will be moved to CSRSS and will
* get proper message queue.
*/
/* #define DESKTOP_IN_CSRSS */
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
VOID FASTCALL VOID FASTCALL
@@ -151,129 +143,88 @@ IntGetNCUpdateRegion(PWINDOW_OBJECT Window, BOOL Remove)
VOID FASTCALL VOID FASTCALL
IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags) IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
{ {
HDC hDC; HDC hDC;
HWND hWnd = Window->Self; HWND hWnd = Window->Self;
if (!(Window->Style & WS_VISIBLE)) if (! (Window->Style & WS_VISIBLE))
{ {
return; return;
} }
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW)) if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
{ {
if (IntIsDesktopWindow(Window)) if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{ {
/* NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window, TRUE), 0);
* Repainting of desktop window }
*/
#ifndef DESKTOP_IN_CSRSS if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
VIS_RepaintDesktop(hWnd, Window->UpdateRegion); {
Window->Flags &= ~(WINDOWOBJECT_NEED_NCPAINT | if (Window->UpdateRegion)
WINDOWOBJECT_NEED_INTERNALPAINT | WINDOWOBJECT_NEED_ERASEBKGND);
NtGdiDeleteObject(Window->UpdateRegion);
Window->UpdateRegion = NULL;
#else
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
MsqDecPaintCountQueue(Window->MessageQueue);
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
}
if (Window->UpdateRegion ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
MsqDecPaintCountQueue(Window->MessageQueue);
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
}
if (Window->UpdateRegion)
{
hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
DCX_INTERSECTUPDATE);
if (hDC != NULL)
{ {
NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0); hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
NtUserReleaseDC(hWnd, hDC); DCX_INTERSECTUPDATE);
NtGdiDeleteObject(Window->UpdateRegion); if (hDC != NULL)
Window->UpdateRegion = NULL; {
}
}
#endif
}
else
{
/*
* Repainting of non-desktop window
*/
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window, TRUE), 0);
}
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
{
if (Window->UpdateRegion)
{
hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
DCX_INTERSECTUPDATE);
if (hDC != NULL)
{
if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0)) if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND; {
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
}
NtUserReleaseDC(hWnd, hDC); NtUserReleaseDC(hWnd, hDC);
} }
} }
} }
if (Flags & RDW_UPDATENOW) if (Flags & RDW_UPDATENOW)
{ {
if (Window->UpdateRegion != NULL || if (Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{ {
NtUserSendMessage(hWnd, WM_PAINT, 0, 0); NtUserSendMessage(hWnd, WM_PAINT, 0, 0);
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{ {
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
if (Window->UpdateRegion == NULL) if (Window->UpdateRegion == NULL)
{ {
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
} }
} }
} }
} }
} }
}
/* /*
* Check that the window is still valid at this point * Check that the window is still valid at this point
*/ */
if (!IntIsWindow(hWnd)) if (! IntIsWindow(hWnd))
{
return; return;
}
/* /*
* Paint child windows. * Paint child windows.
*/ */
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) && ((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)) &&
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN))) ! IntIsDesktopWindow(Window))
{ {
HWND *List, *phWnd; HWND *List, *phWnd;
if ((List = IntWinListChildren(Window))) if ((List = IntWinListChildren(Window)))
{ {
for (phWnd = List; *phWnd; ++phWnd) for (phWnd = List; *phWnd; ++phWnd)
{
Window = IntGetWindowObject(*phWnd);
if (Window)
{ {
IntPaintWindows(Window, Flags); Window = IntGetWindowObject(*phWnd);
IntReleaseWindowObject(Window); if (Window)
{
IntPaintWindows(Window, Flags);
IntReleaseWindowObject(Window);
}
} }
} ExFreePool(List);
ExFreePool(List); }
} }
}
} }
/* /*
@@ -442,33 +393,25 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags,
/* /*
* Fake post paint messages to window message queue if needed * Fake post paint messages to window message queue if needed
*/ */
HasPaintMessage = Window->UpdateRegion != NULL ||
#ifndef DESKTOP_IN_CSRSS
if (Window->MessageQueue)
#endif
{
HasPaintMessage = Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT; HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
if (HasPaintMessage != HadPaintMessage) if (HasPaintMessage != HadPaintMessage)
{ {
if (HadPaintMessage) if (HadPaintMessage)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
else else
MsqIncPaintCountQueue(Window->MessageQueue); MsqIncPaintCountQueue(Window->MessageQueue);
} }
if (HasNCPaintMessage != HadNCPaintMessage) if (HasNCPaintMessage != HadNCPaintMessage)
{ {
if (HadNCPaintMessage) if (HadNCPaintMessage)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
else else
MsqIncPaintCountQueue(Window->MessageQueue); MsqIncPaintCountQueue(Window->MessageQueue);
}
#ifndef DESKTOP_IN_CSRSS
} }
#endif
} }
/* /*
+4 -10
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: vis.c,v 1.12 2003/11/21 21:12:08 navaraf Exp $ * $Id: vis.c,v 1.13 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -214,14 +214,7 @@ VIS_ComputeVisibleRegion(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
VOID FASTCALL VOID FASTCALL
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn) VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn)
{ {
HDC dc = NtUserGetDC(Desktop); NtUserRedrawWindow(Desktop, NULL, RepaintRgn, RDW_UPDATENOW | RDW_INVALIDATE | RDW_NOCHILDREN);
if (dc)
{
HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165));
NtGdiFillRgn(dc, RepaintRgn, DesktopBrush);
NtGdiDeleteObject(DesktopBrush);
}
NtUserReleaseDC(Desktop, dc);
} }
static VOID FASTCALL static VOID FASTCALL
@@ -349,7 +342,8 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
NtGdiCombineRgn(Repaint, NewlyExposed, NULL, RGN_COPY); NtGdiCombineRgn(Repaint, NewlyExposed, NULL, RGN_COPY);
NtGdiOffsetRgn(Repaint, Window->WindowRect.left, Window->WindowRect.top); NtGdiOffsetRgn(Repaint, Window->WindowRect.left, Window->WindowRect.top);
NtGdiCombineRgn(Repaint, Repaint, Uncovered, RGN_AND); NtGdiCombineRgn(Repaint, Repaint, Uncovered, RGN_AND);
VIS_RepaintDesktop(DesktopWindow->Self, Repaint); NtUserRedrawWindow(DesktopWindow->Self, NULL, Repaint,
RDW_UPDATENOW | RDW_INVALIDATE | RDW_NOCHILDREN);
NtGdiDeleteObject(Repaint); NtGdiDeleteObject(Repaint);
} }
+82 -121
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.153 2003/12/07 22:25:34 weiden Exp $ /* $Id: window.c,v 1.154 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -550,71 +550,6 @@ IntGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid)
return (DWORD) Wnd->OwnerThread->Cid.UniqueThread; return (DWORD) Wnd->OwnerThread->Cid.UniqueThread;
} }
HWND STDCALL
IntCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
PWNDCLASS_OBJECT DesktopClass,
ULONG Width, ULONG Height)
{
PWSTR WindowName;
HWND Handle;
PWINDOW_OBJECT WindowObject;
if(!DesktopClass)
{
return (HWND)0;
}
/* 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.
*/
ObmReferenceObject(DesktopClass);
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)
{ {
@@ -1104,16 +1039,9 @@ NtUserCreateWindowEx(DWORD dwExStyle,
DPRINT("NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight); DPRINT("NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight);
/* Initialize gui state if necessary. */ if (! RtlCreateUnicodeString(&WindowName,
if (! IntGraphicsCheck(TRUE)) NULL == lpWindowName->Buffer ?
{ L"" : lpWindowName->Buffer))
DPRINT1("Unable to initialize graphics, returning NULL window\n");
return NULL;
}
if (!RtlCreateUnicodeString(&WindowName,
NULL == lpWindowName->Buffer ?
L"" : lpWindowName->Buffer))
{ {
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return((HWND)0); return((HWND)0);
@@ -1139,10 +1067,18 @@ NtUserCreateWindowEx(DWORD dwExStyle,
} }
else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD) else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
{ {
RtlFreeUnicodeString(&WindowName);
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */ return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
} }
ParentWindow = IntGetWindowObject(ParentWindowHandle); if (NULL != ParentWindowHandle)
{
ParentWindow = IntGetWindowObject(ParentWindowHandle);
}
else
{
ParentWindow = NULL;
}
/* FIXME: parent must belong to the current process */ /* FIXME: parent must belong to the current process */
@@ -1151,7 +1087,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&WindowName); RtlFreeUnicodeString(&WindowName);
IntReleaseWindowObject(ParentWindow); if (NULL != ParentWindow)
{
IntReleaseWindowObject(ParentWindow);
}
return((HWND)0); return((HWND)0);
} }
@@ -1164,9 +1103,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
&WinStaObject); &WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&WindowName);
ObmDereferenceObject(ClassObject); ObmDereferenceObject(ClassObject);
IntReleaseWindowObject(ParentWindow); RtlFreeUnicodeString(&WindowName);
if (NULL != ParentWindow)
{
IntReleaseWindowObject(ParentWindow);
}
DPRINT("Validation of window station handle (0x%X) failed\n", DPRINT("Validation of window station handle (0x%X) failed\n",
PROCESS_WINDOW_STATION()); PROCESS_WINDOW_STATION());
return (HWND)0; return (HWND)0;
@@ -1184,12 +1126,21 @@ NtUserCreateWindowEx(DWORD dwExStyle,
ObDereferenceObject(WinStaObject); ObDereferenceObject(WinStaObject);
ObmDereferenceObject(ClassObject); ObmDereferenceObject(ClassObject);
RtlFreeUnicodeString(&WindowName); RtlFreeUnicodeString(&WindowName);
IntReleaseWindowObject(ParentWindow); if (NULL != ParentWindow)
{
IntReleaseWindowObject(ParentWindow);
}
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return (HWND)0; return (HWND)0;
} }
ObDereferenceObject(WinStaObject); ObDereferenceObject(WinStaObject);
if (NULL == PsGetWin32Thread()->Desktop->DesktopWindow)
{
/* If there is no desktop window yet, we must be creating it */
PsGetWin32Thread()->Desktop->DesktopWindow = Handle;
}
/* /*
* Fill out the structure describing it. * Fill out the structure describing it.
*/ */
@@ -1215,12 +1166,15 @@ NtUserCreateWindowEx(DWORD dwExStyle,
WindowObject->Parent = ParentWindow; WindowObject->Parent = ParentWindow;
WindowObject->Owner = IntGetWindowObject(OwnerWindowHandle); WindowObject->Owner = IntGetWindowObject(OwnerWindowHandle);
WindowObject->UserData = 0; WindowObject->UserData = 0;
if ((((DWORD)ClassObject->lpfnWndProcA & 0xFFFF0000) != 0xFFFF0000) && (((DWORD)ClassObject->lpfnWndProcW & 0xFFFF0000) != 0xFFFF0000)) if ((((DWORD)ClassObject->lpfnWndProcA & 0xFFFF0000) != 0xFFFF0000)
{ && (((DWORD)ClassObject->lpfnWndProcW & 0xFFFF0000) != 0xFFFF0000))
WindowObject->Unicode = ClassObject->Unicode; {
} else { WindowObject->Unicode = ClassObject->Unicode;
WindowObject->Unicode = bUnicodeWindow; }
} else
{
WindowObject->Unicode = bUnicodeWindow;
}
WindowObject->WndProcA = ClassObject->lpfnWndProcA; WindowObject->WndProcA = ClassObject->lpfnWndProcA;
WindowObject->WndProcW = ClassObject->lpfnWndProcW; WindowObject->WndProcW = ClassObject->lpfnWndProcW;
WindowObject->OwnerThread = PsGetCurrentThread(); WindowObject->OwnerThread = PsGetCurrentThread();
@@ -1247,12 +1201,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
ExInitializeFastMutex(&WindowObject->ChildrenListLock); ExInitializeFastMutex(&WindowObject->ChildrenListLock);
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer); RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
/*
This is incorrect!!! -- Filip
RtlFreeUnicodeString(&WindowName);
*/
/* Correct the window style. */ /* Correct the window style. */
if (!(dwStyle & WS_CHILD)) if (!(dwStyle & WS_CHILD))
@@ -1262,8 +1210,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if (!(dwStyle & WS_POPUP)) if (!(dwStyle & WS_POPUP))
{ {
WindowObject->Style |= WS_CAPTION; WindowObject->Style |= WS_CAPTION;
WindowObject->Flags |= WINDOWOBJECT_NEED_SIZE; WindowObject->Flags |= WINDOWOBJECT_NEED_SIZE;
DPRINT("4: Style is now %d\n", WindowObject->Style); DPRINT("4: Style is now %d\n", WindowObject->Style);
/* FIXME: Note the window needs a size. */ /* FIXME: Note the window needs a size. */
} }
} }
@@ -1275,7 +1223,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock); ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
/* Allocate a DCE for this window. */ /* Allocate a DCE for this window. */
if (dwStyle & CS_OWNDC) WindowObject->Dce = DceAllocDCE(WindowObject->Self,DCE_WINDOW_DC); if (dwStyle & CS_OWNDC)
{
WindowObject->Dce = DceAllocDCE(WindowObject->Self, DCE_WINDOW_DC);
}
/* FIXME: Handle "CS_CLASSDC" */ /* FIXME: Handle "CS_CLASSDC" */
/* Initialize the window dimensions. */ /* Initialize the window dimensions. */
@@ -1353,7 +1304,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if (!Result) if (!Result)
{ {
/* FIXME: Cleanup. */ /* FIXME: Cleanup. */
IntReleaseWindowObject(ParentWindow); if (NULL != ParentWindow)
{
IntReleaseWindowObject(ParentWindow);
}
DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n"); DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n");
return((HWND)0); return((HWND)0);
} }
@@ -1371,19 +1325,22 @@ NtUserCreateWindowEx(DWORD dwExStyle,
MaxPos.y - WindowObject->WindowRect.top); MaxPos.y - WindowObject->WindowRect.top);
/* link the window into the parent's child list */ if (NULL != ParentWindow)
ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock); {
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) /* link the window into the parent's child list */
{ ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
/* link window as bottom sibling */ if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
IntLinkWindow(WindowObject, ParentWindow, ParentWindow->LastChild /*prev sibling*/); {
} /* link window as bottom sibling */
else IntLinkWindow(WindowObject, ParentWindow, ParentWindow->LastChild /*prev sibling*/);
{ }
/* link window as top sibling */ else
IntLinkWindow(WindowObject, ParentWindow, NULL /*prev sibling*/); {
} /* link window as top sibling */
ExReleaseFastMutexUnsafe(&ParentWindow->ChildrenListLock); IntLinkWindow(WindowObject, ParentWindow, NULL /*prev sibling*/);
}
ExReleaseFastMutexUnsafe(&ParentWindow->ChildrenListLock);
}
/* Send the WM_CREATE message. */ /* Send the WM_CREATE message. */
DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n"); DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n");
@@ -1391,7 +1348,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if (Result == (LRESULT)-1) if (Result == (LRESULT)-1)
{ {
/* FIXME: Cleanup. */ /* FIXME: Cleanup. */
IntReleaseWindowObject(ParentWindow); if (NULL != ParentWindow)
{
IntReleaseWindowObject(ParentWindow);
}
DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n"); DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n");
return((HWND)0); return((HWND)0);
} }
@@ -1448,7 +1408,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
} }
/* Notify the parent window of a new child. */ /* Notify the parent window of a new child. */
if ((WindowObject->Style & WS_CHILD) || if ((WindowObject->Style & WS_CHILD) &&
(!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY))) (!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
{ {
DPRINT("NtUserCreateWindow(): About to notify parent\n"); DPRINT("NtUserCreateWindow(): About to notify parent\n");
@@ -2362,15 +2322,6 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
DPRINT("NtUserGetWindowLong(%x,%d,%d)\n", hWnd, (INT)Index, Ansi); DPRINT("NtUserGetWindowLong(%x,%d,%d)\n", hWnd, (INT)Index, Ansi);
/*
* Don't allow GetWindowLong with desktop window handle.
*/
if (hWnd == IntGetDesktopWindow())
{
SetLastWin32Error(STATUS_ACCESS_DENIED);
return 0;
}
WindowObject = IntGetWindowObject(hWnd); WindowObject = IntGetWindowObject(hWnd);
if (WindowObject == NULL) if (WindowObject == NULL)
{ {
@@ -2378,6 +2329,16 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
return 0; return 0;
} }
/*
* Only allow CSRSS to mess with the desktop window
*/
if (hWnd == IntGetDesktopWindow()
&& WindowObject->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
{
SetLastWin32Error(STATUS_ACCESS_DENIED);
return 0;
}
if ((INT)Index >= 0) if ((INT)Index >= 0)
{ {
if (Index > WindowObject->ExtraDataSize - sizeof(LONG)) if (Index > WindowObject->ExtraDataSize - sizeof(LONG))
+10 -7
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.51 2003/12/07 19:29:33 weiden Exp $ /* $Id: winpos.c,v 1.52 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -680,12 +680,6 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
/* FIXME: Get current active window from active queue. */ /* FIXME: Get current active window from active queue. */
/* Check if the window is for a desktop. */
if (Wnd == IntGetDesktopWindow())
{
return FALSE;
}
Window = IntGetWindowObject(Wnd); Window = IntGetWindowObject(Wnd);
if (!Window) if (!Window)
{ {
@@ -693,6 +687,15 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
return FALSE; return FALSE;
} }
/*
* Only allow CSRSS to mess with the desktop window
*/
if (Wnd == IntGetDesktopWindow()
&& Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
{
return FALSE;
}
WinPos.hwnd = Wnd; WinPos.hwnd = Wnd;
WinPos.hwndInsertAfter = WndInsertAfter; WinPos.hwndInsertAfter = WndInsertAfter;
WinPos.x = x; WinPos.x = x;
+2 -4
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: winsta.c,v 1.50 2003/12/07 19:29:33 weiden Exp $ * $Id: winsta.c,v 1.51 2003/12/07 23:02:57 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@@ -60,9 +60,6 @@
/* Currently active window station */ /* Currently active window station */
PWINSTATION_OBJECT InputWindowStation = NULL; PWINSTATION_OBJECT InputWindowStation = NULL;
LRESULT CALLBACK
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* INITALIZATION FUNCTIONS ****************************************************/ /* INITALIZATION FUNCTIONS ****************************************************/
NTSTATUS FASTCALL NTSTATUS FASTCALL
@@ -227,6 +224,7 @@ IntEndDesktopGraphics(VOID)
NtGdiDeleteDC(ScreenDeviceContext); NtGdiDeleteDC(ScreenDeviceContext);
ScreenDeviceContext = NULL; ScreenDeviceContext = NULL;
} }
IntHideDesktop(IntGetActiveDesktop());
IntDestroyPrimarySurface(); IntDestroyPrimarySurface();
} }
+4 -3
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: dc.c,v 1.107 2003/12/07 19:29:33 weiden Exp $ /* $Id: dc.c,v 1.108 2003/12/07 23:02:57 gvg Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@@ -470,7 +470,6 @@ IntCreatePrimarySurface()
PWSTR CurrentName; PWSTR CurrentName;
BOOL GotDriver; BOOL GotDriver;
BOOL DoDefault; BOOL DoDefault;
extern void FASTCALL IntInitDesktopWindow(ULONG Width, ULONG Height);
/* Open the miniport driver */ /* Open the miniport driver */
if ((PrimarySurface.VideoDeviceObject = DRIVER_FindMPDriver(L"DISPLAY")) == NULL) if ((PrimarySurface.VideoDeviceObject = DRIVER_FindMPDriver(L"DISPLAY")) == NULL)
@@ -638,7 +637,9 @@ IntCreatePrimarySurface()
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) PrimarySurface.Handle); SurfObj = (PSURFOBJ)AccessUserObject((ULONG) PrimarySurface.Handle);
SurfObj->dhpdev = PrimarySurface.PDev; SurfObj->dhpdev = PrimarySurface.PDev;
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) PrimarySurface.Handle); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) PrimarySurface.Handle);
IntInitDesktopWindow(SurfGDI->SurfObj.sizlBitmap.cx, SurfGDI->SurfObj.sizlBitmap.cy); IntShowDesktop(IntGetActiveDesktop(),
SurfGDI->SurfObj.sizlBitmap.cx,
SurfGDI->SurfObj.sizlBitmap.cy);
return TRUE; return TRUE;
} }