From 7cd08d2a4392a092693c690d7d1ff948a037fe4d Mon Sep 17 00:00:00 2001 From: Regina König Date: Thu, 20 Aug 2020 23:45:00 +0200 Subject: Am able to add a new line to file --- .../Memtest/ProtocolInformation/ProtocolInformation.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'memtestEDK') diff --git a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c index afd47ec..235d0b0 100644 --- a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c +++ b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c @@ -186,7 +186,7 @@ UefiMain ( 0); checkStatus(efiStatus, "Open"); - UINTN fileSize = 100; // TODO get the actual size + UINTN fileSize = 500; // TODO get the actual size CHAR16* fileBuffer = NULL; efiStatus = bs->AllocatePool(EfiLoaderData, (UINTN) (fileSize) , (void **)&fileBuffer); checkStatus(efiStatus, "AllocatePool for file"); @@ -201,14 +201,13 @@ UefiMain ( checkStatus(efiStatus, "GetPosition"); Print(L"Current File Position: %d\n", currPos); - fileBuffer[0] = (CHAR16) 'C'; // TODO create new buffer. What's the best practice? Extra function - fileBuffer[1] = (CHAR16) '\0'; - Console->OutputString(Console, fileBuffer); - UINTN length = 2; + char *message = "\nAdding a new line"; + UINTN length = 19; + Print(L"Lengh: %d\n", length); token->SetPosition(token, fileSize - 1); - efiStatus = token->Write(token, &length, fileBuffer); + efiStatus = token->Write(token, &length, message); checkStatus(efiStatus, "Write"); fileSize += length; @@ -216,7 +215,7 @@ UefiMain ( token->SetPosition(token, 0); efiStatus = token->Read(token, &fileSize, fileBuffer); - Print(L"File Content after write: %a\n", fileBuffer); + printFileContent(fileSize, fileBuffer); } // end if (compareGuids(&sfspGuid, guid)) } // end for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) -- cgit v1.2.3-55-g7522