summaryrefslogtreecommitdiffstats
path: root/memtestEDK
diff options
context:
space:
mode:
authorRegina König2020-08-19 13:24:54 +0200
committerRegina König2020-08-19 13:24:54 +0200
commitf0d52e9c170dfb14f8790a67f2cd2c204ef8e2e1 (patch)
tree8136e1b4ccf9ff2ab91c4e50dde33410ce74636e /memtestEDK
parentsome progress in init() function (diff)
downloadmemtest86-f0d52e9c170dfb14f8790a67f2cd2c204ef8e2e1.tar.gz
memtest86-f0d52e9c170dfb14f8790a67f2cd2c204ef8e2e1.tar.xz
memtest86-f0d52e9c170dfb14f8790a67f2cd2c204ef8e2e1.zip
first attempt to write to a file was sucessful, but not the optimal solution
Diffstat (limited to 'memtestEDK')
-rw-r--r--memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
index 59e424f..547c91e 100644
--- a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
+++ b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
@@ -166,10 +166,10 @@ UefiMain (
root,
&token,
L"log",
- EFI_FILE_MODE_READ,
- EFI_FILE_READ_ONLY | EFI_FILE_HIDDEN | EFI_FILE_SYSTEM);
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE,
+ 0);
- UINTN fileSize = 50;
+ UINTN fileSize = 50; // TODO get the actual size
CHAR16* fileBuffer = NULL;
efiStatus = bs->AllocatePool(EfiLoaderData, (UINTN) (fileSize) , (void **)&fileBuffer);
@@ -177,9 +177,22 @@ UefiMain (
Print(L"Status after file read: %r\n", efiStatus);
Print(L"File Size: %d\n", fileSize);
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);
+
+ Print(L"Status after file write: %r\n", efiStatus);
+
/*
EFI_FILE_OPEN Open;