Commit in reactos on MAIN
include/win32k/ntuser.h+11.135 -> 1.136
subsys/win32k/makefile+7-71.99 -> 1.100
             /w32k.h+11.2 -> 1.3
subsys/win32k/include/csr.h+18added 1.1
subsys/win32k/ntuser/csr.c+79added 1.1
                    /desktop.c+3-441.14 -> 1.15
                    /misc.c+6-21.75 -> 1.76
lib/user32/user32.def+11.42 -> 1.43
          /user32.edf+11.36 -> 1.37
lib/user32/misc/misc.c+9-21.4 -> 1.5
subsys/csrss/init.c+60-31.26 -> 1.27
            /makefile+3-31.28 -> 1.29
subsys/csrss/include/csrplugin.h+5-21.1 -> 1.2
subsys/csrss/win32csr/dllmain.c+11-11.4 -> 1.5
                     /win32csr.edf+2-21.1 -> 1.2
+207-66
2 added + 13 modified, total 15 files
Clean up calls from win32k to csrss

reactos/include/win32k
ntuser.h 1.135 -> 1.136
diff -u -r1.135 -r1.136
--- ntuser.h	21 May 2004 10:09:31 -0000	1.135
+++ ntuser.h	28 May 2004 21:33:40 -0000	1.136
@@ -162,6 +162,7 @@
 #define NOPARAM_ROUTINE_INIT_MESSAGE_PUMP	0xffff0004
 #define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO	0xffff0005
 #define NOPARAM_ROUTINE_ANYPOPUP	0xffff0006
+#define NOPARAM_ROUTINE_CSRSS_INITIALIZED	0xffff0007
 DWORD
 STDCALL
 NtUserCallNoParam(

reactos/subsys/win32k
makefile 1.99 -> 1.100
diff -u -r1.99 -r1.100
--- makefile	13 May 2004 19:29:47 -0000	1.99
+++ makefile	28 May 2004 21:33:40 -0000	1.100
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.99 2004/05/13 19:29:47 jfilby Exp $
+# $Id: makefile,v 1.100 2004/05/28 21:33:40 gvg Exp $
 
 PATH_TO_TOP = ../..
 
@@ -54,12 +54,12 @@
 LDR_OBJECTS = ldr/loader.o
 
 NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o \
-                 ntuser/clipboard.o ntuser/focus.o ntuser/desktop.o ntuser/guicheck.o \
-                 ntuser/hook.o ntuser/hotkey.o ntuser/input.o ntuser/keyboard.o \
-                 ntuser/menu.o ntuser/message.o ntuser/metric.o ntuser/misc.o \
-                 ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o ntuser/scrollbar.o \
-                 ntuser/stubs.o ntuser/timer.o ntuser/useratom.o ntuser/vis.o \
-                 ntuser/windc.o ntuser/window.o ntuser/winpos.o ntuser/winsta.o
+                 ntuser/clipboard.o ntuser/csr.o ntuser/focus.o ntuser/desktop.o \
+                 ntuser/guicheck.o ntuser/hook.o ntuser/hotkey.o ntuser/input.o \
+                 ntuser/keyboard.o ntuser/menu.o ntuser/message.o ntuser/metric.o \
+                 ntuser/misc.o ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o \
+                 ntuser/scrollbar.o ntuser/stubs.o ntuser/timer.o ntuser/useratom.o \
+                 ntuser/vis.o ntuser/windc.o ntuser/window.o ntuser/winpos.o ntuser/winsta.o
 
 OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o  \
                   objects/color.o objects/coord.o objects/dc.o  \

reactos/subsys/win32k
w32k.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- w32k.h	15 May 2004 16:17:59 -0000	1.2
+++ w32k.h	28 May 2004 21:33:40 -0000	1.3
@@ -34,6 +34,7 @@
 #include <include/cleanup.h>
 #include <include/clipboard.h>
 #include <include/color.h>
+#include <include/csr.h>
 #include <include/cursoricon.h>
 #include <include/dce.h>
 #include <include/desktop.h>

reactos/subsys/win32k/include
csr.h added at 1.1
diff -N csr.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ csr.h	28 May 2004 21:33:41 -0000	1.1
@@ -0,0 +1,18 @@
+/* $Id: csr.h,v 1.1 2004/05/28 21:33:41 gvg Exp $
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * PURPOSE:          Interface to csrss
+ * FILE:             subsys/win32k/include/csr.h
+ * PROGRAMER:        Ge van Geldorp (ge@gse.nl)
+ */
+
+#ifndef CSR_H_INCLUDED
+#define CSR_H_INCLUDED
+
+extern NTSTATUS FASTCALL CsrInit(void);
+extern NTSTATUS FASTCALL CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply);
+
+#endif /* CSR_H_INCLUDED */
+
+/* EOF */

