Commit in reactos on MAIN
iface/addsys/w32ksvc.db+1-11.55 -> 1.56
include/csrss/csrss.h-171.50 -> 1.51
include/user32/regcontrol.h+3-41.9 -> 1.10
include/win32k/ntuser.h+3-31.142 -> 1.143
lib/kernel32/misc/console.c+60-931.88 -> 1.89
lib/ntdll/csr/lpc.c+2-51.14 -> 1.15
lib/user32/controls/regcontrol.c+83-1011.21 -> 1.22
lib/user32/misc/misc.c+1-81.13 -> 1.14
lib/user32/user32.def+4-91.46 -> 1.47
lib/user32/windows/class.c+15-51.54 -> 1.55
                  /window.c+15-11.122 -> 1.123
subsys/csrss/win32csr/desktopbg.c+68-1111.14 -> 1.15
                     /dllmain.c+1-21.8 -> 1.9
subsys/win32k/include/class.h-91.26 -> 1.27
                     /desktop.h+1-11.12 -> 1.13
                     /guicheck.h-11.11 -> 1.12
subsys/win32k/main/dllmain.c+3-31.84 -> 1.85
subsys/win32k/makefile+1-21.108 -> 1.109
subsys/win32k/ntuser/class.c+18-741.63 -> 1.64
                    /desktop.c+49-971.29 -> 1.30
                    /guicheck.c+1-71.21 -> 1.22
                    /misc.c+1-51.93 -> 1.94
                    /winsta.c+19-801.69 -> 1.70
subsys/win32k/objects/dc.c+2-11.154 -> 1.155
+351-640
24 modified files
revert my temporary class hacks and remove my desktop handling changes temporarily as they cause some trouble

reactos/iface/addsys
w32ksvc.db 1.55 -> 1.56
diff -u -r1.55 -r1.56
--- w32ksvc.db	21 Dec 2004 21:38:25 -0000	1.55
+++ w32ksvc.db	24 Dec 2004 17:45:57 -0000	1.56
@@ -464,7 +464,7 @@
 NtUserReleaseDC				2
 NtUserRealChildWindowFromPoint          3
 NtUserRedrawWindow                      4
-NtUserRegisterClassEx                   6
+NtUserRegisterClassExWOW                7
 NtUserRegisterHotKey                    4
 NtUserRegisterTasklist                  1
 NtUserRegisterWindowMessage             1

reactos/include/csrss
csrss.h 1.50 -> 1.51
diff -u -r1.50 -r1.51
--- csrss.h	21 Dec 2004 21:38:25 -0000	1.50
+++ csrss.h	24 Dec 2004 17:45:57 -0000	1.51
@@ -70,8 +70,6 @@
 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
 {
-  HDESK hDesktop;
   HWND DesktopWindow;
   ULONG Width;
   ULONG Height;
@@ -547,7 +544,6 @@
 
 typedef struct
 {
-  HDESK hDesktop;
   HWND DesktopWindow;
 } CSRSS_HIDE_DESKTOP_REQUEST, *PCSRSS_HIDE_DESKTOP_REQUEST;
 
@@ -619,16 +615,6 @@
   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 @@
 #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 @@
         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 @@
         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;
     };
   };

reactos/include/user32
regcontrol.h 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- regcontrol.h	21 Dec 2004 21:38:25 -0000	1.9
+++ regcontrol.h	24 Dec 2004 17:45:57 -0000	1.10
@@ -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 @@
     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 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 */

reactos/include/win32k
ntuser.h 1.142 -> 1.143
diff -u -r1.142 -r1.143
--- ntuser.h	21 Dec 2004 21:38:25 -0000	1.142
+++ ntuser.h	24 Dec 2004 17:45:57 -0000	1.143
@@ -164,7 +164,6 @@
 #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 @@
 #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

reactos/lib/kernel32/misc
console.c 1.88 -> 1.89
diff -u -r1.88 -r1.89
--- console.c	21 Dec 2004 21:38:25 -0000	1.88
+++ console.c	24 Dec 2004 17:45:57 -0000	1.89
@@ -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 @@
  */
 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 @@
 	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 @@
    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 @@
                     LPDWORD lpNumberOfEventsRead,
                     BOOL bUnicode)
 {
-  CSRSS_API_REQUEST Request;
+  PCSRSS_API_REQUEST Request;
   CSRSS_API_REPLY Reply;
   NTSTATUS Status;
   PVOID BufferBase;
@@ -1639,24 +1576,34 @@
     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 @@
                      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 @@
     SetLastErrorByStatus(Status);
     return FALSE;
   }
