TianoCore EDK2 master
Loading...
Searching...
No Matches
BufferImage.c File Reference
#include "HexEditor.h"

Go to the source code of this file.

Functions

EFI_STATUS HBufferImageInit (VOID)
 
EFI_STATUS HBufferImageBackup (VOID)
 
EFI_STATUS HBufferImageFreeLines (VOID)
 
EFI_STATUS HBufferImageCleanup (VOID)
 
EFI_STATUS HBufferImagePrintLine (IN HEFI_EDITOR_LINE *Line, IN UINTN Row, IN UINTN FRow, IN HEFI_EDITOR_COLOR_UNION Orig, IN HEFI_EDITOR_COLOR_UNION New)
 
BOOLEAN HBufferImageIsAtHighBits (IN UINTN Column, OUT UINTN *FCol)
 
BOOLEAN HBufferImageIsInSelectedArea (IN UINTN MouseRow, IN UINTN MouseCol)
 
EFI_STATUS HBufferImageRestoreMousePosition (VOID)
 
EFI_STATUS HBufferImageRestorePosition (VOID)
 
EFI_STATUS HBufferImageRefresh (VOID)
 
EFI_STATUS HBufferImageRead (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 *FileName, IN CHAR16 *DiskName, IN UINTN DiskOffset, IN UINTN DiskSize, IN UINTN MemOffset, IN UINTN MemSize, IN EDIT_FILE_TYPE BufferType)
 
HEFI_EDITOR_LINEHBufferImageCreateLine (VOID)
 
EFI_STATUS HBufferImageFree (VOID)
 
INTN HBufferImageCharToHex (IN CHAR16 Char)
 
EFI_STATUS HBufferImageAddChar (IN CHAR16 Char)
 
EFI_STATUS HBufferImageDoBackspace (VOID)
 
EFI_STATUS HBufferImageDoCharInput (IN CHAR16 Char)
 
BOOLEAN HAboveCurrentScreen (IN UINTN FileRow)
 
BOOLEAN HUnderCurrentScreen (IN UINTN FileRow)
 
VOID HBufferImageMovePosition (IN UINTN NewFilePosRow, IN UINTN NewFilePosCol, IN BOOLEAN HighBits)
 
EFI_STATUS HBufferImageScrollRight (VOID)
 
EFI_STATUS HBufferImageScrollLeft (VOID)
 
EFI_STATUS HBufferImageScrollDown (VOID)
 
EFI_STATUS HBufferImageScrollUp (VOID)
 
EFI_STATUS HBufferImagePageDown (VOID)
 
EFI_STATUS HBufferImagePageUp (VOID)
 
EFI_STATUS HBufferImageHome (VOID)
 
EFI_STATUS HBufferImageEnd (VOID)
 
UINTN HBufferImageGetTotalSize (VOID)
 
EFI_STATUS HBufferImageDeleteCharacterFromBuffer (IN UINTN Pos, IN UINTN Count, OUT UINT8 *DeleteBuffer)
 
EFI_STATUS HBufferImageAddCharacterToBuffer (IN UINTN Pos, IN UINTN Count, IN UINT8 *AddBuffer)
 
EFI_STATUS HBufferImageDoDelete (VOID)
 
EFI_STATUS HBufferImageBufferToList (IN VOID *Buffer, IN UINTN Bytes)
 
EFI_STATUS HBufferImageListToBuffer (IN VOID *Buffer, IN UINTN Bytes)
 
VOID HBufferImageAdjustMousePosition (IN INT32 TextX, IN INT32 TextY)
 
EFI_STATUS HBufferImageHandleInput (IN EFI_INPUT_KEY *Key)
 

Variables

EFI_HANDLE HImageHandleBackup
 
HEFI_EDITOR_FILE_IMAGE HFileImage
 
HEFI_EDITOR_DISK_IMAGE HDiskImage
 
HEFI_EDITOR_MEM_IMAGE HMemImage
 
HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar
 
HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar
 
HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar
 
BOOLEAN HEditorMouseAction
 
HEFI_EDITOR_GLOBAL_EDITOR HMainEditor
 
HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar
 
HEFI_EDITOR_BUFFER_IMAGE HBufferImage
 
HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar
 
HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst
 
BOOLEAN HBufferImageNeedRefresh
 
BOOLEAN HBufferImageOnlyLineNeedRefresh
 
BOOLEAN HBufferImageMouseNeedRefresh
 

Detailed Description

Defines HBufferImage - the view of the file that is visible at any point, as well as the event handlers for editing the file

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file BufferImage.c.

Function Documentation

◆ HAboveCurrentScreen()

BOOLEAN HAboveCurrentScreen ( IN UINTN  FileRow)

