diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-27 13:31:05 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-27 13:31:05 +0000 |
commit | 657073df4f0cfd1c39dd98f8ea4d1fbe4849081d (patch) | |
tree | 3340f3b4c3d5bdb3792e810b57e7395fca71e96f /MdePkg/Library/BasePeCoffLib/BasePeCoff.c | |
parent | 008dfe313e0a2ab27a7568332e45e817bcbede0a (diff) | |
download | edk2-platforms-657073df4f0cfd1c39dd98f8ea4d1fbe4849081d.tar.xz |
Add several missing assertions.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6766 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BasePeCoffLib/BasePeCoff.c')
-rw-r--r-- | MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index 9756520aa6..3b14c9b6e4 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -1319,15 +1319,26 @@ PeCoffLoaderRelocateImageForRuntime ( /**
- ImageRead function that operates on a memory buffer whos base is passed into
- FileHandle.
+ Reads contents of a PE/COFF image from a buffer in system memory.
+
+ This is the default implementation of a PE_COFF_LOADER_READ_FILE function
+ that assumes FileHandle pointer to the beginning of a PE/COFF image.
+ This function reads contents of the PE/COFF image that starts at the system memory
+ address specified by FileHandle. The read operation copies ReadSize bytes from the
+ PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
+ The size of the buffer actually read is returned in ReadSize.
+
+ If FileHandle is NULL, then ASSERT().
+ If ReadSize is NULL, then ASSERT().
+ If Buffer is NULL, then ASSERT().
- @param FileHandle Ponter to baes of the input stream
- @param FileOffset Offset to the start of the buffer
- @param ReadSize Number of bytes to copy into the buffer
- @param Buffer Location to place results of read
+ @param FileHandle Pointer to base of the input stream
+ @param FileOffset Offset into the PE/COFF image to begin the read operation.
+ @param ReadSize On input, the size in bytes of the requested read operation.
+ On output, the number of bytes actually read.
+ @param Buffer Output buffer that contains the data read from the PE/COFF image.
- @retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
+ @retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
the buffer.
**/
RETURN_STATUS
@@ -1339,6 +1350,10 @@ PeCoffLoaderImageReadFromMemory ( OUT VOID *Buffer
)
{
+ ASSERT (ReadSize != NULL);
+ ASSERT (FileHandle != NULL);
+ ASSERT (Buffer != NULL);
+
CopyMem (Buffer, ((UINT8 *)FileHandle) + FileOffset, *ReadSize);
return RETURN_SUCCESS;
}
|