+  
+  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;
+  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,
+  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 @@
   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 @@
                       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 @@
       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;

reactos/lib/ntdll/csr
lpc.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- lpc.c	21 Dec 2004 21:38:26 -0000	1.14
+++ lpc.c	24 Dec 2004 17:45:57 -0000	1.15
@@ -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 @@
     {
       return(STATUS_NO_MEMORY);
     }
-  if(ParameterBuffer != NULL)
-  {
-    memcpy(Block, ParameterBuffer, ParameterBufferSize);
-  }
+  memcpy(Block, ParameterBuffer, ParameterBufferSize);
   *ClientAddress = Block;
   *ServerAddress = Block - CsrSectionMapBase + CsrSectionMapServerBase;
   return(STATUS_SUCCESS);

reactos/lib/user32/controls
regcontrol.c 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- regcontrol.c	21 Dec 2004 21:38:26 -0000	1.21
+++ regcontrol.c	24 Dec 2004 17:45:58 -0000	1.22
@@ -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 @@
       &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);
-   }
+  if (Register)
+    {
+      for (i = 0; i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); i++)
+        {
+          RegisterBuiltinClass(ClassDescriptions[i]);
+        }
+    }
 
-   return NtUserRegisterClassEx(
-      lpwcx,
-      &ClassName,
-      &MenuName,
-      lpfnWndProcA,
-      REGISTERCLASS_SYSTEM,
-      hWindowStation);
+  return Register;
 }

reactos/lib/user32/misc
misc.c 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- misc.c	21 Dec 2004 21:38:26 -0000	1.13
+++ misc.c	24 Dec 2004 17:45:58 -0000	1.14
@@ -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 @@
   NtUserCallNoParam(NOPARAM_ROUTINE_CSRSS_INITIALIZED);
 }
 
-BOOL
-STDCALL
-PrivateCsrssIsGUIActive(VOID)
-{
-  return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_IS_GUI_ACTIVE);
-}
-
 
 /*
  * @implemented

reactos/lib/user32
user32.def 1.46 -> 1.47
diff -u -r1.46 -r1.47
--- user32.def	21 Dec 2004 21:38:26 -0000	1.46
+++ user32.def	24 Dec 2004 17:45:58 -0000	1.47
@@ -521,6 +521,10 @@
 PostThreadMessageA@16
 PostThreadMessageW@16
 PrintWindow@12
+PrivateCsrssAcquireOrReleaseInputOwnership@4
+PrivateCsrssRegisterPrimitive@0
+PrivateCsrssManualGuiCheck@4
+PrivateCsrssInitialized@0
 PrivateExtractIconExA@20
 PrivateExtractIconExW@20
 PrivateExtractIconsA@32
@@ -738,13 +742,4 @@
 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

reactos/lib/user32/windows
class.c 1.54 -> 1.55
diff -u -r1.54 -r1.55
--- class.c	21 Dec 2004 21:38:26 -0000	1.54
+++ class.c	24 Dec 2004 17:45:58 -0000	1.55
@@ -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 @@
     str = (LPWSTR)lpszClass;
   else
   {
+    extern BOOL ControlsInitialized;
+
     if (unicode)
     {
         str = HEAP_strdupW ( lpszClass, wcslen(lpszClass) );
@@ -61,6 +63,12 @@
             return FALSE;
         }
     }
+
+    /* Register built-in controls if not already done */
+    if ( !ControlsInitialized )
+    {
+      ControlsInitialized = ControlsInit(str);
+    }
   }
 
   str2.Length = str3.Length = 0;
@@ -450,13 +458,14 @@
       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 @@
       RtlInitUnicodeString(&ClassName, lpwcx->lpszClassName);
    }
 