Check user specified FileRow is above current screen.

Parameters
[in]FileRowRow of file position ( start from 1 ).
Return values
TRUEIt is above the current screen.
FALSEIt is not above the current screen.

Definition at line 1379 of file BufferImage.c.

◆ HBufferImageAddChar()

EFI_STATUS HBufferImageAddChar ( IN CHAR16  Char)

Add character.

Parameters
[in]Char– input char.
Return values
EFI_SUCCESSThe operation was successful.
EFI_OUT_OF_RESOURCESA memory allocation failed.

Definition at line 1134 of file BufferImage.c.

◆ HBufferImageAddCharacterToBuffer()

EFI_STATUS HBufferImageAddCharacterToBuffer ( IN UINTN  Pos,
IN UINTN  Count,
IN UINT8 *  AddBuffer 
)

Add character to buffer, add before pos.

Parameters
[in]PosPosition, Pos starting from 0.
[in]CountCount of characters to add.
[in]AddBufferAdd buffer.
Return values
EFI_SUCCESSSuccess.

Definition at line 2018 of file BufferImage.c.

◆ HBufferImageAdjustMousePosition()

VOID HBufferImageAdjustMousePosition ( IN INT32  TextX,
IN INT32  TextY 
)

Move the mouse in the image buffer.

Parameters
[in]TextXThe x-coordinate.
[in]TextYThe y-coordinate.

Definition at line 2291 of file BufferImage.c.

◆ HBufferImageBackup()

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.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 141 of file BufferImage.c.

◆ HBufferImageBufferToList()

EFI_STATUS HBufferImageBufferToList ( IN VOID *  Buffer,
IN UINTN  Bytes 
)

Change the raw buffer to a list of lines for the UI.

Parameters
[in]BufferThe pointer to the buffer to fill.
[in]BytesThe size of the buffer in bytes.
Return values
EFI_SUCCESSThe operation was successful.
EFI_OUT_OF_RESOURCESA memory allocation failed.

Definition at line 2175 of file BufferImage.c.

◆ HBufferImageCharToHex()

INTN HBufferImageCharToHex ( IN CHAR16  Char)

change char to int value based on Hex.

Parameters
[in]CharThe input char.
Returns
The character's index value.
Return values
-1The operation failed.

Definition at line 1103 of file BufferImage.c.

◆ HBufferImageCleanup()

EFI_STATUS HBufferImageCleanup ( VOID  )

Cleanup function for HBufferImage

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 211 of file BufferImage.c.

◆ HBufferImageCreateLine()

HEFI_EDITOR_LINE * HBufferImageCreateLine ( VOID  )

Create a new line and append it to the line list. Fields affected: NumLines Lines

Return values
NULLcreate line failed.
Returns
the line created.

Definition at line 1040 of file BufferImage.c.

◆ HBufferImageDeleteCharacterFromBuffer()

EFI_STATUS HBufferImageDeleteCharacterFromBuffer ( IN UINTN  Pos,
IN UINTN  Count,
OUT UINT8 *  DeleteBuffer 
)

Delete character from buffer.

Parameters
[in]PosPosition, Pos starting from 0.
[in]CountThe Count of characters to delete.
[out]DeleteBufferThe DeleteBuffer.
Return values
EFI_SUCCESSSuccess

Definition at line 1889 of file BufferImage.c.

◆ HBufferImageDoBackspace()

EFI_STATUS HBufferImageDoBackspace ( VOID  )

Delete the previous character.

Return values
EFI_SUCCESSThe operationw as successful.

Definition at line 1266 of file BufferImage.c.

◆ HBufferImageDoCharInput()

EFI_STATUS HBufferImageDoCharInput ( IN CHAR16  Char)

ASCII key + Backspace + return.

Parameters
[in]CharThe input char.
Return values
EFI_SUCCESSThe operation was successful.
EFI_LOAD_ERRORA load error occurred.
EFI_OUT_OF_RESOURCESA memory allocation failed.

Definition at line 1329 of file BufferImage.c.

◆ HBufferImageDoDelete()

EFI_STATUS HBufferImageDoDelete ( VOID  )

Delete current character from line.

Return values
EFI_SUCCESSThe operationw as successful.

Definition at line 2116 of file BufferImage.c.

◆ HBufferImageEnd()

EFI_STATUS HBufferImageEnd ( VOID  )

Scroll cursor to end of line.

Return values
EFI_SUCCESSTeh operation was successful.

Definition at line 1810 of file BufferImage.c.

◆ HBufferImageFree()

EFI_STATUS HBufferImageFree ( VOID  )

Free the current image.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1082 of file BufferImage.c.

◆ HBufferImageFreeLines()

EFI_STATUS HBufferImageFreeLines ( VOID  )

