]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h
Dmpstore command does not return lasterror equal to 0 when ā€˜-sā€™ flag used to dump...
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / BufferImage.h
CommitLineData
632820d1 1/** @file\r
2 Defines BufferImage - the view of the file that is visible at any point, \r
3 as well as the event handlers for editing the file\r
4 \r
5 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _LIB_BUFFER_IMAGE_H_\r
17#define _LIB_BUFFER_IMAGE_H_\r
18\r
19#include "HexEditor.h"\r
20\r
a1d4bfcc 21/**\r
22 Initialization function for HBufferImage\r
23\r
24 @retval EFI_SUCCESS The operation was successful.\r
25 @retval EFI_LOAD_ERROR A load error occured.\r
26**/\r
632820d1 27EFI_STATUS\r
28HBufferImageInit (\r
29 VOID\r
30 );\r
a1d4bfcc 31\r
32/**\r
33 Cleanup function for HBufferImage\r
34\r
35 @retval EFI_SUCCESS The operation was successful.\r
36**/\r
632820d1 37EFI_STATUS\r
38HBufferImageCleanup (\r
39 VOID\r
40 );\r
a1d4bfcc 41\r
42/**\r
43 Refresh function for HBufferImage.\r
44\r
45 @retval EFI_SUCCESS The operation was successful.\r
46 @retval EFI_LOAD_ERROR A Load error occured.\r
47\r
48**/\r
632820d1 49EFI_STATUS\r
50HBufferImageRefresh (\r
51 VOID\r
52 );\r
a1d4bfcc 53\r
54/**\r
55 Dispatch input to different handler\r
56\r
57 @param[in] Key The input key:\r
58 the keys can be:\r
59 ASCII KEY\r
60 Backspace/Delete\r
61 Direction key: up/down/left/right/pgup/pgdn\r
62 Home/End\r
63 INS\r
64\r
65 @retval EFI_SUCCESS The operation was successful.\r
66 @retval EFI_LOAD_ERROR A load error occured.\r
67 @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r
68**/\r
632820d1 69EFI_STATUS\r
70HBufferImageHandleInput (\r
a1d4bfcc 71 IN EFI_INPUT_KEY *Key\r
632820d1 72 );\r
a1d4bfcc 73\r
74/**\r
75 Backup function for HBufferImage. Only a few fields need to be backup. \r
76 This is for making the file buffer refresh as few as possible.\r
77\r
78 @retval EFI_SUCCESS The operation was successful.\r
79**/\r
632820d1 80EFI_STATUS\r
81HBufferImageBackup (\r
82 VOID\r
83 );\r
84\r
a1d4bfcc 85/**\r
86 Read an image into a buffer friom a source.\r
87\r
88 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
89 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
90 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
91 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
92 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
93 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
94 @param[in] BufferType The type of buffer to save. IGNORED.\r
95 @param[in] Recover TRUE for recovermode, FALSE otherwise.\r
96\r
97 @return EFI_SUCCESS The operation was successful.\r
98**/\r
632820d1 99EFI_STATUS\r
a1d4bfcc 100EFIAPI\r
632820d1 101HBufferImageRead (\r
a1d4bfcc 102 IN CONST CHAR16 *FileName,\r
103 IN CONST CHAR16 *DiskName,\r
104 IN UINTN DiskOffset,\r
105 IN UINTN DiskSize,\r
106 IN UINTN MemOffset,\r
107 IN UINTN MemSize,\r
108 IN EDIT_FILE_TYPE BufferType,\r
109 IN BOOLEAN Recover\r
632820d1 110 );\r
111\r
a1d4bfcc 112/**\r
113 Save the current image.\r
632820d1 114\r
a1d4bfcc 115 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
116 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
117 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
118 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
119 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
120 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
121 @param[in] BufferType The type of buffer to save. IGNORED.\r
632820d1 122\r
a1d4bfcc 123 @return EFI_SUCCESS The operation was successful.\r
124**/\r
632820d1 125EFI_STATUS\r
a1d4bfcc 126HBufferImageSave (\r
127 IN CHAR16 *FileName,\r
128 IN CHAR16 *DiskName,\r
129 IN UINTN DiskOffset,\r
130 IN UINTN DiskSize,\r
131 IN UINTN MemOffset,\r
132 IN UINTN MemSize,\r
133 IN EDIT_FILE_TYPE BufferType\r
632820d1 134 );\r
135\r
a1d4bfcc 136/**\r
137 According to cursor's file position, adjust screen display.\r
138\r
139 @param[in] NewFilePosRow Row of file position ( start from 1 ).\r
140 @param[in] NewFilePosCol Column of file position ( start from 1 ).\r
141 @param[in] HighBits Cursor will on high4 bits or low4 bits.\r
142**/\r
632820d1 143VOID\r
144HBufferImageMovePosition (\r
a1d4bfcc 145 IN UINTN NewFilePosRow,\r
146 IN UINTN NewFilePosCol,\r
147 IN BOOLEAN HighBits\r
632820d1 148 );\r
149\r
632820d1 150\r
a1d4bfcc 151/**\r
152 Create a new line and append it to the line list.\r
153 Fields affected:\r
154 NumLines\r
155 Lines \r
632820d1 156\r
a1d4bfcc 157 @retval NULL create line failed.\r
158 @return the line created.\r
632820d1 159\r
a1d4bfcc 160**/\r
161HEFI_EDITOR_LINE *\r
162HBufferImageCreateLine (\r
632820d1 163 VOID\r
164 );\r
165\r
a1d4bfcc 166/**\r
ae724571 167 Free the current image.\r
168\r
169 @retval EFI_SUCCESS The operation was successful.\r
170**/\r
632820d1 171EFI_STATUS\r
172HBufferImageFree (\r
173 VOID\r
ae724571 174 );\r
632820d1 175\r
a1d4bfcc 176/**\r
177 Delete character from buffer.\r
178 \r
179 @param[in] Pos Position, Pos starting from 0.\r
180 @param[in] Count The Count of characters to delete.\r
181 @param[out] DeleteBuffer The DeleteBuffer.\r
182\r
183 @retval EFI_SUCCESS Success \r
184**/\r
632820d1 185EFI_STATUS\r
186HBufferImageDeleteCharacterFromBuffer (\r
a1d4bfcc 187 IN UINTN Pos,\r
188 IN UINTN Count,\r
189 OUT UINT8 *DeleteBuffer\r
632820d1 190 );\r
191\r
a1d4bfcc 192/**\r
193 Add character to buffer, add before pos.\r
194\r
195 @param[in] Pos Position, Pos starting from 0.\r
196 @param[in] Count Count of characters to add.\r
197 @param[in] AddBuffer Add buffer.\r
198\r
199 @retval EFI_SUCCESS Success. \r
200**/\r
632820d1 201EFI_STATUS\r
202HBufferImageAddCharacterToBuffer (\r
a1d4bfcc 203 IN UINTN Pos,\r
204 IN UINTN Count,\r
205 IN UINT8 *AddBuffer\r
632820d1 206 );\r
207\r
a1d4bfcc 208/**\r
209 Change the raw buffer to a list of lines for the UI.\r
210 \r
211 @param[in] Buffer The pointer to the buffer to fill.\r
212 @param[in] Bytes The size of the buffer in bytes.\r
213\r
214 @retval EFI_SUCCESS The operation was successful.\r
215 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
216**/\r
632820d1 217EFI_STATUS\r
a1d4bfcc 218EFIAPI\r
632820d1 219HBufferImageBufferToList (\r
a1d4bfcc 220 IN VOID *Buffer,\r
221 IN UINTN Bytes\r
632820d1 222 );\r
223\r
a1d4bfcc 224/**\r
225 Change the list of lines from the UI to a raw buffer.\r
226 \r
227 @param[in] Buffer The pointer to the buffer to fill.\r
228 @param[in] Bytes The size of the buffer in bytes.\r
229\r
230 @retval EFI_SUCCESS The operation was successful.\r
231**/\r
632820d1 232EFI_STATUS\r
a1d4bfcc 233EFIAPI\r
632820d1 234HBufferImageListToBuffer (\r
a1d4bfcc 235 IN VOID *Buffer,\r
236 IN UINTN Bytes\r
632820d1 237 );\r
238\r
a1d4bfcc 239/**\r
240 Move the mouse in the image buffer.\r
241\r
242 @param[in] TextX The x-coordinate.\r
243 @param[in] TextY The y-coordinate.\r
244**/\r
632820d1 245VOID\r
a1d4bfcc 246EFIAPI\r
632820d1 247HBufferImageAdjustMousePosition (\r
a1d4bfcc 248 IN INT32 TextX,\r
249 IN INT32 TextY\r
632820d1 250 );\r
251\r
a1d4bfcc 252/**\r
253 Function to decide if a column number is stored in the high bits.\r
254\r
255 @param[in] Column The column to examine.\r
256 @param[out] FCol The actual column number.\r
257\r
258 @retval TRUE The actual column was in high bits and is now in FCol.\r
259 @retval FALSE There was not a column number in the high bits.\r
260**/\r
632820d1 261BOOLEAN\r
262HBufferImageIsAtHighBits (\r
a1d4bfcc 263 IN UINTN Column,\r
264 OUT UINTN *FCol\r
632820d1 265 );\r
266\r
a1d4bfcc 267/**\r
268 Get the size of the open buffer.\r
269\r
270 @retval The size in bytes.\r
271**/\r
632820d1 272UINTN\r
273HBufferImageGetTotalSize (\r
274 VOID\r
275 );\r
276\r
632820d1 277#endif\r