diff --git a/reactos/base/system/smss/init.c b/reactos/base/system/smss/init.c index 48a60fc14b9..90de9328cde 100644 --- a/reactos/base/system/smss/init.c +++ b/reactos/base/system/smss/init.c @@ -32,7 +32,7 @@ struct { // {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"} diff --git a/reactos/base/system/smss/initpage.c b/reactos/base/system/smss/initpage.c index ab1fc0735a7..677e8a82dfe 100644 --- a/reactos/base/system/smss/initpage.c +++ b/reactos/base/system/smss/initpage.c @@ -12,7 +12,7 @@ #define NDEBUG #include -#if 0 +#if 1 #define GIGABYTE (1024 * 1024 * 1024) /* One Gigabyte */ @@ -220,7 +220,7 @@ SmpPagingFilesQueryRoutine(PWSTR ValueName, 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); } diff --git a/reactos/base/system/smss2/pagefile.c b/reactos/base/system/smss2/pagefile.c index db72364a1c3..7c3c21a602e 100644 --- a/reactos/base/system/smss2/pagefile.c +++ b/reactos/base/system/smss2/pagefile.c @@ -457,7 +457,8 @@ SmpCreatePagingFile(IN PUNICODE_STRING Name, 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 @@ SmpCreatePagingFileOnFixedDrive(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor, 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 @@ SmpCreateVolumeDescriptors(VOID) 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) diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 9343fa0978e..ac1dc5d141e 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -1759,6 +1759,10 @@ NTSTATUS 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 @@ SSI_DEF(SystemCreateSession) /* 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); } diff --git a/reactos/ntoskrnl/mm/ARM3/procsup.c b/reactos/ntoskrnl/mm/ARM3/procsup.c index e1640fa5827..387c3d21612 100644 --- a/reactos/ntoskrnl/mm/ARM3/procsup.c +++ b/reactos/ntoskrnl/mm/ARM3/procsup.c @@ -1478,6 +1478,35 @@ MmSessionCreate(OUT PULONG SessionId) 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