-   return (ATOM)NtUserRegisterClassEx(
+   return (ATOM)NtUserRegisterClassExWOW(
       &WndClass,
       &ClassName,
+      &ClassName,
       &MenuName,
       NULL,
       0,
-      NULL);
+      0);
 }
 
 /*

reactos/lib/user32/windows
window.c 1.122 -> 1.123
diff -u -r1.122 -r1.123
--- window.c	21 Dec 2004 21:38:26 -0000	1.122
+++ window.c	24 Dec 2004 17:45:58 -0000	1.123
@@ -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 @@
 	}
     }
 
+  /* 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 @@
   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);

reactos/subsys/csrss/win32csr
desktopbg.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- desktopbg.c	23 Dec 2004 18:02:12 -0000	1.14
+++ desktopbg.c	24 Dec 2004 17:45:58 -0000	1.15
@@ -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 @@
   };
 } 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 @@
           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 @@
   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 @@
 
   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 @@
       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 @@
       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(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 @@
                                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(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 @@
                                WM_NOTIFY,
                                (WPARAM)nmh.hdr.hwndFrom,
                                (LPARAM)&nmh)
-                  ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
+                  ? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
 
   return Reply->Status;
 }
@@ -355,10 +310,12 @@
 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 */

reactos/subsys/csrss/win32csr
dllmain.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- dllmain.c	21 Dec 2004 21:38:26 -0000	1.8
+++ dllmain.c	24 Dec 2004 17:45:58 -0000	1.9
@@ -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 @@
     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 }
   };
 

reactos/subsys/win32k/include
class.h 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- class.h	21 Dec 2004 21:38:26 -0000	1.26
+++ class.h	24 Dec 2004 17:45:58 -0000	1.27
@@ -27,7 +27,6 @@
   BOOL Unicode;
   BOOL Global;
   LIST_ENTRY ListEntry;
-  LIST_ENTRY GlobalListEntry; /* HACK!!! */
   PCHAR   ExtraData;
   /* list of windows */
   FAST_MUTEX ClassWindowsListLock;
@@ -73,14 +72,6 @@
    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);

reactos/subsys/win32k/include
desktop.h 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- desktop.h	21 Dec 2004 21:38:26 -0000	1.12
+++ desktop.h	24 Dec 2004 17:45:58 -0000	1.13
@@ -45,7 +45,7 @@
 IntGetActiveDesktop(VOID);
 
 NTSTATUS FASTCALL
-IntShowDesktop(PDESKTOP_OBJECT Desktop);
+IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
 
 NTSTATUS FASTCALL
 IntHideDesktop(PDESKTOP_OBJECT Desktop);

reactos/subsys/win32k/include
guicheck.h 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- guicheck.h	21 Dec 2004 21:38:26 -0000	1.11
+++ guicheck.h	24 Dec 2004 17:45:58 -0000	1.12
@@ -9,7 +9,6 @@
 VOID FASTCALL IntDestroyPrimarySurface();
 
 NTSTATUS FASTCALL InitGuiCheckImpl (VOID);
-BOOL FASTCALL IntIsGUIActive(VOID);
 
 #endif /* _WIN32K_GUICHECK_H */
 

reactos/subsys/win32k/main
dllmain.c 1.84 -> 1.85
diff -u -r1.84 -r1.85
--- dllmain.c	21 Dec 2004 21:38:26 -0000	1.84
+++ dllmain.c	24 Dec 2004 17:45:58 -0000	1.85
@@ -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 @@
       CleanupMonitorImpl();
 
       GDI_CleanupForProcess(Process);
+
+      IntGraphicsCheck(FALSE);
       
       /*
        * Deregister logon application automatically
@@ -192,8 +194,6 @@
       {
         ObDereferenceObject(Win32Thread->Desktop);
       }
-      
-      IntGraphicsCheck(FALSE);
     }
 
   return STATUS_SUCCESS;

reactos/subsys/win32k
makefile 1.108 -> 1.109
diff -u -r1.108 -r1.109
--- makefile	21 Dec 2004 04:05:18 -0000	1.108
+++ makefile	24 Dec 2004 17:45:58 -0000	1.109
@@ -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 @@
  -DUNICODE \
  -Wall -Werror \
  -D__USE_W32API -D_WIN32_WINNT=0x0501 \
- -DGDI_DEBUG \
  -DWINVER=0x600 -D_WIN32K_ \
  $(CFLAGS_OPT)
 

reactos/subsys/win32k/ntuser
class.c 1.63 -> 1.64
diff -u -r1.63 -r1.64
--- class.c	21 Dec 2004 21:38:26 -0000	1.63
+++ class.c	24 Dec 2004 17:45:58 -0000	1.64
@@ -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 @@
 {
    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 @@
 
       CurrentEntry = CurrentEntry->Flink;
    }
-   IntUnlockGlobalClassList();
+   IntUnLockProcessClasses(Process);
 
    if (BestMatch != NULL)
    {
@@ -95,7 +84,7 @@
       ObmReferenceObject(BestMatch);
       return TRUE;
    }
-  
+
    return FALSE;
 }
 
@@ -370,13 +359,14 @@
 }
 
 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 @@
       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 @@
     {
       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 @@
   {
     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 @@
   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 @@
    ClassDereferenceObject(Class);
   
    RemoveEntryList(&Class->ListEntry);
-   
-   IntLockGlobalClassList();
-   RemoveEntryList(&Class->GlobalListEntry);
-   IntUnlockGlobalClassList();
 
    RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Class->Atom);
   

reactos/subsys/win32k/ntuser
desktop.c 1.29 -> 1.30
diff -u -r1.29 -r1.30
--- desktop.c	21 Dec 2004 21:38:27 -0000	1.29
+++ desktop.c	24 Dec 2004 17:45:58 -0000	1.30
@@ -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 @@
 
 /* Currently active desktop */
 PDESKTOP_OBJECT InputDesktop = NULL;
