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);
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;
}
#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));
// 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;
}
// 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;
}
if (Pcr == 0)
{
- UiMessageBox("Can't allocate PCR\n");
+ UiMessageBox("Can't allocate PCR.");
return;
}
if (GdtIdt == NULL)
{
- UiMessageBox("Can't allocate pages for GDT+IDT!\n");
+ UiMessageBox("Can't allocate pages for GDT+IDT!");
return;
}
//
if (Information.EndingAddress.HighPart != 0)
{
- UiMessageBox("RAM disk too big\n");
+ UiMessageBox("RAM disk too big.");
FsCloseFile(RamFile);
return FALSE;
}
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;
}
gRamDiskBase = NULL;
gRamDiskSize = 0;
FsCloseFile(RamFile);
- UiMessageBox("Failed to read RAM disk\n");
+ UiMessageBox("Failed to read RAM disk.");
return FALSE;
}
}
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;
}
PCSTR Description = OperatingSystem->LoadIdentifier;
PFILE LinuxKernel = 0;
PFILE LinuxInitrdFile = 0;
- CHAR TempString[260];
UiDrawBackdrop();
LinuxKernel = FsOpenFile(LinuxKernelName);
if (!LinuxKernel)
{
- sprintf(TempString, "Linux kernel \'%s\' not found.", LinuxKernelName);
- UiMessageBox(TempString);
+ UiMessageBox("Linux kernel \'%s\' not found.", LinuxKernelName);
goto LinuxBootFailed;
}
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;
}
}
BOOLEAN LinuxParseIniSection(PCSTR SectionName)
{
ULONG_PTR SectionId;
- CHAR SettingName[260];
/* Find all the message box settings and run them */
UiShowMessageBoxesInSection(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;
}
CHAR FileName[260];
PFILE FilePointer;
ULONG BytesRead;
- CHAR SettingName[80];
/* Find all the message box settings and run them */
UiShowMessageBoxesInSection(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;
}
FilePointer = FsOpenFile(FileName);
if (!FilePointer)
{
- strcat(FileName, " not found.");
- UiMessageBox(FileName);
+ UiMessageBox("%s not found.", FileName);
return;
}
{
ULONG_PTR SectionId;
PCSTR SectionName = OperatingSystem->SystemPartition;
- CHAR SettingName[80];
CHAR SettingValue[80];
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR DriveNumber;
/* 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;
}
{
ULONG_PTR SectionId;
PCSTR SectionName = OperatingSystem->SystemPartition;
- CHAR SettingName[80];
CHAR SettingValue[80];
UCHAR DriveNumber;
/* 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;
}
Status = ArcOpen(FileName, OpenReadOnly, &FileId);
if (Status != ESUCCESS)
{
- //UiMessageBox("Can not open the file");
+ // UiMessageBox("Can not open the file.");
return FALSE;
}
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;
}
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;
}
/* 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;
}
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;
}
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;
}
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;
}
/* 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;
}
}
MemoryMap = MmGetMemoryMap(&NoEntries);
if (MemoryMap == NULL)
{
- UiMessageBox("Can not retrieve the current memory map");
+ UiMessageBox("Can not retrieve the current memory map.");
return FALSE;
}
/*Status = MempSetupPaging(OsLoaderBase >> MM_PAGE_SHIFT, OsLoaderSize >> MM_PAGE_SHIFT);
if (!Status)
{
- UiMessageBox("Error during MempSetupPaging");
+ UiMessageBox("Error during MempSetupPaging.");
return;
}*/
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;
}