On FAT16 partitions smaller than 128MB, the cluster size is 2048, which is smaller than PAGE_SIZE. This caused creation of the paging file on such a partition to fail, which in turn made SMSS fail, blocking the boot process. Creation of paging file fixed, and failure to create it is no longer a blocker for the boot process (just try to run without paging file). Modified: trunk/reactos/ntoskrnl/mm/pagefile.c Modified: trunk/reactos/subsys/smss/initobdir.c Modified: trunk/reactos/subsys/smss/initpage.c Modified: trunk/reactos/subsys/smss/print.c Modified: trunk/reactos/subsys/smss/smss.c _____
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c --- trunk/reactos/ntoskrnl/mm/pagefile.c 2005-12-31 19:02:48 UTC (rev 20492) +++ trunk/reactos/ntoskrnl/mm/pagefile.c 2005-12-31 19:50:29 UTC (rev 20493) @@ -809,13 +809,6 @@
PreviousMode = ExGetPreviousMode();
- Status = ProbeAndCaptureUnicodeString(&CapturedFileName, - PreviousMode, - FileName); - if (!NT_SUCCESS(Status)) - { - return(Status); - } if (PreviousMode != KernelMode) { _SEH_TRY @@ -831,8 +824,6 @@
if (!NT_SUCCESS(Status)) { - ReleaseCapturedUnicodeString(&CapturedFileName, - PreviousMode); return Status; } } @@ -842,6 +833,29 @@ SafeMaximumSize = *MaximumSize; }
+ /* Pagefiles can't be larger than 4GB and ofcourse the minimum should be + smaller than the maximum */ + if (0 != SafeInitialSize.u.HighPart) + { + return STATUS_INVALID_PARAMETER_2; + } + if (0 != SafeMaximumSize.u.HighPart) + { + return STATUS_INVALID_PARAMETER_3; + } + if (SafeMaximumSize.u.LowPart < SafeInitialSize.u.LowPart) + { + return STATUS_INVALID_PARAMETER_MIX; + } + + Status = ProbeAndCaptureUnicodeString(&CapturedFileName, + PreviousMode, + FileName); + if (!NT_SUCCESS(Status)) + { + return(Status); + } + InitializeObjectAttributes(&ObjectAttributes, &CapturedFileName, 0, @@ -881,12 +895,24 @@ return Status; }
- BytesPerAllocationUnit = FsSizeInformation.SectorsPerAllocationUnit * FsSizeInformation.BytesPerSector; - if (BytesPerAllocationUnit % PAGE_SIZE) + BytesPerAllocationUnit = FsSizeInformation.SectorsPerAllocationUnit * + FsSizeInformation.BytesPerSector; + + /* We have to find a value which is a multiple of both PAGE_SIZE and + BytesPerAllocationUnit */ + SafeInitialSize.u.LowPart = ((SafeInitialSize.u.LowPart + PAGE_SIZE - 1) / + PAGE_SIZE) * PAGE_SIZE; + while (0 != (SafeInitialSize.u.LowPart % BytesPerAllocationUnit) && + SafeInitialSize.u.LowPart <= SafeMaximumSize.u.LowPart - PAGE_SIZE) { + SafeInitialSize.u.LowPart += PAGE_SIZE; + } + if (0 != (SafeInitialSize.u.LowPart % BytesPerAllocationUnit)) + { ZwClose(FileHandle); - return STATUS_UNSUCCESSFUL; + return STATUS_ALLOTTED_SPACE_EXCEEDED; } + ASSERT(0 == (SafeInitialSize.u.LowPart % PAGE_SIZE));
Status = ZwSetInformationFile(FileHandle, &IoStatus, _____
Modified: trunk/reactos/subsys/smss/initobdir.c --- trunk/reactos/subsys/smss/initobdir.c 2005-12-31 19:02:48 UTC (rev 20492) +++ trunk/reactos/subsys/smss/initobdir.c 2005-12-31 19:50:29 UTC (rev 20493) @@ -41,10 +41,8 @@
HANDLE WindowsDirectory; NTSTATUS Status = STATUS_SUCCESS;
-#ifndef NDEBUG - DbgPrint("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength); - DbgPrint("ValueData '%S'\n", (PWSTR)ValueData); -#endif + DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength); + DPRINT("ValueData '%S'\n", (PWSTR)ValueData); if (ValueType != REG_SZ) { return(STATUS_SUCCESS); _____
Modified: trunk/reactos/subsys/smss/initpage.c --- trunk/reactos/subsys/smss/initpage.c 2005-12-31 19:02:48 UTC (rev 20492) +++ trunk/reactos/subsys/smss/initpage.c 2005-12-31 19:50:29 UTC (rev 20493) @@ -1,5 +1,4 @@
-/* $Id$ - * +/* * initpage.c - * * ReactOS Operating System @@ -217,18 +216,23 @@ MaximumSize.QuadPart = InitialSize.QuadPart; }
- DPRINT1("SMSS: Created paging file %wZ with size %I64d KB\n", + DPRINT("Creating paging file %wZ with size %I64d KB\n", &FileName, InitialSize.QuadPart / 1024);
Status = NtCreatePagingFile(&FileName, &InitialSize, &MaximumSize, 0); + if (! NT_SUCCESS(Status)) + { + PrintString("Creation of paging file %wZ with size %I64d KB failed (status 0x%x\n", + &FileName, InitialSize.QuadPart / 1024); + }
Cleanup: RtlFreeUnicodeString(&FileName);
- return Status; + return STATUS_SUCCESS; }
@@ -238,7 +242,7 @@ RTL_QUERY_REGISTRY_TABLE QueryTable[2]; NTSTATUS Status;
- DbgPrint("SM: creating system paging files\n"); + DPRINT("creating system paging files\n"); /* * Disable paging file on MiniNT/Live CD. */ _____
Modified: trunk/reactos/subsys/smss/print.c --- trunk/reactos/subsys/smss/print.c 2005-12-31 19:02:48 UTC (rev 20492) +++ trunk/reactos/subsys/smss/print.c 2005-12-31 19:50:29 UTC (rev 20493) @@ -31,7 +31,7 @@
UNICODE_STRING us;
RtlInitUnicodeString (&us, lpwString); - ZwDisplayString (&us); + NtDisplayString (&us); }
VOID STDCALL PrintString (char* fmt, ...) @@ -44,6 +44,7 @@ va_start(ap, fmt); vsprintf(buffer, fmt, ap); va_end(ap); + DPRINT1("%s", buffer);
RtlInitAnsiString (&AnsiString, buffer); RtlAnsiStringToUnicodeString (&UnicodeString, _____
Modified: trunk/reactos/subsys/smss/smss.c --- trunk/reactos/subsys/smss/smss.c 2005-12-31 19:02:48 UTC (rev 20492) +++ trunk/reactos/subsys/smss/smss.c 2005-12-31 19:50:29 UTC (rev 20493) @@ -41,9 +41,6 @@
NTSTATUS Status = STATUS_SUCCESS; PROCESS_BASIC_INFORMATION PBI = {0};
- PrintString("ReactOS Session Manager (Build %s)\n", - KERNEL_VERSION_BUILD_STR); - /* Lookup yourself */ Status = NtQueryInformationProcess (NtCurrentProcess(), ProcessBasicInformation,