SM some simple work (wip)
authorEmanuele Aliberti <ea@iol.it>
Sat, 26 Feb 2005 23:22:48 +0000 (23:22 +0000)
committerEmanuele Aliberti <ea@iol.it>
Sat, 26 Feb 2005 23:22:48 +0000 (23:22 +0000)
svn path=/trunk/; revision=13762

reactos/subsys/smss/client.c
reactos/subsys/smss/init.c
reactos/subsys/smss/initobdir.c
reactos/subsys/smss/smss.c
reactos/subsys/smss/smss.h

index 66e9050..18f81fe 100644 (file)
@@ -169,6 +169,8 @@ SmCreateClient(PSM_PORT_MESSAGE Request, PSM_CLIENT_DATA * ClientData)
         * Initialize the client data\r
         */\r
        pClient->SubsystemId = ConnectData->Subsystem;\r
+       /* SM auto-initializes; other subsystems are required to call\r
+        * SM_API_COMPLETE_SESSION via SMDLL. */\r
        pClient->Initialized = (IMAGE_SUBSYSTEM_NATIVE == pClient->SubsystemId);\r
        if (SbApiPortNameSize > 0)\r
        {\r
index be2125b..f3a1126 100644 (file)
 static NTSTATUS
 SmpSignalInitEvent(VOID)
 {
-  NTSTATUS Status;
-  OBJECT_ATTRIBUTES ObjectAttributes;
-  UNICODE_STRING UnicodeString;
-  HANDLE ReactOSInitEvent;
+  NTSTATUS          Status = STATUS_SUCCESS;
+  OBJECT_ATTRIBUTES ObjectAttributes = {0};
+  UNICODE_STRING    EventName ={0};
+  HANDLE            ReactOSInitEvent = NULL;
 
-  RtlRosInitUnicodeStringFromLiteral(&UnicodeString, L"\\ReactOSInitDone");
+  RtlInitUnicodeString (& EventName, L"\\ReactOSInitDone");
   InitializeObjectAttributes(&ObjectAttributes,
-    &UnicodeString,
+    & EventName,
     EVENT_ALL_ACCESS,
     0,
     NULL);
index 4386389..0a1c6ad 100644 (file)
@@ -23,8 +23,6 @@
  *\r
  * --------------------------------------------------------------------\r
  */\r
-\r
-\r
 #include "smss.h"\r
 \r
 #define NDEBUG\r
@@ -82,7 +80,7 @@ SmCreateObjectDirectories(VOID)
   QueryTable[0].QueryRoutine = SmpObjectDirectoryQueryRoutine;\r
 \r
   Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,\r
-                                 L"\\Session Manager",\r
+                                 SM_REGISTRY_ROOT_NAME,\r
                                  QueryTable,\r
                                  NULL,\r
                                  NULL);\r
index 5d51441..d95e54a 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
+HANDLE SmSsProcessId = 0;
+
 /* Native image's entry point */
 
 VOID STDCALL
 NtProcessStartup(PPEB Peb)
 {
   NTSTATUS Status;
-
+  PROCESS_BASIC_INFORMATION PBI = {0};
+  
   DisplayString(L"SMSS\n");
   PrintString("ReactOS Session Manager %s (Build %s)\n",
             KERNEL_RELEASE_STR,
             KERNEL_VERSION_BUILD_STR);
 
+  /* Lookup yourself */
+  Status = NtQueryInformationProcess (NtCurrentProcess(),
+                                     ProcessBasicInformation,
+                                     & PBI,
+                                     sizeof PBI,
+                                     NULL);
+  if(NT_SUCCESS(Status))
+  {
+         SmSsProcessId = PBI.UniqueProcessId;
+  }
+  /* Initialize the system */
   Status = InitSessionManager();
   if (!NT_SUCCESS(Status))
     {
@@ -64,7 +78,7 @@ NtProcessStartup(PPEB Peb)
                                    NULL);      /* NULL for infinite */
   if (!NT_SUCCESS(Status))
     {
-      DPRINT1("SM: NtWaitForMultipleObjects failed!\n");
+      DPRINT1("SM: NtWaitForMultipleObjects failed! (Status=0x%08lx)\n", Status);
     }
   else
     {
index 6e0c85b..ea78a89 100644 (file)
@@ -9,6 +9,9 @@
 #define CHILD_CSRSS     0
 #define CHILD_WINLOGON  1
 
+/* smss.c */
+extern HANDLE SmSsProcessId;
+
 /* init.c */
 NTSTATUS InitSessionManager(VOID);