15extern BOOLEAN HBufferImageNeedRefresh;
16extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
17extern BOOLEAN HBufferImageMouseNeedRefresh;
48 CopyMem (&HDiskImage, &HDiskImageConst,
sizeof (HDiskImage));
50 CopyMem (&HDiskImageBackupVar, &HDiskImageConst,
sizeof (HDiskImageBackupVar));
71 SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
73 HDiskImageBackupVar.Name =
CatSPrint (
NULL, L
"%s", HDiskImage.Name);
74 if (HDiskImageBackupVar.Name ==
NULL) {
75 return EFI_OUT_OF_RESOURCES;
78 HDiskImageBackupVar.Offset = HDiskImage.Offset;
79 HDiskImageBackupVar.Size = HDiskImage.Size;
94 SHELL_FREE_NON_NULL (HDiskImage.Name);
95 SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
117 if (Str == HDiskImage.Name) {
128 SHELL_FREE_NON_NULL (HDiskImage.Name);
130 if (HDiskImage.Name ==
NULL) {
131 return EFI_OUT_OF_RESOURCES;
134 HDiskImage.Offset = Offset;
135 HDiskImage.Size = Size;
174 HBufferImage.BufferType = FileTypeDiskBuffer;
176 DevicePath = gEfiShellProtocol->GetDevicePathFromMap (DeviceName);
177 if (DevicePath ==
NULL) {
179 return EFI_INVALID_PARAMETER;
183 DupDevicePathForFree = DupDevicePath;
187 Status =
gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DupDevicePath, &Handle);
189 if (EFI_ERROR (Status)) {
194 Status =
gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo,
gImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
195 if (EFI_ERROR (Status)) {
206 return EFI_LOAD_ERROR;
212 if (Buffer ==
NULL) {
214 return EFI_OUT_OF_RESOURCES;
220 Status = BlkIo->ReadBlocks (
228 if (EFI_ERROR (Status)) {
231 return EFI_LOAD_ERROR;
242 if (EFI_ERROR (Status)) {
248 if (EFI_ERROR (Status)) {
250 return EFI_OUT_OF_RESOURCES;
258 HBufferImage.DisplayPosition.Row = 2;
259 HBufferImage.DisplayPosition.Column = 10;
261 HBufferImage.MousePosition.Row = 2;
262 HBufferImage.MousePosition.Column = 10;
264 HBufferImage.LowVisibleRow = 1;
265 HBufferImage.HighBits =
TRUE;
267 HBufferImage.BufferPosition.Row = 1;
268 HBufferImage.BufferPosition.Column = 1;
271 Str =
CatSPrint (
NULL, L
"%d Lines Read", HBufferImage.NumLines);
274 return EFI_OUT_OF_RESOURCES;
278 SHELL_FREE_NON_NULL (Str);
280 HMainEditor.SelectStart = 0;
281 HMainEditor.SelectEnd = 0;
287 if (HBufferImage.Lines !=
NULL) {
288 HBufferImage.CurrentLine =
CR (
289 HBufferImage.ListHead->ForwardLink,
301 return EFI_OUT_OF_RESOURCES;
304 HBufferImage.CurrentLine = Line;
307 HBufferImage.Modified =
FALSE;
308 HBufferImageNeedRefresh =
TRUE;
309 HBufferImageOnlyLineNeedRefresh =
FALSE;
310 HBufferImageMouseNeedRefresh =
TRUE;
330 IN CHAR16 *DeviceName,
347 if (HBufferImage.Modified ==
FALSE) {
351 HBufferImage.BufferType = FileTypeDiskBuffer;
353 DevicePath = gEfiShellProtocol->GetDevicePathFromMap (DeviceName);
354 if (DevicePath ==
NULL) {
356 return EFI_INVALID_PARAMETER;
360 DupDevicePathForFree = DupDevicePath;
365 Status =
gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DupDevicePath, &Handle);
367 if (EFI_ERROR (Status)) {
372 Status =
gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo,
gImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
373 if (EFI_ERROR (Status)) {
381 if (Buffer ==
NULL) {
382 return EFI_OUT_OF_RESOURCES;
389 if (EFI_ERROR (Status)) {
397 Status = BlkIo->WriteBlocks (
407 if (EFI_ERROR (Status)) {
408 return EFI_LOAD_ERROR;
414 HBufferImage.Modified =
FALSE;
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS HBufferImageFree(VOID)
EFI_STATUS HBufferImageListToBuffer(IN VOID *Buffer, IN UINTN Bytes)
EFI_STATUS HBufferImageBufferToList(IN VOID *Buffer, IN UINTN Bytes)
HEFI_EDITOR_LINE * HBufferImageCreateLine(VOID)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS HDiskImageCleanup(VOID)
EFI_STATUS HDiskImageSetDiskNameOffsetSize(IN CONST CHAR16 *Str, IN UINTN Offset, IN UINTN Size)
EFI_STATUS HDiskImageSave(IN CHAR16 *DeviceName, IN UINTN Offset, IN UINTN Size)
EFI_STATUS HDiskImageInit(VOID)
EFI_STATUS HDiskImageBackup(VOID)
EFI_STATUS HDiskImageRead(IN CONST CHAR16 *DeviceName, IN UINTN Offset, IN UINTN Size, IN BOOLEAN Recover)
EFI_STATUS StatusBarSetStatusString(IN CHAR16 *Str)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define CR(Record, TYPE, Field, TestSignature)
CHAR16 *EFIAPI CatSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString,...)
EFI_BLOCK_IO_MEDIA * Media