[if gte mso 9]>

Re: [edk2] Problems creating file using ShellOpenFileByName

Subject: Re: [edk2] Problems creating file using ShellOpenFileByName

From: "Carsey, Jaben" <jaben.carsey@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2012-03-31 05:55:58

Stephen,

 

Have you tried opening with both read and write?  I’ve found that many file systems will fail if you open for write without read.

 

-Jaben

 

From: Bekefi, Stephen C [mailto:stephen.c.bekefi@intel.com]
Sent: Friday, March 30, 2012 2:53 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] Problems creating file using ShellOpenFileByName

 

I was wondering if someone could help me diagnose a problem. When I use this function to open a file to read, it works. When I try to open a file to write or create I always get EFI_INVALID_PARAMETER. The only thing I’ve changed is the file mode. I’ve used my itp to dive as far uefi assembly to find the problem and I’m not having any luck.

 

Basically the call below on line 517 of UefiShellLib.c always fails with mode EFI_FILE_MODE_WRITE

Status = LastHandle->Open (LastHandle,  FileHandle, ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, OpenMode &~EFI_FILE_MODE_CREATE, 0 );

 

And the call below on line 529 of UefiShellLib.c always fail with mode EFI_FILE_MODE_CREATE

Status = LastHandle->Open (LastHandle,  FileHandle, ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName,  OpenMode, Attributes );

 

I’ve attached my code snippet.

 

#define MAX_FILE_LENGTH 522

EFI_STATUS                         Status;

EFI_FILE_HANDLE            FileHandle;

CHAR16                                fname[MAX_FILE_LENGTH];

UINT64                                 Attributes = 0;

 

StrnCpy(fname, L"fs0:\\test.txt", MAX_FILE_LENGTH);

Status = ShellOpenFileByName(fname, &FileHandle, EFI_FILE_MODE_CREATE, Attributes);

 

Status is EFI_INVALID_PARAMETER

 

I’m using UDK2010.UP4 because I need it for compatibility with customer systems, shell version 2.0 [4.632], Current running mode 1.1.2

 

Any ideas would be greatly appreciated.

 

Thanks,

Stephen Bekefi

Technology Solutions Enabling

Intel Corporation