Author: hbelusca Date: Fri Feb 20 22:03:23 2015 New Revision: 66375
URL: http://svn.reactos.org/svn/reactos?rev=66375&view=rev Log: [SMSS]: Improve some dprints (that prints strings; sometimes they happen to print empty strings for unknown reasons so I need to really check whether they are empty or not); remove extra whitespace at the end of dprints. Initialize a variable.
Modified: trunk/reactos/base/system/smss/pagefile.c trunk/reactos/base/system/smss/sminit.c
Modified: trunk/reactos/base/system/smss/pagefile.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/pagefile.c... ============================================================================== --- trunk/reactos/base/system/smss/pagefile.c [iso-8859-1] (original) +++ trunk/reactos/base/system/smss/pagefile.c [iso-8859-1] Fri Feb 20 22:03:23 2015 @@ -101,7 +101,7 @@ }
/* Parse the specified and get the name and arguments out of it */ - DPRINT("SMSS:PFILE: Paging file specifier `%wZ' \n", PageFileToken); + DPRINT("SMSS:PFILE: Paging file specifier `%wZ'\n", PageFileToken); Status = SmpParseCommandLine(PageFileToken, NULL, &PageFileName, @@ -216,7 +216,7 @@ /* This means no duplicates exist, so insert our descriptor! */ InsertTailList(&SmpPagingFileDescriptorList, &Descriptor->Entry); SmpNumberOfPagingFiles++; - DPRINT("SMSS:PFILE: Created descriptor for `%wZ' (`%wZ') \n", + DPRINT("SMSS:PFILE: Created descriptor for `%wZ' (`%wZ')\n", PageFileToken, &Descriptor->Name); return STATUS_SUCCESS; } @@ -228,7 +228,7 @@ !(Descriptor->Flags & SMP_PAGEFILE_ON_ANY_DRIVE));
/* We found a duplicate, so skip this descriptor/pagefile and fail */ - DPRINT1("SMSS:PFILE: Skipping duplicate specifier `%wZ' \n", PageFileToken); + DPRINT1("SMSS:PFILE: Skipping duplicate specifier `%wZ'\n", PageFileToken); RtlFreeUnicodeString(&PageFileName); RtlFreeHeap(RtlGetProcessHeap(), 0, Descriptor); return STATUS_INVALID_PARAMETER; @@ -268,7 +268,7 @@ FileStandardInformation); if (!NT_SUCCESS(Status)) { - DPRINT1("SMSS:PFILE: Failed query for size potential pagefile `%wZ' with status %X \n", + DPRINT1("SMSS:PFILE: Failed query for size potential pagefile `%wZ' with status %X\n", FileName, Status); NtClose(FileHandle); return Status; @@ -351,7 +351,7 @@ wcscpy(PathString, L"\??\A:\"); RtlInitUnicodeString(&VolumeName, PathString); VolumeName.Buffer[STANDARD_DRIVE_LETTER_OFFSET] = Volume->DriveLetter; - DPRINT("SMSS:PFILE: Querying volume `%wZ' for free space \n", &VolumeName); + DPRINT("SMSS:PFILE: Querying volume `%wZ' for free space\n", &VolumeName);
/* Open the volume */ InitializeObjectAttributes(&ObjectAttributes, @@ -367,7 +367,7 @@ FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE); if (!NT_SUCCESS(Status)) { - DPRINT1("SMSS:PFILE: Open volume `%wZ' failed with status %X \n", &VolumeName, Status); + DPRINT1("SMSS:PFILE: Open volume `%wZ' failed with status %X\n", &VolumeName, Status); return Status; }
@@ -381,7 +381,7 @@ { /* We failed */ DPRINT1("SMSS:PFILE: Query volume `%wZ' (handle %p) for size failed" - " with status %X \n", + " with status %X\n", &VolumeName, VolumeHandle, Status); @@ -456,14 +456,14 @@ Status = NtCreatePagingFile(Name, MinSize, MaxSize, Priority); if (NT_SUCCESS(Status)) { - DPRINT("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) succeeded. \n", + DPRINT("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) succeeded.\n", Name, MinSize->QuadPart, MaxSize->QuadPart); } else { - DPRINT1("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) failed with %X \n", + DPRINT1("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) failed with %X\n", Name, MinSize->QuadPart, MaxSize->QuadPart, @@ -492,7 +492,7 @@ if (!Volume) { /* Couldn't find it, fail */ - DPRINT1("SMSS:PFILE: No volume descriptor for `%wZ' \n", + DPRINT1("SMSS:PFILE: No volume descriptor for `%wZ'\n", &Descriptor->Name); return STATUS_INVALID_PARAMETER; } @@ -504,7 +504,7 @@ if (!(Descriptor->Flags & SMP_PAGEFILE_DUMP_PROCESSED)) { /* Try to find a crash dump and extract it */ - DPRINT("SMSS:PFILE: Checking for crash dump in `%wZ' on boot volume \n", + DPRINT("SMSS:PFILE: Checking for crash dump in `%wZ' on boot volume\n", &Descriptor->Name); SmpCheckForCrashDump(&Descriptor->Name);
@@ -529,7 +529,7 @@ { /* Crashdumps can only be on the boot volume */ DPRINT("SMSS:PFILE: Skipping crash dump checking for `%wZ' on non boot" - "volume `%wC' \n", + "volume `%wC'\n", &Descriptor->Name, Volume->DriveLetter); } @@ -544,7 +544,7 @@ DPRINT("SMSS:PFILE: Detected size %I64X for future paging file `%wZ'\n", PageFileSize, &Descriptor->Name); - DPRINT("SMSS:PFILE: Free space on volume `%wC' is %I64X \n", + DPRINT("SMSS:PFILE: Free space on volume `%wC' is %I64X\n", Volume->DriveLetter, Volume->FreeSpace.QuadPart);
@@ -558,7 +558,7 @@ { Descriptor->ActualMaxSize = PageFileSize; } - DPRINT("SMSS:PFILE: min %I64X, max %I64X, real min %I64X \n", + DPRINT("SMSS:PFILE: min %I64X, max %I64X, real min %I64X\n", Descriptor->ActualMinSize.QuadPart, Descriptor->ActualMaxSize.QuadPart, MinimumSize->QuadPart); @@ -595,7 +595,7 @@ /* 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; } - DPRINT1("SMSS:PFILE: Failing for min %I64X, max %I64X, real min %I64X \n", + DPRINT1("SMSS:PFILE: Failing for min %I64X, max %I64X, real min %I64X\n", Descriptor->ActualMinSize.QuadPart, Descriptor->ActualMaxSize.QuadPart, MinimumSize->QuadPart); @@ -670,7 +670,7 @@ if (!NT_SUCCESS(Status)) { /* If we failed, use defaults since we have no idea otherwise */ - DPRINT1("SMSS:PFILE: NtQuerySystemInformation failed with %x \n", Status); + DPRINT1("SMSS:PFILE: NtQuerySystemInformation failed with %x\n", Status); SmpMakeDefaultPagingFileDescriptor(Descriptor); return; } @@ -734,7 +734,7 @@ if (WasTooBig) { /* Notify debugger output and write a flag in the descriptor */ - DPRINT("SMSS:PFILE: Trimmed size of `%wZ' to maximum allowed \n", + DPRINT("SMSS:PFILE: Trimmed size of `%wZ' to maximum allowed\n", &Descriptor->Name); Descriptor->Flags |= SMP_PAGEFILE_WAS_TOO_BIG; } @@ -842,7 +842,7 @@ NULL); if (!NT_SUCCESS(Status)) { - DPRINT1("SMSS:PFILE: Query(ProcessDeviceMap) failed with status %X \n", + DPRINT1("SMSS:PFILE: Query(ProcessDeviceMap) failed with status %X\n", Status); return Status; } @@ -874,7 +874,7 @@ if (!NT_SUCCESS(Status)) { /* Skip the volume if we failed */ - DPRINT1("SMSS:PFILE: Open volume `%wZ' failed with status %X \n", + DPRINT1("SMSS:PFILE: Open volume `%wZ' failed with status %X\n", &VolumePath, Status); continue; } @@ -889,7 +889,7 @@ { /* Move to the next volume if we failed */ DPRINT1("SMSS:PFILE: Query volume `%wZ' (handle %p) for device info" - " failed with status %X \n", + " failed with status %X\n", &VolumePath, VolumeHandle, Status); @@ -904,7 +904,7 @@ FILE_REMOVABLE_MEDIA)) { /* It isn't, so skip it */ - DPRINT1("SMSS:PFILE: Volume `%wZ' (%X) cannot store a paging file \n", + DPRINT1("SMSS:PFILE: Volume `%wZ' (%X) cannot store a paging file\n", &VolumePath, DeviceInfo.Characteristics); NtClose(VolumeHandle); @@ -918,7 +918,7 @@ if (!Volume) { /* Failed to allocate memory, try the next disk */ - DPRINT1("SMSS:PFILE: Failed to allocate a volume descriptor (%u bytes) \n", + DPRINT1("SMSS:PFILE: Failed to allocate a volume descriptor (%u bytes)\n", sizeof(SMP_VOLUME_DESCRIPTOR)); NtClose(VolumeHandle); continue; @@ -948,7 +948,7 @@ { /* We failed -- keep going */ DPRINT1("SMSS:PFILE: Query volume `%wZ' (handle %p) for size failed" - " with status %X \n", + " with status %X\n", &VolumePath, VolumeHandle, Status); @@ -981,7 +981,7 @@ /* All done, add this volume to our descriptor list */ InsertTailList(&SmpVolumeDescriptorList, &Volume->Entry); Volume->Flags |= SMP_VOLUME_INSERTED; - DPRINT("SMSS:PFILE: Created volume descriptor for`%wZ' \n", &VolumePath); + DPRINT("SMSS:PFILE: Created volume descriptor for`%wZ'\n", &VolumePath); }
/* We must've found at least the boot volume */ @@ -1006,9 +1006,9 @@ /* Check if no paging files were requested */ if (!(SmpNumberOfPagingFiles) && !(SmpRegistrySpecifierPresent)) { - /* The list should be empty -- nothign to do */ + /* The list should be empty -- nothing to do */ ASSERT(IsListEmpty(&SmpPagingFileDescriptorList)); - DPRINT1("SMSS:PFILE: No paging file was requested \n"); + DPRINT1("SMSS:PFILE: No paging file was requested\n"); return STATUS_SUCCESS; }
@@ -1040,7 +1040,7 @@ if (!NT_SUCCESS(Status)) { /* We failed -- try again, with size minimization this time */ - DPRINT1("SMSS:PFILE: Trying lower sizes for (`%wZ') \n", + DPRINT1("SMSS:PFILE: Trying lower sizes for (`%wZ')\n", &Descriptor->Name); Status = SmpCreateSystemManagedPagingFile(Descriptor, TRUE); } @@ -1051,7 +1051,7 @@ SmpValidatePagingFileSizes(Descriptor);
/* Check if this is an ANY pagefile or a FIXED pagefile */ - DPRINT("SMSS:PFILE: Creating a normal paging file (`%wZ') \n", + DPRINT("SMSS:PFILE: Creating a normal paging file (`%wZ')\n", &Descriptor->Name); if (Descriptor->Name.Buffer[STANDARD_DRIVE_LETTER_OFFSET] == L'?') { @@ -1063,7 +1063,7 @@ if (!NT_SUCCESS(Status)) { /* We failed to create it. Try again with a smaller size */ - DPRINT1("SMSS:PFILE: Trying lower sizes for (`%wZ') \n", + DPRINT1("SMSS:PFILE: Trying lower sizes for (`%wZ')\n", &Descriptor->Name); Size.QuadPart = 16 * MEGABYTE; Status = SmpCreatePagingFileOnAnyDrive(Descriptor, @@ -1090,7 +1090,7 @@ if (!Created) { /* Build an emergency pagefile ourselves */ - DPRINT1("SMSS:PFILE: Creating emergency paging file. \n"); + DPRINT1("SMSS:PFILE: Creating emergency paging file.\n"); Status = SmpCreateEmergencyPagingFile(); }
Modified: trunk/reactos/base/system/smss/sminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/sminit.c?r... ============================================================================== --- trunk/reactos/base/system/smss/sminit.c [iso-8859-1] (original) +++ trunk/reactos/base/system/smss/sminit.c [iso-8859-1] Fri Feb 20 22:03:23 2015 @@ -104,8 +104,8 @@ /* A new entry -- allocate it */ RegEntry = RtlAllocateHeap(RtlGetProcessHeap(), SmBaseTag, - NameString.MaximumLength + - sizeof(SMP_REGISTRY_VALUE)); + sizeof(SMP_REGISTRY_VALUE) + + NameString.MaximumLength); if (!RegEntry) return STATUS_NO_MEMORY;
/* Initialize the list and set all values to NULL */ @@ -355,15 +355,15 @@ IN PVOID EntryContext) { NTSTATUS Status; - static PWCHAR Canary; + static PWCHAR Canary = NULL;
/* Check if this is the second call */ if (Canary) { /* Save the data into the list */ - DPRINT1("Renamed file: %S-%S\n", Canary, ValueData); + DPRINT1("Renamed file: '%S' - '%S'\n", Canary, ValueData); Status = SmpSaveRegistryValue(EntryContext, Canary, ValueData, FALSE); - Canary = 0; + Canary = NULL; } else { @@ -1994,7 +1994,7 @@ /* Get this entry */ NextEntry = RemoveHeadList(Head); RegEntry = CONTAINING_RECORD(NextEntry, SMP_REGISTRY_VALUE, Entry); - DPRINT1("Processing PFRO: %wZ/%wZ\n", &RegEntry->Value, &RegEntry->Name); + DPRINT1("Processing PFRO: '%wZ' / '%wZ'\n", &RegEntry->Value, &RegEntry->Name);
/* Skip past the '@' marker */ if (!(RegEntry->Value.Length) && (*RegEntry->Name.Buffer == L'@')) @@ -2077,7 +2077,7 @@ (Buffer->ReplaceIfExists))) { /* Open the file for write attribute access this time... */ - DPRINT1("\nSMSS: %wZ => %wZ failed - Status == %x, Possible readonly target\n", + DPRINT1("\nSMSS: '%wZ' => '%wZ' failed - Status == %x, Possible readonly target\n", &RegEntry->Name, &RegEntry->Value, STATUS_OBJECT_NAME_COLLISION); @@ -2150,18 +2150,18 @@ if (!NT_SUCCESS(Status)) { /* We totally failed */ - DPRINT1("SMSS: %wZ => %wZ failed - Status == %x\n", + DPRINT1("SMSS: '%wZ' => '%wZ' failed - Status == %x\n", &RegEntry->Name, &RegEntry->Value, Status); } else if (RegEntry->Value.Length) { /* We succeed with a rename */ - DPRINT1("SMSS: %wZ (renamed to) %wZ\n", &RegEntry->Name, &RegEntry->Value); + DPRINT1("SMSS: '%wZ' (renamed to) '%wZ'\n", &RegEntry->Name, &RegEntry->Value); } else { /* We suceeded with a delete */ - DPRINT1("SMSS: %wZ (deleted)\n", &RegEntry->Name); + DPRINT1("SMSS: '%wZ' (deleted)\n", &RegEntry->Name); }
/* Now free this entry and keep going */