29BOOLEAN HEditorMouseAction;
34extern BOOLEAN HBufferImageMouseNeedRefresh;
35extern BOOLEAN HBufferImageNeedRefresh;
36extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
113 gShellDebug1HiiHandle,
118 if (InfoString !=
NULL) {
129 Status =
gBS->WaitForEvent (1, &HMainEditor.TextInputEx->
WaitForKeyEx, &EventIndex);
130 if (EFI_ERROR (Status) || (EventIndex != 0)) {
134 Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData);
135 if (EFI_ERROR (Status)) {
146 if (KeyData.
Key.UnicodeChar == L
'W' - L
'A' + 1) {
151 ((KeyData.
KeyState.
KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0))
157 if ((KeyData.
Key.UnicodeChar ==
'w') || (KeyData.
Key.UnicodeChar ==
'W')) {
164 HBufferImageNeedRefresh =
TRUE;
165 HBufferImageOnlyLineNeedRefresh =
FALSE;
199 if (EFI_ERROR (Status)) {
204 if (EFI_ERROR (Status)) {
209 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
214 if (Status == EFI_NOT_READY) {
223 if (EFI_ERROR (Status)) {
233 if (Offset >= Size) {
243 HBufferImageNeedRefresh =
TRUE;
244 HBufferImageOnlyLineNeedRefresh =
FALSE;
245 HBufferImageMouseNeedRefresh =
TRUE;
270 SHELL_FILE_HANDLE ShellFileHandle;
272 if (HMainEditor.BufferImage->BufferType != FileTypeFileBuffer) {
273 if (!HMainEditor.BufferImage->Modified) {
277 Status =
InputBarSetPrompt (L
"Dangerous to save disk/mem buffer. Save (Yes/No/Cancel) ? ");
278 if (EFI_ERROR (Status)) {
286 if (EFI_ERROR (Status)) {
295 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
300 if (Status == EFI_NOT_READY) {
312 HMainEditor.BufferImage->DiskImage->Name,
313 HMainEditor.BufferImage->DiskImage->Offset,
314 HMainEditor.BufferImage->DiskImage->Size,
315 HMainEditor.BufferImage->MemImage->Offset,
316 HMainEditor.BufferImage->MemImage->Size,
317 HMainEditor.BufferImage->BufferType
320 if (EFI_ERROR (Status)) {
389 L
"File to Save: [%s]",
390 HMainEditor.BufferImage->FileImage->FileName
393 return EFI_OUT_OF_RESOURCES;
408 if (EFI_ERROR (Status)) {
413 if (EFI_ERROR (Status)) {
420 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
425 if (Status == EFI_NOT_READY) {
426 SHELL_FREE_NON_NULL (Str);
430 SHELL_FREE_NON_NULL (Str);
439 HMainEditor.BufferImage->FileImage->FileName
445 if (FileName ==
NULL) {
446 return EFI_OUT_OF_RESOURCES;
451 SHELL_FREE_NON_NULL (FileName);
462 &HMainEditor.BufferImage->FileImage->FileName
472 if (HMainEditor.BufferImage->FileImage->ReadOnly) {
474 SHELL_FREE_NON_NULL (FileName);
480 if (!EFI_ERROR (Status)) {
487 if (Info->
Attribute & EFI_FILE_READ_ONLY) {
489 SHELL_FREE_NON_NULL (FileName);
493 SHELL_FREE_NON_NULL (Info);
498 if (EFI_ERROR (Status)) {
499 SHELL_FREE_NON_NULL (FileName);
504 if (EFI_ERROR (Status)) {
505 SHELL_FREE_NON_NULL (FileName);
511 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
513 if (Status == EFI_NOT_READY) {
514 SHELL_FREE_NON_NULL (FileName);
525 SHELL_FREE_NON_NULL (FileName);
529 SHELL_FREE_NON_NULL (FileName);
541 HMainEditor.BufferImage->DiskImage->Name,
542 HMainEditor.BufferImage->DiskImage->Offset,
543 HMainEditor.BufferImage->DiskImage->Size,
544 HMainEditor.BufferImage->MemImage->Offset,
545 HMainEditor.BufferImage->MemImage->Size,
548 SHELL_FREE_NON_NULL (FileName);
550 if (EFI_ERROR (Status)) {
551 return EFI_LOAD_ERROR;
571 Start = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column;
576 if (HMainEditor.BufferImage->CurrentLine->Link.ForwardLink == HMainEditor.BufferImage->ListHead) {
577 if (HMainEditor.BufferImage->BufferPosition.Column > HMainEditor.BufferImage->CurrentLine->Size) {
579 return EFI_LOAD_ERROR;
583 if ((HMainEditor.SelectEnd != 0) && (Start > HMainEditor.SelectEnd)) {
585 return EFI_LOAD_ERROR;
588 HMainEditor.SelectStart = Start;
590 HBufferImageNeedRefresh =
TRUE;
609 End = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column;
614 if (HMainEditor.BufferImage->CurrentLine->Link.ForwardLink == HMainEditor.BufferImage->ListHead) {
615 if (HMainEditor.BufferImage->BufferPosition.Column > HMainEditor.BufferImage->CurrentLine->Size) {
617 return EFI_LOAD_ERROR;
621 if ((HMainEditor.SelectStart != 0) && (End < HMainEditor.SelectStart)) {
626 HMainEditor.SelectEnd = End;
628 HBufferImageNeedRefresh =
TRUE;
653 if (HMainEditor.SelectStart == 0) {
661 if (HMainEditor.SelectEnd == 0) {
666 Link = HMainEditor.BufferImage->ListHead->ForwardLink;
667 for (Index = 0; Index < (HMainEditor.SelectEnd - 1) / 0x10; Index++) {
668 Link = Link->ForwardLink;
671 Count = HMainEditor.SelectEnd - HMainEditor.SelectStart + 1;
673 if (Buffer ==
NULL) {
674 return EFI_OUT_OF_RESOURCES;
681 HMainEditor.SelectStart - 1,
691 HBufferImageNeedRefresh =
TRUE;
692 HBufferImageOnlyLineNeedRefresh =
FALSE;
694 if (!HMainEditor.BufferImage->Modified) {
695 HMainEditor.BufferImage->Modified =
TRUE;
701 HMainEditor.SelectStart = 0;
702 HMainEditor.SelectEnd = 0;
719 BOOLEAN OnlyLineRefresh;
726 if ((Count == 0) || (Buffer ==
NULL)) {
731 Line = HMainEditor.BufferImage->CurrentLine;
733 OnlyLineRefresh =
FALSE;
734 if ((Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead) && (Line->Size + Count < 0x10)) {
742 OnlyLineRefresh =
TRUE;
745 FPos = 0x10 * (HMainEditor.BufferImage->BufferPosition.Row - 1) + HMainEditor.BufferImage->BufferPosition.Column - 1;
749 if (OnlyLineRefresh) {
750 HBufferImageNeedRefresh =
FALSE;
751 HBufferImageOnlyLineNeedRefresh =
TRUE;
753 HBufferImageNeedRefresh =
TRUE;
754 HBufferImageOnlyLineNeedRefresh =
FALSE;
757 if (!HMainEditor.BufferImage->Modified) {
758 HMainEditor.BufferImage->Modified =
TRUE;
796 if (HMainEditor.BufferImage->Modified) {
798 if (EFI_ERROR (Status)) {
803 if (EFI_ERROR (Status)) {
808 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
813 if (Status == EFI_NOT_READY) {
824 HMainEditor.BufferImage->FileImage->FileName,
825 HMainEditor.BufferImage->DiskImage->Name,
826 HMainEditor.BufferImage->DiskImage->Offset,
827 HMainEditor.BufferImage->DiskImage->Size,
828 HMainEditor.BufferImage->MemImage->Offset,
829 HMainEditor.BufferImage->MemImage->Size,
830 HMainEditor.BufferImage->BufferType
832 if (!EFI_ERROR (Status)) {
868 EDIT_FILE_TYPE BufferType;
870 BufferType = HMainEditor.BufferImage->BufferType;
902 if (HMainEditor.BufferImage->Modified) {
904 if (EFI_ERROR (Status)) {
912 if (EFI_ERROR (Status)) {
922 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
927 if (Status == EFI_NOT_READY) {
938 HMainEditor.BufferImage->FileImage->FileName,
939 HMainEditor.BufferImage->DiskImage->Name,
940 HMainEditor.BufferImage->DiskImage->Offset,
941 HMainEditor.BufferImage->DiskImage->Size,
942 HMainEditor.BufferImage->MemImage->Offset,
943 HMainEditor.BufferImage->MemImage->Size,
944 HMainEditor.BufferImage->BufferType
946 if (EFI_ERROR (Status)) {
951 HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name :
NULL,
952 HMainEditor.BufferImage->BufferType,
953 HMainEditor.BufferImage->FileImage->ReadOnly,
955 HMainEditor.ScreenSize.Column,
956 HMainEditor.ScreenSize.Row,
957 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
958 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
982 if (EFI_ERROR (Status)) {
984 HMainEditor.BufferImage->FileImage->FileName,
985 HMainEditor.BufferImage->DiskImage->Name,
986 HMainEditor.BufferImage->DiskImage->Offset,
987 HMainEditor.BufferImage->DiskImage->Size,
988 HMainEditor.BufferImage->MemImage->Offset,
989 HMainEditor.BufferImage->MemImage->Size,
997 if (EFI_ERROR (Status)) {
999 HMainEditor.BufferImage->FileImage->FileName,
1000 HMainEditor.BufferImage->DiskImage->Name,
1001 HMainEditor.BufferImage->DiskImage->Offset,
1002 HMainEditor.BufferImage->DiskImage->Size,
1003 HMainEditor.BufferImage->MemImage->Offset,
1004 HMainEditor.BufferImage->MemImage->Size,
1012 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1017 if (Status == EFI_NOT_READY) {
1019 HMainEditor.BufferImage->FileImage->FileName,
1020 HMainEditor.BufferImage->DiskImage->Name,
1021 HMainEditor.BufferImage->DiskImage->Offset,
1022 HMainEditor.BufferImage->DiskImage->Size,
1023 HMainEditor.BufferImage->MemImage->Offset,
1024 HMainEditor.BufferImage->MemImage->Size,
1041 HMainEditor.BufferImage->FileImage->FileName,
1042 HMainEditor.BufferImage->DiskImage->Name,
1043 HMainEditor.BufferImage->DiskImage->Offset,
1044 HMainEditor.BufferImage->DiskImage->Size,
1045 HMainEditor.BufferImage->MemImage->Offset,
1046 HMainEditor.BufferImage->MemImage->Size,
1064 HMainEditor.BufferImage->DiskImage->Name,
1065 HMainEditor.BufferImage->DiskImage->Offset,
1066 HMainEditor.BufferImage->DiskImage->Size,
1067 HMainEditor.BufferImage->MemImage->Offset,
1068 HMainEditor.BufferImage->MemImage->Size,
1073 if (EFI_ERROR (Status)) {
1075 HMainEditor.BufferImage->FileImage->FileName,
1076 HMainEditor.BufferImage->DiskImage->Name,
1077 HMainEditor.BufferImage->DiskImage->Offset,
1078 HMainEditor.BufferImage->DiskImage->Size,
1079 HMainEditor.BufferImage->MemImage->Offset,
1080 HMainEditor.BufferImage->MemImage->Size,
1085 return EFI_LOAD_ERROR;
1110 EDIT_FILE_TYPE BufferType;
1117 BufferType = HMainEditor.BufferImage->BufferType;
1123 if (HMainEditor.BufferImage->Modified) {
1125 if (EFI_ERROR (Status)) {
1133 if (EFI_ERROR (Status)) {
1143 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1148 if (Status == EFI_NOT_READY) {
1159 HMainEditor.BufferImage->FileImage->FileName,
1160 HMainEditor.BufferImage->DiskImage->Name,
1161 HMainEditor.BufferImage->DiskImage->Offset,
1162 HMainEditor.BufferImage->DiskImage->Size,
1163 HMainEditor.BufferImage->MemImage->Offset,
1164 HMainEditor.BufferImage->MemImage->Size,
1167 if (EFI_ERROR (Status)) {
1172 HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name :
NULL,
1173 HMainEditor.BufferImage->BufferType,
1174 HMainEditor.BufferImage->FileImage->ReadOnly,
1176 HMainEditor.ScreenSize.Column,
1177 HMainEditor.ScreenSize.Row,
1178 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
1179 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
1203 if (EFI_ERROR (Status)) {
1208 if (EFI_ERROR (Status)) {
1213 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1218 if (Status == EFI_NOT_READY) {
1231 if (DeviceName ==
NULL) {
1232 return EFI_OUT_OF_RESOURCES;
1239 if (EFI_ERROR (Status)) {
1244 if (EFI_ERROR (Status)) {
1249 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1254 if (Status == EFI_NOT_READY) {
1263 if (EFI_ERROR (Status)) {
1275 if (EFI_ERROR (Status)) {
1280 if (EFI_ERROR (Status)) {
1285 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1290 if (Status == EFI_NOT_READY) {
1299 if (EFI_ERROR (Status)) {
1322 if (EFI_ERROR (Status)) {
1324 HMainEditor.BufferImage->FileImage->FileName,
1325 HMainEditor.BufferImage->DiskImage->Name,
1326 HMainEditor.BufferImage->DiskImage->Offset,
1327 HMainEditor.BufferImage->DiskImage->Size,
1328 HMainEditor.BufferImage->MemImage->Offset,
1329 HMainEditor.BufferImage->MemImage->Size,
1333 return EFI_NOT_FOUND;
1356 EDIT_FILE_TYPE BufferType;
1363 BufferType = HMainEditor.BufferImage->BufferType;
1369 if (HMainEditor.BufferImage->Modified) {
1371 if (EFI_ERROR (Status)) {
1379 if (EFI_ERROR (Status)) {
1389 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1394 if (Status == EFI_NOT_READY) {
1405 HMainEditor.BufferImage->FileImage->FileName,
1406 HMainEditor.BufferImage->DiskImage->Name,
1407 HMainEditor.BufferImage->DiskImage->Offset,
1408 HMainEditor.BufferImage->DiskImage->Size,
1409 HMainEditor.BufferImage->MemImage->Offset,
1410 HMainEditor.BufferImage->MemImage->Size,
1413 if (EFI_ERROR (Status)) {
1418 HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name :
NULL,
1419 HMainEditor.BufferImage->BufferType,
1420 HMainEditor.BufferImage->FileImage->ReadOnly,
1422 HMainEditor.ScreenSize.Column,
1423 HMainEditor.ScreenSize.Row,
1424 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
1425 HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
1449 if (EFI_ERROR (Status)) {
1454 if (EFI_ERROR (Status)) {
1459 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1464 if (Status == EFI_NOT_READY) {
1473 if (EFI_ERROR (Status)) {
1485 if (EFI_ERROR (Status)) {
1490 if (EFI_ERROR (Status)) {
1495 Status =
InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column);
1500 if (Status == EFI_NOT_READY) {
1509 if (EFI_ERROR (Status)) {
1521 if ((Offset + Size - 1) > 0xffffffff) {
1523 return EFI_LOAD_ERROR;
1537 if (EFI_ERROR (Status)) {
1540 HMainEditor.BufferImage->FileImage->FileName,
1541 HMainEditor.BufferImage->DiskImage->Name,
1542 HMainEditor.BufferImage->DiskImage->Offset,
1543 HMainEditor.BufferImage->DiskImage->Size,
1544 HMainEditor.BufferImage->MemImage->Offset,
1545 HMainEditor.BufferImage->MemImage->Size,
1549 return EFI_NOT_FOUND;
1555MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
1665 CopyMem (&HMainEditor, &HMainEditorConst,
sizeof (HMainEditor));
1674 HOriginalColors = HMainEditor.ColorAttributes.Colors;
1684 &(HMainEditor.ScreenSize.Column),
1685 &(HMainEditor.ScreenSize.Row)
1692 Status =
gBS->HandleProtocol (
1694 &gEfiSimpleTextInputExProtocolGuid,
1695 (VOID **)&HMainEditor.TextInputEx
1697 if (EFI_ERROR (Status)) {
1704 Status =
gBS->HandleProtocol (
1706 &gEfiSimplePointerProtocolGuid,
1707 (VOID **)&HMainEditor.MouseInterface
1709 if (EFI_ERROR (Status)) {
1713 HandleBuffer =
NULL;
1714 HMainEditor.MouseInterface =
NULL;
1715 Status =
gBS->LocateHandleBuffer (
1717 &gEfiSimplePointerProtocolGuid,
1722 if (!EFI_ERROR (Status) && (HandleCount > 0)) {
1726 for (Index = 0; Index < HandleCount; Index++) {
1727 Status =
gBS->HandleProtocol (
1728 HandleBuffer[Index],
1729 &gEfiSimplePointerProtocolGuid,
1730 (VOID **)&HMainEditor.MouseInterface
1732 if (!EFI_ERROR (Status)) {
1738 if (HandleBuffer !=
NULL) {
1743 if (!EFI_ERROR (Status) && (HMainEditor.MouseInterface !=
NULL)) {
1744 HMainEditor.MouseAccumulatorX = 0;
1745 HMainEditor.MouseAccumulatorY = 0;
1746 HMainEditor.MouseSupported =
TRUE;
1753 if (EFI_ERROR (Status)) {
1755 return EFI_LOAD_ERROR;
1759 if (EFI_ERROR (Status)) {
1761 return EFI_LOAD_ERROR;
1765 if (EFI_ERROR (Status)) {
1767 return EFI_LOAD_ERROR;
1771 if (EFI_ERROR (Status)) {
1773 return EFI_LOAD_ERROR;
1779 if (EFI_ERROR (Status)) {
1781 return EFI_LOAD_ERROR;
1785 if (EFI_ERROR (Status)) {
1787 return EFI_LOAD_ERROR;
1799 HEditorFirst =
TRUE;
1800 HEditorExit =
FALSE;
1801 HEditorMouseAction =
FALSE;
1831 if (EFI_ERROR (Status)) {
1836 if (EFI_ERROR (Status)) {
1849 EFI_TEXT_ATTR (HOriginalColors.Foreground, HOriginalColors.Background)
1872 if (HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer) {
1873 if ((HMainEditor.BufferImage->DiskImage !=
NULL) &&
1874 (HBufferImageBackupVar.DiskImage !=
NULL) &&
1875 ((HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset) ||
1876 (HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size)))
1880 }
else if (HMainEditor.BufferImage->BufferType == FileTypeMemBuffer) {
1881 if ((HMainEditor.BufferImage->MemImage !=
NULL) &&
1882 (HBufferImageBackupVar.MemImage !=
NULL) &&
1883 ((HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset) ||
1884 (HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size)))
1888 }
else if (HMainEditor.BufferImage->BufferType == FileTypeFileBuffer) {
1889 if ((HMainEditor.BufferImage->FileImage !=
NULL) &&
1890 (HMainEditor.BufferImage->FileImage->FileName !=
NULL) &&
1891 (HBufferImageBackupVar.FileImage !=
NULL) &&
1892 (HBufferImageBackupVar.FileImage->FileName !=
NULL) &&
1893 (
StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0))
1899 if ((HMainEditor.BufferImage->FileImage !=
NULL) &&
1900 (HBufferImageBackupVar.FileImage !=
NULL) &&
1901 (HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly))
1917 || (HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType)
1918 || (HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified)
1922 HMainEditor.BufferImage->BufferType == FileTypeFileBuffer && HMainEditor.BufferImage->FileImage !=
NULL ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage !=
NULL ? HMainEditor.BufferImage->DiskImage->Name :
NULL,
1923 HMainEditor.BufferImage->BufferType,
1924 (BOOLEAN)(HMainEditor.BufferImage->FileImage !=
NULL ? HMainEditor.BufferImage->FileImage->ReadOnly :
FALSE),
1925 HMainEditor.BufferImage->Modified,
1926 HMainEditor.ScreenSize.Column,
1927 HMainEditor.ScreenSize.Row,
1928 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,
1929 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
1935 || (HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row)
1936 || (HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column)
1941 HMainEditor.ScreenSize.Row,
1942 HMainEditor.ScreenSize.Column,
1957 HEditorFirst =
FALSE;
1976 OUT BOOLEAN *BeforeLeftButtonDown
1994 if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) {
1998 TextX =
HGetTextX (MouseState.RelativeMovementX);
1999 TextY =
HGetTextY (MouseState.RelativeMovementY);
2006 if (MouseState.LeftButton) {
2008 HMainEditor.BufferImage->MousePosition.Column,
2022 HMainEditor.BufferImage->MousePosition.Column -= 10;
2023 if (HMainEditor.BufferImage->MousePosition.Column > 24) {
2024 HMainEditor.BufferImage->MousePosition.Column--;
2025 FCol = HMainEditor.BufferImage->MousePosition.Column / 3 + 1 + 1;
2027 if (HMainEditor.BufferImage->MousePosition.Column < 24) {
2028 FCol = HMainEditor.BufferImage->MousePosition.Column / 3 + 1 + 1;
2040 FRow = HMainEditor.BufferImage->BufferPosition.Row +
2041 HMainEditor.BufferImage->MousePosition.Row -
2042 HMainEditor.BufferImage->DisplayPosition.Row;
2044 if (HMainEditor.BufferImage->NumLines < FRow) {
2051 FRow = HMainEditor.BufferImage->NumLines;
2055 Link = HMainEditor.BufferImage->ListHead->ForwardLink;
2056 for (Index = 0; Index < FRow - 1; Index++) {
2057 Link = Link->ForwardLink;
2068 if (FCol > Line->Size) {
2069 if (*BeforeLeftButtonDown) {
2072 if (Line->Size == 0) {
2084 FCol = Line->Size + 1;
2091 HMainEditor.BufferImage->MousePosition.Row = HMainEditor.BufferImage->DisplayPosition.Row;
2093 HMainEditor.BufferImage->MousePosition.Column = HMainEditor.BufferImage->DisplayPosition.Column;
2095 *BeforeLeftButtonDown =
TRUE;
2104 if (*BeforeLeftButtonDown) {
2111 *BeforeLeftButtonDown =
FALSE;
2118 return EFI_NOT_FOUND;
2136 BOOLEAN NoShiftState;
2137 BOOLEAN LengthChange;
2140 BOOLEAN BeforeMouseIsDown;
2141 BOOLEAN MouseIsDown;
2146 UINTN SelectStartBackup;
2147 UINTN SelectEndBackup;
2155 LengthChange =
FALSE;
2157 MouseIsDown =
FALSE;
2164 HEditorMouseAction =
FALSE;
2179 if (HMainEditor.MouseSupported) {
2180 Status = HMainEditor.MouseInterface->GetState (
2181 HMainEditor.MouseInterface,
2184 if (!EFI_ERROR (Status)) {
2185 BeforeMouseIsDown = MouseIsDown;
2189 if (!EFI_ERROR (Status)) {
2190 if (!BeforeMouseIsDown) {
2195 FRow = HBufferImage.BufferPosition.Row;
2196 FCol = HBufferImage.BufferPosition.Column;
2197 SelectStartBackup = HMainEditor.SelectStart;
2198 SelectEndBackup = HMainEditor.SelectEnd;
2203 SelectStartBackup = HMainEditor.SelectStart;
2204 SelectEndBackup = HMainEditor.SelectEnd;
2212 HMainEditor.SelectStart = 0;
2213 HMainEditor.SelectEnd = 0;
2214 HMainEditor.SelectStart = (FRow - 1) * 0x10 + FCol;
2221 (HBufferImage.BufferPosition.Row - 1) *
2223 HBufferImage.BufferPosition.Column
2224 ) >= HMainEditor.SelectStart
2227 HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
2229 HBufferImage.BufferPosition.Column;
2231 HMainEditor.SelectEnd = 0;
2244 HMainEditor.SelectStart = 0;
2245 HMainEditor.SelectEnd = 0;
2251 (HBufferImage.BufferPosition.Row - 1) *
2253 HBufferImage.BufferPosition.Column
2254 ) >= HMainEditor.SelectStart
2257 HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
2259 HBufferImage.BufferPosition.Column;
2261 HMainEditor.SelectEnd = 0;
2264 if (HMainEditor.SelectEnd == 0) {
2265 HMainEditor.SelectStart = 0;
2273 if ((SelectStartBackup != HMainEditor.SelectStart) || (SelectEndBackup != HMainEditor.SelectEnd)) {
2274 if ((SelectStartBackup - 1) / 0x10 != (HMainEditor.SelectStart - 1) / 0x10) {
2275 HBufferImageNeedRefresh =
TRUE;
2277 if ((SelectEndBackup - 1) / 0x10 != (HMainEditor.SelectEnd - 1) / 0x10) {
2278 HBufferImageNeedRefresh =
TRUE;
2280 HBufferImageOnlyLineNeedRefresh =
TRUE;
2286 HEditorMouseAction =
TRUE;
2287 HBufferImageMouseNeedRefresh =
TRUE;
2288 }
else if (Status == EFI_LOAD_ERROR) {
2298 if (!EFI_ERROR (Status)) {
2299 Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData);
2300 if (!EFI_ERROR (Status)) {
2305 HBufferImageMouseNeedRefresh =
TRUE;
2320 }
else if (NoShiftState && (KeyData.
Key.ScanCode == SCAN_NULL)) {
2322 }
else if (NoShiftState && ((KeyData.
Key.ScanCode >= SCAN_UP) && (KeyData.
Key.ScanCode <= SCAN_PAGE_DOWN))) {
2324 }
else if (NoShiftState && ((KeyData.
Key.ScanCode >= SCAN_F1) && (KeyData.
Key.ScanCode <= SCAN_F12))) {
2329 HBufferImageMouseNeedRefresh =
FALSE;
2332 if ((Status !=
EFI_SUCCESS) && (Status != EFI_OUT_OF_RESOURCES)) {
2345 if (HBufferImage.BufferType != HBufferImageBackupVar.BufferType) {
2346 LengthChange =
FALSE;
2351 if (HBufferImage.BufferType != FileTypeFileBuffer) {
2354 switch (HBufferImage.BufferType) {
2355 case FileTypeDiskBuffer:
2356 OldSize = HBufferImage.DiskImage->Size * HBufferImage.DiskImage->BlockSize;
2359 case FileTypeMemBuffer:
2360 OldSize = HBufferImage.MemImage->Size;
2368 if (!LengthChange) {
2369 if (OldSize != Size) {
2374 if (OldSize != Size) {
2375 LengthChange =
TRUE;
2377 LengthChange =
FALSE;
2387 }
while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit);
2400 HMainEditorBackupVar.SelectStart = HMainEditor.SelectStart;
2401 HMainEditorBackupVar.SelectEnd = HMainEditor.SelectEnd;
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINT32 EFIAPI ModU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS HBufferImageHandleInput(IN EFI_INPUT_KEY *Key)
VOID HBufferImageAdjustMousePosition(IN INT32 TextX, IN INT32 TextY)
EFI_STATUS HBufferImageRefresh(VOID)
EFI_STATUS HBufferImageAddCharacterToBuffer(IN UINTN Pos, IN UINTN Count, IN UINT8 *AddBuffer)
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)
UINTN HBufferImageGetTotalSize(VOID)
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)
EFI_STATUS HBufferImageBackup(VOID)
BOOLEAN HBufferImageIsAtHighBits(IN UINTN Column, OUT UINTN *FCol)
VOID HBufferImageMovePosition(IN UINTN NewFilePosRow, IN UINTN NewFilePosCol, IN BOOLEAN HighBits)
EFI_STATUS HBufferImageDeleteCharacterFromBuffer(IN UINTN Pos, IN UINTN Count, OUT UINT8 *DeleteBuffer)
EFI_STATUS HBufferImageInit(VOID)
EFI_STATUS HBufferImageCleanup(VOID)
UINTN HClipBoardGet(OUT UINT8 **Buffer)
EFI_STATUS HClipBoardInit(VOID)
EFI_STATUS HClipBoardSet(IN UINT8 *Buffer, IN UINTN Size)
EFI_STATUS HClipBoardCleanup(VOID)
VOID StatusBarSetRefresh(VOID)
EFI_STATUS StatusBarRefresh(IN BOOLEAN EditorFirst, IN UINTN LastRow, IN UINTN LastCol, IN UINTN FileRow, IN UINTN FileCol, IN BOOLEAN InsertMode)
EFI_STATUS StatusBarSetStatusString(IN CHAR16 *Str)
CONST CHAR16 * StatusBarGetString(VOID)
BOOLEAN StatusBarGetRefresh(VOID)
EFI_STATUS StatusBarInit(VOID)
VOID StatusBarCleanup(VOID)
EFI_STATUS MainTitleBarInit(CONST CHAR16 *Prompt)
EFI_STATUS MainTitleBarRefresh(IN CONST CHAR16 *FileName OPTIONAL, IN CONST EDIT_FILE_TYPE FileType, IN CONST BOOLEAN ReadOnly, IN CONST BOOLEAN Modified, IN CONST UINTN LastCol, IN CONST UINTN LastRow, IN CONST UINTN Offset, IN CONST UINTN Size)
VOID MainTitleBarCleanup(VOID)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS HMainCommandCut(VOID)
EFI_STATUS HMainCommandDisplayHelp(VOID)
EFI_STATUS HMainCommandGoToOffset(VOID)
EFI_STATUS HMainEditorKeyInput(VOID)
VOID HMainEditorBackup(VOID)
EFI_STATUS HMainEditorRefresh(VOID)
EFI_STATUS HMainCommandOpenDisk(VOID)
EFI_STATUS HMainCommandExit(VOID)
EFI_STATUS HMainCommandOpenFile(VOID)
EFI_STATUS HMainEditorCleanup(VOID)
EFI_STATUS HMainCommandSaveBuffer(VOID)
EFI_STATUS HMainEditorHandleMouseInput(IN EFI_SIMPLE_POINTER_STATE MouseState, OUT BOOLEAN *BeforeLeftButtonDown)
EFI_STATUS HMainEditorInit(VOID)
EFI_STATUS HMainCommandSelectEnd(VOID)
EFI_STRING_ID HexMainMenuHelpInfo[]
EFI_STATUS HMainCommandOpenMemory(VOID)
EFI_STATUS HMainCommandSelectStart(VOID)
EFI_STATUS HMainCommandPaste(VOID)
#define CR(Record, TYPE, Field, TestSignature)
EFI_FILE_INFO *EFIAPI ShellGetFileInfo(IN SHELL_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
EFI_STATUS EFIAPI ShellCloseFile(IN SHELL_FILE_HANDLE *FileHandle)
INT32 HGetTextY(IN INT32 GuidY)
INT32 HGetTextX(IN INT32 GuidX)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
CHAR16 *EFIAPI CatSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString,...)
BOOLEAN IsValidFileName(IN CONST CHAR16 *Name)
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
EFI_HANDLE ConsoleInHandle
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut