summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c600
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h336
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c64
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h35
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c164
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h61
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c191
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h53
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h6
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c367
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h28
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c209
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h62
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c426
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h109
15 files changed, 1106 insertions, 1605 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
index 8aa75b419a..469642245d 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
@@ -74,23 +74,16 @@ BOOLEAN HBufferImageOnlyLineNeedRefresh;
BOOLEAN HBufferImageMouseNeedRefresh;
+/**
+ Initialization function for HBufferImage
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HBufferImageInit (
VOID
)
-/**
- Initialization function for HBufferImage
-
-
-
- None
-
-
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
-**/
{
EFI_STATUS Status;
@@ -144,25 +137,16 @@ HBufferImageInit (
return EFI_SUCCESS;
}
+/**
+ Backup function for HBufferImage. Only a few fields need to be backup.
+ This is for making the file buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageBackup (
VOID
)
-/**
- Backup function for HBufferImage
- Only a few fields need to be backup.
- This is for making the file buffer refresh
- as few as possible.
-
-
-
- None
-
-
-
- EFI_SUCCESS
-
-**/
{
HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;
@@ -197,27 +181,20 @@ HBufferImageBackup (
return EFI_SUCCESS;
}
-EFI_STATUS
-HBufferImageFreeLines (
- VOID
- )
-/**
- Free all the lines in HBufferImage
+/**
+ Free all the lines in HBufferImage.
Fields affected:
Lines
CurrentLine
NumLines
ListHead
-
-
- None
-
-
-
- EFI_SUCCESS
-
+ @retval EFI_SUCCESS The operation was successful.
**/
+EFI_STATUS
+HBufferImageFreeLines (
+ VOID
+ )
{
HFreeLines (HBufferImage.ListHead, HBufferImage.Lines);
@@ -228,22 +205,15 @@ HBufferImageFreeLines (
return EFI_SUCCESS;
}
+/**
+ Cleanup function for HBufferImage
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageCleanup (
VOID
)
-/**
- Cleanup function for HBufferImage
-
-
-
- None
-
-
-
- EFI_SUCCESS
-
-**/
{
EFI_STATUS Status;
@@ -257,12 +227,22 @@ HBufferImageCleanup (
HFileImageCleanup ();
HDiskImageCleanup ();
- HMemImageCleanup ();
return Status;
}
+/**
+ Print Line on Row
+
+ @param[in] Line The lline to print.
+ @param[in] Row The row on screen ( begin from 1 ).
+ @param[in] FRow The FRow.
+ @param[in] Orig The original color.
+ @param[in] New The color to print with.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImagePrintLine (
IN HEFI_EDITOR_LINE *Line,
@@ -272,22 +252,6 @@ HBufferImagePrintLine (
IN HEFI_EDITOR_COLOR_UNION New
)
-/**
- Print Line on Row
-
-
-
- Line - Line to print
- Row - Row on screen ( begin from 1 )
- FRow - FRow
- Orig - Orig
- New - Light display
-
-
-
- EFI_SUCCESS
-
-**/
{
UINTN Index;
@@ -330,7 +294,7 @@ HBufferImagePrintLine (
}
- if (HEditorMouseAction == FALSE) {
+ if (!HEditorMouseAction) {
ShellPrintEx (
0,
(INT32)Row - 1,
@@ -417,7 +381,7 @@ HBufferImagePrintLine (
//
// PRINT the buffer content
//
- if (HEditorMouseAction == FALSE) {
+ if (!HEditorMouseAction) {
for (Index = 0; Index < 0x10 && Index < Line->Size; Index++) {
Pos = ASCII_POSITION + Index;
@@ -456,6 +420,15 @@ HBufferImagePrintLine (
return EFI_SUCCESS;
}
+/**
+ Function to decide if a column number is stored in the high bits.
+
+ @param[in] Column The column to examine.
+ @param[out] FCol The actual column number.
+
+ @retval TRUE The actual column was in high bits and is now in FCol.
+ @retval FALSE There was not a column number in the high bits.
+**/
BOOLEAN
HBufferImageIsAtHighBits (
IN UINTN Column,
@@ -479,7 +452,7 @@ HBufferImageIsAtHighBits (
*FCol = (Column / 3) + 1;
- if (!(Column % 3)) {
+ if (Column % 3 == 0) {
return TRUE;
}
@@ -490,6 +463,15 @@ HBufferImageIsAtHighBits (
return FALSE;
}
+/**
+ Decide if a point is in the already selected area.
+
+ @param[in] MouseRow The row of the point to test.
+ @param[in] MouseCol The col of the point to test.
+
+ @retval TRUE The point is in the selected area.
+ @retval FALSE The point is not in the selected area.
+**/
BOOLEAN
HBufferImageIsInSelectedArea (
IN UINTN MouseRow,
@@ -552,6 +534,11 @@ HBufferImageIsInSelectedArea (
return TRUE;
}
+/**
+ Set mouse position according to HBufferImage.MousePosition.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageRestoreMousePosition (
VOID
@@ -719,22 +706,15 @@ HBufferImageRestoreMousePosition (
return EFI_SUCCESS;
}
+/**
+ Set cursor position according to HBufferImage.DisplayPosition.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageRestorePosition (
VOID
)
-/**
- Set cursor position according to HBufferImage.DisplayPosition.
-
-
-
- None
-
-
-
- EFI_SUCCESS
-
-**/
{
//
// set cursor position
@@ -748,7 +728,7 @@ HBufferImageRestorePosition (
return EFI_SUCCESS;
}
-/**
+/**
Refresh function for HBufferImage.
@retval EFI_SUCCESS The operation was successful.
@@ -890,7 +870,7 @@ HBufferImageRefresh (
} while (Link != HBufferImage.ListHead && Row <= EndRow);
while (Row <= EndRow) {
- HEditorClearLine (Row);
+ EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);
Row++;
}
//
@@ -915,8 +895,8 @@ HBufferImageRefresh (
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
- @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
- @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@param[in] Recover TRUE for recovermode, FALSE otherwise.
@@ -980,8 +960,8 @@ HBufferImageRead (
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
- @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
- @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@return EFI_SUCCESS The operation was successful.
@@ -1036,7 +1016,7 @@ HBufferImageSave (
return Status;
}
-/**
+/**
Create a new line and append it to the line list.
Fields affected:
NumLines
@@ -1083,7 +1063,7 @@ HBufferImageCreateLine (
return Line;
}
-/**
+/**
Free the current image.
@retval EFI_SUCCESS The operation was successful.
@@ -1101,160 +1081,6 @@ HBufferImageFree (
return EFI_SUCCESS;
}
-/**
- Dispatch input to different handler
-
- @param[in] Key The input key:
- the keys can be:
- ASCII KEY
- Backspace/Delete
- Direction key: up/down/left/right/pgup/pgdn
- Home/End
- INS
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_LOAD_ERROR A load error occured.
- @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
-**/
-EFI_STATUS
-HBufferImageHandleInput (
- IN EFI_INPUT_KEY *Key
- )
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- switch (Key->ScanCode) {
- //
- // ordinary key
- //
- case SCAN_NULL:
- Status = HBufferImageDoCharInput (Key->UnicodeChar);
- break;
-
- //
- // up arrow
- //
- case SCAN_UP:
- Status = HBufferImageScrollUp ();
- break;
-
- //
- // down arrow
- //
- case SCAN_DOWN:
- Status = HBufferImageScrollDown ();
- break;
-
- //
- // right arrow
- //
- case SCAN_RIGHT:
- Status = HBufferImageScrollRight ();
- break;
-
- //
- // left arrow
- //
- case SCAN_LEFT:
- Status = HBufferImageScrollLeft ();
- break;
-
- //
- // page up
- //
- case SCAN_PAGE_UP:
- Status = HBufferImagePageUp ();
- break;
-
- //
- // page down
- //
- case SCAN_PAGE_DOWN:
- Status = HBufferImagePageDown ();
- break;
-
- //
- // delete
- //
- case SCAN_DELETE:
- Status = HBufferImageDoDelete ();
- break;
-
- //
- // home
- //
- case SCAN_HOME:
- Status = HBufferImageHome ();
- break;
-
- //
- // end
- //
- case SCAN_END:
- Status = HBufferImageEnd ();
- break;
-
- default:
- Status = StatusBarSetStatusString (L"Unknown Command");
- break;
- }
-
- return Status;
-}
-
-/**
- ASCII key + Backspace + return.
-
- @param[in] Char The input char.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_LOAD_ERROR A load error occured.
- @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
-**/
-EFI_STATUS
-EFIAPI
-HBufferImageDoCharInput (
- IN CHAR16 Char
- )
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- switch (Char) {
- case 0:
- break;
-
- case 0x08:
- Status = HBufferImageDoBackspace ();
- break;
-
- case 0x09:
- case 0x0a:
- case 0x0d:
- //
- // Tabs, Returns are thought as nothing
- //
- break;
-
- default:
- //
- // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
- //
- if (Char > 127 || Char < 32) {
- Status = StatusBarSetStatusString (L"Unknown Command");
- } else {
- Status = HBufferImageAddChar (Char);
- }
-
- break;
- }
-
- return Status;
-}
-
/**
change char to int value based on Hex.
@@ -1422,23 +1248,114 @@ HBufferImageAddChar (
}
/**
- Check user specified FileRow and FileCol is in current screen.
+ Delete the previous character.
- @param[in] FileRow Row of file position ( start from 1 ).
+ @retval EFI_SUCCESS The operationw as successful.
+**/
+EFI_STATUS
+EFIAPI
+HBufferImageDoBackspace (
+ VOID
+ )
+{
+ HEFI_EDITOR_LINE *Line;
- @retval TRUE It's on the current screen.
- @retval FALSE It's not on the current screen.
+ UINTN FileColumn;
+ UINTN FPos;
+ BOOLEAN LastLine;
+
+ //
+ // variable initialization
+ //
+ LastLine = FALSE;
+
+ //
+ // already the first character
+ //
+ if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
+ return EFI_SUCCESS;
+ }
+
+ FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
+
+ FileColumn = HBufferImage.BufferPosition.Column;
+
+ Line = HBufferImage.CurrentLine;
+ LastLine = FALSE;
+ if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
+ LastLine = TRUE;
+ }
+
+ HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);
+
+ //
+ // if is the last line
+ // then only this line need to be refreshed
+ //
+ if (LastLine) {
+ HBufferImageNeedRefresh = FALSE;
+ HBufferImageOnlyLineNeedRefresh = TRUE;
+ } else {
+ HBufferImageNeedRefresh = TRUE;
+ HBufferImageOnlyLineNeedRefresh = FALSE;
+ }
+
+ if (!HBufferImage.Modified) {
+ HBufferImage.Modified = TRUE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ ASCII key + Backspace + return.
+
+ @param[in] Char The input char.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
-BOOLEAN
-HInCurrentScreen (
- IN UINTN FileRow
+EFI_STATUS
+EFIAPI
+HBufferImageDoCharInput (
+ IN CHAR16 Char
)
{
- if (FileRow >= HBufferImage.LowVisibleRow && FileRow <= HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {
- return TRUE;
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ switch (Char) {
+ case 0:
+ break;
+
+ case 0x08:
+ Status = HBufferImageDoBackspace ();
+ break;
+
+ case 0x09:
+ case 0x0a:
+ case 0x0d:
+ //
+ // Tabs, Returns are thought as nothing
+ //
+ break;
+
+ default:
+ //
+ // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
+ //
+ if (Char > 127 || Char < 32) {
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ } else {
+ Status = HBufferImageAddChar (Char);
+ }
+
+ break;
}
- return FALSE;
+ return Status;
}
/**
@@ -1496,7 +1413,6 @@ HBufferImageMovePosition (
IN UINTN NewFilePosCol,
IN BOOLEAN HighBits
)
-
{
INTN RowGap;
UINTN Abs;
@@ -1972,7 +1888,7 @@ HBufferImageGetTotalSize (
@param[in] Pos Position, Pos starting from 0.
@param[in] Count The Count of characters to delete.
- @param[OUT] DeleteBuffer The DeleteBuffer.
+ @param[out] DeleteBuffer The DeleteBuffer.
@retval EFI_SUCCESS Success
**/
@@ -2210,66 +2126,6 @@ HBufferImageAddCharacterToBuffer (
}
/**
- Delete the previous character.
-
- @retval EFI_SUCCESS The operationw as successful.
-**/
-EFI_STATUS
-EFIAPI
-HBufferImageDoBackspace (
- VOID
- )
-{
- HEFI_EDITOR_LINE *Line;
-
- UINTN FileColumn;
- UINTN FPos;
- BOOLEAN LastLine;
-
- //
- // variable initialization
- //
- LastLine = FALSE;
-
- //
- // already the first character
- //
- if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
- return EFI_SUCCESS;
- }
-
- FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
-
- FileColumn = HBufferImage.BufferPosition.Column;
-
- Line = HBufferImage.CurrentLine;
- LastLine = FALSE;
- if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
- LastLine = TRUE;
- }
-
- HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);
-
- //
- // if is the last line
- // then only this line need to be refreshed
- //
- if (LastLine) {
- HBufferImageNeedRefresh = FALSE;
- HBufferImageOnlyLineNeedRefresh = TRUE;
- } else {
- HBufferImageNeedRefresh = TRUE;
- HBufferImageOnlyLineNeedRefresh = FALSE;
- }
-
- if (!HBufferImage.Modified) {
- HBufferImage.Modified = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
Delete current character from line.
@retval EFI_SUCCESS The operationw as successful.
@@ -2534,3 +2390,107 @@ HBufferImageAdjustMousePosition (
}
}
+
+/**
+ Dispatch input to different handler
+
+ @param[in] Key The input key:
+ the keys can be:
+ ASCII KEY
+ Backspace/Delete
+ Direction key: up/down/left/right/pgup/pgdn
+ Home/End
+ INS
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
+**/
+EFI_STATUS
+HBufferImageHandleInput (
+ IN EFI_INPUT_KEY *Key
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ switch (Key->ScanCode) {
+ //
+ // ordinary key
+ //
+ case SCAN_NULL:
+ Status = HBufferImageDoCharInput (Key->UnicodeChar);
+ break;
+
+ //
+ // up arrow
+ //
+ case SCAN_UP:
+ Status = HBufferImageScrollUp ();
+ break;
+
+ //
+ // down arrow
+ //
+ case SCAN_DOWN:
+ Status = HBufferImageScrollDown ();
+ break;
+
+ //
+ // right arrow
+ //
+ case SCAN_RIGHT:
+ Status = HBufferImageScrollRight ();
+ break;
+
+ //
+ // left arrow
+ //
+ case SCAN_LEFT:
+ Status = HBufferImageScrollLeft ();
+ break;
+
+ //
+ // page up
+ //
+ case SCAN_PAGE_UP:
+ Status = HBufferImagePageUp ();
+ break;
+
+ //
+ // page down
+ //
+ case SCAN_PAGE_DOWN:
+ Status = HBufferImagePageDown ();
+ break;
+
+ //
+ // delete
+ //
+ case SCAN_DELETE:
+ Status = HBufferImageDoDelete ();
+ break;
+
+ //
+ // home
+ //
+ case SCAN_HOME:
+ Status = HBufferImageHome ();
+ break;
+
+ //
+ // end
+ //
+ case SCAN_END:
+ Status = HBufferImageEnd ();
+ break;
+
+ default:
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ break;
+ }
+
+ return Status;
+}
+
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h
index 5e637ce700..91369b5931 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h
@@ -18,177 +18,152 @@
#include "HexEditor.h"
+/**
+ Initialization function for HBufferImage
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HBufferImageInit (
VOID
);
+
+/**
+ Cleanup function for HBufferImage
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageCleanup (
VOID
);
+
+/**
+ Refresh function for HBufferImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A Load error occured.
+
+**/
EFI_STATUS
HBufferImageRefresh (
VOID
);
-EFI_STATUS
-HBufferImageHide (
- VOID
- );
+
+/**
+ Dispatch input to different handler
+
+ @param[in] Key The input key:
+ the keys can be:
+ ASCII KEY
+ Backspace/Delete
+ Direction key: up/down/left/right/pgup/pgdn
+ Home/End
+ INS
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
+**/
EFI_STATUS
HBufferImageHandleInput (
- EFI_INPUT_KEY *
+ IN EFI_INPUT_KEY *Key
);
+
+/**
+ Backup function for HBufferImage. Only a few fields need to be backup.
+ This is for making the file buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HBufferImageBackup (
VOID
);
+/**
+ Read an image into a buffer friom a source.
+
+ @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
+ @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] BufferType The type of buffer to save. IGNORED.
+ @param[in] Recover TRUE for recovermode, FALSE otherwise.
+
+ @return EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
+EFIAPI
HBufferImageRead (
- IN CONST CHAR16 *,
- IN CONST CHAR16 *,
- IN UINTN,
- IN UINTN,
- IN UINTN,
- IN UINTN,
- IN EDIT_FILE_TYPE,
- IN BOOLEAN
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType,
+ IN BOOLEAN Recover
);
-EFI_STATUS
-HBufferImageSave (
- IN CHAR16 *,
- IN CHAR16 *,
- IN UINTN,
- IN UINTN,
- IN UINTN,
- IN UINTN,
- IN EDIT_FILE_TYPE
- );
+/**
+ Save the current image.
-INTN
-HBufferImageCharToHex (
- IN CHAR16
- );
+ @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
+ @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
+ @param[in] BufferType The type of buffer to save. IGNORED.
+ @return EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
-HBufferImageRestoreMousePosition (
- VOID
- );
-EFI_STATUS
-HBufferImageRestorePosition (
- VOID
+HBufferImageSave (
+ IN CHAR16 *FileName,
+ IN CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType
);
+/**
+ According to cursor's file position, adjust screen display.
+
+ @param[in] NewFilePosRow Row of file position ( start from 1 ).
+ @param[in] NewFilePosCol Column of file position ( start from 1 ).
+ @param[in] HighBits Cursor will on high4 bits or low4 bits.
+**/
VOID
HBufferImageMovePosition (
- IN UINTN,
- IN UINTN,
- IN BOOLEAN
+ IN UINTN NewFilePosRow,
+ IN UINTN NewFilePosCol,
+ IN BOOLEAN HighBits
);
-EFI_STATUS
-HBufferImageHandleInput (
- EFI_INPUT_KEY *
- );
-HEFI_EDITOR_LINE *
-HBufferImageCreateLine (
- VOID
- );
+/**
+ Create a new line and append it to the line list.
+ Fields affected:
+ NumLines
+ Lines
-EFI_STATUS
-HBufferImageDoCharInput (
- CHAR16
- );
-EFI_STATUS
-HBufferImageAddChar (
- CHAR16
- );
+ @retval NULL create line failed.
+ @return the line created.
-BOOLEAN
-HInCurrentScreen (
- UINTN
- );
-BOOLEAN
-HAboveCurrentScreen (
- UINTN
- );
-BOOLEAN
-HUnderCurrentScreen (
- UINTN
- );
-
-EFI_STATUS
-HBufferImageScrollRight (
- VOID
- );
-EFI_STATUS
-HBufferImageScrollLeft (
- VOID
- );
-EFI_STATUS
-HBufferImageScrollDown (
- VOID
- );
-EFI_STATUS
-HBufferImageScrollUp (
- VOID
- );
-EFI_STATUS
-HBufferImagePageUp (
- VOID
- );
-EFI_STATUS
-HBufferImagePageDown (
- VOID
- );
-EFI_STATUS
-HBufferImageHome (
- VOID
- );
-EFI_STATUS
-HBufferImageEnd (
- VOID
- );
-
-EFI_STATUS
-HBufferImageDoBackspace (
- VOID
- );
-EFI_STATUS
-HBufferImageDoDelete (
- VOID
- );
-
-EFI_STATUS
-HBufferImageCutLine (
- HEFI_EDITOR_LINE **
- );
-EFI_STATUS
-HBufferImagePasteLine (
+**/
+HEFI_EDITOR_LINE *
+HBufferImageCreateLine (
VOID
);
-EFI_STATUS
-HBufferImageGetFileInfo (
- EFI_FILE_HANDLE,
- CHAR16 *,
- EFI_FILE_INFO **
- );
-
-EFI_STATUS
-HBufferImageSearch (
- CHAR16 *,
- UINTN
- );
-EFI_STATUS
-HBufferImageReplace (
- CHAR16 *,
- UINTN
- );
-
-/**
+/**
Free the current image.
@retval EFI_SUCCESS The operation was successful.
@@ -198,58 +173,105 @@ HBufferImageFree (
VOID
);
+/**
+ Delete character from buffer.
+
+ @param[in] Pos Position, Pos starting from 0.
+ @param[in] Count The Count of characters to delete.
+ @param[out] DeleteBuffer The DeleteBuffer.
+
+ @retval EFI_SUCCESS Success
+**/
EFI_STATUS
HBufferImageDeleteCharacterFromBuffer (
- IN UINTN,
- IN UINTN,
- UINT8 *
+ IN UINTN Pos,
+ IN UINTN Count,
+ OUT UINT8 *DeleteBuffer
);
+/**
+ Add character to buffer, add before pos.
+
+ @param[in] Pos Position, Pos starting from 0.
+ @param[in] Count Count of characters to add.
+ @param[in] AddBuffer Add buffer.
+
+ @retval EFI_SUCCESS Success.
+**/
EFI_STATUS
HBufferImageAddCharacterToBuffer (
- IN UINTN,
- IN UINTN,
- UINT8 *
+ IN UINTN Pos,
+ IN UINTN Count,
+ IN UINT8 *AddBuffer
);
+/**
+ Change the raw buffer to a list of lines for the UI.
+
+ @param[in] Buffer The pointer to the buffer to fill.
+ @param[in] Bytes The size of the buffer in bytes.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
+EFIAPI
HBufferImageBufferToList (
- IN VOID *,
- IN UINTN
+ IN VOID *Buffer,
+ IN UINTN Bytes
);
+/**
+ Change the list of lines from the UI to a raw buffer.
+
+ @param[in] Buffer The pointer to the buffer to fill.
+ @param[in] Bytes The size of the buffer in bytes.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
+EFIAPI
HBufferImageListToBuffer (
- IN VOID *,
- IN UINTN
+ IN VOID *Buffer,
+ IN UINTN Bytes
);
+/**
+ Move the mouse in the image buffer.
+
+ @param[in] TextX The x-coordinate.
+ @param[in] TextY The y-coordinate.
+**/
VOID
+EFIAPI
HBufferImageAdjustMousePosition (
- INT32,
- INT32
+ IN INT32 TextX,
+ IN INT32 TextY
);
+/**
+ Function to decide if a column number is stored in the high bits.
+
+ @param[in] Column The column to examine.
+ @param[out] FCol The actual column number.
+
+ @retval TRUE The actual column was in high bits and is now in FCol.
+ @retval FALSE There was not a column number in the high bits.
+**/
BOOLEAN
HBufferImageIsAtHighBits (
- UINTN,
- UINTN *
- ) ;
-
-EFI_STATUS
-HBufferImageCutLine (
- HEFI_EDITOR_LINE **
+ IN UINTN Column,
+ OUT UINTN *FCol
);
+/**
+ Get the size of the open buffer.
+
+ @retval The size in bytes.
+**/
UINTN
HBufferImageGetTotalSize (
VOID
);
-BOOLEAN
-HBufferImageIsInSelectedArea (
- UINTN,
- UINTN
- );
-
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c
index 2408027abb..4d5bfb391f 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c
@@ -14,6 +14,11 @@
#include "HexEditor.h"
+typedef struct {
+ UINT8 *Buffer;
+ UINTN Size;
+} HEFI_EDITOR_CLIPBOARD;
+
HEFI_EDITOR_CLIPBOARD HClipBoard;
//
@@ -24,26 +29,16 @@ HEFI_EDITOR_CLIPBOARD HClipBoardConst = {
0
};
+/**
+ Initialization function for HDiskImage.
+
+ @param[in] EFI_SUCCESS The operation was successful.
+ @param[in] EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HClipBoardInit (
VOID
)
-/*++
-
-Routine Description:
-
- Initialization function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
//
// basiclly initialize the HDiskImage
@@ -53,26 +48,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Initialization function for HDiskImage.
+
+ @param[in] EFI_SUCCESS The operation was successful.
+ @param[in] EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HClipBoardCleanup (
VOID
)
-/*++
-
-Routine Description:
-
- Initialization function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
SHELL_FREE_NON_NULL (HClipBoard.Buffer);
@@ -80,6 +65,14 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Set a buffer into the clipboard.
+
+ @param[in] Buffer The buffer to add to the clipboard.
+ @param[in] Size The size of Buffer in bytes.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HClipBoardSet (
IN UINT8 *Buffer,
@@ -98,6 +91,13 @@ HClipBoardSet (
return EFI_SUCCESS;
}
+/**
+ Get a buffer from the clipboard.
+
+ @param[out] Buffer The pointer to the buffer to add to the clipboard.
+
+ @return the size of the buffer.
+**/
UINTN
HClipBoardGet (
OUT UINT8 **Buffer
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h
index 9165d98f30..8066c29247 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h
@@ -18,23 +18,52 @@
#include "HexEditor.h"
+/**
+ Initialization function for HDiskImage
+
+ @param[in] EFI_SUCCESS The operation was successful.
+ @param[in] EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HClipBoardInit (
VOID
);
+
+/**
+ Initialization function for HDiskImage.
+
+ @param[in] EFI_SUCCESS The operation was successful.
+ @param[in] EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HClipBoardCleanup (
VOID
);
+/**
+ Set a buffer into the clipboard.
+
+ @param[in] Buffer The buffer to add to the clipboard.
+ @param[in] Size The size of Buffer in bytes.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HClipBoardSet (
- UINT8 *,
- UINTN
+ IN UINT8 *Buffer,
+ IN UINTN Size
);
+
+/**
+ Get a buffer from the clipboard.
+
+ @param[out] Buffer The pointer to the buffer to add to the clipboard.
+
+ @return the size of the buffer.
+**/
UINTN
HClipBoardGet (
- UINT8 **
+ OUT UINT8 **Buffer
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
index 86db6aadf2..c956f77b28 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
@@ -37,26 +37,16 @@ HEFI_EDITOR_DISK_IMAGE HDiskImageConst = {
0
};
+/**
+ Initialization function for HDiskImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HDiskImageInit (
VOID
)
-/*++
-
-Routine Description:
-
- Initialization function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
//
// basically initialize the HDiskImage
@@ -68,29 +58,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Backup function for HDiskImage. Only a few fields need to be backup.
+ This is for making the Disk buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES gST->ConOut of resources.
+**/
EFI_STATUS
HDiskImageBackup (
VOID
)
-/*++
-
-Routine Description:
-
- Backup function for HDiskImage
- Only a few fields need to be backup.
- This is for making the Disk buffer refresh
- as few as possible.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Success
- EFI_OUT_OF_RESOURCES - gST->ConOut of resources
-
---*/
{
//
// backup the disk name, offset and size
@@ -109,25 +87,15 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Cleanup function for HDiskImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HDiskImageCleanup (
VOID
)
-/*++
-
-Routine Description:
-
- Cleanup function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
{
SHELL_FREE_NON_NULL (HDiskImage.Name);
SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
@@ -135,6 +103,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Set FileName field in HFileImage.
+
+ @param[in] Str File name to set.
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
EFIAPI
HDiskImageSetDiskNameOffsetSize (
@@ -142,24 +120,6 @@ HDiskImageSetDiskNameOffsetSize (
IN UINTN Offset,
IN UINTN Size
)
-/*++
-
-Routine Description:
-
- Set FileName field in HFileImage
-
-Arguments:
-
- Str - File name to set
- Offset - The offset
- Size - The size
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
{
UINTN Len;
UINTN Index;
@@ -188,6 +148,19 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Read a disk from disk into HBufferImage.
+
+ @param[in] DeviceName filename to read.
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+ @param[in] Recover if is for recover, no information print.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.
+**/
EFI_STATUS
HDiskImageRead (
IN CONST CHAR16 *DeviceName,
@@ -195,27 +168,6 @@ HDiskImageRead (
IN UINTN Size,
IN BOOLEAN Recover
)
-/*++
-
-Routine Description:
-
- Read a disk from disk into HBufferImage
-
-Arguments:
-
- DeviceName - filename to read
- Offset - The offset
- Size - The size
- Recover - if is for recover, no information print
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
- EFI_INVALID_PARAMETER
-
---*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
@@ -374,33 +326,25 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Save lines in HBufferImage to disk.
+ NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
+
+ @param[in] DeviceName The device name.
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.
+**/
EFI_STATUS
HDiskImageSave (
IN CHAR16 *DeviceName,
IN UINTN Offset,
IN UINTN Size
)
-/*++
-
-Routine Description:
-
- Save lines in HBufferImage to disk
- NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
-
-Arguments:
-
- DeviceName - The device name
- Offset - The offset
- Size - The size
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
- EFI_INVALID_PARAMETER
-
---*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h
index eaa8e2615d..06fb53020a 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h
@@ -18,31 +18,78 @@
#include "HexEditor.h"
+/**
+ Initialization function for HDiskImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HDiskImageInit (
VOID
);
+
+/**
+ Cleanup function for HDiskImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HDiskImageCleanup (
VOID
);
+
+/**
+ Backup function for HDiskImage. Only a few fields need to be backup.
+ This is for making the Disk buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES gST->ConOut of resources.
+**/
EFI_STATUS
HDiskImageBackup (
VOID
);
+/**
+ Read a disk from disk into HBufferImage.
+
+ @param[in] DeviceName filename to read.
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+ @param[in] Recover if is for recover, no information print.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.
+**/
EFI_STATUS
HDiskImageRead (
- IN CONST CHAR16 *,
- IN UINTN,
- IN UINTN,
- IN BOOLEAN
+ IN CONST CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
);
+
+/**
+ Save lines in HBufferImage to disk.
+ NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
+
+ @param[in] DeviceName The device name.
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.
+**/
EFI_STATUS
HDiskImageSave (
- IN CHAR16 *,
- IN UINTN,
- IN UINTN
+ IN CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
index 5397071b3b..8562662638 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
@@ -35,26 +35,15 @@ HEFI_EDITOR_BUFFER_IMAGE HFileImageConst = {
FALSE
};
+/**
+ Initialization function for HFileImage
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HFileImageInit (
VOID
)
-/*++
-
-Routine Description:
-
- Initialization function for HFileImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
//
// basically initialize the HFileImage
@@ -70,29 +59,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Backup function for HFileImage. Only a few fields need to be backup.
+ This is for making the file buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HFileImageBackup (
VOID
)
-/*++
-
-Routine Description:
-
- Backup function for HFileImage
- Only a few fields need to be backup.
- This is for making the file buffer refresh
- as few as possible.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
{
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
HFileImageBackupVar.FileName = CatSPrint(NULL, L"%s", HFileImage.FileName);
@@ -103,25 +80,15 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Cleanup function for HFileImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HFileImageCleanup (
VOID
)
-/*++
-
-Routine Description:
-
- Cleanup function for HFileImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
{
SHELL_FREE_NON_NULL (HFileImage.FileName);
@@ -130,26 +97,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Set FileName field in HFileImage
+
+ @param[in] Str File name to set.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HFileImageSetFileName (
IN CONST CHAR16 *Str
)
-/*++
-
-Routine Description:
-
- Set FileName field in HFileImage
-
-Arguments:
-
- Str -- File name to set
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
{
UINTN Size;
UINTN Index;
@@ -175,79 +134,21 @@ Returns:
return EFI_SUCCESS;
}
-EFI_STATUS
-HFileImageGetFileInfo (
- IN EFI_FILE_HANDLE Handle,
- IN CHAR16 *FileName,
- OUT EFI_FILE_INFO **InfoOut
- )
-/*++
-
-Routine Description:
-
- Get this file's information
-
-Arguments:
-
- Handle - in NT32 mode Directory handle, in other mode File Handle
- FileName - The file name
- InfoOut - parameter to pass file information out
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_LOAD_ERROR
-
---*/
-{
-
- VOID *Info;
- UINTN Size;
- EFI_STATUS Status;
-
- Size = SIZE_OF_EFI_FILE_INFO + 1024;
- Info = AllocateZeroPool (Size);
- if (!Info) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // get file information
- //
- Status = Handle->GetInfo (Handle, &gEfiFileInfoGuid, &Size, Info);
- if (EFI_ERROR (Status)) {
- return EFI_LOAD_ERROR;
- }
-
- *InfoOut = (EFI_FILE_INFO *) Info;
+/**
+ Read a file from disk into HBufferImage.
- return EFI_SUCCESS;
-
-}
+ @param[in] FileName filename to read.
+ @param[in] Recover if is for recover, no information print.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HFileImageRead (
IN CONST CHAR16 *FileName,
IN BOOLEAN Recover
)
-/*++
-
-Routine Description:
-
- Read a file from disk into HBufferImage
-
-Arguments:
-
- FileName -- filename to read
- Recover -- if is for recover, no information print
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
HEFI_EDITOR_LINE *Line;
UINT8 *Buffer;
@@ -343,27 +244,19 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Save lines in HBufferImage to disk.
+
+ @param[in] FileName The file name.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HFileImageSave (
IN CHAR16 *FileName
)
-/*++
-
-Routine Description:
-
- Save lines in HBufferImage to disk
-
-Arguments:
-
- FileName - The file name
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
LIST_ENTRY *Link;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h
index ae386d2fc9..ed27ad03ae 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h
@@ -18,39 +18,66 @@
#include "HexEditor.h"
+/**
+ Initialization function for HFileImage
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HFileImageInit (
VOID
);
+
+/**
+ Cleanup function for HFileImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HFileImageCleanup (
VOID
);
+
+/**
+ Backup function for HFileImage. Only a few fields need to be backup.
+ This is for making the file buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HFileImageBackup (
VOID
);
-EFI_STATUS
-HFileImageSetFileName (
- IN CONST CHAR16 *
- );
+/**
+ Read a file from disk into HBufferImage.
-EFI_STATUS
-HFileImageGetFileInfo (
- EFI_FILE_HANDLE,
- CHAR16 *,
- EFI_FILE_INFO **
- );
+ @param[in] FileName filename to read.
+ @param[in] Recover if is for recover, no information print.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HFileImageRead (
- IN CONST CHAR16 *,
- IN BOOLEAN
+ IN CONST CHAR16 *FileName,
+ IN BOOLEAN Recover
);
+
+/**
+ Save lines in HBufferImage to disk.
+
+ @param[in] FileName The file name.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HFileImageSave (
- IN CHAR16 *
+ IN CHAR16 *FileName
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
index 51c9f44cd5..2849f2b413 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
@@ -110,13 +110,7 @@ typedef struct {
} HEFI_EDITOR_BUFFER_IMAGE;
typedef struct {
- UINT8 *Buffer;
- UINTN Size;
-} HEFI_EDITOR_CLIPBOARD;
-
-typedef struct {
HEFI_EDITOR_BUFFER_IMAGE *BufferImage;
- HEFI_EDITOR_CLIPBOARD *Clipboard;
HEFI_EDITOR_COLOR_UNION ColorAttributes;
HEFI_EDITOR_POSITION ScreenSize; // row number and column number
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
index 58c25f81d4..73fa4c238d 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
@@ -37,8 +37,6 @@ BOOLEAN HEditorMouseAction;
extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
extern HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
-extern HEFI_EDITOR_CLIPBOARD HClipBoard;
-
extern BOOLEAN HBufferImageMouseNeedRefresh;
extern BOOLEAN HBufferImageNeedRefresh;
extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
@@ -51,7 +49,6 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar;
//
HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
&HBufferImage,
- &HClipBoard,
{
0,
0
@@ -68,25 +65,15 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
1
};
+/**
+ Move cursor to specified lines.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HMainCommandGoToOffset (
VOID
)
-/*++
-
-Routine Description:
-
- move cursor to specified lines
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
{
UINTN Size;
UINT64 Offset;
@@ -157,29 +144,19 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Save current opened buffer.
+ If is file buffer, you can save to current file name or
+ save to another file name.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandSaveBuffer (
VOID
)
-/*++
-
-Routine Description:
-
- save current opened buffer .
- if is file buffer, you can save to current file name or
- save to another file name
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_LOAD_ERROR
-
---*/
{
EFI_STATUS Status;
BOOLEAN Done;
@@ -190,7 +167,7 @@ Returns:
SHELL_FILE_HANDLE ShellFileHandle;
if (HMainEditor.BufferImage->BufferType != FileTypeFileBuffer) {
- if (HMainEditor.BufferImage->Modified == FALSE) {
+ if (!HMainEditor.BufferImage->Modified) {
return EFI_SUCCESS;
}
@@ -381,7 +358,7 @@ Returns:
//
// if the file is read only, so can not write back to it.
//
- if (HMainEditor.BufferImage->FileImage->ReadOnly == TRUE) {
+ if (HMainEditor.BufferImage->FileImage->ReadOnly) {
StatusBarSetStatusString (L"Access Denied");
SHELL_FREE_NON_NULL (FileName);
return EFI_SUCCESS;
@@ -467,27 +444,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Load a disk buffer editor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandSelectStart (
VOID
)
-/*++
-
-Routine Description:
-
- Load a disk buffer editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
UINTN Start;
@@ -515,27 +482,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Load a disk buffer editor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandSelectEnd (
VOID
)
-/*++
-
-Routine Description:
-
- Load a disk buffer editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
UINTN End;
@@ -563,27 +520,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Cut current line to clipboard.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandCut (
VOID
)
-/*++
-
-Routine Description:
-
- cut current line to clipboard
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_LOAD_ERROR
-
---*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@@ -648,28 +595,17 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Paste line to file buffer.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandPaste (
VOID
)
-/*++
-
-Routine Description:
-
- paste line to file buffer
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_LOAD_ERROR
-
-
---*/
{
BOOLEAN OnlyLineRefresh;
@@ -719,27 +655,17 @@ Returns:
}
+/**
+ Exit editor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandExit (
VOID
)
-/*++
-
-Routine Description:
-
- exit editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_LOAD_ERROR
-
---*/
{
EFI_STATUS Status;
@@ -822,27 +748,17 @@ Returns:
}
+/**
+ Load a file from disk to editor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainCommandOpenFile (
VOID
)
-/*++
-
-Routine Description:
-
- Load a file from disk to editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
BOOLEAN Done;
EFI_STATUS Status;
@@ -1065,28 +981,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Load a disk buffer editor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_NOT_FOUND The disk was not found.
+**/
EFI_STATUS
HMainCommandOpenDisk (
VOID
)
-/*++
-
-Routine Description:
-
- Load a disk buffer editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
- EFI_NOT_FOUND
-
---*/
{
UINT64 Size;
UINT64 Offset;
@@ -1320,28 +1226,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Load memory content to editor
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_NOT_FOUND The disk was not found.
+**/
EFI_STATUS
HMainCommandOpenMemory (
VOID
)
-/*++
-
-Routine Description:
-
- Load memory content to editor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
- EFI_NOT_FOUND
-
---*/
{
UINT64 Size;
UINT64 Offset;
@@ -1604,27 +1500,16 @@ CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = {
}
};
+/**
+ Init function for MainEditor
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorInit (
VOID
)
-/*++
-
-Routine Description:
-
- Init function for MainEditor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer;
@@ -1754,26 +1639,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Cleanup function for MainEditor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorCleanup (
VOID
)
-/*++
-
-Routine Description:
-
- cleanup function for MainEditor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
EFI_STATUS Status;
@@ -1813,25 +1688,15 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Refresh function for MainEditor.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HMainEditorRefresh (
VOID
)
-/*++
-
-Routine Description:
-
- Refresh function for MainEditor
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
{
BOOLEAN NameChange;
BOOLEAN ReadChange;
@@ -1874,8 +1739,8 @@ Returns:
HMainEditor.BufferImage->Modified,
HMainEditor.ScreenSize.Column,
HMainEditor.ScreenSize.Row,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Offset:0,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Size :0
);
HBufferImageRefresh ();
}
@@ -1910,7 +1775,17 @@ Returns:
return EFI_SUCCESS;
}
-STATIC
+/**
+ Handle the mouse input.
+
+ @param[in] MouseState The current mouse state.
+ @param[out] BeforeLeftButtonDown helps with selections.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_NOT_FOUND The disk was not found.
+**/
EFI_STATUS
HMainEditorHandleMouseInput (
IN EFI_SIMPLE_POINTER_STATE MouseState,
@@ -2046,7 +1921,7 @@ HMainEditorHandleMouseInput (
//
// release LButton
//
- if (*BeforeLeftButtonDown == TRUE) {
+ if (*BeforeLeftButtonDown) {
Action = TRUE;
}
//
@@ -2062,27 +1937,17 @@ HMainEditorHandleMouseInput (
return EFI_NOT_FOUND;
}
+/**
+ Handle user key input. will route it to other components handle function.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorKeyInput (
VOID
)
-/*++
-
-Routine Description:
-
- Handle user key input. will route it to other components handle function
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
EFI_INPUT_KEY Key;
EFI_STATUS Status;
@@ -2142,11 +2007,11 @@ Returns:
Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
if (!EFI_ERROR (Status)) {
- if (BeforeMouseIsDown == FALSE) {
+ if (!BeforeMouseIsDown) {
//
// mouse down
//
- if (MouseIsDown == TRUE) {
+ if (MouseIsDown) {
FRow = HBufferImage.BufferPosition.Row;
FCol = HBufferImage.BufferPosition.Column;
SelectStartBackup = HMainEditor.SelectStart;
@@ -2162,8 +2027,8 @@ Returns:
//
// begin to drag
//
- if (MouseIsDown == TRUE) {
- if (FirstDown == TRUE) {
+ if (MouseIsDown) {
+ if (FirstDown) {
if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) {
HMainEditor.SelectStart = 0;
HMainEditor.SelectEnd = 0;
@@ -2301,7 +2166,7 @@ Returns:
break;
}
- if (LengthChange == FALSE) {
+ if (!LengthChange) {
if (OldSize != Size) {
StatusBarSetStatusString (L"Disk/Mem Buffer Length should not be changed");
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h
index c4f2ea6382..ad9a7b4be8 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h
@@ -20,18 +20,45 @@
#include "HexEditor.h"
+/**
+ Init function for MainEditor
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorInit (
VOID
);
+
+/**
+ Cleanup function for MainEditor.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorCleanup (
VOID
);
+
+/**
+ Refresh function for MainEditor.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HMainEditorRefresh (
VOID
);
+
+/**
+ Handle user key input. will route it to other components handle function.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation occured.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMainEditorKeyInput (
VOID
@@ -45,4 +72,5 @@ EFIAPI
HMainEditorBackup (
VOID
);
+
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
index 73464906b4..a593d0afec 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
@@ -38,6 +38,17 @@ HEFI_EDITOR_MEM_IMAGE HMemImageConst = {
0
};
+/**
+ Empty function. always returns the same.
+
+ @param[in] This Ignored.
+ @param[in] Width Ignored.
+ @param[in] Address Ignored.
+ @param[in] Count Ignored.
+ @param[in,out] Buffer Ignored.
+
+ @retval EFI_UNSUPPORTED.
+**/
EFI_STATUS
DummyMemRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
@@ -45,8 +56,22 @@ DummyMemRead (
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
- );
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Empty function. always returns the same.
+
+ @param[in] This Ignored.
+ @param[in] Width Ignored.
+ @param[in] Address Ignored.
+ @param[in] Count Ignored.
+ @param[in,out] Buffer Ignored.
+ @retval EFI_UNSUPPORTED.
+**/
EFI_STATUS
DummyMemWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
@@ -54,28 +79,21 @@ DummyMemWrite (
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
- );
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Initialization function for HDiskImage.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMemImageInit (
VOID
)
-/*++
-
-Routine Description:
-
- Initialization function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
-
---*/
{
EFI_STATUS Status;
@@ -107,28 +125,16 @@ Returns:
}
}
+/**
+ Backup function for HDiskImage. Only a few fields need to be backup.
+ This is for making the Disk buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HMemImageBackup (
VOID
)
-/*++
-
-Routine Description:
-
- Backup function for HDiskImage
- Only a few fields need to be backup.
- This is for making the Disk buffer refresh
- as few as possible.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
{
HMemImageBackupVar.Offset = HMemImage.Offset;
HMemImageBackupVar.Size = HMemImage.Size;
@@ -136,51 +142,20 @@ Returns:
return EFI_SUCCESS;
}
-EFI_STATUS
-HMemImageCleanup (
- VOID
- )
-/*++
-
-Routine Description:
+/**
+ Set FileName field in HFileImage.
- Cleanup function for HDiskImage
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- return EFI_SUCCESS;
-}
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageSetMemOffsetSize (
IN UINTN Offset,
IN UINTN Size
)
-/*++
-
-Routine Description:
-
- Set FileName field in HFileImage
-
-Arguments:
-
- Offset - The offset
- Size - The size
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
{
HMemImage.Offset = Offset;
@@ -189,31 +164,23 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Read a disk from disk into HBufferImage.
+
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+ @param[in] Recover if is for recover, no information print.
+
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageRead (
- IN UINTN Offset,
- IN UINTN Size,
- BOOLEAN Recover
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
)
-/*++
-
-Routine Description:
-
- Read a disk from disk into HBufferImage
-
-Arguments:
-
- Offset - The offset
- Size - The size
- Recover - if is for recover, no information print
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
EFI_STATUS Status;
@@ -312,29 +279,21 @@ Returns:
}
+/**
+ Save lines in HBufferImage to disk.
+
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageSave (
IN UINTN Offset,
IN UINTN Size
)
-/*++
-
-Routine Description:
-
- Save lines in HBufferImage to disk
-
-Arguments:
-
- Offset - The offset
- Size - The size
-
-Returns:
-
- EFI_SUCCESS
- EFI_LOAD_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
{
EFI_STATUS Status;
@@ -387,26 +346,4 @@ Returns:
return EFI_SUCCESS;
}
-EFI_STATUS
-DummyMemRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
-EFI_STATUS
-DummyMemWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h
index 8805c0d75d..54fe517858 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h
@@ -18,35 +18,75 @@
#include "HexEditor.h"
+/**
+ Initialization function for HDiskImage.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_LOAD_ERROR A load error occured.
+**/
EFI_STATUS
HMemImageInit (
VOID
);
-EFI_STATUS
-HMemImageCleanup (
- VOID
- );
+
+/**
+ Backup function for HDiskImage. Only a few fields need to be backup.
+ This is for making the Disk buffer refresh as few as possible.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HMemImageBackup (
VOID
);
+/**
+ Set FileName field in HFileImage.
+
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageSetMemOffsetSize (
- IN UINTN,
- IN UINTN
+ IN UINTN Offset,
+ IN UINTN Size
);
+/**
+ Read a disk from disk into HBufferImage.
+
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+ @param[in] Recover if is for recover, no information print.
+
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageRead (
- IN UINTN,
- IN UINTN,
- IN BOOLEAN
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
);
+
+/**
+ Save lines in HBufferImage to disk.
+
+ @param[in] Offset The offset.
+ @param[in] Size The size.
+
+ @retval EFI_LOAD_ERROR A load error occured.
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+**/
EFI_STATUS
HMemImageSave (
- IN UINTN,
- IN UINTN
+ IN UINTN Offset,
+ IN UINTN Size
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c
index da11789625..d6961c5bb7 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c
@@ -1,7 +1,7 @@
/** @file
Implementation of various string and line routines
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (TempVarC) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -16,119 +16,15 @@
extern BOOLEAN HEditorMouseAction;
-VOID
-HEditorClearLine (
- IN UINTN Row
- )
-/*++
-
-Routine Description:
-
- Clear line at Row
-
-Arguments:
-
- Row -- row number to be cleared ( start from 1 )
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- CHAR16 Line[200];
- UINTN Index;
- UINTN Limit;
- UINTN StartCol;
-
- if (HEditorMouseAction) {
- Limit = 3 * 0x10;
- StartCol = 10;
- } else {
- Limit = HMainEditor.ScreenSize.Column;
- StartCol = 1;
- }
- //
- // prepare a blank line
- //
- for (Index = 0; Index < Limit; Index++) {
- Line[Index] = ' ';
- }
-
- if (Row == HMainEditor.ScreenSize.Row && Limit == HMainEditor.ScreenSize.Column) {
- //
- // if '\0' is still at position 80, it will cause first line error
- //
- Line[Limit - 1] = '\0';
- } else {
- Line[Limit] = '\0';
- }
- //
- // print out the blank line
- //
- ShellPrintEx ((INT32)StartCol - 1, (INT32)Row - 1, Line);
-}
-
-HEFI_EDITOR_LINE *
-HLineDup (
- IN HEFI_EDITOR_LINE *Src
- )
-/*++
-
-Routine Description:
-
- Duplicate a line
-
-Arguments:
-
- Src -- line to be duplicated
-
-Returns:
-
- NULL -- wrong
- Not NULL -- line created
-
---*/
-{
- HEFI_EDITOR_LINE *Dest;
-
- //
- // allocate for the line structure
- //
- Dest = AllocateZeroPool (sizeof (HEFI_EDITOR_LINE));
- if (Dest == NULL) {
- return NULL;
- }
-
- Dest->Signature = EFI_EDITOR_LINE_LIST;
- Dest->Size = Src->Size;
-
- CopyMem (Dest->Buffer, Src->Buffer, 0x10);
-
- Dest->Link = Src->Link;
-
- return Dest;
-}
-
+/**
+ Free a line and it's internal buffer.
+
+ @param[in] Src The line to be freed.
+**/
VOID
HLineFree (
IN HEFI_EDITOR_LINE *Src
)
-/*++
-
-Routine Description:
-
- Free a line and it's internal buffer
-
-Arguments:
-
- Src -- line to be freed
-
-Returns:
-
- None
-
---*/
{
if (Src == NULL) {
return ;
@@ -138,26 +34,18 @@ Returns:
}
+/**
+ Advance to the next Count lines.
+
+ @param[in] Count The line number to advance.
+
+ @retval NULL An error occured.
+ @return A pointer to the line after advance.
+**/
HEFI_EDITOR_LINE *
-_HLineAdvance (
+HLineAdvance (
IN UINTN Count
)
-/*++
-
-Routine Description:
-
- Advance to the next Count lines
-
-Arguments:
-
- Count -- line number to advance
-
-Returns:
-
- NULL -- wrong
- Not NULL -- line after advance
-
---*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@@ -181,26 +69,18 @@ Returns:
return Line;
}
+/**
+ Retreat to the previous Count lines.
+
+ @param[in] Count The line number to retreat.
+
+ @retval NULL An error occured.
+ @return A pointer to the line after retreat.
+**/
HEFI_EDITOR_LINE *
-_HLineRetreat (
+HLineRetreat (
IN UINTN Count
)
-/*++
-
-Routine Description:
-
- Retreat to the previous Count lines
-
-Arguments:
-
- Count -- line number to retreat
-
-Returns:
-
- NULL -- wrong
- Not NULL -- line after retreat
-
---*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@@ -224,28 +104,20 @@ Returns:
return Line;
}
+/**
+ Advance/Retreat lines.
+
+ @param[in] Count The line number to advance/retreat.
+ >0 : advance
+ <0: retreat
+
+ @retval NULL An error occured.
+ @return A pointer to the line after move.
+**/
HEFI_EDITOR_LINE *
HMoveLine (
IN INTN Count
)
-/*++
-
-Routine Description:
-
- Advance/Retreat lines
-
-Arguments:
-
- Count -- line number to advance/retreat
- >0 : advance
- <0: retreat
-
-Returns:
-
- NULL -- wrong
- Not NULL -- line after advance
-
---*/
{
HEFI_EDITOR_LINE *Line;
UINTN AbsCount;
@@ -257,37 +129,28 @@ Returns:
//
if (Count <= 0) {
AbsCount = (UINTN)ABS(Count);
- Line = _HLineRetreat (AbsCount);
+ Line = HLineRetreat (AbsCount);
} else {
- Line = _HLineAdvance ((UINTN)Count);
+ Line = HLineAdvance ((UINTN)Count);
}
return Line;
}
+/**
+ Advance/Retreat lines and set CurrentLine in BufferImage to it.
+
+ @param[in] Count The line number to advance/retreat.
+ >0 : advance
+ <0: retreat
+
+ @retval NULL An error occured.
+ @return A pointer to the line after move.
+**/
HEFI_EDITOR_LINE *
HMoveCurrentLine (
IN INTN Count
)
-/*++
-
-Routine Description:
-
- Advance/Retreat lines and set CurrentLine in BufferImage to it
-
-Arguments:
-
- Count -- line number to advance/retreat
- >0 : advance
- <0: retreat
-
-Returns:
-
- NULL -- wrong
- Not NULL -- line after advance
-
-
---*/
{
HEFI_EDITOR_LINE *Line;
UINTN AbsCount;
@@ -298,9 +161,9 @@ Returns:
//
if (Count <= 0) {
AbsCount = (UINTN)ABS(Count);
- Line = _HLineRetreat (AbsCount);
+ Line = HLineRetreat (AbsCount);
} else {
- Line = _HLineAdvance ((UINTN)Count);
+ Line = HLineAdvance ((UINTN)Count);
}
if (Line == NULL) {
@@ -313,34 +176,26 @@ Returns:
}
-EFI_STATUS
-HFreeLines (
- IN LIST_ENTRY *ListHead,
- IN HEFI_EDITOR_LINE *Lines
- )
-/*++
-
-Routine Description:
-
- Free all the lines in HBufferImage
+/**
+ Free all the lines in HBufferImage.
Fields affected:
Lines
CurrentLine
NumLines
ListHead
-Arguments:
-
- ListHead - The list head
- Lines - The lines
-
-Returns:
+ @param[in] ListHead The list head.
+ @param[in] Lines The lines.
- EFI_SUCCESS
-
---*/
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+HFreeLines (
+ IN LIST_ENTRY *ListHead,
+ IN HEFI_EDITOR_LINE *Lines
+ )
{
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
HEFI_EDITOR_LINE *Line;
//
@@ -363,83 +218,13 @@ Returns:
return EFI_SUCCESS;
}
-UINTN
-HStrStr (
- IN CHAR16 *Str,
- IN CHAR16 *Pat
- )
-/*++
-
-Routine Description:
-
- Search Pat in Str
-
-Arguments:
-
- Str -- mother string
- Pat -- search pattern
-
-
-Returns:
-
- 0 : not found
- >= 1 : found position + 1
-
---*/
-{
- INTN *Failure;
- INTN i;
- INTN j;
- INTN Lenp;
- INTN Lens;
-
- //
- // this function copies from some lib
- //
- Lenp = StrLen (Pat);
- Lens = StrLen (Str);
+/**
+ Get the X information for the mouse.
- Failure = AllocateZeroPool ((UINTN)(Lenp * sizeof (INTN)));
- if (Failure == NULL) {
- return 0;
- }
- Failure[0] = -1;
- for (j = 1; j < Lenp; j++) {
- i = Failure[j - 1];
- while ((Pat[j] != Pat[i + 1]) && (i >= 0)) {
- i = Failure[i];
- }
-
- if (Pat[j] == Pat[i + 1]) {
- Failure[j] = i + 1;
- } else {
- Failure[j] = -1;
- }
- }
-
- i = 0;
- j = 0;
- while (i < Lens && j < Lenp) {
- if (Str[i] == Pat[j]) {
- i++;
- j++;
- } else if (j == 0) {
- i++;
- } else {
- j = Failure[j - 1] + 1;
- }
- }
-
- FreePool (Failure);
-
- //
- // 0: not found
- // >=1 : found position + 1
- //
- return ((j == Lenp) ? (i - Lenp) : -1) + 1;
-
-}
+ @param[in] GuidX The change.
+ @return the new information.
+**/
INT32
HGetTextX (
IN INT32 GuidX
@@ -454,6 +239,13 @@ HGetTextX (
return Gap;
}
+/**
+ Get the Y information for the mouse.
+
+ @param[in] GuidY The change.
+
+ @return the new information.
+**/
INT32
HGetTextY (
IN INT32 GuidY
@@ -468,77 +260,3 @@ HGetTextY (
return Gap;
}
-
-EFI_STATUS
-HXtoi (
- IN CHAR16 *Str,
- OUT UINTN *Value
- )
-/*++
-Routine Description:
-
- convert hex string to uint
-
-Arguments:
-
- Str - The string
- Value - The value
-
-Returns:
-
-
---*/
-{
- UINT64 u;
- CHAR16 c;
- UINTN Size;
-
- Size = sizeof (UINTN);
-
- //
- // skip leading white space
- //
- while (*Str && *Str == ' ') {
- Str += 1;
- }
-
- if (StrLen (Str) > Size * 2) {
- return EFI_LOAD_ERROR;
- }
- //
- // convert hex digits
- //
- u = 0;
- c = *Str;
- while (c) {
- c = *Str;
- Str++;
-
- if (c == 0) {
- break;
- }
- //
- // not valid char
- //
- if (!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || (c >= '0' && c <= '9') || (c == '\0'))) {
- return EFI_LOAD_ERROR;
- }
-
- if (c >= 'a' && c <= 'f') {
- c -= 'a' - 'A';
- }
-
- if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {
- u = LShiftU64 (u, 4) + (c - (c >= 'A' ? 'A' - 10 : '0'));
- } else {
- //
- // '\0'
- //
- break;
- }
- }
-
- *Value = (UINTN) u;
-
- return EFI_SUCCESS;
-}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h
index a9b59ff514..df947935b0 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h
@@ -17,80 +17,77 @@
#include "HexEditor.h"
-VOID
-HEditorClearLine (
- UINTN
- );
-HEFI_EDITOR_LINE *
-HLineDup (
- HEFI_EDITOR_LINE *
- );
-VOID
-HLineFree (
- HEFI_EDITOR_LINE *
- );
+/**
+ Advance/Retreat lines.
-HEFI_EDITOR_LINE *
+ @param[in] Count The line number to advance/retreat.
+ >0 : advance
+ <0: retreat
+
+ @retval NULL An error occured.
+ @return A pointer to the line after move.
+**/
+HEFI_EDITOR_LINE *
HMoveLine (
- INTN
- );
-HEFI_EDITOR_LINE *
-HMoveCurrentLine (
- INTN
+ IN INTN Count
);
-UINTN
-HLineStrInsert (
- HEFI_EDITOR_LINE *,
- CHAR16,
- UINTN,
- UINTN
- );
+/**
+ Advance/Retreat lines and set CurrentLine in BufferImage to it.
-VOID
-HLineCat (
- HEFI_EDITOR_LINE *,
- HEFI_EDITOR_LINE *
- );
+ @param[in] Count The line number to advance/retreat.
+ >0 : advance
+ <0: retreat
-VOID
-HLineDeleteAt (
- HEFI_EDITOR_LINE *,
- UINTN
+ @retval NULL An error occured.
+ @return A pointer to the line after move.
+**/
+HEFI_EDITOR_LINE *
+HMoveCurrentLine (
+ IN INTN Count
);
-UINTN
-HUnicodeToAscii (
- CHAR16 *,
- UINTN,
- CHAR8 *
- );
+/**
+ Free all the lines in HBufferImage.
+ Fields affected:
+ Lines
+ CurrentLine
+ NumLines
+ ListHead
-UINTN
-HStrStr (
- CHAR16 *,
- CHAR16 *
- );
+ @param[in] ListHead The list head.
+ @param[in] Lines The lines.
+ @retval EFI_SUCCESS The operation was successful.
+**/
EFI_STATUS
HFreeLines (
- LIST_ENTRY *,
- HEFI_EDITOR_LINE *
+ IN LIST_ENTRY *ListHead,
+ IN HEFI_EDITOR_LINE *Lines
);
+/**
+ Get the X information for the mouse.
+
+ @param[in] GuidX The change.
+
+ @return the new information.
+**/
INT32
HGetTextX (
- INT32
- ) ;
+ IN INT32 GuidX
+ );
+
+/**
+ Get the Y information for the mouse.
+
+ @param[in] GuidY The change.
+
+ @return the new information.
+**/
INT32
HGetTextY (
- INT32
- ) ;
-
-EFI_STATUS
-HXtoi (
- CHAR16 *,
- UINTN *
+ IN INT32 GuidY
);
#endif