diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-29 20:20:57 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-29 20:20:57 +0200 |
| commit | 77423c4fa55a060c5cf710bbe5c4de02fce43e97 (patch) | |
| tree | 9fd6308619a7ee4deca80c05d44fea2566d99da4 /Private/NewBoot | |
| parent | a21859d722597e4eb1216a4a48d08d8f2659b514 (diff) | |
MHR-18: Fixing last bugs...
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot')
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 8 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootATA.cxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx | 10 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 6 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx | 30 |
5 files changed, 40 insertions, 16 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index ca6f56ac..c916978f 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -225,7 +225,7 @@ public: return false; } - writer.Write(L"Device Size: ").Write(this->fDiskDev.GetDiskSize()).Write(L"\r\n"); + writer.Write(L"Device Size: ").Write(this->fDiskDev.GetDiskSize()).Write(L"\r"); if (blockPart->DiskSize != this->fDiskDev.GetDiskSize() || blockPart->DiskSize < 1 || @@ -236,7 +236,7 @@ public: EFI::ThrowError(L"Invalid-Partition-Name", L"Invalid disk partition."); } - writer.Write(L"Device Partition: ").Write(blockPart->PartitionName).Write(L" is healthy.\r\n"); + writer.Write(L"Device Partition: ").Write(blockPart->PartitionName).Write(L" is healthy.\r"); return true; } @@ -300,7 +300,7 @@ private: SizeT cur = 0UL; writer.Write((catalogKind->Kind == kNewFSCatalogKindFile) ? L"New Boot: Write-File: " : - L"New Boot: Write-Directory: " ).Write(blob->fFileName).Write(L"\r\n"); + L"New Boot: Write-Directory: " ).Write(blob->fFileName).Write(L"\r"); /// Set disk cursor here. @@ -396,7 +396,7 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName, fDiskDev.Write(buf, sectorSz); BTextWriter writer; - writer.Write(L"New Boot: Write-Partition, OK.\r\n"); + writer.Write(L"New Boot: Write-Partition, OK.\r"); return true; } else { diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx index d6b5542c..edfbaed8 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx @@ -73,7 +73,7 @@ ATAInit_Retry: if (statRdy & ATA_SR_ERR) { writer.Write( - L"New Boot: ATA: Select error, not an IDE based hard-drive.\r\n"); + L"New Boot: ATA: Select error, not an IDE based hard-drive.\r"); return false; } diff --git a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx index b2d728ae..e01d0b96 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx @@ -52,12 +52,12 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, EfiGUID guidImg = EfiGUID(EFI_LOADED_IMAGE_PROTOCOL_GUID); if (BS->HandleProtocol(ImageHandle, &guidImg, (void**)&img) != kEfiOk) { - mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); + mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Protocol").Write(L"\r"); this->mErrorCode = kNotSupported; } if (BS->HandleProtocol(img->DeviceHandle, &guidEfp, (void**)&efp) != kEfiOk) { - mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); + mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Protocol").Write(L"\r"); this->mErrorCode = kNotSupported; return; } @@ -65,7 +65,7 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, /// Start doing disk I/O if (efp->OpenVolume(efp, &rootFs) != kEfiOk) { - mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Volume").Write(L"\r\n"); + mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Volume").Write(L"\r"); EFI::ThrowError(L"NoSuchVolume", L"No Such volume."); this->mErrorCode = kNotSupported; return; @@ -77,7 +77,7 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, kEfiOk) { mWriter.Write(L"New Boot: Fetch-Protocol: No-Such-Path: ") .Write(mPath) - .Write(L"\r\n"); + .Write(L"\r"); EFI::ThrowError(L"NoSuchPath", L"No Such file on filesystem."); this->mErrorCode = kNotSupported; return; @@ -109,7 +109,7 @@ Void BFileReader::ReadAll(SizeT until, SizeT chunk) { if (mBlob == nullptr) { if (auto err = BS->AllocatePool(EfiLoaderCode, until, (VoidPtr*)&mBlob) != kEfiOk) { - mWriter.Write(L"*** EFI-Code: ").Write(err).Write(L" ***\r\n"); + mWriter.Write(L"*** EFI-Code: ").Write(err).Write(L" ***\r"); EFI::ThrowError(L"OutOfMemory", L"Allocation error."); } } diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index 96999df8..1462115a 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -65,9 +65,9 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, writer.Write(L"Mahrouss-Logic (R) New Boot: ") .Write(BVersionString::Shared()); - writer.Write(L"\r\nNew Boot: Firmware Vendor: ") + writer.Write(L"\rNew Boot: Firmware Vendor: ") .Write(SystemTable->FirmwareVendor) - .Write(L"\r\n"); + .Write(L"\r"); UInt32* MapKey = new UInt32(); UInt32* SizePtr = new UInt32(); @@ -151,7 +151,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, writer.WriteCharacter(buf[i]); } } else - writer.Write(L"\r\n"); + writer.Write(L"\r"); } } diff --git a/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx b/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx index fc91a02a..2a92ce6d 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx @@ -26,12 +26,28 @@ BTextWriter &BTextWriter::Write(const CharacterTypeUTF16 *str) { #ifdef __DEBUG__ if (!str || *str == 0) return *this; - ST->ConOut->OutputString(ST->ConOut, str); + CharacterTypeUTF16 strTmp[2]; + strTmp[1] = 0; + + for (size_t i = 0; str[i] != 0; i++) { + if (str[i] == '\r') { + strTmp[0] = str[i]; + ST->ConOut->OutputString(ST->ConOut, strTmp); + + strTmp[0] = '\n'; + ST->ConOut->OutputString(ST->ConOut, strTmp); + } else { + strTmp[0] = str[i]; + ST->ConOut->OutputString(ST->ConOut, strTmp); + } + } #endif // ifdef __DEBUG__ return *this; } +/// @brief UTF-8 equivalent of Write (UTF-16). +/// @param str the input string. BTextWriter &BTextWriter::Write(const Char *str) { #ifdef __DEBUG__ if (!str || *str == 0) return *this; @@ -40,8 +56,16 @@ BTextWriter &BTextWriter::Write(const Char *str) { strTmp[1] = 0; for (size_t i = 0; str[i] != 0; i++) { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); + if (str[i] == '\r') { + strTmp[0] = str[i]; + ST->ConOut->OutputString(ST->ConOut, strTmp); + + strTmp[0] = '\n'; + ST->ConOut->OutputString(ST->ConOut, strTmp); + } else { + strTmp[0] = str[i]; + ST->ConOut->OutputString(ST->ConOut, strTmp); + } } #endif // ifdef __DEBUG__ |
