Hello,
 
Try also using the read and create flags. I had a problem like this and
passing those flags the file could be opened and written.
 
Best Regards
 
Leandro Becker

>>> Em Quinta, 27 de Março de 2014 às 13:50, na mensagem
<98d4070157384f6aa641a82900863...@amspr02mb229.eurprd02.prod.outlook.com>,
"miguelro...@ua.pt" <miguelro...@ua.pt> gravou:

Hello all,

I'm getting an error when trying to open a file for writing. I have no
problems when I open the same file with read permissions.

I'm using the following code:

EFI_FILE_IO_INTERFACE *
get_io_interface(EFI_HANDLE image)
{
EFI_STATUS status;
EFI_HANDLE loadedImHandle;
EFI_FILE_IO_INTERFACE * vol;
EFI_LOADED_IMAGE *li;

status = uefi_call_wrapper( BS->HandleProtocol, 3,
image, &LoadedImageProtocol, (void **) &li);

if( status != EFI_SUCCESS ) return NULL;

loadedImHandle = li->DeviceHandle;

status = uefi_call_wrapper( BS->HandleProtocol, 3,
loadedImHandle, &FileSystemProtocol,
(void **)&vol );

  if(status != EFI_SUCCESS) return NULL;

return vol;
}

EFI_FILE_HANDLE 
get_file_handle(EFI_HANDLE image, UINT64 mode)
{
EFI_STATUS status;
EFI_FILE_IO_INTERFACE * vol;
EFI_FILE_HANDLE root;
EFI_FILE_HANDLE fp;

vol = get_io_interface(image);

if( vol == NULL) return NULL;

status = uefi_call_wrapper( vol->OpenVolume, 2,
vol, &root);

if( status != EFI_SUCCESS ) return NULL;

status = uefi_call_wrapper( root->Open, 5,
root, &fp, ticket_file,
mode, 0 );

Print(L"Open=%d\n", status); // I get status = 2 (INVALID_PARAMETER)

if( status != EFI_SUCCESS ) return NULL;

return fp;
}

// pseudo-code
EFI_STATUS
efi_main(EFI_HANDLE image)
{
    //....

   get_file_handle (image, EFI_FILE_MODE_WRITE);

}

(#define EFI_FILE_MODE_WRITE     0x0000000000000002)

I'm using GNUEFI lib.

Am I missing something or Ovmf does not support file writing?

Regards,
Miguel Rocha

------------------------------------------------------------------------------
_______________________________________________
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