reactos/subsys/win32k/ntuser
csr.c added at 1.1
diff -N csr.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ csr.c	28 May 2004 21:33:41 -0000	1.1
@@ -0,0 +1,79 @@
+/* $Id: csr.c,v 1.1 2004/05/28 21:33:41 gvg Exp $
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * PURPOSE:          Interface to csrss
+ * FILE:             subsys/win32k/ntuser/csr.c
+ * PROGRAMER:        Ge van Geldorp (ge@gse.nl)
+ */
+
+#include <w32k.h>
+
+static HANDLE WindowsApiPort = NULL;
+static PEPROCESS CsrProcess = NULL;
+
+NTSTATUS FASTCALL
+CsrInit(void)
+{
+  NTSTATUS Status;
+  UNICODE_STRING PortName;
+  ULONG ConnectInfoLength;
+
+  RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
+  ConnectInfoLength = 0;
+  Status = ZwConnectPort(&WindowsApiPort,
+                         &PortName,
+                         NULL,
+                         NULL,
+                         NULL,
+                         NULL,
+                         NULL,
+                         &ConnectInfoLength);
+  if (! NT_SUCCESS(Status))
+    {
+      return Status;
+    }
+
+  CsrProcess = PsGetCurrentProcess();
+
+  return STATUS_SUCCESS;
+}
+
+
+NTSTATUS FASTCALL
+CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
+{
+  NTSTATUS Status;
+  PEPROCESS OldProcess;
+
+  if (NULL == CsrProcess)
+    {
+      return STATUS_INVALID_PORT_HANDLE;
+    }
+
+  Request->Header.DataSize = sizeof(CSRSS_API_REQUEST) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.MessageSize = sizeof(CSRSS_API_REQUEST);
+
+  /* Switch to the process in which the WindowsApiPort handle is valid */
+  OldProcess = PsGetCurrentProcess();
+  if (CsrProcess != OldProcess)
+    {
+      KeAttachProcess(CsrProcess);
+    }
+  Status = ZwRequestWaitReplyPort(WindowsApiPort,
+                                  &Request->Header,
+                                  &Reply->Header);
+  if (CsrProcess != OldProcess)
+    {
+      KeDetachProcess();
+    }
+
+  if (NT_SUCCESS(Status))
+    {
+      Status = Reply->Status;
+    }
+
+  return STATUS_SUCCESS;
+}
+
+/* EOF */

reactos/subsys/win32k/ntuser
desktop.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- desktop.c	10 May 2004 17:07:18 -0000	1.14
+++ desktop.c	28 May 2004 21:33:41 -0000	1.15
@@ -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.14 2004/05/10 17:07:18 weiden Exp $
+ *  $Id: desktop.c,v 1.15 2004/05/28 21:33:41 gvg Exp $
  *
  *  COPYRIGHT:        See COPYING in the top level directory
  *  PROJECT:          ReactOS kernel
@@ -207,47 +207,6 @@
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
-
-static NTSTATUS FASTCALL
-NotifyCsrss(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
-{
-  NTSTATUS Status;
-  UNICODE_STRING PortName;
-  ULONG ConnectInfoLength;
-  static HANDLE WindowsApiPort = NULL;
-
-  RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
-  ConnectInfoLength = 0;
-  Status = ZwConnectPort(&WindowsApiPort,
-                         &PortName,
-                         NULL,
-                         NULL,
-                         NULL,
-                         NULL,
-                         NULL,
-                         &ConnectInfoLength);
-  if (! NT_SUCCESS(Status))
-    {
-      return Status;
-    }
-
-   Request->Header.DataSize = sizeof(CSRSS_API_REQUEST) - LPC_MESSAGE_BASE_SIZE;
-   Request->Header.MessageSize = sizeof(CSRSS_API_REQUEST);
-   
-   Status = ZwRequestWaitReplyPort(WindowsApiPort,
-				   &Request->Header,
-				   &Reply->Header);
-   if (! NT_SUCCESS(Status) || ! NT_SUCCESS(Status = Reply->Status))
-     {
-       ZwClose(WindowsApiPort);
-       return Status;
-     }
-
-//  ZwClose(WindowsApiPort);
-
-  return STATUS_SUCCESS;
-}
-
 NTSTATUS FASTCALL
 IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height)
 {
@@ -259,7 +218,7 @@
   Request.Data.ShowDesktopRequest.Width = Width;
   Request.Data.ShowDesktopRequest.Height = Height;
 
-  return NotifyCsrss(&Request, &Reply);
+  return CsrNotify(&Request, &Reply);
 }
 
 NTSTATUS FASTCALL