+HDESK InputDesktopHandle = NULL; 
 HDC ScreenDeviceContext = NULL;
 
 BOOL g_PaintDesktopVersion = FALSE;
@@ -447,94 +448,42 @@
 /* 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 @@
    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 @@
       UserMode,
       (HANDLE*)&Desktop);
 
+   ObDereferenceObject(Object);
+
    if (NT_SUCCESS(Status))
    {
       DPRINT("Successfully opened input desktop\n");
@@ -1089,7 +1055,7 @@
 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 @@
    /* 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... */
-
-      if(PreviousDesktop != NULL)
-      {
-         IntHideDesktop(PreviousDesktop);
-      }
-      
-      /* Set the global state. */
-      InputDesktop = DesktopObject;
-      InputWindowStation = DesktopObject->WindowStation;
+   DesktopObject->WindowStation->ActiveDesktop = DesktopObject;
 
-      /* 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);
 

reactos/subsys/win32k/ntuser
guicheck.c 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- guicheck.c	21 Dec 2004 21:38:27 -0000	1.21
+++ guicheck.c	24 Dec 2004 17:45:58 -0000	1.22
@@ -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
@@ -80,12 +80,6 @@
 }
 
 BOOL FASTCALL
-IntIsGUIActive(VOID)
-{
-  return NrGuiAppsRunning > 0;
-}
-
-BOOL FASTCALL
 IntGraphicsCheck(BOOL Create)
 {
   PW32PROCESS W32Data;

reactos/subsys/win32k/ntuser
misc.c 1.93 -> 1.94
diff -u -r1.93 -r1.94
--- misc.c	21 Dec 2004 21:38:27 -0000	1.93
+++ misc.c	24 Dec 2004 17:45:58 -0000	1.94
@@ -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 @@
     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);

reactos/subsys/win32k/ntuser
winsta.c 1.69 -> 1.70
diff -u -r1.69 -r1.70
--- winsta.c	21 Dec 2004 21:38:27 -0000	1.69
+++ winsta.c	24 Dec 2004 17:45:58 -0000	1.70
@@ -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 @@
   
   NtUserAcquireOrReleaseInputOwnership(FALSE);
 
-  /* FIXME - HACK - this is to restore the previously visible desktop! */
-  if(IntGetActiveDesktop() != NULL)
-  {
-    IntShowDesktop(IntGetActiveDesktop());
-  }
   return TRUE;
 }
 
@@ -227,39 +222,6 @@
    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 @@
       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 @@
       SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
       return 0;
    }
-   
-   WindowStationObject->ActiveDesktop = NULL;
   
    InitHotKeys(WindowStationObject);
   
@@ -426,50 +403,12 @@
    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);

reactos/subsys/win32k/objects
dc.c 1.154 -> 1.155
diff -u -r1.154 -r1.155
--- dc.c	21 Dec 2004 21:38:27 -0000	1.154
+++ dc.c	24 Dec 2004 17:45:59 -0000	1.155
@@ -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 @@
       /* FIXME - why does EngEraseSurface() sometimes crash?
         EngEraseSurface(SurfObj, &SurfaceRect, 0); */
       EngUnlockSurface(SurfObj);
+      IntShowDesktop(IntGetActiveDesktop(), SurfSize.cx, SurfSize.cy);
       break;
    }
 
CVSspam 0.2.8