[if gte mso 9]>
Subject: Re: [edk2] Problems creating file using ShellOpenFileByName
From: "Carsey, Jaben" <firstname.lastname@example.org>
To: "email@example.com" <firstname.lastname@example.org>
Date: 2012-03-31 05:55:58
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.
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
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.
Technology Solutions Enabling