@@ -446,7 +405,7 @@
          lpszDesktopName->Length);
   Request.Data.CreateDesktopRequest.DesktopName[lpszDesktopName->Length / sizeof(WCHAR)] = L'\0';
 
-  Status = NotifyCsrss(&Request, &Reply);
+  Status = CsrNotify(&Request, &Reply);
   if (! NT_SUCCESS(Status))
     {
       DPRINT1("Failed to notify CSRSS about new desktop\n");

reactos/subsys/win32k/ntuser
misc.c 1.75 -> 1.76
diff -u -r1.75 -r1.76
--- misc.c	21 May 2004 10:09:31 -0000	1.75
+++ misc.c	28 May 2004 21:33:41 -0000	1.76
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.75 2004/05/21 10:09:31 weiden Exp $
+/* $Id: misc.c,v 1.76 2004/05/28 21:33:41 gvg Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -114,9 +114,13 @@
     case NOPARAM_ROUTINE_ANYPOPUP:
       Result = (DWORD)IntAnyPopup();
       break;
+
+    case NOPARAM_ROUTINE_CSRSS_INITIALIZED:
+      Result = (DWORD)CsrInit();
+      break;
     
     default:
-      DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n");
+      DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
       SetLastWin32Error(ERROR_INVALID_PARAMETER);
       break;
   }

reactos/lib/user32
user32.def 1.42 -> 1.43
diff -u -r1.42 -r1.43
--- user32.def	8 Jan 2004 14:55:12 -0000	1.42
+++ user32.def	28 May 2004 21:33:41 -0000	1.43
@@ -523,6 +523,7 @@
 PrivateCsrssAcquireOrReleaseInputOwnership@4
 PrivateCsrssRegisterPrimitive@0
 PrivateCsrssManualGuiCheck@4
+PrivateCsrssInitialized@0
 PrivateExtractIconExA@20
 PrivateExtractIconExW@20
 PrivateExtractIconsA@32

reactos/lib/user32
user32.edf 1.36 -> 1.37
diff -u -r1.36 -r1.37
--- user32.edf	10 May 2004 12:34:44 -0000	1.36
+++ user32.edf	28 May 2004 21:33:41 -0000	1.37
@@ -524,6 +524,7 @@
 PrivateCsrssAcquireOrReleaseInputOwnership=PrivateCsrssAcquireOrReleaseInputOwnership@4
 PrivateCsrssRegisterPrimitive=PrivateCsrssRegisterPrimitive@0
 PrivateCsrssManualGuiCheck=PrivateCsrssManualGuiCheck@4
+PrivateCsrssInitialized=PrivateCsrssInitialized@0
 PrivateExtractIconExA=PrivateExtractIconExA@20
 PrivateExtractIconExW=PrivateExtractIconExW@20
 PrivateExtractIconsA=PrivateExtractIconsA@32

reactos/lib/user32/misc
misc.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- misc.c	1 May 2004 16:43:14 -0000	1.4
+++ misc.c	28 May 2004 21:33:41 -0000	1.5
@@ -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.4 2004/05/01 16:43:14 weiden Exp $
+/* $Id: misc.c,v 1.5 2004/05/28 21:33:41 gvg Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/misc/misc.c
@@ -48,7 +48,7 @@
 
 
 /*
- * Private call for CSRSS
+ * Private calls for CSRSS
  */
 VOID
 STDCALL
@@ -57,6 +57,13 @@
   NtUserManualGuiCheck(Check);
 }
 
