Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <[email protected]>
---
 Source/C/Common/MemoryFile.c | 22 ++++++++++++++++++++++
 Source/C/Common/MemoryFile.h | 12 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Source/C/Common/MemoryFile.c b/Source/C/Common/MemoryFile.c
index 1fb845d..82ca45d 100644
--- a/Source/C/Common/MemoryFile.c
+++ b/Source/C/Common/MemoryFile.c
@@ -240,6 +240,28 @@ Returns:
 }
 
 
+/**
+  Returns the size of the data stored in the memory file
+
+  @param MemoryFile  The memory file
+
+  @return  Size of the memory file's contents
+**/
+UINTN
+GetMemoryFileSize (
+  IN EFI_HANDLE InputMemoryFile
+  )
+{
+  MEMORY_FILE *MemoryFile;
+
+  CheckMemoryFileState (InputMemoryFile);
+
+  MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+
+  return (UINTN) (MemoryFile->Eof - MemoryFile->FileImage);
+}
+
+
 STATIC
 VOID
 CheckMemoryFileState (
diff --git a/Source/C/Common/MemoryFile.h b/Source/C/Common/MemoryFile.h
index baab40b..3bfa509 100644
--- a/Source/C/Common/MemoryFile.h
+++ b/Source/C/Common/MemoryFile.h
@@ -119,4 +119,16 @@ Returns:
 **/
 
 
+/**
+  Returns the size of the data stored in the memory file
+
+  @param MemoryFile  The memory file
+
+  @return  Size of the memory file's contents
+**/
+UINTN
+GetMemoryFileSize (
+  IN EFI_HANDLE InputMemoryFile
+  );
+
 #endif
-- 
1.9.2


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
edk2-buildtools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-buildtools-devel

Reply via email to