Free all the lines in HBufferImage. Fields affected: Lines CurrentLine NumLines ListHead

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 192 of file BufferImage.c.

◆ HBufferImageGetTotalSize()

UINTN HBufferImageGetTotalSize ( VOID  )

Get the size of the open buffer.

Return values
Thesize in bytes.

Definition at line 1850 of file BufferImage.c.

◆ HBufferImageHandleInput()

EFI_STATUS HBufferImageHandleInput ( IN EFI_INPUT_KEY Key)

Dispatch input to different handler

Parameters
[in]KeyThe input key: the keys can be: ASCII KEY Backspace/Delete Direction key: up/down/left/right/pgup/pgdn Home/End INS
Return values
EFI_SUCCESSThe operation was successful.
EFI_LOAD_ERRORA load error occurred.
EFI_OUT_OF_RESOURCESA Memory allocation failed.

Definition at line 2387 of file BufferImage.c.

◆ HBufferImageHome()

EFI_STATUS HBufferImageHome ( VOID  )

Scroll cursor to start of line

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1781 of file BufferImage.c.

◆ HBufferImageInit()

EFI_STATUS HBufferImageInit ( VOID  )

Initialization function for HBufferImage

Return values
EFI_SUCCESSThe operation was successful.
EFI_LOAD_ERRORA load error occurred.

Definition at line 78 of file BufferImage.c.

◆ HBufferImageIsAtHighBits()

BOOLEAN HBufferImageIsAtHighBits ( IN UINTN  Column,
OUT UINTN FCol 
)

Function to decide if a column number is stored in the high bits.

Parameters
[in]ColumnThe column to examine.
[out]FColThe actual column number.
Return values
TRUEThe actual column was in high bits and is now in FCol.
FALSEThere was not a column number in the high bits.

Definition at line 425 of file BufferImage.c.

◆ HBufferImageIsInSelectedArea()

BOOLEAN HBufferImageIsInSelectedArea ( IN UINTN  MouseRow,
IN UINTN  MouseCol 
)

Decide if a point is in the already selected area.

Parameters
[in]MouseRowThe row of the point to test.
[in]MouseColThe col of the point to test.
Return values
TRUEThe point is in the selected area.
FALSEThe point is not in the selected area.

Definition at line 468 of file BufferImage.c.

◆ HBufferImageListToBuffer()

EFI_STATUS HBufferImageListToBuffer ( IN VOID *  Buffer,
IN UINTN  Bytes 
)

Change the list of lines from the UI to a raw buffer.

Parameters
[in]BufferThe pointer to the buffer to fill.
[in]BytesThe size of the buffer in bytes.
Return values
EFI_SUCCESSThe operation was successful.

Definition at line 2238 of file BufferImage.c.

◆ HBufferImageMovePosition()

VOID HBufferImageMovePosition ( IN UINTN  NewFilePosRow,
IN UINTN  NewFilePosCol,
IN BOOLEAN  HighBits 
)

According to cursor's file position, adjust screen display.

Parameters
[in]NewFilePosRowRow of file position ( start from 1 ).
[in]NewFilePosColColumn of file position ( start from 1 ).
[in]HighBitsCursor will on high4 bits or low4 bits.

Definition at line 1419 of file BufferImage.c.

◆ HBufferImagePageDown()

EFI_STATUS HBufferImagePageDown ( VOID  )

Scroll cursor to next page

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1687 of file BufferImage.c.

◆ HBufferImagePageUp()

EFI_STATUS HBufferImagePageUp ( VOID  )

Scroll cursor to previous page

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1741 of file BufferImage.c.

◆ HBufferImagePrintLine()

EFI_STATUS HBufferImagePrintLine ( IN HEFI_EDITOR_LINE Line,
IN UINTN  Row,
IN UINTN  FRow,
IN HEFI_EDITOR_COLOR_UNION  Orig,
IN HEFI_EDITOR_COLOR_UNION  New 
)

Print Line on Row

Parameters
[in]LineThe lline to print.
[in]RowThe row on screen ( begin from 1 ).
[in]FRowThe FRow.
[in]OrigThe original color.
[in]NewThe color to print with.
Return values
EFI_SUCCESSThe operation was successful.

Definition at line 243 of file BufferImage.c.

◆ HBufferImageRead()

EFI_STATUS HBufferImageRead ( 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 
)

Read an image into a buffer friom a source.

Parameters
[in]FileNamePointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
[in]DiskNamePointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]DiskOffsetOffset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]DiskSizeSize of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]MemOffsetOffset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
[in]MemSizeSize of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
[in]BufferTypeThe type of buffer to save. IGNORED.
[in]RecoverTRUE for recovermode, FALSE otherwise.
Returns
EFI_SUCCESS The operation was successful.

