summaryrefslogtreecommitdiffstats
path: root/memtestEDK
diff options
context:
space:
mode:
authorRegina König2020-08-19 17:30:00 +0200
committerRegina König2020-08-19 17:30:00 +0200
commit5c0604dbf95bc30a71a1594c5207f82dd7dc965d (patch)
tree46145295f88a1447aa34a94b5932076d5548a793 /memtestEDK
parentfirst attempt to write to a file was sucessful, but not the optimal solution (diff)
downloadmemtest86-5c0604dbf95bc30a71a1594c5207f82dd7dc965d.tar.gz
memtest86-5c0604dbf95bc30a71a1594c5207f82dd7dc965d.tar.xz
memtest86-5c0604dbf95bc30a71a1594c5207f82dd7dc965d.zip
able to append one symbol to an existing file
Diffstat (limited to 'memtestEDK')
-rw-r--r--memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
index 547c91e..ddc6e82 100644
--- a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
+++ b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
@@ -18,6 +18,9 @@ UefiMain (
EFI_BOOT_SERVICES* bs = SystemTable->BootServices;
EFI_GUID sfspGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = SystemTable->ConOut;
+
+
EFI_HANDLE* handleBuffer = NULL;
EFI_HANDLE* handleBuffer2 = NULL;
UINTN handleCount = 0;
@@ -179,32 +182,37 @@ UefiMain (
Print(L"File Buffer Pointer: %p\n", fileBuffer);
Print(L"File Content: %a\n", fileBuffer);
+
UINT64 currPos;
token->GetPosition(token, &currPos);
Print(L"Current File Position: %d\n", currPos);
- fileBuffer[0] = (CHAR16) 'X';
- Print(L"New file Buffer: %a\n", fileBuffer);
- token->SetPosition(token, 0);
- efiStatus = token->Write(token, &fileSize, fileBuffer);
+ fileBuffer[0] = (CHAR16) 'C';
+ fileBuffer[1] = (CHAR16) '\0';
+ Console->OutputString(Console, fileBuffer);
+ UINTN length = 2;
+ fileSize += 2;
+
+ token->SetPosition(token, 35);
+
+ efiStatus = token->Write(token, &length, fileBuffer);
Print(L"Status after file write: %r\n", efiStatus);
+ token->SetPosition(token, fileSize - 2);
+
+ efiStatus = token->Read(token, &fileSize, fileBuffer);
+ Print(L"File Content after write: %a\n", fileBuffer);
+
+
+ token->SetPosition(token, 0);
+
+ efiStatus = token->Read(token, &fileSize, fileBuffer);
+ Print(L"File Content after write: %a\n", fileBuffer);
-/*
- EFI_FILE_OPEN Open;
- EFI_FILE_CLOSE Close;
- EFI_FILE_DELETE Delete;
- EFI_FILE_READ Read;
- EFI_FILE_WRITE Write;
- EFI_FILE_GET_POSITION GetPosition;
- EFI_FILE_SET_POSITION SetPosition;
- EFI_FILE_GET_INFO GetInfo;
- EFI_FILE_SET_INFO SetInfo;
- EFI_FILE_FLUSH Flush;*/
}
}
}