revert my temporary class hacks and remove my desktop handling changes temporarily as they cause some trouble

svn path=/trunk/; revision=12319
This commit is contained in:
Thomas Bluemel 2004-12-24 17:45:59 +00:00
parent 68bf1ffa6a
commit e07e530aa6
24 changed files with 353 additions and 642 deletions

View file

@ -464,7 +464,7 @@ NtUserQueryWindow 2
NtUserReleaseDC 2
NtUserRealChildWindowFromPoint 3
NtUserRedrawWindow 4
NtUserRegisterClassEx 6
NtUserRegisterClassExWOW 7
NtUserRegisterHotKey 4
NtUserRegisterTasklist 1
NtUserRegisterWindowMessage 1

View file

@ -70,8 +70,6 @@ typedef struct
typedef struct
{
PCONTROLDISPATCHER CtrlDispatcher;
UNICODE_STRING DesktopName;
UNICODE_STRING Title;
} CSRSS_ALLOC_CONSOLE_REQUEST, *PCSRSS_ALLOC_CONSOLE_REQUEST;
typedef struct
@ -535,7 +533,6 @@ typedef struct
typedef struct
{
HDESK hDesktop;
HWND DesktopWindow;
ULONG Width;
ULONG Height;
@ -547,7 +544,6 @@ typedef struct
typedef struct
{
HDESK hDesktop;
HWND DesktopWindow;
} CSRSS_HIDE_DESKTOP_REQUEST, *PCSRSS_HIDE_DESKTOP_REQUEST;
@ -619,16 +615,6 @@ typedef struct
HANDLE InputWaitHandle;
} CSRSS_GET_INPUT_WAIT_HANDLE_REPLY, *PCSRSS_GET_INPUT_WAIT_HANDLE_REPLY;
typedef struct
{
HWINSTA hWindowStation;
} CSRSS_REGISTER_SYSTEM_CLASSES_REQUEST, *PCSRSS_REGISTER_SYSTEM_CLASSES_REQUEST;
typedef struct
{
HWINSTA hWindowStation;
} CSRSS_REGISTER_SYSTEM_CLASSES_REPLY, *PCSRSS_REGISTER_SYSTEM_CALSSES_REPLY;
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
@ -701,7 +687,6 @@ typedef struct
#define CSRSS_GET_CONSOLE_OUTPUT_CP (0x33)
#define CSRSS_SET_CONSOLE_OUTPUT_CP (0x34)
#define CSRSS_GET_INPUT_WAIT_HANDLE (0x35)
#define CSRSS_REGISTER_SYSTEM_CLASSES (0x36)
/* Keep in sync with definition below. */
#define CSRSS_REQUEST_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG))
@ -767,7 +752,6 @@ typedef struct
CSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE_REQUEST GetConsoleInputWaitHandle;
CSRSS_REGISTER_SYSTEM_CLASSES_REQUEST RegisterSystemClassesRequest;
} Data;
};
};
@ -823,7 +807,6 @@ typedef struct
CSRSS_GET_CONSOLE_OUTPUT_CP_REPLY GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REPLY SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE_REPLY GetConsoleInputWaitHandle;
CSRSS_REGISTER_SYSTEM_CLASSES_REPLY RegisterSystemClassesReply;
} Data;
};
};

View file

@ -1,4 +1,4 @@
/* $Id: regcontrol.h,v 1.9 2004/12/21 21:38:25 weiden Exp $
/* $Id: regcontrol.h,v 1.10 2004/12/24 17:45:57 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32
@ -26,6 +26,8 @@ struct builtin_class_descr
HBRUSH brush; /* brush or system color */
};
extern BOOL FASTCALL ControlsInit(LPCWSTR ClassName);
extern const struct builtin_class_descr BUTTON_builtin_class;
extern const struct builtin_class_descr COMBO_builtin_class;
extern const struct builtin_class_descr COMBOLBOX_builtin_class;
@ -40,7 +42,4 @@ extern const struct builtin_class_descr MENU_builtin_class;
extern const struct builtin_class_descr SCROLL_builtin_class;
extern const struct builtin_class_descr STATIC_builtin_class;
extern BOOL STDCALL PrivateCsrssRegisterBuiltinSystemWindowClasses(HWINSTA hWindowStation);
extern ATOM STDCALL PrivateCsrssRegisterSystemWindowClass(HWINSTA hWindowStation, WNDCLASSEXW *lpwcx, WNDPROC lpfnWndProcA);
#endif /* ROS_REGCONTROL_H */

View file

