47 CONST CHAR16 *FileName,
57 ShellPrintEx (-1, -1, L
"%s: %s\r\n %08x:", FileTag, FileName, Address);
62 for (Index = 0; Index < BufferSize; Index++) {
66 if (BufferSize < DifferentBytes) {
75 for (Index = 0; Index < BufferSize; Index++) {
76 if ((Buffer[Index] >= 0x20) && (Buffer[Index] <= 0x7E)) {
103 FileBuffer->Allocated =
PcdGet32 (PcdShellFileOperationSize);
104 FileBuffer->Data =
AllocatePool (FileBuffer->Allocated);
105 FileBuffer->Left = 0;
122 SHELL_FREE_NON_NULL (FileBuffer->Data);
157 IN SHELL_FILE_HANDLE FileHandle,
166 if (FileBuffer->Left == 0) {
167 ReadSize = FileBuffer->Allocated;
168 Status = gEfiShellProtocol->ReadFile (
173 if (EFI_ERROR (Status)) {
182 FileBuffer->Next = 0;
183 FileBuffer->Left = ReadSize;
187 *Byte = FileBuffer->Data[FileBuffer->Next];
209 CHAR16 *ProblemParam;
212 CONST CHAR16 *TempParam;
214 SHELL_FILE_HANDLE FileHandle1;
215 SHELL_FILE_HANDLE FileHandle2;
218 UINT64 DifferentBytes;
219 UINT64 DifferentCount;
220 UINT8 DiffPointNumber;
221 UINT8 OneByteFromFile1;
222 UINT8 OneByteFromFile2;
223 UINT8 *DataFromFile1;
224 UINT8 *DataFromFile2;
227 UINTN InsertPosition1;
228 UINTN InsertPosition2;
229 UINTN DataSizeFromFile1;
230 UINTN DataSizeFromFile2;
233 UINTN DiffPointAddress;
242 DataFromFile1 =
NULL;
243 DataFromFile2 =
NULL;
251 DiffPointAddress = 0;
266 if (EFI_ERROR (Status)) {
267 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
283 if (TempParam ==
NULL) {
284 ASSERT (TempParam !=
NULL);
291 if (FileName1 ==
NULL) {
296 if (EFI_ERROR (Status)) {
303 if (TempParam ==
NULL) {
304 ASSERT (TempParam !=
NULL);
311 if (FileName2 ==
NULL) {
316 if (EFI_ERROR (Status)) {
323 Status = gEfiShellProtocol->GetFileSize (FileHandle1, &Size1);
325 Status = gEfiShellProtocol->GetFileSize (FileHandle2, &Size2);
330 if (TempParam ==
NULL) {
334 if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TempParam, L
"all") == 0) {
335 DifferentCount = MAX_UINTN;
338 if (EFI_ERROR (Status) || (DifferentCount == 0)) {
348 if (TempParam ==
NULL) {
353 if (EFI_ERROR (Status) || (DifferentBytes == 0)) {
357 if (DifferentBytes >
MAX (Size1, Size2)) {
358 DifferentBytes =
MAX (Size1, Size2);
370 if ((DataFromFile1 ==
NULL) || (DataFromFile2 ==
NULL) ||
371 (FileBuffer1.Data ==
NULL) || (FileBuffer2.Data ==
NULL))
374 SHELL_FREE_NON_NULL (DataFromFile1);
375 SHELL_FREE_NON_NULL (DataFromFile2);
382 while ((UINT64)DiffPointNumber < DifferentCount) {
383 DataSizeFromFile1 = 1;
384 DataSizeFromFile2 = 1;
385 OneByteFromFile1 = 0;
386 OneByteFromFile2 = 0;
409 if (((DataSizeFromFile1 == 0) && (InsertPosition1 == 0) && (DataSizeFromFile2 == 0) && (InsertPosition2 == 0)) ||
410 ((
ReadStatus == InPrevDiffPoint) && ((DataSizeFromFile1 == 0) || (DataSizeFromFile2 == 0)))
417 if (OneByteFromFile1 != OneByteFromFile2) {
419 DiffPointAddress = TempAddress;
420 if (DataSizeFromFile1 == 1) {
421 DataFromFile1[InsertPosition1++] = OneByteFromFile1;
424 if (DataSizeFromFile2 == 1) {
425 DataFromFile2[InsertPosition2++] = OneByteFromFile2;
429 if (DataSizeFromFile1 == 1) {
430 DataFromFile1[InsertPosition1++] = OneByteFromFile1;
433 if (DataSizeFromFile2 == 1) {
434 DataFromFile2[InsertPosition2++] = OneByteFromFile2;
437 if (OneByteFromFile1 == OneByteFromFile2) {
445 if ((InsertPosition1 == DifferentBytes) ||
446 (InsertPosition2 == DifferentBytes) ||
447 ((DataSizeFromFile1 == 0) && (DataSizeFromFile2 == 0))
451 PrintDifferentPoint (FileName1, L
"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes);
452 PrintDifferentPoint (FileName2, L
"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes);
457 if ((InsertPosition1 == 0) || (InsertPosition2 == 0)) {
461 for (Index = 1; Index < InsertPosition1 && Index < InsertPosition2; Index++) {
462 if (DataFromFile1[Index] == DataFromFile2[Index]) {
472 for ( ; Index <
MAX (InsertPosition1, InsertPosition2); Index++) {
473 if (DataFromFile1[Index] != DataFromFile2[Index]) {
475 DiffPointAddress += Index;
486 CopyMem (DataFromFile1, DataFromFile1 + Index, InsertPosition1 - Index);
487 CopyMem (DataFromFile2, DataFromFile2 + Index, InsertPosition2 - Index);
489 SetMem (DataFromFile1 + InsertPosition1 - Index, (
UINTN)DifferentBytes - InsertPosition1 + Index, 0);
490 SetMem (DataFromFile2 + InsertPosition2 - Index, (
UINTN)DifferentBytes - InsertPosition2 + Index, 0);
492 InsertPosition1 -= Index;
493 InsertPosition2 -= Index;
497 SHELL_FREE_NON_NULL (DataFromFile1);
498 SHELL_FREE_NON_NULL (DataFromFile2);
502 if (DiffPointNumber == 0) {
515 SHELL_FREE_NON_NULL (FileName1);
516 SHELL_FREE_NON_NULL (FileName2);
518 if (FileHandle1 !=
NULL) {
519 gEfiShellProtocol->CloseFile (FileHandle1);
522 if (FileHandle2 !=
NULL) {
523 gEfiShellProtocol->CloseFile (FileHandle2);
526 return (ShellStatus);
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
STATIC VOID FileBufferInit(OUT FILE_BUFFER *FileBuffer)
STATIC VOID FileBufferUninit(IN OUT FILE_BUFFER *FileBuffer)
STATIC EFI_STATUS FileBufferReadByte(IN SHELL_FILE_HANDLE FileHandle, IN OUT FILE_BUFFER *FileBuffer, OUT UINTN *BytesRead, OUT UINT8 *Byte)
SHELL_STATUS EFIAPI ShellCommandRunComp(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID PrintDifferentPoint(CONST CHAR16 *FileName, CHAR16 *FileTag, UINT8 *Buffer, UINT64 BufferSize, UINTN Address, UINT64 DifferentBytes)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
#define PcdGet32(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI CommandInit(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
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,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
CHAR16 *EFIAPI ShellFindFilePath(IN CONST CHAR16 *FileName)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
EFI_STATUS EFIAPI ReadStatus(IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 LengthInBytes, OUT UINT8 *FlashStatus)
VOID EFIAPI Exit(IN EFI_STATUS Status)