[ros-diffs] [ion] 55465: [SMSS2/SMSS]: Put SMSS back in charge of the pagefile as yet another attempt to fix KVM. [NTOSKRNL]: Stub-plement SystemSessionDetachInformation.

ion at svn.reactos.org ion at svn.reactos.org
Mon Feb 6 18:14:36 UTC 2012


Author: ion
Date: Mon Feb  6 18:14:36 2012
New Revision: 55465

URL: http://svn.reactos.org/svn/reactos?rev=55465&view=rev
Log:
[SMSS2/SMSS]: Put SMSS back in charge of the pagefile as yet another attempt to fix KVM.
[NTOSKRNL]: Stub-plement SystemSessionDetachInformation.

Modified:
    trunk/reactos/base/system/smss/init.c
    trunk/reactos/base/system/smss/initpage.c
    trunk/reactos/base/system/smss2/pagefile.c
    trunk/reactos/ntoskrnl/ex/sysinfo.c
    trunk/reactos/ntoskrnl/mm/ARM3/procsup.c

Modified: trunk/reactos/base/system/smss/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/init.c?rev=55465&r1=55464&r2=55465&view=diff
==============================================================================
--- trunk/reactos/base/system/smss/init.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/init.c [iso-8859-1] Mon Feb  6 18:14:36 2012
@@ -32,7 +32,7 @@
 //	{TRUE,  SmProcessFileRenameList,      "process the file rename list"},
 //	{FALSE, SmUpdateEnvironment,          "update environment variables"},
 //	{FALSE, SmLoadKnownDlls,              "preload system DLLs"},
-//	{TRUE,  SmCreatePagingFiles,          "create paging files"},
+	{TRUE,  SmCreatePagingFiles,          "create paging files"},
 //	{TRUE,  SmInitializeRegistry,         "initialize the registry"},
 	{TRUE,  SmInitializeClientManagement, "initialize client management"},
 	{TRUE,  SmLoadSubsystems,             "load subsystems"}

Modified: trunk/reactos/base/system/smss/initpage.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/initpage.c?rev=55465&r1=55464&r2=55465&view=diff
==============================================================================
--- trunk/reactos/base/system/smss/initpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/initpage.c [iso-8859-1] Mon Feb  6 18:14:36 2012
@@ -12,7 +12,7 @@
 #define NDEBUG
 #include <debug.h>
 
-#if 0
+#if 1
 
 #define GIGABYTE (1024 * 1024 * 1024) /* One Gigabyte */
 
@@ -220,7 +220,7 @@
                               0);
   if (! NT_SUCCESS(Status))
     {
-      PrintString("Creation of paging file %wZ with size %I64d KB failed (status 0x%x)\n",
+      DPRINT1("Creation of paging file %wZ with size %I64d KB failed (status 0x%x)\n",
                   &FileName, InitialSize.QuadPart / 1024, Status);
     }
 

Modified: trunk/reactos/base/system/smss2/pagefile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss2/pagefile.c?rev=55465&r1=55464&r2=55465&view=diff
==============================================================================
--- trunk/reactos/base/system/smss2/pagefile.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss2/pagefile.c [iso-8859-1] Mon Feb  6 18:14:36 2012
@@ -457,7 +457,8 @@
     NTSTATUS Status;
 
     /* Tell the kernel to create the pagefile */
-    Status = NtCreatePagingFile(Name, MinSize, MaxSize, Priority);
+    //Status = NtCreatePagingFile(Name, MinSize, MaxSize, Priority);
+    Status = STATUS_SUCCESS;
     if (NT_SUCCESS(Status))
     {
         DPRINT1("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) succeeded. \n",
@@ -592,13 +593,7 @@
     if (Descriptor->ActualMinSize.QuadPart < MinimumSize->QuadPart)
     {
         /* Delete the current page file and fail */
-        if (ShouldDelete)
-        {
-            SmpDeletePagingFile(&Descriptor->Name);
-            
-            /* FIXFIX: Windows Vista does this, and it seems like we should too, so try to see if this fixes KVM */
-            Volume->FreeSpace.QuadPart += PageFileSize.QuadPart;
-        }
+        if (ShouldDelete) SmpDeletePagingFile(&Descriptor->Name);
         DPRINT1("SMSS:PFILE: Failing for min %I64X, max %I64X, real min %I64X \n",
                 Descriptor->ActualMinSize.QuadPart,
                 Descriptor->ActualMaxSize.QuadPart,
@@ -978,6 +973,10 @@
                              SizeInfo.SectorsPerAllocationUnit;
         FinalFreeSpace.QuadPart = FreeSpace.QuadPart * SizeInfo.BytesPerSector;
         Volume->FreeSpace = FinalFreeSpace;
+        DPRINT1("AUs: %I64x Sectors: %lx Bytes Per Sector: %lx\n",
+                SizeInfo.AvailableAllocationUnits.QuadPart,
+                SizeInfo.SectorsPerAllocationUnit,
+                SizeInfo.BytesPerSector);
 
         /* Check if there's less than 32MB free so we don't starve the disk */
         if (FinalFreeSpace.QuadPart <= 0x2000000)

Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=55465&r1=55464&r2=55465&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Mon Feb  6 18:14:36 2012
@@ -1759,6 +1759,10 @@
 NTAPI
 MmSessionCreate(OUT PULONG SessionId);
 
+NTSTATUS
+NTAPI
+MmSessionDelete(IN ULONG SessionId);
+
 /* Class 47 - Create a new session (TSE) */
 SSI_DEF(SystemCreateSession)
 {
@@ -1786,9 +1790,22 @@
 /* Class 48 - Delete an existing session (TSE) */
 SSI_DEF(SystemDeleteSession)
 {
-    /* FIXME */
-    DPRINT1("NtSetSystemInformation - SystemDeleteSession not implemented\n");
-    return STATUS_NOT_IMPLEMENTED;
+    ULONG SessionId;
+    KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
+    
+    if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
+    
+    if (PreviousMode != KernelMode)
+    {
+        if (!SeSinglePrivilegeCheck(SeLoadDriverPrivilege, PreviousMode))
+        {
+            return STATUS_PRIVILEGE_NOT_HELD;
+        }
+    }
+    
+    SessionId = *(PULONG)Buffer;
+    
+    return MmSessionDelete(SessionId);
 }
 
 

Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c?rev=55465&r1=55464&r2=55465&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Mon Feb  6 18:14:36 2012
@@ -1478,6 +1478,35 @@
     return Status;
 }
 
+NTSTATUS
+NTAPI
+MmSessionDelete(IN ULONG SessionId)
+{
+    PEPROCESS Process = PsGetCurrentProcess();
+
+    /* Process must be in a session */
+    if (!(Process->Flags & PSF_PROCESS_IN_SESSION_BIT))
+    {
+        DPRINT1("Not in a session!\n");
+        return STATUS_UNABLE_TO_FREE_VM;
+    }
+
+    /* It must be the session leader */
+    if (!Process->Vm.Flags.SessionLeader)
+    {
+        DPRINT1("Not a session leader!\n");
+        return STATUS_UNABLE_TO_FREE_VM;
+    }
+
+    /* Remove one reference count */
+    KeEnterCriticalRegion();
+    /* FIXME: Do it */
+    KeLeaveCriticalRegion();
+
+    /* All done */
+    return STATUS_SUCCESS;
+}
+
 /* SYSTEM CALLS ***************************************************************/
 
 NTSTATUS




More information about the Ros-diffs mailing list