31CONST CHAR16 mFileName[] = L
"ShellCommands";
69 if (
PcdGet8 (PcdShellSupportLevel) < 2) {
74 if (gShellLevel2HiiHandle ==
NULL) {
75 return (EFI_DEVICE_ERROR);
110 if ((
PcdGet8 (PcdShellSupportLevel) == 2) || (
PcdGet8 (PcdShellSupportLevel) == 3)) {
143 if (gShellLevel2HiiHandle !=
NULL) {
171 CHAR16 *PathToReturn;
173 CONST CHAR16 *CurDir;
178 ASSERT ((PathToReturn ==
NULL && Size == 0) || (PathToReturn !=
NULL));
183 CurDir = gEfiShellProtocol->GetCurDir (
NULL);
186 if (*Path == L
'\\') {
195 if (PathToReturn ==
NULL) {
199 while (PathToReturn[
StrLen (PathToReturn)-1] == L
'*') {
200 PathToReturn[
StrLen (PathToReturn)-1] = CHAR_NULL;
203 return (PathToReturn);
221 SHELL_FILE_HANDLE FileHandle;
223 ASSERT (Path !=
NULL);
230 if (PathCopy ==
NULL) {
231 return (EFI_OUT_OF_RESOURCES);
234 for (TempSpot = &PathCopy[
StrLen (PathCopy)-1]; *TempSpot != CHAR_NULL && *TempSpot != L
'\\'; TempSpot = &PathCopy[
StrLen (PathCopy)-1]) {
235 *TempSpot = CHAR_NULL;
238 if (*TempSpot == L
'\\') {
239 *TempSpot = CHAR_NULL;
242 if ((PathCopy !=
NULL) && (*PathCopy != CHAR_NULL)) {
245 if (PathCopy[
StrLen (PathCopy)-1] != L
':') {
246 if (!EFI_ERROR (Status)) {
248 if (FileHandle !=
NULL) {
255 SHELL_FREE_NON_NULL (PathCopy);
288 SourceLength =
StrLen (Source);
289 TargetLength =
StrLen (Target);
290 SourceLength =
MIN (SourceLength, Count);
291 TargetLength =
MIN (TargetLength, Count);
292 SourceCopy =
AllocateCopyPool ((SourceLength + 1) *
sizeof (CHAR16), Source);
293 if (SourceCopy ==
NULL) {
297 TargetCopy =
AllocateCopyPool ((TargetLength + 1) *
sizeof (CHAR16), Target);
298 if (TargetCopy ==
NULL) {
303 SourceCopy[SourceLength] = L
'\0';
304 TargetCopy[TargetLength] = L
'\0';
305 Result = gUnicodeCollation->StriColl (gUnicodeCollation, SourceCopy, TargetCopy);
323 IN CONST CHAR16 *OriginalString,
324 OUT CHAR16 **CleanString
329 if ((OriginalString ==
NULL) || (CleanString ==
NULL)) {
330 return EFI_INVALID_PARAMETER;
334 if (*CleanString ==
NULL) {
335 return EFI_OUT_OF_RESOURCES;
338 for (Walker = *CleanString; Walker !=
NULL && *Walker != CHAR_NULL;) {
339 if (*Walker == L
'\"') {
340 CopyMem (Walker, Walker+1,
StrSize (Walker) -
sizeof (Walker[0]));
SHELL_STATUS EFIAPI ShellCommandRunAttrib(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
CHAR16 *EFIAPI PathCleanUpDirectories(IN CHAR16 *Path)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
SHELL_STATUS EFIAPI ShellCommandRunCd(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunCp(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
SHELL_STATUS EFIAPI ShellCommandRunLs(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunMap(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define DEBUG_CODE_BEGIN()
SHELL_STATUS EFIAPI ShellCommandRunMkDir(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunMv(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunParse(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define PcdGet8(TokenName)
SHELL_STATUS EFIAPI ShellCommandRunRm(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunSet(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
RETURN_STATUS EFIAPI ShellCommandRegisterCommandName(IN CONST CHAR16 *CommandString, IN SHELL_RUN_COMMAND CommandHandler, IN SHELL_GET_MAN_FILENAME GetManFileName, IN UINT32 ShellMinSupportLevel, IN CONST CHAR16 *ProfileName, IN CONST BOOLEAN CanAffectLE, IN CONST EFI_HII_HANDLE HiiHandle, IN CONST EFI_STRING_ID ManFormatHelp)
RETURN_STATUS EFIAPI ShellCommandRegisterAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias)
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS EFIAPI ShellCloseFile(IN SHELL_FILE_HANDLE *FileHandle)
SHELL_STATUS EFIAPI ShellCommandRunReset(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunLoad(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunTime(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunTimeZone(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunDate(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
CHAR16 * GetFullyQualifiedPath(IN CONST CHAR16 *Path)
CONST CHAR16 *EFIAPI ShellCommandGetManFileNameLevel2(VOID)
INTN StrniCmp(IN CONST CHAR16 *Source, IN CONST CHAR16 *Target, IN CONST UINTN Count)
EFI_STATUS VerifyIntermediateDirectories(IN CONST CHAR16 *Path)
EFI_STATUS ShellLevel2StripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString)
EFI_STATUS EFIAPI ShellLevel2CommandsLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI ShellLevel2CommandsLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunVol(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)