@ -164,7 +164,6 @@ NtUserCallNextHookEx(
#define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006
#define NOPARAM_ROUTINE_CSRSS_INITIALIZED 0xffff0007
#define NOPARAM_ROUTINE_GDI_QUERY_TABLE 0xffff0008
#define NOPARAM_ROUTINE_IS_GUI_ACTIVE 0xffff0009
DWORD
STDCALL
NtUserCallNoParam(
@ -1168,13 +1167,14 @@ NtUserRedrawWindow
#define REGISTERCLASS_ALL (REGISTERCLASS_ANSI | REGISTERCLASS_SYSTEM)
RTL_ATOM STDCALL
NtUserRegisterClassEx(
NtUserRegisterClassExWOW(
CONST WNDCLASSEXW* lpwcx,
PUNICODE_STRING ClassName,
PUNICODE_STRING ClassNameCopy,
PUNICODE_STRING MenuName,
WNDPROC wpExtra,
DWORD Flags,
HWINSTA hWindowStation OPTIONAL);
DWORD Unknown7);
BOOL
STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: console.c,v 1.88 2004/12/21 21:38:25 weiden Exp $
/* $Id: console.c,v 1.89 2004/12/24 17:45:57 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -1344,14 +1344,10 @@ ReadConsoleW(HANDLE hConsoleInput,
*/
BOOL STDCALL AllocConsole(VOID)
{
PUNICODE_STRING DesktopName, Title;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
HANDLE hStdError;
ULONG BufSize;
PVOID BufferBase, BufferTargetBase;
PWCHAR szDest, szTargetDest;
if(NtCurrentPeb()->ProcessParameters->hConsole)
{
@ -1359,54 +1355,6 @@ BOOL STDCALL AllocConsole(VOID)
SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS);
return FALSE;
}
DesktopName = &NtCurrentPeb()->ProcessParameters->DesktopInfo;
Title = &NtCurrentPeb()->ProcessParameters->WindowTitle;
BufSize = ((DesktopName->Length >= sizeof(WCHAR)) ? DesktopName->Length + sizeof(WCHAR) : 0);
BufSize += ((Title->Length >= sizeof(WCHAR)) ? Title->Length + sizeof(WCHAR) : 0);
if(BufSize > 0)
{
Status = CsrCaptureParameterBuffer(NULL, BufSize, &BufferBase, &BufferTargetBase);
if(!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return FALSE;
}
szDest = BufferBase;
szTargetDest = BufferTargetBase;
if(DesktopName->Length >= sizeof(WCHAR))
{
memcpy(szDest, DesktopName->Buffer, DesktopName->Length);
szDest = (PWSTR)((ULONG_PTR)szDest + DesktopName->Length);
*(szDest++) = L'\0';
Request.Data.AllocConsoleRequest.DesktopName.Length = DesktopName->Length;
Request.Data.AllocConsoleRequest.DesktopName.MaximumLength = DesktopName->Length + sizeof(WCHAR);
Request.Data.AllocConsoleRequest.DesktopName.Buffer = szTargetDest;
szTargetDest = (PWSTR)((ULONG_PTR)szTargetDest + DesktopName->Length + sizeof(WCHAR));
}
else
{
RtlInitUnicodeString(&Request.Data.AllocConsoleRequest.DesktopName, NULL);
}
if(Title->Length >= sizeof(WCHAR))
{
memcpy(szDest, Title->Buffer, Title->Length);
szDest = (PWSTR)((ULONG_PTR)szDest + Title->Length);
*(szDest++) = L'\0';
Request.Data.AllocConsoleRequest.Title.Length = Title->Length;
Request.Data.AllocConsoleRequest.Title.MaximumLength = Title->Length + sizeof(WCHAR);
Request.Data.AllocConsoleRequest.Title.Buffer = szTargetDest;
szTargetDest = (PWSTR)((ULONG_PTR)szTargetDest + Title->Length + sizeof(WCHAR));
}
else
{
RtlInitUnicodeString(&Request.Data.AllocConsoleRequest.Title, NULL);
}
}
Request.Data.AllocConsoleRequest.CtrlDispatcher = (PCONTROLDISPATCHER) &ConsoleControlDispatcher;
@ -1414,20 +1362,9 @@ BOOL STDCALL AllocConsole(VOID)
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) )
{
if(BufSize > 0)
{
CsrReleaseParameterBuffer(BufferBase);
}
SetLastErrorByStatus ( Status );
SetLastErrorByStatus ( Status );
return FALSE;
}
if(BufSize > 0)
{
CsrReleaseParameterBuffer(BufferBase);
}
/* FIXME - thread-safe exchange!!! */
NtCurrentPeb()->ProcessParameters->hConsole = Reply.Data.AllocConsoleReply.Console;
SetStdHandle( STD_INPUT_HANDLE, Reply.Data.AllocConsoleReply.InputHandle );
SetStdHandle( STD_OUTPUT_HANDLE, Reply.Data.AllocConsoleReply.OutputHandle );
@ -1617,7 +1554,7 @@ IntPeekConsoleInput(HANDLE hConsoleInput,
LPDWORD lpNumberOfEventsRead,
BOOL bUnicode)
{
CSRSS_API_REQUEST Request;
PCSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
PVOID BufferBase;
@ -1639,24 +1576,34 @@ IntPeekConsoleInput(HANDLE hConsoleInput,
return FALSE;
}
Request.Type = CSRSS_PEEK_CONSOLE_INPUT;
Request.Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput;
Request.Data.PeekConsoleInputRequest.Unicode = bUnicode;
Request.Data.PeekConsoleInputRequest.Length = nLength;
Request.Data.PeekConsoleInputRequest.InputRecord = (INPUT_RECORD*)BufferTargetBase;
Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST));
if(Request == NULL)
{
CsrReleaseParameterBuffer(BufferBase);
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
Status = CsrClientCallServer(&Request, &Reply,
Request->Type = CSRSS_PEEK_CONSOLE_INPUT;
Request->Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput;
Request->Data.PeekConsoleInputRequest.Unicode = bUnicode;
Request->Data.PeekConsoleInputRequest.Length = nLength;
Request->Data.PeekConsoleInputRequest.InputRecord = (INPUT_RECORD*)BufferTargetBase;
Status = CsrClientCallServer(Request, &Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase);
return FALSE;
}
memcpy(lpBuffer, BufferBase, sizeof(INPUT_RECORD) * Reply.Data.PeekConsoleInputReply.Length);
RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase);
if(lpNumberOfEventsRead != NULL)
@ -1922,7 +1869,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput,
PSMALL_RECT lpReadRegion,
BOOL bUnicode)
{
CSRSS_API_REQUEST Request;
PCSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
PVOID BufferBase;
PVOID BufferTargetBase;
@ -1943,22 +1890,31 @@ IntReadConsoleOutput(HANDLE hConsoleOutput,
SetLastErrorByStatus(Status);
return FALSE;
}
Request.Type = CSRSS_READ_CONSOLE_OUTPUT;
Request.Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request.Data.ReadConsoleOutputRequest.Unicode = bUnicode;
Request.Data.ReadConsoleOutputRequest.BufferSize = dwBufferSize;
Request.Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request.Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion;
Request.Data.ReadConsoleOutputRequest.CharInfo = (PCHAR_INFO)BufferTargetBase;
Status = CsrClientCallServer(&Request, &Reply,
Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST));
if(Request == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
CsrReleaseParameterBuffer(BufferBase);
return FALSE;
}
Request->Type = CSRSS_READ_CONSOLE_OUTPUT;
Request->Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request->Data.ReadConsoleOutputRequest.Unicode = bUnicode;
Request->Data.ReadConsoleOutputRequest.BufferSize = dwBufferSize;
Request->Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request->Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion;
Request->Data.ReadConsoleOutputRequest.CharInfo = (PCHAR_INFO)BufferTargetBase;
Status = CsrClientCallServer(Request, &Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastErrorByStatus(Status);
RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase);
return FALSE;
}
@ -1967,7 +1923,8 @@ IntReadConsoleOutput(HANDLE hConsoleOutput,
SizeY = Reply.Data.ReadConsoleOutputReply.ReadRegion.Bottom - Reply.Data.ReadConsoleOutputReply.ReadRegion.Top + 1;
memcpy(lpBuffer, BufferBase, sizeof(CHAR_INFO) * SizeX * SizeY);
RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase);
*lpReadRegion = Reply.Data.ReadConsoleOutputReply.ReadRegion;
@ -2023,7 +1980,7 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput,
PSMALL_RECT lpWriteRegion,
BOOL bUnicode)
{
CSRSS_API_REQUEST Request;
PCSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
ULONG Size;
@ -2041,27 +1998,37 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput,
SetLastErrorByStatus(Status);
return(FALSE);
}
Request.Type = CSRSS_WRITE_CONSOLE_OUTPUT;
Request.Data.WriteConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request.Data.WriteConsoleOutputRequest.Unicode = bUnicode;
Request.Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize;
Request.Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request.Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion;
Request.Data.WriteConsoleOutputRequest.CharInfo =
Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(CSRSS_API_REQUEST));
if (Request == NULL)
{
CsrReleaseParameterBuffer(BufferBase);
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
Request->Type = CSRSS_WRITE_CONSOLE_OUTPUT;
Request->Data.WriteConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request->Data.WriteConsoleOutputRequest.Unicode = bUnicode;
Request->Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize;
Request->Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request->Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion;
Request->Data.WriteConsoleOutputRequest.CharInfo =
(CHAR_INFO*)BufferTargetBase;
Status = CsrClientCallServer(&Request, &Reply,
Status = CsrClientCallServer(Request, &Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
CsrReleaseParameterBuffer(BufferBase);
RtlFreeHeap(GetProcessHeap(), 0, Request);
SetLastErrorByStatus(Status);
return FALSE;
}
RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase);
*lpWriteRegion = Reply.Data.WriteConsoleOutputReply.WriteRegion;

View file

@ -1,4 +1,4 @@
/* $Id: lpc.c,v 1.14 2004/12/21 21:38:26 weiden Exp $
/* $Id: lpc.c,v 1.15 2004/12/24 17:45:57 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -71,10 +71,7 @@ CsrCaptureParameterBuffer(PVOID ParameterBuffer,
{
return(STATUS_NO_MEMORY);
}
if(ParameterBuffer != NULL)
{
memcpy(Block, ParameterBuffer, ParameterBufferSize);
}
memcpy(Block, ParameterBuffer, ParameterBufferSize);
*ClientAddress = Block;
*ServerAddress = Block - CsrSectionMapBase + CsrSectionMapServerBase;
return(STATUS_SUCCESS);

View file

@ -1,4 +1,4 @@
/* $Id: regcontrol.c,v 1.21 2004/12/21 21:38:26 weiden Exp $
/* $Id: regcontrol.c,v 1.22 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32
@ -10,18 +10,60 @@
*/
#include "user32.h"
#include <wchar.h>
#include "user32/regcontrol.h"
#include "win32k/ntuser.h"
#define NDEBUG
#include <debug.h>
static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
{
WNDCLASSEXW wc;
UNICODE_STRING ClassName;
UNICODE_STRING MenuName;
wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = Descr->name;
wc.lpfnWndProc = Descr->procW;
wc.style = Descr->style;
wc.hInstance = User32Instance;
wc.hIcon = NULL;
wc.hIconSm = NULL;
wc.hCursor = LoadCursorW(NULL, Descr->cursor);
wc.hbrBackground = Descr->brush;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = Descr->extra;
MenuName.Length =
MenuName.MaximumLength = 0;
MenuName.Buffer = NULL;
if (IS_ATOM(Descr->name))
{
ClassName.Length =
ClassName.MaximumLength = 0;
ClassName.Buffer = (LPWSTR)Descr->name;
} else
{
RtlInitUnicodeString(&ClassName, Descr->name);
}
NtUserRegisterClassExWOW(
&wc,
&ClassName,
&ClassName,
&MenuName,
Descr->procA,
REGISTERCLASS_SYSTEM,
0);
}
/***********************************************************************
* PrivateCsrssRegisterBuiltinSystemWindowClasses
* ControlsInit
*
* Register the classes for the builtin controls - Private to CSRSS!
* Register the classes for the builtin controls
*/
BOOL STDCALL
PrivateCsrssRegisterBuiltinSystemWindowClasses(HWINSTA hWindowStation)
BOOL FASTCALL
ControlsInit(LPCWSTR ClassName)
{
static const struct builtin_class_descr *ClassDescriptions[] =
{
@ -43,102 +85,42 @@ PrivateCsrssRegisterBuiltinSystemWindowClasses(HWINSTA hWindowStation)
&ICONTITLE_builtin_class,
&STATIC_builtin_class
};
const struct builtin_class_descr *Descr;
int i;
for (i = 0; i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); i++)
unsigned i;
BOOL Register;
Register = FALSE;
if (IS_ATOM(ClassName))
{
WNDCLASSEXW wc;
UNICODE_STRING ClassName;
UNICODE_STRING MenuName;
Descr = ClassDescriptions[i];
wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = Descr->name;
wc.lpfnWndProc = Descr->procW;
wc.style = Descr->style;
wc.hInstance = User32Instance;
wc.hIcon = NULL;
wc.hIconSm = NULL;
/* don't load the cursor or icons! the system classes will load cursors
and icons from the resources when duplicating the classes into the
process class list - which happens when creating a window or
overwriting the classes using RegisterClass! */
wc.hCursor = (HCURSOR)Descr->cursor;
wc.hbrBackground = Descr->brush;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = Descr->extra;
MenuName.Length =
MenuName.MaximumLength = 0;
MenuName.Buffer = NULL;
if (IS_ATOM(Descr->name))
{
ClassName.Length =
ClassName.MaximumLength = 0;
ClassName.Buffer = (LPWSTR)Descr->name;
} else
{
RtlInitUnicodeString(&ClassName, Descr->name);
}
if(!NtUserRegisterClassEx(
&wc,
&ClassName,
&MenuName,
Descr->procA,
REGISTERCLASS_SYSTEM,
hWindowStation))
{
if(IS_ATOM(Descr->name))
{
DPRINT("Failed to register builtin class %ws\n", Descr->name);
}
else
{
DPRINT("Failed to register builtin class (Atom 0x%x)\n", Descr->name);
}
return FALSE;
}
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));
}
}
}
return TRUE;
}
/***********************************************************************
* PrivateCsrssRegisterSystemWindowClass
*
* Register a system window class - Private to CSRSS!
*/
ATOM STDCALL
PrivateCsrssRegisterSystemWindowClass(HWINSTA hWindowStation, WNDCLASSEXW *lpwcx, WNDPROC lpfnWndProcA)
{
UNICODE_STRING ClassName;
UNICODE_STRING MenuName;
MenuName.Length =
MenuName.MaximumLength = 0;
MenuName.Buffer = NULL;
if (IS_ATOM(lpwcx->lpszClassName))
{
ClassName.Length =
ClassName.MaximumLength = 0;
ClassName.Buffer = (LPWSTR)lpwcx->lpszClassName;
} else
{
RtlInitUnicodeString(&ClassName, lpwcx->lpszClassName);
}
return NtUserRegisterClassEx(
lpwcx,
&ClassName,
&MenuName,
lpfnWndProcA,
REGISTERCLASS_SYSTEM,
hWindowStation);
if (Register)
{
for (i = 0; i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); i++)
{
RegisterBuiltinClass(ClassDescriptions[i]);
}
}
return Register;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: misc.c,v 1.13 2004/12/21 21:38:26 weiden Exp $
/* $Id: misc.c,v 1.14 2004/12/24 17:45:58 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/misc.c
@ -64,13 +64,6 @@ PrivateCsrssInitialized(VOID)
NtUserCallNoParam(NOPARAM_ROUTINE_CSRSS_INITIALIZED);
}
BOOL
STDCALL
PrivateCsrssIsGUIActive(VOID)
{
return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_IS_GUI_ACTIVE);
}
/*
* @implemented

View file

@ -521,6 +521,10 @@ PostQuitMessage@4
PostThreadMessageA@16
PostThreadMessageW@16
PrintWindow@12
PrivateCsrssAcquireOrReleaseInputOwnership@4
PrivateCsrssRegisterPrimitive@0
PrivateCsrssManualGuiCheck@4
PrivateCsrssInitialized@0
PrivateExtractIconExA@20
PrivateExtractIconExW@20
PrivateExtractIconsA@32
@ -738,13 +742,4 @@ wsprintfW
wvsprintfA@12
wvsprintfW@12
; REACTOS PRIVATE FUNCTIONS
PrivateCsrssRegisterBuiltinSystemWindowClasses@4 NONAME
PrivateCsrssRegisterSystemWindowClass@12 NONAME
PrivateCsrssAcquireOrReleaseInputOwnership@4 NONAME
PrivateCsrssRegisterPrimitive@0 NONAME
PrivateCsrssManualGuiCheck@4 NONAME
PrivateCsrssInitialized@0 NONAME
PrivateCsrssIsGUIActive@0 NONAME
; EOF

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.54 2004/12/21 21:38:26 weiden Exp $
/* $Id: class.c,v 1.55 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -40,6 +40,8 @@ static BOOL GetClassInfoExCommon(
str = (LPWSTR)lpszClass;
else
{
extern BOOL ControlsInitialized;
if (unicode)
{
str = HEAP_strdupW ( lpszClass, wcslen(lpszClass) );
@ -61,6 +63,12 @@ static BOOL GetClassInfoExCommon(
return FALSE;
}
}
/* Register built-in controls if not already done */
if ( !ControlsInitialized )
{
ControlsInitialized = ControlsInit(str);
}
}
str2.Length = str3.Length = 0;
@ -450,13 +458,14 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
RtlCreateUnicodeStringFromAsciiz(&ClassName, lpwcx->lpszClassName);
}
Atom = NtUserRegisterClassEx(
Atom = NtUserRegisterClassExWOW(
(WNDCLASSEXW*)&WndClass,
&ClassName,
&ClassName,
&MenuName,
NULL,
REGISTERCLASS_ANSI,
NULL);
0);
if (!IS_ATOM(lpwcx->lpszMenuName))
RtlFreeUnicodeString(&MenuName);
@ -524,13 +533,14 @@ RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
RtlInitUnicodeString(&ClassName, lpwcx->lpszClassName);
}
return (ATOM)NtUserRegisterClassEx(
return (ATOM)NtUserRegisterClassExWOW(
&WndClass,
&ClassName,
&ClassName,
&MenuName,
NULL,
0,
NULL);
0);
}
/*

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.122 2004/12/21 21:38:26 weiden Exp $
/* $Id: window.c,v 1.123 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -20,6 +20,8 @@
#define NDEBUG
#include <debug.h>
BOOL ControlsInitialized = FALSE;
LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn);
/* FUNCTIONS *****************************************************************/
@ -192,6 +194,12 @@ CreateWindowExA(DWORD dwExStyle,
}
}
/* Register built-in controls if not already done */
if (! ControlsInitialized)
{
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
if (dwExStyle & WS_EX_MDICHILD)
{
if (!IS_ATOM(lpClassName))
@ -271,6 +279,12 @@ CreateWindowExW(DWORD dwExStyle,
WNDCLASSEXW wce;
HANDLE Handle;
/* Register built-in controls if not already done */
if (! ControlsInitialized)
{
ControlsInitialized = ControlsInit(lpClassName);
}
if (dwExStyle & WS_EX_MDICHILD)
return CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, x, y,
nWidth, nHeight, hWndParent, hInstance, (LPARAM)lpParam);

View file

@ -1,4 +1,4 @@
/* $Id: desktopbg.c,v 1.14 2004/12/23 18:02:12 gvg Exp $
/* $Id: desktopbg.c,v 1.15 2004/12/24 17:45:58 weiden Exp $
*
* reactos/subsys/csrss/win32csr/desktopbg.c
*
@ -21,7 +21,6 @@
#include <windows.h>
#include <csrss/csrss.h>
#include <user32/regcontrol.h>
#include "api.h"
#include "desktopbg.h"
@ -29,8 +28,6 @@
#define NDEBUG
#include <debug.h>
extern BOOL STDCALL PrivateCsrssIsGUIActive(VOID);
#define DESKTOP_WINDOW_ATOM 32880
#define PM_SHOW_DESKTOP 1
@ -56,6 +53,9 @@ typedef struct tagPRIVATE_NOTIFY_DESKTOP
};
} PRIVATE_NOTIFY_DESKTOP, *PPRIVATE_NOTIFY_DESKTOP;
static BOOL Initialized = FALSE;
static HWND VisibleDesktopWindow = NULL;
static LRESULT CALLBACK
DtbgWindowProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
@ -99,29 +99,27 @@ DtbgWindowProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
case PM_SHOW_DESKTOP:
{
LRESULT Result;
DPRINT("Show desktop: 0x%x (%d:%d)\n", Wnd, nmh->ShowDesktop.Width, nmh->ShowDesktop.Height);
Result = SetWindowPos(Wnd,
NULL, 0, 0,
nmh->ShowDesktop.Width,
nmh->ShowDesktop.Height,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
Result = ! SetWindowPos(Wnd,
NULL, 0, 0,
nmh->ShowDesktop.Width,
nmh->ShowDesktop.Height,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
UpdateWindow(Wnd);
VisibleDesktopWindow = Wnd;
return Result;
}
case PM_HIDE_DESKTOP:
{
LRESULT Result;
DPRINT("Hide desktop: 0x%x\n", Wnd);
Result = SetWindowPos(Wnd,
NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
SWP_HIDEWINDOW);
Result = ! SetWindowPos(Wnd,
NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
SWP_HIDEWINDOW);
UpdateWindow(Wnd);
VisibleDesktopWindow = NULL;
return Result;
}
@ -135,6 +133,38 @@ DtbgWindowProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
return 0;
}
static BOOL FASTCALL
DtbgInit()
{
WNDCLASSEXW Class;
ATOM ClassAtom;
/*
* 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 = GetSysColorBrush(COLOR_BACKGROUND);
Class.lpszMenuName = NULL;
Class.lpszClassName = (LPCWSTR) DESKTOP_WINDOW_ATOM;
ClassAtom = RegisterClassExW(&Class);
if ((ATOM) 0 == ClassAtom)
{
DPRINT1("Unable to register desktop background class (error %d)\n",
GetLastError());
return FALSE;
}
VisibleDesktopWindow = NULL;
return TRUE;
}
static DWORD STDCALL
DtbgDesktopThread(PVOID Data)
{
@ -170,8 +200,6 @@ DtbgDesktopThread(PVOID Data)
ThreadData->Status = STATUS_SUCCESS;
SetEvent(ThreadData->Event);
DPRINT("Desktop thread running... (wnd: 0x%x, PID:%d)\n", BackgroundWnd, GetCurrentProcessId());
while (GetMessageW(&msg, NULL, 0, 0))
{
@ -179,75 +207,28 @@ DtbgDesktopThread(PVOID Data)
DispatchMessageW(&msg);
}
DPRINT("Desktop thread terminating... (wnd: 0x%x)\n", BackgroundWnd);
return 1;
}
CSR_API(CsrRegisterSystemClasses)
{
WNDCLASSEXW wc;
/* The hWindowStation handle is only valid while processing this request! */
/*
* This routine is called when creating an interactive window station. It sets
* up all system window classes so applications and csrss can use them later.
*/
DPRINT("CsrRegisterSystemClasses\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
/*
* Register the system window classes (buttons, edit controls, ...) that are
* managed by user32
*/
if(!PrivateCsrssRegisterBuiltinSystemWindowClasses(Request->Data.RegisterSystemClassesRequest.hWindowStation))
{
DPRINT1("Unable to register builtin system window classes: LastError: %d\n", GetLastError());
return Reply->Status = STATUS_UNSUCCESSFUL;
}
/*
* Register the desktop window class
*/
wc.cbSize = sizeof(WNDCLASSEXW);
wc.style = 0;
wc.lpfnWndProc = DtbgWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = GetSysColorBrush(COLOR_BACKGROUND);
wc.lpszMenuName = NULL;
wc.lpszClassName = (LPCWSTR) DESKTOP_WINDOW_ATOM;
/* we don't support an ansi version of the window procedure, so don't specify it! */
if(!PrivateCsrssRegisterSystemWindowClass(Request->Data.RegisterSystemClassesRequest.hWindowStation,
&wc,
NULL))
{
DPRINT1("Unable to register the desktop window class: LastError: %d\n", GetLastError());
return Reply->Status = STATUS_UNSUCCESSFUL;
}
Reply->Data.RegisterSystemClassesReply.hWindowStation = Request->Data.RegisterSystemClassesRequest.hWindowStation;
return Reply->Status = STATUS_SUCCESS;
}
CSR_API(CsrCreateDesktop)
{
DTBG_THREAD_DATA ThreadData;
HANDLE ThreadHandle;
DPRINT("CsrCreateDesktop (PID:%d)\n", GetCurrentProcessId());
DPRINT("CsrCreateDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
if (! Initialized)
{
Initialized = TRUE;
if (! DtbgInit())
{
return Reply->Status = STATUS_UNSUCCESSFUL;
}
}
/*
* the desktop handle we got from win32k is in the scope of CSRSS so we can just use it
*/
@ -271,10 +252,8 @@ CSR_API(CsrCreateDesktop)
DPRINT1("Failed to create desktop window thread.\n");
return Reply->Status = STATUS_UNSUCCESSFUL;
}
/* FIXME - we should wait on the thread handle as well, it may happen that the
thread crashes or doesn't start at all, we should catch this case
instead of waiting forever! */
CloseHandle(ThreadHandle);
WaitForSingleObject(ThreadData.Event, INFINITE);
CloseHandle(ThreadData.Event);
@ -286,21 +265,10 @@ CSR_API(CsrCreateDesktop)
CSR_API(CsrShowDesktop)
{
PRIVATE_NOTIFY_DESKTOP nmh;
/* The hDesktop handle is only valid during processing this request! */
DPRINT("CsrShowDesktop\n");
DPRINT("CsrShowDesktop (hwnd: 0x%x) (PID:%d)\n", Request->Data.ShowDesktopRequest.DesktopWindow, GetCurrentProcessId());
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
/* We need to set the desktop for this thread to be able to send the messages
to the desktop thread! */
if(!SetThreadDesktop(Request->Data.ShowDesktopRequest.hDesktop))
{
DPRINT1("CsrShowDesktop: Failed to set thread desktop!\n");
return Reply->Status = STATUS_UNSUCCESSFUL;
}
nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow;
nmh.hdr.idFrom = 0;
@ -313,9 +281,7 @@ CSR_API(CsrShowDesktop)
WM_NOTIFY,
(WPARAM)nmh.hdr.hwndFrom,
(LPARAM)&nmh)
? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
DPRINT("CsrShowDesktop: SendMessageW (Status: 0x%x), LastError: %d\n", Reply->Status, GetLastError());
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
}
@ -323,21 +289,10 @@ CSR_API(CsrShowDesktop)
CSR_API(CsrHideDesktop)
{
PRIVATE_NOTIFY_DESKTOP nmh;
/* The hDesktop handle is only valid while processing this request! */
DPRINT("CsrHideDesktop (hwnd: 0x%x) (PID:%d)\n", Request->Data.ShowDesktopRequest.DesktopWindow, GetCurrentProcessId());
DPRINT("CsrHideDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
/* We need to set the desktop for this thread to be able to send the messages
to the desktop thread! */
if(!SetThreadDesktop(Request->Data.ShowDesktopRequest.hDesktop))
{
DPRINT1("CsrShowDesktop: Failed to set thread desktop!\n");
return Reply->Status = STATUS_UNSUCCESSFUL;
}
nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow;
nmh.hdr.idFrom = 0;
@ -347,7 +302,7 @@ CSR_API(CsrHideDesktop)
WM_NOTIFY,
(WPARAM)nmh.hdr.hwndFrom,
(LPARAM)&nmh)
? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
}
@ -355,10 +310,12 @@ CSR_API(CsrHideDesktop)
BOOL FASTCALL
DtbgIsDesktopVisible(VOID)
{
/* FIXME - This is a hack, it's not possible to determine whether a desktop
is visible or not unless a handle is supplied! we just check through
a private api if we're running in GUI mode */
return PrivateCsrssIsGUIActive();
if (NULL != VisibleDesktopWindow && ! IsWindowVisible(VisibleDesktopWindow))
{
VisibleDesktopWindow = NULL;
}
return NULL != VisibleDesktopWindow;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.8 2004/12/21 21:38:26 weiden Exp $
/* $Id: dllmain.c,v 1.9 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -71,7 +71,6 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_CP, CsrSetConsoleCodePage),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
CSRSS_DEFINE_API(CSRSS_REGISTER_SYSTEM_CLASSES, CsrRegisterSystemClasses),
{ 0, 0, 0, NULL }
};

View file

@ -27,7 +27,6 @@ typedef struct _WNDCLASS_OBJECT
BOOL Unicode;
BOOL Global;
LIST_ENTRY ListEntry;
LIST_ENTRY GlobalListEntry; /* HACK!!! */
PCHAR ExtraData;
/* list of windows */
FAST_MUTEX ClassWindowsListLock;
@ -73,14 +72,6 @@ ClassReferenceClassByNameOrAtom(
LPCWSTR ClassNameOrAtom,
HINSTANCE hInstance);
PWNDCLASS_OBJECT FASTCALL
IntCreateClass(
CONST WNDCLASSEXW *lpwcx,
DWORD Flags,
WNDPROC wpExtra,
PUNICODE_STRING MenuName,
RTL_ATOM Atom);
struct _WINDOW_OBJECT;
ULONG FASTCALL
IntGetClassLong(struct _WINDOW_OBJECT *WindowObject, ULONG Offset, BOOL Ansi);

View file

@ -45,7 +45,7 @@ PDESKTOP_OBJECT FASTCALL
IntGetActiveDesktop(VOID);
NTSTATUS FASTCALL
IntShowDesktop(PDESKTOP_OBJECT Desktop);
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop);

View file

@ -9,7 +9,6 @@ BOOL FASTCALL IntCreatePrimarySurface();
VOID FASTCALL IntDestroyPrimarySurface();
NTSTATUS FASTCALL InitGuiCheckImpl (VOID);
BOOL FASTCALL IntIsGUIActive(VOID);
#endif /* _WIN32K_GUICHECK_H */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dllmain.c,v 1.84 2004/12/21 21:38:26 weiden Exp $
/* $Id: dllmain.c,v 1.85 2004/12/24 17:45:58 weiden Exp $
*
* Entry Point for win32k.sys
*/
@ -88,6 +88,8 @@ Win32kProcessCallback (struct _EPROCESS *Process,
CleanupMonitorImpl();
GDI_CleanupForProcess(Process);
IntGraphicsCheck(FALSE);
/*
* Deregister logon application automatically
@ -192,8 +194,6 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
{
ObDereferenceObject(Win32Thread->Desktop);
}
IntGraphicsCheck(FALSE);
}
return STATUS_SUCCESS;

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.108 2004/12/21 04:05:18 royce Exp $
# $Id: makefile,v 1.109 2004/12/24 17:45:58 weiden Exp $
PATH_TO_TOP = ../..
@ -43,7 +43,6 @@ TARGET_CFLAGS =\
-DUNICODE \
-Wall -Werror \
-D__USE_W32API -D_WIN32_WINNT=0x0501 \
-DGDI_DEBUG \
-DWINVER=0x600 -D_WIN32K_ \
$(CFLAGS_OPT)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: class.c,v 1.63 2004/12/21 21:38:26 weiden Exp $
/* $Id: class.c,v 1.64 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -33,22 +33,11 @@
#define NDEBUG
#include <debug.h>
/* FIXME: Just a bad hack for now... */
LIST_ENTRY GlobalClassListHead;
FAST_MUTEX GlobalClassListLock;
#define IntLockGlobalClassList() \
ExAcquireFastMutex(&GlobalClassListLock)
#define IntUnlockGlobalClassList() \
ExReleaseFastMutex(&GlobalClassListLock)
/* FUNCTIONS *****************************************************************/
NTSTATUS FASTCALL
InitClassImpl(VOID)
{
ExInitializeFastMutex(&GlobalClassListLock);
InitializeListHead(&GlobalClassListHead);
return(STATUS_SUCCESS);
}
@ -66,19 +55,19 @@ ClassReferenceClassByAtom(
{
PWNDCLASS_OBJECT Current, BestMatch = NULL;
PLIST_ENTRY CurrentEntry;
/* HACK!! */
IntLockGlobalClassList();
CurrentEntry = GlobalClassListHead.Flink;
while (CurrentEntry != &GlobalClassListHead)
PW32PROCESS Process = PsGetWin32Process();
IntLockProcessClasses(Process);
CurrentEntry = Process->ClassListHead.Flink;
while (CurrentEntry != &Process->ClassListHead)
{
Current = CONTAINING_RECORD(CurrentEntry, WNDCLASS_OBJECT, GlobalListEntry);
Current = CONTAINING_RECORD(CurrentEntry, WNDCLASS_OBJECT, ListEntry);
if (Current->Atom == Atom && (hInstance == NULL || Current->hInstance == hInstance))
{
*Class = Current;
ObmReferenceObject(Current);
IntUnlockGlobalClassList();
IntUnLockProcessClasses(Process);
return TRUE;
}
@ -87,7 +76,7 @@ ClassReferenceClassByAtom(
CurrentEntry = CurrentEntry->Flink;
}
IntUnlockGlobalClassList();
IntUnLockProcessClasses(Process);
if (BestMatch != NULL)
{
@ -95,7 +84,7 @@ ClassReferenceClassByAtom(
ObmReferenceObject(BestMatch);
return TRUE;
}
return FALSE;
}
@ -370,13 +359,14 @@ IntCreateClass(
}
RTL_ATOM STDCALL
NtUserRegisterClassEx(
NtUserRegisterClassExWOW(
CONST WNDCLASSEXW* lpwcx,
PUNICODE_STRING ClassName,
PUNICODE_STRING ClassNameCopy,
PUNICODE_STRING MenuName,
WNDPROC wpAnsiWindowProc OPTIONAL, /* FIXME: Windows uses this parameter for something different. */
WNDPROC wpExtra, /* FIXME: Windows uses this parameter for something different. */
DWORD Flags,
HWINSTA hWindowStation OPTIONAL)
DWORD Unknown7)
/*
* FUNCTION:
@ -422,32 +412,7 @@ NtUserRegisterClassEx(
return (RTL_ATOM)0;
}
if(Flags & REGISTERCLASS_SYSTEM)
{
if(PsGetCurrentProcess() != CsrProcess)
{
DPRINT1("Process (ID: %d) attempted to register a system window class!\n", PsGetCurrentProcessId());
SetLastWin32Error(ERROR_ACCESS_DENIED);
return (RTL_ATOM)0;
}
Status = ObReferenceObjectByHandle(hWindowStation,
0,
ExWindowStationObjectType,
UserMode,
(PVOID*)&WinStaObject,
NULL);
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return (RTL_ATOM)0;
}
}
else
{
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
}
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
if (ClassName->Length > 0)
{
@ -460,11 +425,7 @@ NtUserRegisterClassEx(
{
DPRINT1("Failed adding class name (%S) to atom table\n",
ClassName->Buffer);
SetLastNtError(Status);
if(Flags & REGISTERCLASS_SYSTEM)
{
ObDereferenceObject(WinStaObject);
}
SetLastNtError(Status);
return((RTL_ATOM)0);
}
}
@ -472,17 +433,13 @@ NtUserRegisterClassEx(
{
Atom = (RTL_ATOM)(ULONG)ClassName->Buffer;
}
ClassObject = IntCreateClass(&SafeClass, Flags, wpAnsiWindowProc, MenuName, Atom);
ClassObject = IntCreateClass(&SafeClass, Flags, wpExtra, MenuName, Atom);
if (ClassObject == NULL)
{
if (ClassName->Length)
{
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
}
if(Flags & REGISTERCLASS_SYSTEM)
{
ObDereferenceObject(WinStaObject);
}
DPRINT("Failed creating window class object\n");
return((RTL_ATOM)0);
}
@ -490,15 +447,6 @@ NtUserRegisterClassEx(
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
IntUnLockProcessClasses(PsGetWin32Process());
/* HACK!!! */
IntLockGlobalClassList();
InsertTailList(&GlobalClassListHead, &ClassObject->GlobalListEntry);
IntUnlockGlobalClassList();
if(Flags & REGISTERCLASS_SYSTEM)
{
ObDereferenceObject(WinStaObject);
}
return(Atom);
}
@ -735,10 +683,6 @@ NtUserUnregisterClass(
ClassDereferenceObject(Class);
RemoveEntryList(&Class->ListEntry);
IntLockGlobalClassList();
RemoveEntryList(&Class->GlobalListEntry);
IntUnlockGlobalClassList();
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Class->Atom);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: desktop.c,v 1.29 2004/12/21 21:38:27 weiden Exp $
* $Id: desktop.c,v 1.30 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -47,6 +47,7 @@ ObFindHandleForObject(IN PEPROCESS Process,
/* Currently active desktop */
PDESKTOP_OBJECT InputDesktop = NULL;
HDESK InputDesktopHandle = NULL;
HDC ScreenDeviceContext = NULL;
BOOL g_PaintDesktopVersion = FALSE;
@ -447,94 +448,42 @@ BOOL FASTCALL IntDesktopUpdatePerUserSettings(BOOL bEnable)
/* PUBLIC FUNCTIONS ***********************************************************/
NTSTATUS FASTCALL
IntShowDesktop(PDESKTOP_OBJECT Desktop)
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
SIZEL DesktopSize;
PDC dc;
HDC hDC;
IntGraphicsCheck(TRUE);
hDC = IntGetScreenDC();
if(hDC != NULL && (dc = DC_LockDc(hDC)))
{
BITMAPOBJ *BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
if(BitmapObj != NULL)
{
DesktopSize.cx = BitmapObj->SurfObj.sizlBitmap.cx;
DesktopSize.cy = BitmapObj->SurfObj.sizlBitmap.cy;
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
}
DC_UnlockDc(hDC);
}
else
{
DPRINT1("Failed to query screen size!\n");
IntGraphicsCheck(FALSE);
return STATUS_UNSUCCESSFUL;
}
DPRINT1("IntShowDesktop: 0x%x, %d, %d\n", Desktop->DesktopWindow, DesktopSize.cx, DesktopSize.cy);
Status = CsrInsertObject((PVOID)Desktop,
NULL,
GENERIC_ALL,
0,
NULL,
(HANDLE*)&Request.Data.ShowDesktopRequest.hDesktop);
if (NT_SUCCESS(Status))
{
Request.Type = CSRSS_SHOW_DESKTOP;
Request.Data.ShowDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
Request.Data.ShowDesktopRequest.Width = DesktopSize.cx;
Request.Data.ShowDesktopRequest.Height = DesktopSize.cy;
Status = CsrNotify(&Request, &Reply);
CsrCloseHandle(Request.Data.ShowDesktopRequest.hDesktop);
}
if(!NT_SUCCESS(Status))
{
DPRINT1("IntShowDesktop: Failed to notify CSRSS!\n");
IntGraphicsCheck(FALSE);
}
Request.Type = CSRSS_SHOW_DESKTOP;
Request.Data.ShowDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
Request.Data.ShowDesktopRequest.Width = Width;
Request.Data.ShowDesktopRequest.Height = Height;
return Status;
return CsrNotify(&Request, &Reply);
}
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop)
{
#if 0
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
Status = CsrInsertObject((PVOID)Desktop,
NULL,
GENERIC_ALL,
0,
NULL,
(HANDLE*)&Request.Data.HideDesktopRequest.hDesktop);
if(NT_SUCCESS(Status))
{
Request.Type = CSRSS_HIDE_DESKTOP;
Request.Data.HideDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
Status = CsrNotify(&Request, &Reply);
CsrCloseHandle(Request.Data.HideDesktopRequest.hDesktop);
}
if(NT_SUCCESS(Status))
{
IntGraphicsCheck(FALSE);
}
return Status;
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
}
/*
@ -847,15 +796,30 @@ NtUserOpenInputDesktop(
BOOL fInherit,
ACCESS_MASK dwDesiredAccess)
{
PDESKTOP_OBJECT Object;
NTSTATUS Status;
HDESK Desktop;
DPRINT("About to open input desktop\n");
/* Get a pointer to the desktop object */
Status = IntValidateDesktopHandle(
InputDesktopHandle,
UserMode,
0,
&Object);
if (!NT_SUCCESS(Status))
{
DPRINT("Validation of input desktop handle (0x%X) failed\n", InputDesktop);
return (HDESK)0;
}
/* Create a new handle to the object */
Status = ObOpenObjectByPointer(
InputDesktop,
Object,
0,
NULL,
dwDesiredAccess,
@ -863,6 +827,8 @@ NtUserOpenInputDesktop(
UserMode,
(HANDLE*)&Desktop);
ObDereferenceObject(Object);
if (NT_SUCCESS(Status))
{
DPRINT("Successfully opened input desktop\n");
@ -1089,7 +1055,7 @@ NtUserPaintDesktop(HDC hDC)
BOOL STDCALL
NtUserSwitchDesktop(HDESK hDesktop)
{
PDESKTOP_OBJECT DesktopObject, PreviousDesktop;
PDESKTOP_OBJECT DesktopObject;
NTSTATUS Status;
DPRINT("About to switch desktop (0x%X)\n", hDesktop);
@ -1124,26 +1090,12 @@ NtUserSwitchDesktop(HDESK hDesktop)
/* FIXME: Connect to input device */
/* Set the active desktop in the desktop's window station. */
PreviousDesktop = InterlockedExchangePointer(&DesktopObject->WindowStation->ActiveDesktop, DesktopObject);
if(PreviousDesktop != DesktopObject)
{
/* FIXME - nasty hack... */
DesktopObject->WindowStation->ActiveDesktop = DesktopObject;
if(PreviousDesktop != NULL)
{
IntHideDesktop(PreviousDesktop);
}
/* Set the global state. */
InputDesktop = DesktopObject;
InputWindowStation = DesktopObject->WindowStation;
/* FIXME - HACK! This is only because we want GUI on demand! */
if(IntIsGUIActive())
{
IntShowDesktop(DesktopObject);
}
}
/* Set the global state. */
InputDesktop = DesktopObject;
InputDesktopHandle = hDesktop;
InputWindowStation = DesktopObject->WindowStation;
ObDereferenceObject(DesktopObject);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: guicheck.c,v 1.21 2004/12/21 21:38:27 weiden Exp $
/* $Id: guicheck.c,v 1.22 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -79,12 +79,6 @@ RemoveGuiApp(PW32PROCESS W32Data)
}
}
BOOL FASTCALL
IntIsGUIActive(VOID)
{
return NrGuiAppsRunning > 0;
}
BOOL FASTCALL
IntGraphicsCheck(BOOL Create)
{

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.93 2004/12/21 21:38:27 weiden Exp $
/* $Id: misc.c,v 1.94 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -134,10 +134,6 @@ NtUserCallNoParam(DWORD Routine)
case NOPARAM_ROUTINE_GDI_QUERY_TABLE:
Result = (DWORD)GDI_MapHandleTable(NtCurrentProcess());
break;
case NOPARAM_ROUTINE_IS_GUI_ACTIVE:
Result = (DWORD)IntIsGUIActive();
break;
default:
DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: winsta.c,v 1.69 2004/12/21 21:38:27 weiden Exp $
* $Id: winsta.c,v 1.70 2004/12/24 17:45:58 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -199,11 +199,6 @@ IntInitializeDesktopGraphics(VOID)
NtUserAcquireOrReleaseInputOwnership(FALSE);
/* FIXME - HACK - this is to restore the previously visible desktop! */
if(IntGetActiveDesktop() != NULL)
{
IntShowDesktop(IntGetActiveDesktop());
}
return TRUE;
}
@ -227,39 +222,6 @@ IntGetScreenDC(VOID)
return ScreenDeviceContext;
}
NTSTATUS FASTCALL
IntRegisterSystemWindowClasses(PWINSTATION_OBJECT WinStaObject)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
HWINSTA hWindowStation;
NTSTATUS Status;
/*
* Create a valid handle for CSRSS
*/
Status = CsrInsertObject((PVOID)WinStaObject,
NULL,
GENERIC_ALL,
0,
NULL,
(HANDLE*)&hWindowStation);
if (!NT_SUCCESS(Status))
{
return Status;
}
Request.Type = CSRSS_REGISTER_SYSTEM_CLASSES;
Request.Data.RegisterSystemClassesRequest.hWindowStation = hWindowStation;
Status = CsrNotify(&Request, &Reply);
CsrCloseHandle(hWindowStation);
return Status;
}
/* PUBLIC FUNCTIONS ***********************************************************/
/*
@ -380,6 +342,23 @@ NtUserCreateWindowStation(
return 0;
}
Status = ObInsertObject(
(PVOID)WindowStationObject,
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
(PVOID*)&WindowStation);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed creating window station (%wZ)\n", &WindowStationName);
ExFreePool(WindowStationName.Buffer);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
ObDereferenceObject(WindowStationObject);
return 0;
}
/*
* Initialize the new window station object
*/
@ -404,8 +383,6 @@ NtUserCreateWindowStation(
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return 0;
}
WindowStationObject->ActiveDesktop = NULL;
InitHotKeys(WindowStationObject);
@ -426,50 +403,12 @@ NtUserCreateWindowStation(
CurInfo->DblClickHeight = 4;
WindowStationObject->SystemCursor = CurInfo;
if (!IntSetupCurIconHandles(WindowStationObject))
{
DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
/* FIXME: Complain more loudly? */
}
Status = ObInsertObject(
(PVOID)WindowStationObject,
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
(PVOID*)&WindowStation);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed creating window station (%wZ)\n", &WindowStationName);
ExFreePool(WindowStationName.Buffer);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
ObDereferenceObject(WindowStationObject);
return 0;
}
/* Register the system window classes by CSRSS. This works even though CSRSS
is not assigned to a window station (because it can't!). The desktop
background windows however will be created by CSRSS when needed. This is
NOT a hack because CSRSS can manage multiple desktops in different window
stations, so whenever CSRSS uses win32 api, the window station is determined
by the desktop the calling thread is attached to. The reason it works is that
we pass the window station handle to NtUserRegisterClass when registering
a system window class - which is only possible in the context of CSRSS so
no other application can mess with this. We need to pass that handle so
it knows where to register the classes in - basically because at this point
CSRSS can't be assigned to any desktop - which would be required to register
regular window classes. This is NOT a hack, it's the only clean and consistent
way to do what we need to do.
- Thomas */
if(!NT_SUCCESS(IntRegisterSystemWindowClasses(WindowStationObject)))
{
DPRINT1("Registering the desktop window class failed!\n");
/* FIXME: Complain more loudly? */
}
DPRINT("Window station successfully created (%wZ)\n", &WindowStationName);
ExFreePool(WindowStationName.Buffer);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dc.c,v 1.154 2004/12/21 21:38:27 weiden Exp $
/* $Id: dc.c,v 1.155 2004/12/24 17:45:59 weiden Exp $
*
* DC.C - Device context functions
*
@ -664,6 +664,7 @@ IntCreatePrimarySurface()
/* FIXME - why does EngEraseSurface() sometimes crash?
EngEraseSurface(SurfObj, &SurfaceRect, 0); */
EngUnlockSurface(SurfObj);
IntShowDesktop(IntGetActiveDesktop(), SurfSize.cx, SurfSize.cy);
break;
}