[FREELDR]: Remove some extra newlines at the end of error messages that are displayed via message boxes, and also for few of them, use the fact that our message boxes implement printf-like features.

svn path=/trunk/; revision=66174
This commit is contained in:
Hermès Bélusca-Maïto 2015-02-05 21:24:26 +00:00
parent 927ab9996d
commit d511783a3c
11 changed files with 42 additions and 58 deletions

View file

@ -384,7 +384,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
PcrBasePage = Pcr >> MM_PAGE_SHIFT;
if (Pcr == 0)
{
UiMessageBox("Can't allocate PCR\n");
UiMessageBox("Can't allocate PCR.");
return;
}
RtlZeroMemory((PVOID)Pcr, 2 * MM_PAGE_SIZE);
@ -400,7 +400,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
GdtIdt = (PKGDTENTRY)MmAllocateMemoryWithType(NumPages * MM_PAGE_SIZE, LoaderMemoryData);
if (GdtIdt == NULL)
{
UiMessageBox("Can't allocate pages for GDT+IDT!\n");
UiMessageBox("Can't allocate pages for GDT+IDT!");
return;
}

View file

@ -30,16 +30,15 @@ ULONG DriveMapHandlerSegOff = 0; // Segment:offset style address of ou
#ifndef _MSC_VER
VOID DriveMapMapDrivesInSection(PCSTR SectionName)
{
CHAR SettingName[80];
CHAR SettingValue[80];
CHAR ErrorText[260];
CHAR Drive1[80];
CHAR Drive2[80];
ULONG SectionId;
ULONG SectionItemCount;
ULONG Index;
ULONG Index2;
DRIVE_MAP_LIST DriveMapList;
CHAR SettingName[80];
CHAR SettingValue[80];
CHAR Drive1[80];
CHAR Drive2[80];
ULONG SectionId;
ULONG SectionItemCount;
ULONG Index;
ULONG Index2;
DRIVE_MAP_LIST DriveMapList;
RtlZeroMemory(&DriveMapList, sizeof(DRIVE_MAP_LIST));
@ -62,8 +61,7 @@ VOID DriveMapMapDrivesInSection(PCSTR SectionName)
// Make sure we haven't exceeded the drive map max count
if (DriveMapList.DriveMapCount >= 4)
{
sprintf(ErrorText, "Max DriveMap count exceeded in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue);
UiMessageBox(ErrorText);
UiMessageBox("Max DriveMap count exceeded in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue);
continue;
}
@ -88,8 +86,7 @@ VOID DriveMapMapDrivesInSection(PCSTR SectionName)
// Make sure we got good values before we add them to the map
if (!DriveMapIsValidDriveString(Drive1) || !DriveMapIsValidDriveString(Drive2))
{
sprintf(ErrorText, "Error in DriveMap setting in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue);
UiMessageBox(ErrorText);
UiMessageBox("Error in DriveMap setting in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue);
continue;
}

View file

@ -365,7 +365,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
if (Pcr == 0)
{
UiMessageBox("Can't allocate PCR\n");
UiMessageBox("Can't allocate PCR.");
return;
}
@ -384,7 +384,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
if (GdtIdt == NULL)
{
UiMessageBox("Can't allocate pages for GDT+IDT!\n");
UiMessageBox("Can't allocate pages for GDT+IDT!");
return;
}

View file

@ -155,7 +155,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
//
if (Information.EndingAddress.HighPart != 0)
{
UiMessageBox("RAM disk too big\n");
UiMessageBox("RAM disk too big.");
FsCloseFile(RamFile);
return FALSE;
}
@ -172,7 +172,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
gRamDiskBase = MmAllocateMemoryWithType(gRamDiskSize, LoaderXIPRom);
if (!gRamDiskBase)
{
UiMessageBox("Failed to allocate memory for RAM disk\n");
UiMessageBox("Failed to allocate memory for RAM disk.");
FsCloseFile(RamFile);
return FALSE;
}
@ -222,7 +222,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
gRamDiskBase = NULL;
gRamDiskSize = 0;
FsCloseFile(RamFile);
UiMessageBox("Failed to read RAM disk\n");
UiMessageBox("Failed to read RAM disk.");
return FALSE;
}
}

View file

@ -41,13 +41,13 @@ VOID BootMain(LPSTR CmdLine)
if (!UiInitialize(FALSE))
{
UiMessageBoxCritical("Unable to initialize UI.\n");
UiMessageBoxCritical("Unable to initialize UI.");
goto Quit;
}
if (!MmInitializeMemoryManager())
{
UiMessageBoxCritical("Unable to initialize memory manager");
UiMessageBoxCritical("Unable to initialize memory manager.");
goto Quit;
}

View file

@ -82,7 +82,6 @@ LoadAndBootLinux(IN OperatingSystemItem* OperatingSystem,
PCSTR Description = OperatingSystem->LoadIdentifier;
PFILE LinuxKernel = 0;
PFILE LinuxInitrdFile = 0;
CHAR TempString[260];
UiDrawBackdrop();
@ -102,8 +101,7 @@ LoadAndBootLinux(IN OperatingSystemItem* OperatingSystem,
LinuxKernel = FsOpenFile(LinuxKernelName);
if (!LinuxKernel)
{
sprintf(TempString, "Linux kernel \'%s\' not found.", LinuxKernelName);
UiMessageBox(TempString);
UiMessageBox("Linux kernel \'%s\' not found.", LinuxKernelName);
goto LinuxBootFailed;
}
@ -113,8 +111,7 @@ LoadAndBootLinux(IN OperatingSystemItem* OperatingSystem,
LinuxInitrdFile = FsOpenFile(LinuxInitrdName);
if (!LinuxInitrdFile)
{
sprintf(TempString, "Linux initrd image \'%s\' not found.", LinuxInitrdName);
UiMessageBox(TempString);
UiMessageBox("Linux initrd image \'%s\' not found.", LinuxInitrdName);
goto LinuxBootFailed;
}
}
@ -212,7 +209,6 @@ LinuxBootFailed:
BOOLEAN LinuxParseIniSection(PCSTR SectionName)
{
ULONG_PTR SectionId;
CHAR SettingName[260];
/* Find all the message box settings and run them */
UiShowMessageBoxesInSection(SectionName);
@ -220,8 +216,7 @@ BOOLEAN LinuxParseIniSection(PCSTR SectionName)
/* Try to open the operating system section in the .ini file */
if (!IniOpenSection(SectionName, &SectionId))
{
sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", SectionName);
UiMessageBox(SettingName);
UiMessageBox("Section [%s] not found in freeldr.ini.", SectionName);
return FALSE;
}

View file

@ -34,7 +34,6 @@ LoadAndBootBootSector(IN OperatingSystemItem* OperatingSystem,
CHAR FileName[260];
PFILE FilePointer;
ULONG BytesRead;
CHAR SettingName[80];
/* Find all the message box settings and run them */
UiShowMessageBoxesInSection(SectionName);
@ -42,8 +41,7 @@ LoadAndBootBootSector(IN OperatingSystemItem* OperatingSystem,
/* Try to open the operating system section in the .ini file */
if (!IniOpenSection(SectionName, &SectionId))
{
sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", SectionName);
UiMessageBox(SettingName);
UiMessageBox("Section [%s] not found in freeldr.ini.", SectionName);
return;
}
@ -56,8 +54,7 @@ LoadAndBootBootSector(IN OperatingSystemItem* OperatingSystem,
FilePointer = FsOpenFile(FileName);
if (!FilePointer)
{
strcat(FileName, " not found.");
UiMessageBox(FileName);
UiMessageBox("%s not found.", FileName);
return;
}
@ -97,7 +94,6 @@ LoadAndBootPartition(IN OperatingSystemItem* OperatingSystem,
{
ULONG_PTR SectionId;
PCSTR SectionName = OperatingSystem->SystemPartition;
CHAR SettingName[80];
CHAR SettingValue[80];
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR DriveNumber;
@ -109,8 +105,7 @@ LoadAndBootPartition(IN OperatingSystemItem* OperatingSystem,
/* Try to open the operating system section in the .ini file */
if (!IniOpenSection(SectionName, &SectionId))
{
sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", SectionName);
UiMessageBox(SettingName);
UiMessageBox("Section [%s] not found in freeldr.ini.", SectionName);
return;
}
@ -175,7 +170,6 @@ LoadAndBootDrive(IN OperatingSystemItem* OperatingSystem,
{
ULONG_PTR SectionId;
PCSTR SectionName = OperatingSystem->SystemPartition;
CHAR SettingName[80];
CHAR SettingValue[80];
UCHAR DriveNumber;
@ -185,8 +179,7 @@ LoadAndBootDrive(IN OperatingSystemItem* OperatingSystem,
/* Try to open the operating system section in the .ini file */
if (!IniOpenSection(SectionName, &SectionId))
{
sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", SectionName);
UiMessageBox(SettingName);
UiMessageBox("Section [%s] not found in freeldr.ini.", SectionName);
return;
}

View file

@ -282,7 +282,7 @@ WinLdrLoadImage(IN PCHAR FileName,
Status = ArcOpen(FileName, OpenReadOnly, &FileId);
if (Status != ESUCCESS)
{
//UiMessageBox("Can not open the file");
// UiMessageBox("Can not open the file.");
return FALSE;
}
@ -290,7 +290,7 @@ WinLdrLoadImage(IN PCHAR FileName,
Status = ArcRead(FileId, HeadersBuffer, SECTOR_SIZE * 2, &BytesRead);
if (Status != ESUCCESS)
{
UiMessageBox("Error reading from file");
UiMessageBox("Error reading from file.");
ArcClose(FileId);
return FALSE;
}
@ -299,8 +299,8 @@ WinLdrLoadImage(IN PCHAR FileName,
NtHeaders = RtlImageNtHeader(HeadersBuffer);
if (!NtHeaders)
{
//Print(L"Error - no NT header found in %s\n", FileName);
UiMessageBox("Error - no NT header found");
// Print(L"Error - no NT header found in %s\n", FileName);
UiMessageBox("Error - no NT header found.");
ArcClose(FileId);
return FALSE;
}
@ -308,8 +308,8 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Ensure this is executable image */
if (((NtHeaders->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE) == 0))
{
//Print(L"Not an executable image %s\n", FileName);
UiMessageBox("Not an executable image");
// Print(L"Not an executable image %s\n", FileName);
UiMessageBox("Not an executable image.");
ArcClose(FileId);
return FALSE;
}
@ -330,8 +330,8 @@ WinLdrLoadImage(IN PCHAR FileName,
if (PhysicalBase == NULL)
{
//Print(L"Failed to alloc pages for image %s\n", FileName);
UiMessageBox("Failed to alloc pages for image");
// Print(L"Failed to alloc pages for image %s\n", FileName);
UiMessageBox("Failed to alloc pages for image.");
ArcClose(FileId);
return FALSE;
}
@ -347,7 +347,7 @@ WinLdrLoadImage(IN PCHAR FileName,
Status = ArcSeek(FileId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
UiMessageBox("Error seeking to start of file");
UiMessageBox("Error seeking to start of file.");
ArcClose(FileId);
return FALSE;
}
@ -355,8 +355,8 @@ WinLdrLoadImage(IN PCHAR FileName,
Status = ArcRead(FileId, PhysicalBase, NtHeaders->OptionalHeader.SizeOfHeaders, &BytesRead);
if (Status != ESUCCESS)
{
//Print(L"Error reading headers %s\n", FileName);
UiMessageBox("Error reading headers");
// Print(L"Error reading headers %s\n", FileName);
UiMessageBox("Error reading headers.");
ArcClose(FileId);
return FALSE;
}

View file

@ -682,7 +682,7 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
/* Load the ramdisk */
if (!RamDiskLoadVirtualFile(FileName))
{
UiMessageBox("Failed to load RAM disk file %s\n", FileName);
UiMessageBox("Failed to load RAM disk file %s", FileName);
return;
}
}

View file

@ -220,7 +220,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
MemoryMap = MmGetMemoryMap(&NoEntries);
if (MemoryMap == NULL)
{
UiMessageBox("Can not retrieve the current memory map");
UiMessageBox("Can not retrieve the current memory map.");
return FALSE;
}
@ -334,7 +334,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
/*Status = MempSetupPaging(OsLoaderBase >> MM_PAGE_SHIFT, OsLoaderSize >> MM_PAGE_SHIFT);
if (!Status)
{
UiMessageBox("Error during MempSetupPaging");
UiMessageBox("Error during MempSetupPaging.");
return;
}*/

View file

@ -437,8 +437,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
return TRUE;
Failure:
//UiMessageBox("Error reading NLS file %s\n", Filename);
UiMessageBox("Error reading NLS file!");
UiMessageBox("Error reading NLS file %s", FileName);
return FALSE;
}