+VOID
+STDCALL
+PrivateCsrssInitialized()
+{
+  NtUserCallNoParam(NOPARAM_ROUTINE_CSRSS_INITIALIZED);
+}
+
 /*
  * @implemented
  */

reactos/subsys/csrss
init.c 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- init.c	9 Apr 2004 20:03:15 -0000	1.26
+++ init.c	28 May 2004 21:33:41 -0000	1.27
@@ -1,4 +1,4 @@
-/* $Id: init.c,v 1.26 2004/04/09 20:03:15 navaraf Exp $
+/* $Id: init.c,v 1.27 2004/05/28 21:33:41 gvg Exp $
  * 
  * reactos/subsys/csrss/init.c
  *
@@ -35,6 +35,53 @@
 
 extern HANDLE CsrssApiHeap;
 
+static unsigned InitCompleteProcCount;
+static CSRPLUGIN_INIT_COMPLETE_PROC *InitCompleteProcs = NULL;
+
+static NTSTATUS FASTCALL
+AddInitCompleteProc(CSRPLUGIN_INIT_COMPLETE_PROC Proc)
+{
+  CSRPLUGIN_INIT_COMPLETE_PROC *NewProcs;
+
+  NewProcs = RtlAllocateHeap(CsrssApiHeap, 0,
+                             (InitCompleteProcCount + 1)
+                             * sizeof(CSRPLUGIN_INIT_COMPLETE_PROC));
+  if (NULL == NewProcs)
+    {
+      return STATUS_NO_MEMORY;
+    }
+  if (0 != InitCompleteProcCount)
+    {
+      RtlCopyMemory(NewProcs, InitCompleteProcs,
+                    InitCompleteProcCount * sizeof(CSRPLUGIN_INIT_COMPLETE_PROC));
+      RtlFreeHeap(CsrssApiHeap, 0, InitCompleteProcs);
+    }
+  NewProcs[InitCompleteProcCount] = Proc;
+  InitCompleteProcs = NewProcs;
+  InitCompleteProcCount++;
+
+  return STATUS_SUCCESS;
+}
+
+static BOOL FASTCALL
+CallInitComplete(void)
+{
+  BOOL Ok;
+  unsigned i;
+
+  Ok = TRUE;
+  if (0 != InitCompleteProcCount)
+    {
+      for (i = 0; i < InitCompleteProcCount && Ok; i++)
+        {
+          Ok = (*(InitCompleteProcs[i]))();
+        }
+      RtlFreeHeap(CsrssApiHeap, 0, InitCompleteProcs);
+    }
+
+  return Ok;
+}
+
 ULONG
 InitializeVideoAddressSpace(VOID);
 
@@ -113,6 +160,7 @@
   CSRSS_EXPORTED_FUNCS Exports;
   PCSRSS_API_DEFINITION ApiDefinitions;
   PCSRSS_OBJECT_DEFINITION ObjectDefinitions;
+  CSRPLUGIN_INIT_COMPLETE_PROC InitCompleteProc;
 
   RtlInitUnicodeString(&DllName, L"win32csr.dll");
   Status = LdrLoadDll(NULL, 0, &DllName, (PVOID *) &hInst);
@@ -129,7 +177,8 @@
   Exports.CsrInsertObjectProc = CsrInsertObject;
   Exports.CsrGetObjectProc = CsrGetObject;
   Exports.CsrReleaseObjectProc = CsrReleaseObject;
-  if (! (*InitProc)(&ApiDefinitions, &ObjectDefinitions, &Exports, CsrssApiHeap))
+  if (! (*InitProc)(&ApiDefinitions, &ObjectDefinitions, &InitCompleteProc,
+                    &Exports, CsrssApiHeap))
     {
       return STATUS_UNSUCCESSFUL;
     }
@@ -140,6 +189,14 @@
       return Status;
     }
   Status = CsrRegisterObjectDefinitions(ObjectDefinitions);
+  if (! NT_SUCCESS(Status))
+    {
+      return Status;
+    }
+  if (NULL != InitCompleteProc)
+    {
+      Status = AddInitCompleteProc(InitCompleteProc);
+    }
 
   return Status;
 }
@@ -254,7 +311,7 @@
       return FALSE;
     }
 
-  return TRUE;
+  return CallInitComplete();
 }
 
 /* EOF */

