- Use the actual previous mode (spotted by Thomas)
Modified: trunk/reactos/ntoskrnl/lpc/connect.c

Modified: trunk/reactos/ntoskrnl/lpc/connect.c
--- trunk/reactos/ntoskrnl/lpc/connect.c	2005-08-09 03:31:22 UTC (rev 17224)
+++ trunk/reactos/ntoskrnl/lpc/connect.c	2005-08-09 03:38:34 UTC (rev 17225)
@@ -410,7 +410,7 @@
                                     NULL,
                                     PORT_ALL_ACCESS,  /* DesiredAccess */
                                     LpcPortObjectType,
-                                    UserMode,
+                                    PreviousMode,
                                     NULL,
                                     (PVOID*)&NamedPort);
   if (!NT_SUCCESS(Status))
@@ -430,7 +430,7 @@
       Status = ObReferenceObjectByHandle(WriteMap.SectionHandle,
 					 SECTION_MAP_READ | SECTION_MAP_WRITE,
 					 MmSectionObjectType,
-					 UserMode,
+					 PreviousMode,
 					 (PVOID*)&SectionObject,
 					 NULL);
       if (!NT_SUCCESS(Status))
@@ -669,6 +669,7 @@
   PEPORT_CONNECT_REQUEST_MESSAGE CRequest;
   PEPORT_CONNECT_REPLY_MESSAGE CReply;
   ULONG Size;
+  KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
 
   Size = sizeof(EPORT_CONNECT_REPLY_MESSAGE);
   if (LpcMessage)
@@ -685,7 +686,7 @@
   Status = ObReferenceObjectByHandle(NamedPortHandle,
 				     PORT_ALL_ACCESS,
 				     LpcPortObjectType,
-				     UserMode,
+				     PreviousMode,
 				     (PVOID*)&NamedPort,
 				     NULL);
   if (!NT_SUCCESS(Status))
@@ -699,10 +700,10 @@
    */
   if (AcceptIt)
     {
-      Status = ObCreateObject(ExGetPreviousMode(),
+      Status = ObCreateObject(PreviousMode,
 			      LpcPortObjectType,
 			      NULL,
-			      ExGetPreviousMode(),
+			      PreviousMode,
 			      NULL,
 			      sizeof(EPORT),
 			      0,
@@ -789,7 +790,7 @@
       Status = ObReferenceObjectByHandle(WriteMap->SectionHandle,
 					 SECTION_MAP_READ | SECTION_MAP_WRITE,
 					 MmSectionObjectType,
-					 UserMode,
+					 PreviousMode,
 					 (PVOID*)&SectionObject,
 					 NULL);
       if (!NT_SUCCESS(Status))