The GetInfo function of the EFI_FILE_PROTOCOL can be used to retrieve the 
information about the file.  You will need to use the EFI_FILE_PROTOCOL 
instance from opening the specific file instance.  for example, if you 
wanted to open Info.txt in the root of the file system, you should use the 
root->open for "Info.txt" and get the returned file handle.  Then, using 
the returned EFI_FILE_PROTOCOL, you should call EFI_FILE_GET_INFO and pass 
the gEfiFileInfoGuid and a buffer and a buffersize. The EFI_FILE_GET_INFO 
function may return EFI_BUFFER_TOO_SMALL, in which case, it will update 
the buffer size pointer with the required size to fit the EFI_FILE_INFO 
structure. 

Best Regards,
Aaron



From:   KSilva <>
To:     edk2-devel@lists.sourceforge.net, 
Date:   06/01/2015 06:33 AM
Subject:        [edk2] how to get the file length



I am trying to get a file length, but I have not had success yet.

here is my code: 


                 Status = gBS->HandleProtocol(Device,
                                                  &gSimpleFileProtocol,
  (VOID**)&fileSystemProtocol
                                                  );

                 Print(L"Status HandleProtocol :%r\n", Status);

                 root = NULL;
                 AsciiStrToUnicodeStr("kdias", texto);

                 Status = 
fileSystemProtocol->OpenVolume(fileSystemProtocol,
                 &root);

                 Print(L"Status OpenVolume :%r\n", Status);


                                                 Status = root->Open(root,
  &newHandle,
  nameFile,
                                                 EFI_FILE_MODE_READ| 
EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE,              0);


                                                 Print(L"Status do Open : 
%r \n",Status);


                                                 Status = 
newHandle->GetInfo(newHandle,&gEfiFileInfoGuid,&BufferSize,(VOID
&fileInfo);
                                                 Print(L"Status GetInfo 
:%r \n",Status);



                 return EFI_SUCCESS;
}


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to