Definition at line 909 of file BufferImage.c.

◆ HBufferImageRefresh()

EFI_STATUS HBufferImageRefresh ( VOID  )

Refresh function for HBufferImage.

Return values
EFI_SUCCESSThe operation was successful.
EFI_LOAD_ERRORA Load error occurred.

Definition at line 740 of file BufferImage.c.

◆ HBufferImageRestoreMousePosition()

EFI_STATUS HBufferImageRestoreMousePosition ( VOID  )

Set mouse position according to HBufferImage.MousePosition.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 536 of file BufferImage.c.

◆ HBufferImageRestorePosition()

EFI_STATUS HBufferImageRestorePosition ( VOID  )

Set cursor position according to HBufferImage.DisplayPosition.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 716 of file BufferImage.c.

◆ HBufferImageSave()

EFI_STATUS HBufferImageSave ( IN CHAR16 *  FileName,
IN CHAR16 *  DiskName,
IN UINTN  DiskOffset,
IN UINTN  DiskSize,
IN UINTN  MemOffset,
IN UINTN  MemSize,
IN EDIT_FILE_TYPE  BufferType 
)

Save the current image.

Parameters
[in]FileNamePointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
[in]DiskNamePointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]DiskOffsetOffset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]DiskSizeSize of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
[in]MemOffsetOffset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
[in]MemSizeSize of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
[in]BufferTypeThe type of buffer to save. IGNORED.
Returns
EFI_SUCCESS The operation was successful.

Definition at line 976 of file BufferImage.c.

◆ HBufferImageScrollDown()

EFI_STATUS HBufferImageScrollDown ( VOID  )

Scroll cursor to the next line

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1610 of file BufferImage.c.

◆ HBufferImageScrollLeft()

EFI_STATUS HBufferImageScrollLeft ( VOID  )

Scroll cursor to left.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1562 of file BufferImage.c.

◆ HBufferImageScrollRight()

EFI_STATUS HBufferImageScrollRight ( VOID  )

Scroll cursor to right.

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1505 of file BufferImage.c.

◆ HBufferImageScrollUp()

EFI_STATUS HBufferImageScrollUp ( VOID  )

Scroll cursor to previous line

Return values
EFI_SUCCESSThe operation was successful.

Definition at line 1654 of file BufferImage.c.

◆ HUnderCurrentScreen()

BOOLEAN HUnderCurrentScreen ( IN UINTN  FileRow)

Check user specified FileRow is under current screen.

Parameters
[in]FileRowRow of file position ( start from 1 ).
Return values
TRUEIt is under the current screen.
FALSEIt is not under the current screen.

Definition at line 1400 of file BufferImage.c.

Variable Documentation

◆ HBufferImage

Definition at line 27 of file BufferImage.c.

◆ HBufferImageBackupVar

HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar

Definition at line 28 of file BufferImage.c.

◆ HBufferImageConst

HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst
Initial value:
= {
0,
{
0,
0
},
{
0,
0
},
{
0,
0
},
0,
FileTypeNone,
}
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307

Definition at line 33 of file BufferImage.c.

◆ HBufferImageMouseNeedRefresh

BOOLEAN HBufferImageMouseNeedRefresh

Definition at line 69 of file BufferImage.c.

◆ HBufferImageNeedRefresh

BOOLEAN HBufferImageNeedRefresh

Definition at line 62 of file BufferImage.c.

◆ HBufferImageOnlyLineNeedRefresh

BOOLEAN HBufferImageOnlyLineNeedRefresh

Definition at line 67 of file BufferImage.c.

◆ HDiskImage

HEFI_EDITOR_DISK_IMAGE HDiskImage
extern

Definition at line 21 of file DiskImage.c.

◆ HDiskImageBackupVar

HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar
extern

Definition at line 22 of file DiskImage.c.

◆ HEditorMouseAction

BOOLEAN HEditorMouseAction
extern

Definition at line 29 of file MainHexEditor.c.

◆ HFileImage

HEFI_EDITOR_FILE_IMAGE HFileImage
extern

Definition at line 20 of file FileImage.c.

◆ HFileImageBackupVar

HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar
extern

Definition at line 21 of file FileImage.c.

◆ HMainEditor

HEFI_EDITOR_GLOBAL_EDITOR HMainEditor
extern

Definition at line 38 of file MainHexEditor.c.

◆ HMainEditorBackupVar

HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar
extern

Definition at line 39 of file MainHexEditor.c.

◆ HMemImage

HEFI_EDITOR_MEM_IMAGE HMemImage
extern

Definition at line 21 of file MemImage.c.

◆ HMemImageBackupVar

HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar
extern

Definition at line 22 of file MemImage.c.