reactos/subsys/csrss
makefile 1.28 -> 1.29
diff -u -r1.28 -r1.29
--- makefile	9 Apr 2004 20:03:15 -0000	1.28
+++ makefile	28 May 2004 21:33:41 -0000	1.29
@@ -1,9 +1,9 @@
-# $Id: makefile,v 1.28 2004/04/09 20:03:15 navaraf Exp $
+# $Id: makefile,v 1.29 2004/05/28 21:33:41 gvg Exp $
 
 PATH_TO_TOP = ../..
 
-#TARGET_TYPE = program
-TARGET_TYPE = proglib
+TARGET_TYPE = program
+#TARGET_TYPE = proglib
 
 TARGET_APPTYPE = native
 

reactos/subsys/csrss/include
csrplugin.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- csrplugin.h	2 Dec 2003 11:38:46 -0000	1.1
+++ csrplugin.h	28 May 2004 21:33:41 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: csrplugin.h,v 1.1 2003/12/02 11:38:46 gvg Exp $
+/* $Id: csrplugin.h,v 1.2 2004/05/28 21:33:41 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -38,8 +38,11 @@
   CSRSS_RELEASE_OBJECT_PROC CsrReleaseObjectProc;
 } CSRSS_EXPORTED_FUNCS, *PCSRSS_EXPORTED_FUNCS;
 
-typedef BOOL STDCALL (*CSRPLUGIN_INITIALIZE_PROC)(PCSRSS_API_DEFINITION *ApiDefinitions,
+typedef BOOL (STDCALL *CSRPLUGIN_INIT_COMPLETE_PROC)(void);
+
+typedef BOOL (STDCALL *CSRPLUGIN_INITIALIZE_PROC)(PCSRSS_API_DEFINITION *ApiDefinitions,
                                                   PCSRSS_OBJECT_DEFINITION *ObjectDefinitions,
+                                                  CSRPLUGIN_INIT_COMPLETE_PROC *InitCompleteProc,
                                                   PCSRSS_EXPORTED_FUNCS Exports,
                                                   HANDLE CsrssApiHeap);
 

reactos/subsys/csrss/win32csr
dllmain.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- dllmain.c	19 Jan 2004 20:14:28 -0000	1.4
+++ dllmain.c	28 May 2004 21:33:41 -0000	1.5
@@ -1,4 +1,4 @@
-/* $Id: dllmain.c,v 1.4 2004/01/19 20:14:28 gvg Exp $
+/* $Id: dllmain.c,v 1.5 2004/05/28 21:33:41 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -19,6 +19,7 @@
 
 /* Not defined in any header file */
 extern VOID STDCALL PrivateCsrssManualGuiCheck(LONG Check);
+extern VOID STDCALL PrivateCsrssInitialized();
 
 /* GLOBALS *******************************************************************/
 
@@ -141,10 +142,18 @@
   return (CsrExports.CsrReleaseObjectProc)(ProcessData, Object);
 }
 
+static BOOL STDCALL
+Win32CsrInitComplete(void)
+{
+  PrivateCsrssInitialized();
+
+  return TRUE;
+}
 
 BOOL STDCALL
 Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions,
                        PCSRSS_OBJECT_DEFINITION *ObjectDefinitions,
+                       CSRPLUGIN_INIT_COMPLETE_PROC *InitComplete,
                        PCSRSS_EXPORTED_FUNCS Exports,
                        HANDLE CsrssApiHeap)
 {
@@ -165,6 +174,7 @@
 
   *ApiDefinitions = Win32CsrApiDefinitions;
   *ObjectDefinitions = Win32CsrObjectDefinitions;
+  *InitComplete = Win32CsrInitComplete;
 
   return TRUE;
 }

reactos/subsys/csrss/win32csr
win32csr.edf 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- win32csr.edf	2 Dec 2003 11:38:46 -0000	1.1
+++ win32csr.edf	28 May 2004 21:33:41 -0000	1.2
@@ -1,4 +1,4 @@
-; $Id: win32csr.edf,v 1.1 2003/12/02 11:38:46 gvg Exp $
+; $Id: win32csr.edf,v 1.2 2004/05/28 21:33:41 gvg Exp $
 ;
 ;
 
@@ -6,4 +6,4 @@
 
 EXPORTS
 
-Win32CsrInitialization=Win32CsrInitialization@16
+Win32CsrInitialization=Win32CsrInitialization@20
CVSspam 0.2.8