/** @file
Functions to deal with Mem buffer
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HexEditor.h"
extern EFI_HANDLE HImageHandleBackup;
extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
extern BOOLEAN HBufferImageNeedRefresh;
extern BOOLEAN HBufferImageMouseNeedRefresh;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
//
// for basic initialization of HDiskImage
//
NULL,
0,
0
};
/**
Empty function. always returns the same.
@param[in] This Ignored.
@param[in] Width Ignored.
@param[in] Address Ignored.
@param[in] Count Ignored.
@param[in, out] Buffer Ignored.
@retval EFI_UNSUPPORTED.
**/
)
{
return EFI_UNSUPPORTED;
}
/**
Empty function. always returns the same.
@param[in] This Ignored.
@param[in] Width Ignored.
@param[in] Address Ignored.
@param[in] Count Ignored.
@param[in, out] Buffer Ignored.
@retval EFI_UNSUPPORTED.
**/
)
{
return EFI_UNSUPPORTED;
}
/**
Initialization function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
)
{
//
// basically initialize the HMemImage
//
NULL,
);
if (Status == EFI_NOT_FOUND) {
//
// For NT32, no EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL is available
// Use Dummy PciRootBridgeIo for memory access
//
}
return EFI_SUCCESS;
} else {
return EFI_LOAD_ERROR;
}
}
/**
Backup function for HDiskImage. Only a few fields need to be backup.
This is for making the Disk buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
**/
)
{
return EFI_SUCCESS;
}
/**
Set FileName field in HFileImage.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
)
{
return EFI_SUCCESS;
}
/**
Read a disk from disk into HBufferImage.
@param[in] Offset The offset.
@param[in] Size The size.
@param[in] Recover if is for recover, no information print.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
)
{
void *Buffer;
StatusBarSetStatusString (L"Read Memory Failed");
return EFI_OUT_OF_RESOURCES;
}
Size,
);
StatusBarSetStatusString (L"Memory Specified Not Accessible");
return EFI_LOAD_ERROR;
}
HBufferImageFree ();
StatusBarSetStatusString (L"Read Memory Failed");
return Status;
}
if (!Recover) {
StatusBarSetStatusString (L"Read Memory Failed");
return EFI_OUT_OF_RESOURCES;
}
HMainEditor.SelectStart = 0;
HMainEditor.SelectEnd = 0;
}
//
// has line
//
HBufferImage.CurrentLine = CR (HBufferImage.ListHead->ForwardLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
} else {
//
// create a dummy line
//
Line = HBufferImageCreateLine ();
StatusBarSetStatusString (L"Read Memory Failed");
return EFI_OUT_OF_RESOURCES;
}
}
return EFI_SUCCESS;
}
/**
Save lines in HBufferImage to disk.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
)
{
//
// not modified, so directly return
//
return EFI_SUCCESS;
}
return EFI_OUT_OF_RESOURCES;
}
return Status;
}
//
// write back to memory
//
Size,
);
return EFI_LOAD_ERROR;
}
//
// now not modified
//
return EFI_SUCCESS;
}