mirror of https://github.com/acidanthera/audk.git
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8633 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8bb37919e3
commit
9b3bf083f7
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
This should be executed with "/Param2 Val1" and "/Param1" as the 2 command line options!
|
This should be executed with "/Param2 Val1" and "/Param1" as the 2 command line options!
|
||||||
|
|
||||||
Copyright (c) 2008, Intel Corporation
|
Copyright (c) 2008-2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -211,7 +211,7 @@ UefiMain (
|
||||||
ASSERT(NoFile == FALSE);
|
ASSERT(NoFile == FALSE);
|
||||||
Status = ShellFindNextFile(FileHandle, pFileInfo, &NoFile);
|
Status = ShellFindNextFile(FileHandle, pFileInfo, &NoFile);
|
||||||
ASSERT_EFI_ERROR(Status);
|
ASSERT_EFI_ERROR(Status);
|
||||||
/// @todo - why is NoFile never set? limitation of NT32 file system?
|
///@todo - why is NoFile never set? limitation of NT32 file system?
|
||||||
Status = ShellDeleteFile(&FileHandle);
|
Status = ShellDeleteFile(&FileHandle);
|
||||||
ASSERT(Status == RETURN_WARN_DELETE_FAILURE);
|
ASSERT(Status == RETURN_WARN_DELETE_FAILURE);
|
||||||
Print(L"FindFirst - pass\r\n");
|
Print(L"FindFirst - pass\r\n");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Provides interface to EFI_FILE_HANDLE functionality.
|
Provides interface to EFI_FILE_HANDLE functionality.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
|
|
@ -455,7 +455,7 @@ ShellGetExecutionBreakFlag(
|
||||||
CONST CHAR16*
|
CONST CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellGetEnvironmentVariable (
|
ShellGetEnvironmentVariable (
|
||||||
IN CHAR16 *EnvKey
|
IN CONST CHAR16 *EnvKey
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -566,7 +566,7 @@ ShellSetPageBreakMode (
|
||||||
and will process '?' and '*' as such. the list must be freed with a call to
|
and will process '?' and '*' as such. the list must be freed with a call to
|
||||||
ShellCloseFileMetaArg().
|
ShellCloseFileMetaArg().
|
||||||
|
|
||||||
This function will fail if called sequentially without freeing the list in the middle.
|
If you are NOT appending to an existing list *ListHead must be NULL.
|
||||||
|
|
||||||
@param Arg pointer to path string
|
@param Arg pointer to path string
|
||||||
@param OpenMode mode to open files with
|
@param OpenMode mode to open files with
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/** @file
|
/** @file
|
||||||
Defines for EFI shell environment 2 ported to EDK II build environment.
|
Defines for EFI shell environment 2 ported to EDK II build environment. (no spec)
|
||||||
|
|
||||||
Copyright (c) 2005, 2009 Intel Corporation
|
Copyright (c) 2005, 2009 Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
|
|
|
@ -258,8 +258,7 @@ EFIAPI
|
||||||
ShellLibDestructor (
|
ShellLibDestructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
){
|
||||||
{
|
|
||||||
if (mEfiShellEnvironment2 != NULL) {
|
if (mEfiShellEnvironment2 != NULL) {
|
||||||
gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle,
|
gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle,
|
||||||
&gEfiShellEnvironment2Guid,
|
&gEfiShellEnvironment2Guid,
|
||||||
|
@ -984,7 +983,7 @@ ShellGetExecutionBreakFlag(
|
||||||
CONST CHAR16*
|
CONST CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellGetEnvironmentVariable (
|
ShellGetEnvironmentVariable (
|
||||||
IN CHAR16 *EnvKey
|
IN CONST CHAR16 *EnvKey
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -1002,7 +1001,7 @@ ShellGetEnvironmentVariable (
|
||||||
//
|
//
|
||||||
// using EFI Shell
|
// using EFI Shell
|
||||||
//
|
//
|
||||||
return (mEfiShellEnvironment2->GetEnv(EnvKey));
|
return (mEfiShellEnvironment2->GetEnv((CHAR16*)EnvKey));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
set the value of an environment variable
|
set the value of an environment variable
|
||||||
|
@ -1220,32 +1219,26 @@ typedef struct {
|
||||||
EFI_SHELL_FILE_INFO based list. it is up to the caller to free the memory via
|
EFI_SHELL_FILE_INFO based list. it is up to the caller to free the memory via
|
||||||
the ShellCloseFileMetaArg function.
|
the ShellCloseFileMetaArg function.
|
||||||
|
|
||||||
@param FileList the EFI shell list type
|
@param[in] FileList the EFI shell list type
|
||||||
|
@param[in][out] ListHead the list to add to
|
||||||
|
|
||||||
@retval the resultant head of the double linked new format list;
|
@retval the resultant head of the double linked new format list;
|
||||||
**/
|
**/
|
||||||
LIST_ENTRY*
|
LIST_ENTRY*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalShellConvertFileListType (
|
InternalShellConvertFileListType (
|
||||||
LIST_ENTRY *FileList
|
IN LIST_ENTRY *FileList,
|
||||||
)
|
IN OUT LIST_ENTRY *ListHead
|
||||||
{
|
){
|
||||||
LIST_ENTRY *ListHead;
|
|
||||||
SHELL_FILE_ARG *OldInfo;
|
SHELL_FILE_ARG *OldInfo;
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
EFI_SHELL_FILE_INFO_NO_CONST *NewInfo;
|
EFI_SHELL_FILE_INFO_NO_CONST *NewInfo;
|
||||||
|
|
||||||
//
|
//
|
||||||
// ASSERT that FileList is not NULL
|
// ASSERTs
|
||||||
//
|
//
|
||||||
ASSERT(FileList != NULL);
|
ASSERT(FileList != NULL);
|
||||||
|
ASSERT(ListHead != NULL);
|
||||||
//
|
|
||||||
// Allocate our list head and initialize the list
|
|
||||||
//
|
|
||||||
ListHead = AllocateZeroPool(sizeof(LIST_ENTRY));
|
|
||||||
ASSERT (ListHead != NULL);
|
|
||||||
ListHead = InitializeListHead (ListHead);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// enumerate through each member of the old list and copy
|
// enumerate through each member of the old list and copy
|
||||||
|
@ -1299,7 +1292,7 @@ InternalShellConvertFileListType (
|
||||||
//
|
//
|
||||||
// add that to the list
|
// add that to the list
|
||||||
//
|
//
|
||||||
InsertTailList(ListHead, (LIST_ENTRY*)NewInfo);
|
InsertTailList(ListHead, &NewInfo->Link);
|
||||||
}
|
}
|
||||||
return (ListHead);
|
return (ListHead);
|
||||||
}
|
}
|
||||||
|
@ -1313,7 +1306,7 @@ InternalShellConvertFileListType (
|
||||||
and will process '?' and '*' as such. the list must be freed with a call to
|
and will process '?' and '*' as such. the list must be freed with a call to
|
||||||
ShellCloseFileMetaArg().
|
ShellCloseFileMetaArg().
|
||||||
|
|
||||||
This function will fail if called sequentially without freeing the list in the middle.
|
If you are NOT appending to an existing list *ListHead must be NULL.
|
||||||
|
|
||||||
@param Arg pointer to path string
|
@param Arg pointer to path string
|
||||||
@param OpenMode mode to open files with
|
@param OpenMode mode to open files with
|
||||||
|
@ -1336,8 +1329,7 @@ ShellOpenFileMetaArg (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
LIST_ENTRY *EmptyNode;
|
LIST_ENTRY mOldStyleFileList;
|
||||||
LIST_ENTRY *mOldStyleFileList;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ASSERT that Arg and ListHead are not NULL
|
// ASSERT that Arg and ListHead are not NULL
|
||||||
|
@ -1359,43 +1351,36 @@ ShellOpenFileMetaArg (
|
||||||
//
|
//
|
||||||
ASSERT(mEfiShellEnvironment2 != NULL);
|
ASSERT(mEfiShellEnvironment2 != NULL);
|
||||||
|
|
||||||
//
|
|
||||||
// allocate memory for old list head
|
|
||||||
//
|
|
||||||
mOldStyleFileList = (LIST_ENTRY*)AllocatePool(sizeof(LIST_ENTRY));
|
|
||||||
ASSERT(mOldStyleFileList != NULL);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// make sure the list head is initialized
|
// make sure the list head is initialized
|
||||||
//
|
//
|
||||||
InitializeListHead((LIST_ENTRY*)mOldStyleFileList);
|
InitializeListHead(&mOldStyleFileList);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the EFI Shell list of files
|
// Get the EFI Shell list of files
|
||||||
//
|
//
|
||||||
Status = mEfiShellEnvironment2->FileMetaArg(Arg, mOldStyleFileList);
|
Status = mEfiShellEnvironment2->FileMetaArg(Arg, &mOldStyleFileList);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
*ListHead = NULL;
|
*ListHead = NULL;
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*ListHead == NULL) {
|
||||||
|
*ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
|
||||||
|
if (*ListHead == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert that to equivalent of UEFI Shell 2.0 structure
|
// Convert that to equivalent of UEFI Shell 2.0 structure
|
||||||
//
|
//
|
||||||
EmptyNode = InternalShellConvertFileListType(mOldStyleFileList);
|
InternalShellConvertFileListType(&mOldStyleFileList, &(*ListHead)->Link);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free the EFI Shell version that was converted.
|
// Free the EFI Shell version that was converted.
|
||||||
//
|
//
|
||||||
ASSERT_EFI_ERROR(mEfiShellEnvironment2->FreeFileList(mOldStyleFileList));
|
mEfiShellEnvironment2->FreeFileList(&mOldStyleFileList);
|
||||||
FreePool(mOldStyleFileList);
|
|
||||||
mOldStyleFileList = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
// remove the empty head of the list
|
|
||||||
//
|
|
||||||
*ListHead = (EFI_SHELL_FILE_INFO*)RemoveEntryList(EmptyNode);
|
|
||||||
FreePool(EmptyNode);
|
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
@ -1431,7 +1416,9 @@ ShellCloseFileMetaArg (
|
||||||
// Since this is EFI Shell version we need to free our internally made copy
|
// Since this is EFI Shell version we need to free our internally made copy
|
||||||
// of the list
|
// of the list
|
||||||
//
|
//
|
||||||
for (Node = GetFirstNode((LIST_ENTRY*)*ListHead) ; IsListEmpty((LIST_ENTRY*)*ListHead) == FALSE ; Node = GetFirstNode((LIST_ENTRY*)*ListHead)) {
|
for ( Node = GetFirstNode(&(*ListHead)->Link)
|
||||||
|
; IsListEmpty(&(*ListHead)->Link) == FALSE
|
||||||
|
; Node = GetFirstNode(&(*ListHead)->Link)) {
|
||||||
RemoveEntryList(Node);
|
RemoveEntryList(Node);
|
||||||
((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle->Close(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle);
|
((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle->Close(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle);
|
||||||
FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FullName);
|
FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FullName);
|
||||||
|
@ -1444,7 +1431,7 @@ ShellCloseFileMetaArg (
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LIST_ENTRY List;
|
LIST_ENTRY Link;
|
||||||
CHAR16 *Name;
|
CHAR16 *Name;
|
||||||
ParamType Type;
|
ParamType Type;
|
||||||
CHAR16 *Value;
|
CHAR16 *Value;
|
||||||
|
@ -1636,7 +1623,7 @@ InternalCommandLineParse (
|
||||||
//
|
//
|
||||||
// this item has no value expected; we are done
|
// this item has no value expected; we are done
|
||||||
//
|
//
|
||||||
InsertHeadList(*CheckPackage, (LIST_ENTRY*)CurrentItemPackage);
|
InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
|
||||||
}
|
}
|
||||||
} else if (GetItemValue == TRUE && InternalIsFlag(Argv[LoopCounter]) == FALSE) {
|
} else if (GetItemValue == TRUE && InternalIsFlag(Argv[LoopCounter]) == FALSE) {
|
||||||
ASSERT(CurrentItemPackage != NULL);
|
ASSERT(CurrentItemPackage != NULL);
|
||||||
|
@ -1647,7 +1634,7 @@ InternalCommandLineParse (
|
||||||
CurrentItemPackage->Value = AllocateZeroPool(StrSize(Argv[LoopCounter]));
|
CurrentItemPackage->Value = AllocateZeroPool(StrSize(Argv[LoopCounter]));
|
||||||
ASSERT(CurrentItemPackage->Value != NULL);
|
ASSERT(CurrentItemPackage->Value != NULL);
|
||||||
StrCpy(CurrentItemPackage->Value, Argv[LoopCounter]);
|
StrCpy(CurrentItemPackage->Value, Argv[LoopCounter]);
|
||||||
InsertHeadList(*CheckPackage, (LIST_ENTRY*)CurrentItemPackage);
|
InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
|
||||||
} else if (InternalIsFlag(Argv[LoopCounter]) == FALSE) {
|
} else if (InternalIsFlag(Argv[LoopCounter]) == FALSE) {
|
||||||
//
|
//
|
||||||
// add this one as a non-flag
|
// add this one as a non-flag
|
||||||
|
@ -1660,7 +1647,7 @@ InternalCommandLineParse (
|
||||||
ASSERT(CurrentItemPackage->Value != NULL);
|
ASSERT(CurrentItemPackage->Value != NULL);
|
||||||
StrCpy(CurrentItemPackage->Value, Argv[LoopCounter]);
|
StrCpy(CurrentItemPackage->Value, Argv[LoopCounter]);
|
||||||
CurrentItemPackage->OriginalPosition = Count++;
|
CurrentItemPackage->OriginalPosition = Count++;
|
||||||
InsertHeadList(*CheckPackage, (LIST_ENTRY*)CurrentItemPackage);
|
InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
|
||||||
} else if (ProblemParam) {
|
} else if (ProblemParam) {
|
||||||
//
|
//
|
||||||
// this was a non-recognised flag... error!
|
// this was a non-recognised flag... error!
|
||||||
|
|
Loading…
Reference in New Issue