43 Status = Vol->OpenVolume (Vol, &RootDir);
44 if (EFI_ERROR (Status)) {
51 Status = RootDir->Open (
58 if (EFI_ERROR (Status)) {
59 RootDir->Close (RootDir);
63 RootDir->Close (RootDir);
72 Handle->Close (Handle);
76 Status = Handle->GetInfo (
82 if (EFI_ERROR (Status)) {
83 Handle->Close (Handle);
93 if (TempBuffer ==
NULL) {
94 Handle->Close (Handle);
104 Status = Handle->Read (
109 if (EFI_ERROR (Status)) {
110 Handle->Close (Handle);
111 gBS->FreePool (TempBuffer);
115 Handle->Close (Handle);
117 *BufferSize = TempBufferSize;
118 *Buffer = TempBuffer;
153 UINTN TempBufferSize;
162 if ((FileName ==
NULL) || (Buffer ==
NULL)) {
163 return EFI_INVALID_PARAMETER;
170 if (DebuggerPrivate->Vol ==
NULL) {
171 return EFI_INVALID_PARAMETER;
177 return ReadFileFromVol (DebuggerPrivate->Vol, FileName, BufferSize, Buffer);
187 Status =
gBS->LocateHandleBuffer (
189 &gEfiSimpleFileSystemProtocolGuid,
194 if (EFI_ERROR (Status) && (NoHandles == 0)) {
195 return EFI_NOT_FOUND;
201 DebuggerPrivate->Vol =
NULL;
204 for (Index = 0; Index < NoHandles; Index++) {
205 Status =
gBS->HandleProtocol (
207 &gEfiSimpleFileSystemProtocolGuid,
210 if (EFI_ERROR (Status)) {
214 Status =
ReadFileFromVol (Vol, FileName, &TempBufferSize, &TempBuffer);
215 if (!EFI_ERROR (Status)) {
219 if (DebuggerPrivate->Vol !=
NULL) {
223 gBS->FreePool (TempBuffer);
224 gBS->FreePool (*Buffer);
225 EDBPrint (L
"Duplicated FileName found!\n");
226 return EFI_NO_MAPPING;
231 DebuggerPrivate->Vol = Vol;
232 *BufferSize = TempBufferSize;
233 *Buffer = TempBuffer;
241 if (DebuggerPrivate->Vol ==
NULL) {
242 return EFI_NOT_FOUND;
281 if (DebuggerPrivate->Vol ==
NULL) {
282 Status =
gBS->LocateProtocol (
283 &gEfiSimpleFileSystemProtocolGuid,
285 (VOID **)&DebuggerPrivate->Vol
287 if (EFI_ERROR (Status)) {
292 Vol = DebuggerPrivate->Vol;
297 Status = Vol->OpenVolume (Vol, &RootDir);
298 if (EFI_ERROR (Status)) {
305 Status = RootDir->Open (
312 if (EFI_ERROR (Status)) {
313 RootDir->Close (RootDir);
317 RootDir->Close (RootDir);
322 Status = Handle->SetPosition (Handle, 0);
323 if (EFI_ERROR (Status)) {
324 Handle->Close (Handle);
335 Handle->Close (Handle);
350 Status = Handle->Read (
355 if (EFI_ERROR (Status) || (FileInfoSize == 0)) {
371 if (FileIndex == *Index) {
385 Handle->Close (Handle);
BOOLEAN EFIAPI StrEndWith(IN CHAR16 *Str, IN CHAR16 *SubStr)
CHAR16 *EFIAPI StrDuplicate(IN CHAR16 *Src)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
EFI_STATUS EFIAPI ReadFileFromVol(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol, IN CHAR16 *FileName, OUT UINTN *BufferSize, OUT VOID **Buffer)
EFI_STATUS EFIAPI ReadFileToBuffer(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *FileName, OUT UINTN *BufferSize, OUT VOID **Buffer, IN BOOLEAN ScanFs)
CHAR16 *EFIAPI GetFileNameUnderDir(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *DirName, IN CHAR16 *FileName, IN OUT UINTN *Index)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
EFI_FILE_INFO * FileInfo(IN EFI_FILE_HANDLE FHand)