mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
Move desktop window proc from WIN32K to CSRSS
svn path=/trunk/; revision=6908
This commit is contained in:
parent
bfcd20af5e
commit
89d0892531
|
@ -563,7 +563,7 @@ NtUserGetWindow 2
|
|||
NtUserGetLastActivePopup 1
|
||||
NtUserGetShellWindow 0
|
||||
NtUserDereferenceWndProcHandle 2
|
||||
NtUserGraphicsDone 0
|
||||
NtUserManualGuiCheck 1
|
||||
# DirectDraw system calls
|
||||
NtGdiD3dContextCreate 4
|
||||
NtGdiD3dContextDestroy 1
|
||||
|
|
|
@ -496,6 +496,35 @@ typedef struct
|
|||
HWND WindowHandle;
|
||||
} 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 \
|
||||
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
|
||||
|
||||
|
@ -557,6 +586,9 @@ typedef struct
|
|||
#define CSRSS_DUPLICATE_HANDLE (0x28)
|
||||
#define CSRSS_SETGET_CONSOLE_HW_STATE (0x29)
|
||||
#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. */
|
||||
#define CSRSS_REQUEST_HEADER_SIZE (sizeof(LPC_MESSAGE) + sizeof(ULONG))
|
||||
|
@ -607,6 +639,9 @@ typedef struct
|
|||
CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest;
|
||||
CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest;
|
||||
CSRSS_CONSOLE_WINDOW ConsoleWindowRequest;
|
||||
CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest;
|
||||
CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest;
|
||||
CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest;
|
||||
} Data;
|
||||
} CSRSS_API_REQUEST, *PCSRSS_API_REQUEST;
|
||||
|
||||
|
@ -643,6 +678,9 @@ typedef struct
|
|||
CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply;
|
||||
CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply;
|
||||
CSRSS_CONSOLE_WINDOW ConsoleWindowReply;
|
||||
CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply;
|
||||
CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply;
|
||||
CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply;
|
||||
} Data;
|
||||
} CSRSS_API_REPLY, *PCSRSS_API_REPLY;
|
||||
|
||||
|
|
|
@ -200,5 +200,18 @@ NTSTATUS STDCALL NtWriteRequestData (HANDLE PortHandle,
|
|||
ULONG BufferLength,
|
||||
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 */
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef struct _W32PROCESS
|
|||
WORD GDIObjects;
|
||||
WORD UserObjects;
|
||||
BOOL CreatedWindowOrDC;
|
||||
BOOL ManualGuiCheck;
|
||||
} W32PROCESS, *PW32PROCESS;
|
||||
|
||||
PW32THREAD STDCALL
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS User32
|
||||
|
@ -29,7 +29,7 @@ struct builtin_class_descr
|
|||
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 COMBO_builtin_class;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#ifndef __WIN32K_MISC_H
|
||||
#define __WIN32K_MISC_H
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
NtUserGraphicsDone(VOID);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
DestroyThreadWindows(struct _ETHREAD *Thread);
|
||||
|
|
|
@ -1844,6 +1844,9 @@ typedef struct _WndProcHandle
|
|||
|
||||
DWORD STDCALL
|
||||
NtUserDereferenceWndProcHandle(WNDPROC wpHandle, WndProcHandle *Data);
|
||||
|
||||
VOID STDCALL
|
||||
NtUserManualGuiCheck(LONG Check);
|
||||
#endif /* __WIN32K_NTUSER_H */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS User32
|
||||
|
@ -9,7 +9,8 @@
|
|||
* NOTES: Adapted from Wine
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#include "user32/regcontrol.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
|
||||
*/
|
||||
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
|
||||
DbgPrint("ControlsInit()\n");
|
||||
&DESKTOP_builtin_class,
|
||||
#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);
|
||||
RegisterBuiltinClass(&POPUPMENU_builtin_class);
|
||||
RegisterBuiltinClass(&COMBO_builtin_class);
|
||||
RegisterBuiltinClass(&COMBOLBOX_builtin_class);
|
||||
#if 0
|
||||
RegisterBuiltinClass(&DESKTOP_builtin_class);
|
||||
#endif
|
||||
RegisterBuiltinClass(&MDICLIENT_builtin_class);
|
||||
#if 0
|
||||
RegisterBuiltinClass(&MENU_builtin_class);
|
||||
RegisterBuiltinClass(&SCROLL_builtin_class);
|
||||
#endif
|
||||
RegisterBuiltinClass(&BUTTON_builtin_class);
|
||||
RegisterBuiltinClass(&LISTBOX_builtin_class);
|
||||
RegisterBuiltinClass(&EDIT_builtin_class);
|
||||
RegisterBuiltinClass(&ICONTITLE_builtin_class);
|
||||
RegisterBuiltinClass(&STATIC_builtin_class);
|
||||
Register = FALSE;
|
||||
if (IS_ATOM(ClassName))
|
||||
{
|
||||
for (i = 0;
|
||||
! Register && i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]);
|
||||
i++)
|
||||
{
|
||||
if (IS_ATOM(ClassDescriptions[i]->name))
|
||||
{
|
||||
Register = (ClassName == ClassDescriptions[i]->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0;
|
||||
! 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;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
* FILE: lib/user32/misc/misc.c
|
||||
|
@ -52,7 +52,7 @@ GetGuiResources(
|
|||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
PrivateCsrssGraphicsDone(VOID)
|
||||
PrivateCsrssManualGuiCheck(LONG Check)
|
||||
{
|
||||
NtUserGraphicsDone();
|
||||
NtUserManualGuiCheck(Check);
|
||||
}
|
||||
|
|
|
@ -522,7 +522,7 @@ PostThreadMessageW@16
|
|||
PrintWindow@12
|
||||
PrivateCsrssAcquireOrReleaseInputOwnership@4
|
||||
PrivateCsrssRegisterPrimitive@0
|
||||
PrivateCsrssGraphicsDone@0
|
||||
PrivateCsrssManualGuiCheck@4
|
||||
PrivateExtractIconExA@20
|
||||
PrivateExtractIconExW@20
|
||||
PrivateExtractIconsA@32
|
||||
|
|
|
@ -523,7 +523,7 @@ PostThreadMessageW=PostThreadMessageW@16
|
|||
PrintWindow=PrintWindow@12
|
||||
PrivateCsrssAcquireOrReleaseInputOwnership=PrivateCsrssAcquireOrReleaseInputOwnership@4
|
||||
PrivateCsrssRegisterPrimitive=PrivateCsrssRegisterPrimitive@0
|
||||
PrivateCsrssGraphicsDone=PrivateCsrssGraphicsDone@0
|
||||
PrivateCsrssManualGuiCheck=PrivateCsrssManualGuiCheck@4
|
||||
PrivateExtractIconExA=PrivateExtractIconExA@20
|
||||
PrivateExtractIconExW=PrivateExtractIconExW@20
|
||||
PrivateExtractIconsA=PrivateExtractIconsA@32
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -21,7 +21,7 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static BOOL ControlsInitCalled = FALSE;
|
||||
static BOOL ControlsInitialized = FALSE;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -399,13 +399,6 @@ CreateWindowExA(DWORD dwExStyle,
|
|||
DbgPrint("[window] CreateWindowExA style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
|
||||
#endif
|
||||
|
||||
/* Register built-in controls if not already done */
|
||||
if (! ControlsInitCalled)
|
||||
{
|
||||
ControlsInit();
|
||||
ControlsInitCalled = TRUE;
|
||||
}
|
||||
|
||||
if (IS_ATOM(lpClassName))
|
||||
{
|
||||
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 (!IS_ATOM(lpClassName))
|
||||
|
@ -543,10 +542,9 @@ CreateWindowExW(DWORD dwExStyle,
|
|||
UINT sw;
|
||||
|
||||
/* Register built-in controls if not already done */
|
||||
if (! ControlsInitCalled)
|
||||
if (! ControlsInitialized)
|
||||
{
|
||||
ControlsInit();
|
||||
ControlsInitCalled = TRUE;
|
||||
ControlsInitialized = ControlsInit(lpClassName);
|
||||
}
|
||||
|
||||
if (IS_ATOM(lpClassName))
|
||||
|
|
22
reactos/subsys/csrss/include/desktopbg.h
Normal file
22
reactos/subsys/csrss/include/desktopbg.h
Normal 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 */
|
||||
|
|
@ -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 = ../../..
|
||||
|
||||
|
@ -15,7 +15,7 @@ TARGET_LFLAGS = -nostartfiles -nostdlib
|
|||
|
||||
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
|
||||
|
||||
|
|
261
reactos/subsys/csrss/win32csr/desktopbg.c
Normal file
261
reactos/subsys/csrss/win32csr/desktopbg.c
Normal 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 */
|
|
@ -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
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -11,11 +11,15 @@
|
|||
#include <windows.h>
|
||||
#include "csrplugin.h"
|
||||
#include "conio.h"
|
||||
#include "desktopbg.h"
|
||||
#include "guiconsole.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* Not defined in any header file */
|
||||
extern VOID STDCALL PrivateCsrssManualGuiCheck(LONG Check);
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
HANDLE Win32CsrApiHeap;
|
||||
|
@ -53,6 +57,9 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
|
|||
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
|
||||
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
|
||||
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 }
|
||||
};
|
||||
|
||||
|
@ -108,6 +115,7 @@ Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions,
|
|||
CsrExports = *Exports;
|
||||
Win32CsrApiHeap = CsrssApiHeap;
|
||||
|
||||
PrivateCsrssManualGuiCheck(0);
|
||||
CsrInitConsoleSupport();
|
||||
ThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Console_Api, NULL, 0, NULL);
|
||||
if (NULL == ThreadHandle)
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "win32csr.h"
|
||||
|
||||
/* Not defined in any header file */
|
||||
extern VOID STDCALL PrivateCsrssGraphicsDone(VOID);
|
||||
extern VOID STDCALL PrivateCsrssManualGuiCheck(LONG Check);
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
|
@ -498,7 +498,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
NotifyWnd = NULL;
|
||||
DestroyWindow(hWnd);
|
||||
PrivateCsrssGraphicsDone();
|
||||
PrivateCsrssManualGuiCheck(-1);
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
|
@ -513,6 +513,8 @@ GuiConsoleGuiThread(PVOID Data)
|
|||
MSG msg;
|
||||
PHANDLE GraphicsStartupEvent = (PHANDLE) Data;
|
||||
|
||||
PrivateCsrssManualGuiCheck(+1);
|
||||
|
||||
wc.lpszClassName = L"Win32CsrCreateNotify";
|
||||
wc.lpfnWndProc = GuiConsoleNotifyWndProc;
|
||||
wc.style = 0;
|
||||
|
@ -525,6 +527,7 @@ GuiConsoleGuiThread(PVOID Data)
|
|||
wc.cbWndExtra = 0;
|
||||
if (RegisterClassW(&wc) == 0)
|
||||
{
|
||||
PrivateCsrssManualGuiCheck(-1);
|
||||
NtSetEvent(*GraphicsStartupEvent, 0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -541,6 +544,7 @@ GuiConsoleGuiThread(PVOID Data)
|
|||
wc.cbWndExtra = 0;
|
||||
if (RegisterClassW(&wc) == 0)
|
||||
{
|
||||
PrivateCsrssManualGuiCheck(-1);
|
||||
NtSetEvent(*GraphicsStartupEvent, 0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -558,6 +562,7 @@ GuiConsoleGuiThread(PVOID Data)
|
|||
NULL);
|
||||
if (NULL == NotifyWnd)
|
||||
{
|
||||
PrivateCsrssManualGuiCheck(-1);
|
||||
NtSetEvent(*GraphicsStartupEvent, 0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -579,21 +584,9 @@ GuiConsoleInitConsoleSupport(VOID)
|
|||
NTSTATUS Status;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE GraphicsStartupEvent;
|
||||
HWINSTA WindowStation;
|
||||
HDESK Desktop;
|
||||
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);
|
||||
if (NULL == Desktop)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,12 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
|
|||
PDESKTOP_OBJECT FASTCALL
|
||||
IntGetActiveDesktop(VOID);
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
IntHideDesktop(PDESKTOP_OBJECT Desktop);
|
||||
|
||||
#endif /* _WIN32K_DESKTOP_H */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -118,11 +118,6 @@ IntGetWindowObject (HWND hWnd);
|
|||
VOID FASTCALL
|
||||
IntReleaseWindowObject (PWINDOW_OBJECT Window);
|
||||
|
||||
HWND STDCALL
|
||||
IntCreateDesktopWindow (PWINSTATION_OBJECT WindowStation,
|
||||
PWNDCLASS_OBJECT DesktopClass,
|
||||
ULONG Width, ULONG Height);
|
||||
|
||||
HWND FASTCALL
|
||||
IntGetActiveWindow (VOID);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
*/
|
||||
|
@ -92,6 +92,7 @@ Win32kProcessCallback (struct _EPROCESS *Process,
|
|||
}
|
||||
|
||||
Win32Process->CreatedWindowOrDC = FALSE;
|
||||
Win32Process->ManualGuiCheck = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -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 = ../..
|
||||
|
||||
|
@ -30,6 +30,7 @@ TARGET_CFLAGS =\
|
|||
-Wall -Werror
|
||||
|
||||
# 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_LFLAGS =\
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -176,14 +176,6 @@ IntCallWindowProc(WNDPROC Proc,
|
|||
NTSTATUS Status;
|
||||
PVOID ResultPointer;
|
||||
ULONG ResultLength;
|
||||
PWINDOW_OBJECT WindowObject = IntGetWindowObject(Wnd);
|
||||
|
||||
if (IntIsDesktopWindow(WindowObject))
|
||||
{
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return(IntDesktopWindowProc(Wnd, Message, wParam, lParam));
|
||||
}
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
|
||||
Arguments.Proc = Proc;
|
||||
Arguments.Wnd = Wnd;
|
||||
|
@ -199,9 +191,10 @@ IntCallWindowProc(WNDPROC Proc,
|
|||
&ResultLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(0xFFFFFFFF);
|
||||
return -1;
|
||||
}
|
||||
return(Result);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
LRESULT STDCALL
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -33,6 +33,7 @@
|
|||
#define NTOS_MODE_KERNEL
|
||||
#include <ntos.h>
|
||||
#include <ddk/ntddmou.h>
|
||||
#include <csrss/csrss.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <include/winsta.h>
|
||||
#include <include/desktop.h>
|
||||
|
@ -54,7 +55,6 @@
|
|||
/* Currently active desktop */
|
||||
PDESKTOP_OBJECT InputDesktop = NULL;
|
||||
HDESK InputDesktopHandle = NULL;
|
||||
PWNDCLASS_OBJECT DesktopWindowClass;
|
||||
HDC ScreenDeviceContext = NULL;
|
||||
|
||||
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||
|
@ -62,53 +62,17 @@ HDC ScreenDeviceContext = NULL;
|
|||
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;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
CleanupDesktopImpl(VOID)
|
||||
{
|
||||
/* FIXME: Unregister the desktop window class */
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
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
|
||||
*
|
||||
|
@ -174,7 +138,88 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
|||
|
||||
/* 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
|
||||
*
|
||||
* Creates a new desktop.
|
||||
|
@ -214,125 +259,134 @@ NtUserCreateDesktop(
|
|||
LPSECURITY_ATTRIBUTES lpSecurity,
|
||||
HWINSTA hWindowStation)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
PDESKTOP_OBJECT DesktopObject;
|
||||
UNICODE_STRING DesktopName;
|
||||
NTSTATUS Status;
|
||||
HDESK Desktop;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
PDESKTOP_OBJECT DesktopObject;
|
||||
UNICODE_STRING DesktopName;
|
||||
NTSTATUS Status;
|
||||
HDESK Desktop;
|
||||
CSRSS_API_REQUEST Request;
|
||||
CSRSS_API_REPLY Reply;
|
||||
|
||||
Status = IntValidateWindowStationHandle(
|
||||
hWindowStation,
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
Status = IntValidateWindowStationHandle(
|
||||
hWindowStation,
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Failed validation of window station handle (0x%X)\n",
|
||||
hWindowStation);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed validation of window station handle (0x%X)\n",
|
||||
hWindowStation);
|
||||
SetLastNtError(Status);
|
||||
return 0;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
||||
lpszDesktopName))
|
||||
{
|
||||
if (! IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name,
|
||||
lpszDesktopName))
|
||||
{
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
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 */
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&DesktopName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
/* Initialize ObjectAttributes for the desktop object */
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&DesktopName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = ObOpenObjectByName(
|
||||
&ObjectAttributes,
|
||||
ExDesktopObjectType,
|
||||
NULL,
|
||||
UserMode,
|
||||
dwDesiredAccess,
|
||||
NULL,
|
||||
&Desktop);
|
||||
Status = ObOpenObjectByName(
|
||||
&ObjectAttributes,
|
||||
ExDesktopObjectType,
|
||||
NULL,
|
||||
UserMode,
|
||||
dwDesiredAccess,
|
||||
NULL,
|
||||
&Desktop);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
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
|
||||
*/
|
||||
/*
|
||||
* No existing desktop found, try to create new one
|
||||
*/
|
||||
|
||||
Status = ObCreateObject(
|
||||
ExGetPreviousMode(),
|
||||
ExDesktopObjectType,
|
||||
&ObjectAttributes,
|
||||
ExGetPreviousMode(),
|
||||
NULL,
|
||||
sizeof(DESKTOP_OBJECT),
|
||||
0,
|
||||
0,
|
||||
(PVOID*)&DesktopObject);
|
||||
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);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed creating desktop (%wZ)\n", &DesktopName);
|
||||
ExFreePool(DesktopName.Buffer);
|
||||
SetLastNtError(STATUS_UNSUCCESSFUL);
|
||||
return((HDESK)0);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME: Set correct dimensions. */
|
||||
DesktopObject->WorkArea.left = 0;
|
||||
DesktopObject->WorkArea.top = 0;
|
||||
DesktopObject->WorkArea.right = 640;
|
||||
DesktopObject->WorkArea.bottom = 480;
|
||||
/* 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);
|
||||
/* Initialize some local (to win32k) desktop state. */
|
||||
DesktopObject->ActiveMessageQueue = NULL;
|
||||
|
||||
DPRINT("Created Desktop Window: %08x\n", DesktopObject->DesktopWindow);
|
||||
Status = ObInsertObject(
|
||||
(PVOID)DesktopObject,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
0,
|
||||
NULL,
|
||||
&Desktop);
|
||||
|
||||
Status = ObInsertObject(
|
||||
(PVOID)DesktopObject,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
0,
|
||||
NULL,
|
||||
&Desktop);
|
||||
ObDereferenceObject(DesktopObject);
|
||||
ExFreePool(DesktopName.Buffer);
|
||||
|
||||
ObDereferenceObject(DesktopObject);
|
||||
ExFreePool(DesktopName.Buffer);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to create desktop handle\n");
|
||||
SetLastNtError(Status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Failed to create desktop handle\n");
|
||||
SetLastNtError(STATUS_UNSUCCESSFUL);
|
||||
return 0;
|
||||
}
|
||||
Request.Type = CSRSS_CREATE_DESKTOP;
|
||||
memcpy(Request.Data.CreateDesktopRequest.DesktopName, lpszDesktopName->Buffer,
|
||||
lpszDesktopName->Length);
|
||||
Request.Data.CreateDesktopRequest.DesktopName[lpszDesktopName->Length / sizeof(WCHAR)] = L'\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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -51,6 +51,37 @@ static ULONG NrGuiApplicationsRunning = 0;
|
|||
|
||||
/* 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
|
||||
IntGraphicsCheck(BOOL Create)
|
||||
{
|
||||
|
@ -59,33 +90,16 @@ IntGraphicsCheck(BOOL Create)
|
|||
W32Data = PsGetWin32Process();
|
||||
if (Create)
|
||||
{
|
||||
if (! W32Data->CreatedWindowOrDC)
|
||||
if (! W32Data->CreatedWindowOrDC && ! W32Data->ManualGuiCheck)
|
||||
{
|
||||
W32Data->CreatedWindowOrDC = TRUE;
|
||||
if (0 == NrGuiApplicationsRunning++)
|
||||
{
|
||||
if (! IntInitializeDesktopGraphics())
|
||||
{
|
||||
W32Data->CreatedWindowOrDC = FALSE;
|
||||
NrGuiApplicationsRunning--;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return AddGuiApp(W32Data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (W32Data->CreatedWindowOrDC)
|
||||
if (W32Data->CreatedWindowOrDC && ! W32Data->ManualGuiCheck)
|
||||
{
|
||||
W32Data->CreatedWindowOrDC = FALSE;
|
||||
if (0 < NrGuiApplicationsRunning)
|
||||
{
|
||||
NrGuiApplicationsRunning--;
|
||||
}
|
||||
if (0 == NrGuiApplicationsRunning)
|
||||
{
|
||||
IntEndDesktopGraphics();
|
||||
}
|
||||
RemoveGuiApp(W32Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,9 +107,29 @@ IntGraphicsCheck(BOOL Create)
|
|||
}
|
||||
|
||||
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 */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -50,14 +50,6 @@
|
|||
#define NDEBUG
|
||||
#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 **********************************************************/
|
||||
|
||||
VOID FASTCALL
|
||||
|
@ -151,129 +143,88 @@ IntGetNCUpdateRegion(PWINDOW_OBJECT Window, BOOL Remove)
|
|||
VOID FASTCALL
|
||||
IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
|
||||
{
|
||||
HDC hDC;
|
||||
HWND hWnd = Window->Self;
|
||||
HDC hDC;
|
||||
HWND hWnd = Window->Self;
|
||||
|
||||
if (!(Window->Style & WS_VISIBLE))
|
||||
{
|
||||
if (! (Window->Style & WS_VISIBLE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
|
||||
{
|
||||
if (IntIsDesktopWindow(Window))
|
||||
{
|
||||
/*
|
||||
* Repainting of desktop window
|
||||
*/
|
||||
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
|
||||
{
|
||||
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
|
||||
{
|
||||
NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window, TRUE), 0);
|
||||
}
|
||||
|
||||
#ifndef DESKTOP_IN_CSRSS
|
||||
VIS_RepaintDesktop(hWnd, Window->UpdateRegion);
|
||||
Window->Flags &= ~(WINDOWOBJECT_NEED_NCPAINT |
|
||||
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)
|
||||
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
|
||||
{
|
||||
if (Window->UpdateRegion)
|
||||
{
|
||||
NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0);
|
||||
NtUserReleaseDC(hWnd, hDC);
|
||||
NtGdiDeleteObject(Window->UpdateRegion);
|
||||
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)
|
||||
{
|
||||
hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
|
||||
DCX_INTERSECTUPDATE);
|
||||
if (hDC != NULL)
|
||||
{
|
||||
if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
|
||||
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
||||
{
|
||||
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
||||
}
|
||||
NtUserReleaseDC(hWnd, hDC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Flags & RDW_UPDATENOW)
|
||||
{
|
||||
if (Window->UpdateRegion != NULL ||
|
||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||
if (Flags & RDW_UPDATENOW)
|
||||
{
|
||||
if (Window->UpdateRegion != NULL ||
|
||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||
{
|
||||
NtUserSendMessage(hWnd, WM_PAINT, 0, 0);
|
||||
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||
{
|
||||
NtUserSendMessage(hWnd, WM_PAINT, 0, 0);
|
||||
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||
{
|
||||
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Paint child windows.
|
||||
*/
|
||||
|
||||
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
||||
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
|
||||
{
|
||||
/*
|
||||
* Paint child windows.
|
||||
*/
|
||||
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
||||
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)) &&
|
||||
! IntIsDesktopWindow(Window))
|
||||
{
|
||||
HWND *List, *phWnd;
|
||||
|
||||
if ((List = IntWinListChildren(Window)))
|
||||
{
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
Window = IntGetWindowObject(*phWnd);
|
||||
if (Window)
|
||||
{
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
IntPaintWindows(Window, Flags);
|
||||
IntReleaseWindowObject(Window);
|
||||
Window = IntGetWindowObject(*phWnd);
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef DESKTOP_IN_CSRSS
|
||||
if (Window->MessageQueue)
|
||||
#endif
|
||||
{
|
||||
HasPaintMessage = Window->UpdateRegion != NULL ||
|
||||
HasPaintMessage = Window->UpdateRegion != NULL ||
|
||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
|
||||
HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
||||
HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
||||
|
||||
if (HasPaintMessage != HadPaintMessage)
|
||||
{
|
||||
if (HadPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
}
|
||||
|
||||
if (HasNCPaintMessage != HadNCPaintMessage)
|
||||
{
|
||||
if (HadNCPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
}
|
||||
#ifndef DESKTOP_IN_CSRSS
|
||||
if (HasPaintMessage != HadPaintMessage)
|
||||
{
|
||||
if (HadPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
}
|
||||
|
||||
if (HasNCPaintMessage != HadNCPaintMessage)
|
||||
{
|
||||
if (HadNCPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -214,14 +214,7 @@ VIS_ComputeVisibleRegion(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
|
|||
VOID FASTCALL
|
||||
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn)
|
||||
{
|
||||
HDC dc = NtUserGetDC(Desktop);
|
||||
if (dc)
|
||||
{
|
||||
HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165));
|
||||
NtGdiFillRgn(dc, RepaintRgn, DesktopBrush);
|
||||
NtGdiDeleteObject(DesktopBrush);
|
||||
}
|
||||
NtUserReleaseDC(Desktop, dc);
|
||||
NtUserRedrawWindow(Desktop, NULL, RepaintRgn, RDW_UPDATENOW | RDW_INVALIDATE | RDW_NOCHILDREN);
|
||||
}
|
||||
|
||||
static VOID FASTCALL
|
||||
|
@ -349,7 +342,8 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
|
|||
NtGdiCombineRgn(Repaint, NewlyExposed, NULL, RGN_COPY);
|
||||
NtGdiOffsetRgn(Repaint, Window->WindowRect.left, Window->WindowRect.top);
|
||||
NtGdiCombineRgn(Repaint, Repaint, Uncovered, RGN_AND);
|
||||
VIS_RepaintDesktop(DesktopWindow->Self, Repaint);
|
||||
NtUserRedrawWindow(DesktopWindow->Self, NULL, Repaint,
|
||||
RDW_UPDATENOW | RDW_INVALIDATE | RDW_NOCHILDREN);
|
||||
NtGdiDeleteObject(Repaint);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -550,71 +550,6 @@ IntGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid)
|
|||
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
|
||||
IntInitDesktopWindow(ULONG Width, ULONG Height)
|
||||
{
|
||||
|
@ -1104,16 +1039,9 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
|
||||
DPRINT("NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight);
|
||||
|
||||
/* Initialize gui state if necessary. */
|
||||
if (! IntGraphicsCheck(TRUE))
|
||||
{
|
||||
DPRINT1("Unable to initialize graphics, returning NULL window\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!RtlCreateUnicodeString(&WindowName,
|
||||
NULL == lpWindowName->Buffer ?
|
||||
L"" : lpWindowName->Buffer))
|
||||
if (! RtlCreateUnicodeString(&WindowName,
|
||||
NULL == lpWindowName->Buffer ?
|
||||
L"" : lpWindowName->Buffer))
|
||||
{
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return((HWND)0);
|
||||
|
@ -1139,10 +1067,18 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
}
|
||||
else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
|
||||
{
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
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 */
|
||||
|
||||
|
@ -1151,7 +1087,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
}
|
||||
return((HWND)0);
|
||||
}
|
||||
|
||||
|
@ -1164,9 +1103,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
}
|
||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
return (HWND)0;
|
||||
|
@ -1184,12 +1126,21 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
ObDereferenceObject(WinStaObject);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
}
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return (HWND)0;
|
||||
}
|
||||
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.
|
||||
*/
|
||||
|
@ -1215,12 +1166,15 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
WindowObject->Parent = ParentWindow;
|
||||
WindowObject->Owner = IntGetWindowObject(OwnerWindowHandle);
|
||||
WindowObject->UserData = 0;
|
||||
if ((((DWORD)ClassObject->lpfnWndProcA & 0xFFFF0000) != 0xFFFF0000) && (((DWORD)ClassObject->lpfnWndProcW & 0xFFFF0000) != 0xFFFF0000))
|
||||
{
|
||||
WindowObject->Unicode = ClassObject->Unicode;
|
||||
} else {
|
||||
WindowObject->Unicode = bUnicodeWindow;
|
||||
}
|
||||
if ((((DWORD)ClassObject->lpfnWndProcA & 0xFFFF0000) != 0xFFFF0000)
|
||||
&& (((DWORD)ClassObject->lpfnWndProcW & 0xFFFF0000) != 0xFFFF0000))
|
||||
{
|
||||
WindowObject->Unicode = ClassObject->Unicode;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowObject->Unicode = bUnicodeWindow;
|
||||
}
|
||||
WindowObject->WndProcA = ClassObject->lpfnWndProcA;
|
||||
WindowObject->WndProcW = ClassObject->lpfnWndProcW;
|
||||
WindowObject->OwnerThread = PsGetCurrentThread();
|
||||
|
@ -1247,12 +1201,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
|
||||
|
||||
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
||||
/*
|
||||
This is incorrect!!! -- Filip
|
||||
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
*/
|
||||
|
||||
|
||||
/* Correct the window style. */
|
||||
if (!(dwStyle & WS_CHILD))
|
||||
|
@ -1262,8 +1210,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
if (!(dwStyle & WS_POPUP))
|
||||
{
|
||||
WindowObject->Style |= WS_CAPTION;
|
||||
WindowObject->Flags |= WINDOWOBJECT_NEED_SIZE;
|
||||
DPRINT("4: Style is now %d\n", WindowObject->Style);
|
||||
WindowObject->Flags |= WINDOWOBJECT_NEED_SIZE;
|
||||
DPRINT("4: Style is now %d\n", WindowObject->Style);
|
||||
/* FIXME: Note the window needs a size. */
|
||||
}
|
||||
}
|
||||
|
@ -1275,7 +1223,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
|
||||
|
||||
/* 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" */
|
||||
|
||||
/* Initialize the window dimensions. */
|
||||
|
@ -1353,7 +1304,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
if (!Result)
|
||||
{
|
||||
/* FIXME: Cleanup. */
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
}
|
||||
DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n");
|
||||
return((HWND)0);
|
||||
}
|
||||
|
@ -1371,19 +1325,22 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
MaxPos.y - WindowObject->WindowRect.top);
|
||||
|
||||
|
||||
/* link the window into the parent's child list */
|
||||
ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
||||
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
||||
{
|
||||
/* link window as bottom sibling */
|
||||
IntLinkWindow(WindowObject, ParentWindow, ParentWindow->LastChild /*prev sibling*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* link window as top sibling */
|
||||
IntLinkWindow(WindowObject, ParentWindow, NULL /*prev sibling*/);
|
||||
}
|
||||
ExReleaseFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
/* link the window into the parent's child list */
|
||||
ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
||||
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
||||
{
|
||||
/* link window as bottom sibling */
|
||||
IntLinkWindow(WindowObject, ParentWindow, ParentWindow->LastChild /*prev sibling*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* link window as top sibling */
|
||||
IntLinkWindow(WindowObject, ParentWindow, NULL /*prev sibling*/);
|
||||
}
|
||||
ExReleaseFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
||||
}
|
||||
|
||||
/* Send the WM_CREATE message. */
|
||||
DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n");
|
||||
|
@ -1391,7 +1348,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
if (Result == (LRESULT)-1)
|
||||
{
|
||||
/* FIXME: Cleanup. */
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
if (NULL != ParentWindow)
|
||||
{
|
||||
IntReleaseWindowObject(ParentWindow);
|
||||
}
|
||||
DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n");
|
||||
return((HWND)0);
|
||||
}
|
||||
|
@ -1448,7 +1408,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
|||
}
|
||||
|
||||
/* Notify the parent window of a new child. */
|
||||
if ((WindowObject->Style & WS_CHILD) ||
|
||||
if ((WindowObject->Style & WS_CHILD) &&
|
||||
(!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
|
||||
{
|
||||
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);
|
||||
|
||||
/*
|
||||
* Don't allow GetWindowLong with desktop window handle.
|
||||
*/
|
||||
if (hWnd == IntGetDesktopWindow())
|
||||
{
|
||||
SetLastWin32Error(STATUS_ACCESS_DENIED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WindowObject = IntGetWindowObject(hWnd);
|
||||
if (WindowObject == NULL)
|
||||
{
|
||||
|
@ -2378,6 +2329,16 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
|
|||
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 (Index > WindowObject->ExtraDataSize - sizeof(LONG))
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
* 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. */
|
||||
|
||||
/* Check if the window is for a desktop. */
|
||||
if (Wnd == IntGetDesktopWindow())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Window = IntGetWindowObject(Wnd);
|
||||
if (!Window)
|
||||
{
|
||||
|
@ -693,6 +687,15 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only allow CSRSS to mess with the desktop window
|
||||
*/
|
||||
if (Wnd == IntGetDesktopWindow()
|
||||
&& Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WinPos.hwnd = Wnd;
|
||||
WinPos.hwndInsertAfter = WndInsertAfter;
|
||||
WinPos.x = x;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -60,9 +60,6 @@
|
|||
/* Currently active window station */
|
||||
PWINSTATION_OBJECT InputWindowStation = NULL;
|
||||
|
||||
LRESULT CALLBACK
|
||||
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
|
@ -227,6 +224,7 @@ IntEndDesktopGraphics(VOID)
|
|||
NtGdiDeleteDC(ScreenDeviceContext);
|
||||
ScreenDeviceContext = NULL;
|
||||
}
|
||||
IntHideDesktop(IntGetActiveDesktop());
|
||||
IntDestroyPrimarySurface();
|
||||
}
|
||||
|
||||
|
@ -288,7 +286,7 @@ NtUserCreateWindowStation(
|
|||
HWINSTA WindowStation;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/*
|
||||
* Generate full window station name
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: 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
|
||||
*
|
||||
|
@ -470,7 +470,6 @@ IntCreatePrimarySurface()
|
|||
PWSTR CurrentName;
|
||||
BOOL GotDriver;
|
||||
BOOL DoDefault;
|
||||
extern void FASTCALL IntInitDesktopWindow(ULONG Width, ULONG Height);
|
||||
|
||||
/* Open the miniport driver */
|
||||
if ((PrimarySurface.VideoDeviceObject = DRIVER_FindMPDriver(L"DISPLAY")) == NULL)
|
||||
|
@ -638,7 +637,9 @@ IntCreatePrimarySurface()
|
|||
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) PrimarySurface.Handle);
|
||||
SurfObj->dhpdev = PrimarySurface.PDev;
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue