EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Functions

ShellPkg/Application/Shell/ShellParametersProtocol.c File Reference

#include "ShellParametersProtocol.h"
#include "ConsoleWrappers.h"

Go to the source code of this file.

Functions

VOID EFIAPI GetNextParameter (CHAR16 **Walker, CHAR16 **TempParameter)
EFI_STATUS EFIAPI ParseCommandLineToArgs (IN CONST CHAR16 *CommandLine, IN OUT CHAR16 ***Argv, IN OUT UINTN *Argc)
EFI_STATUS EFIAPI CreatePopulateInstallShellParametersProtocol (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL **NewShellParameters, IN OUT BOOLEAN *RootShellInstance)
EFI_STATUS EFIAPI CleanUpShellParametersProtocol (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParameters)
EFI_STATUS EFIAPI IsUnicodeFile (IN CONST CHAR16 *FileName)
VOID EFIAPI StripQuotes (IN OUT CHAR16 *TheString)
VOID CalculateEfiHdrCrc (IN OUT EFI_TABLE_HEADER *Hdr)
CHAR16 *EFIAPI FixFileName (IN CHAR16 *FileName)
EFI_STATUS EFIAPI UpdateStdInStdOutStdErr (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 *NewCommandLine, OUT SHELL_FILE_HANDLE *OldStdIn, OUT SHELL_FILE_HANDLE *OldStdOut, OUT SHELL_FILE_HANDLE *OldStdErr, OUT SYSTEM_TABLE_INFO *SystemTableInfo)
EFI_STATUS EFIAPI RestoreStdInStdOutStdErr (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN SHELL_FILE_HANDLE *OldStdIn, IN SHELL_FILE_HANDLE *OldStdOut, IN SHELL_FILE_HANDLE *OldStdErr, IN SYSTEM_TABLE_INFO *SystemTableInfo)
EFI_STATUS EFIAPI UpdateArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, OUT CHAR16 ***OldArgv OPTIONAL, OUT UINTN *OldArgc OPTIONAL)
VOID EFIAPI RestoreArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 ***OldArgv, IN UINTN *OldArgc)

Detailed Description

Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.

Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file ShellParametersProtocol.c.


Function Documentation

VOID CalculateEfiHdrCrc ( IN OUT EFI_TABLE_HEADER Hdr)

Calcualte the 32-bit CRC in a EFI table using the service provided by the gRuntime service.

Parameters:
HdrPointer to an EFI standard header

Definition at line 481 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI CleanUpShellParametersProtocol ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL NewShellParameters)

frees all memory used by createion and installation of shell parameters protocol and if there was an old version installed it will restore that one.

Parameters:
NewShellParametersthe interface of EFI_SHELL_PARAMETERS_PROTOCOL that is being cleaned up.
Return values:
EFI_SUCCESSthe cleanup was successful
Returns:
other the cleanup failed
See also:
ReinstallProtocolInterface
UninstallProtocolInterface

Definition at line 374 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI CreatePopulateInstallShellParametersProtocol ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL **  NewShellParameters,
IN OUT BOOLEAN RootShellInstance 
)

creates a new EFI_SHELL_PARAMETERS_PROTOCOL instance and populates it and then installs it on our handle and if there is an existing version of the protocol that one is cached for removal later.

Parameters:
[in,out]NewShellParameterson a successful return, a pointer to pointer to the newly installed interface.
[in,out]RootShellInstanceon a successful return, pointer to boolean. TRUE if this is the root shell instance.
Return values:
EFI_SUCCESSthe operation completed successfully.
Returns:
other the operation failed.
See also:
ReinstallProtocolInterface
InstallProtocolInterface
ParseCommandLineToArgs

Definition at line 231 of file ShellParametersProtocol.c.

CHAR16* EFIAPI FixFileName ( IN CHAR16 FileName)

Fix a string to only have the file name, removing starting at the first space of whatever is quoted.

Parameters:
[in]FileNameThe filename to start with.
Return values:
NULLFileName was invalid.
Returns:
The modified FileName.

Definition at line 508 of file ShellParametersProtocol.c.

VOID EFIAPI GetNextParameter ( CHAR16 **  Walker,
CHAR16 **  TempParameter 
)

return the next parameter from a command line string;

This function moves the next parameter from Walker into TempParameter and moves Walker up past that parameter for recursive calling. When the final parameter is moved *Walker will be set to NULL;

Temp Parameter must be large enough to hold the parameter before calling this function.

Parameters:
[in,out]Walkerpointer to string of command line. Adjusted to reminaing command line on return
[in,out]TempParameterpointer to string of command line item extracted.

Definition at line 36 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI IsUnicodeFile ( IN CONST CHAR16 FileName)

Determin if a file name represents a unicode file.

Parameters:
[in]FileNamePointer to the filename to open.
Return values:
EFI_SUCCESSThe file is a unicode file.
Returns:
An error upon failure.

Definition at line 421 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI ParseCommandLineToArgs ( IN CONST CHAR16 CommandLine,
IN OUT CHAR16 ***  Argv,
IN OUT UINTN Argc 
)

Function to populate Argc and Argv.

This function parses the CommandLine and divides it into standard C style Argc/Argv parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space delimited and quote surrounded parameter definition.

Parameters:
[in]CommandLineString of command line to parse
[in,out]Argvpointer to array of strings; one for each parameter
[in,out]Argcpointer to number of strings in Argv array
Returns:
EFI_SUCCESS the operation was sucessful
EFI_OUT_OF_RESOURCES a memory allocation failed.

Definition at line 149 of file ShellParametersProtocol.c.

VOID EFIAPI RestoreArgcArgv ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL ShellParameters,
IN CHAR16 ***  OldArgv,
IN UINTN OldArgc 
)

Funcion will replace the current Argc and Argv in the ShellParameters protocol structure with Argv and Argc. The current values are de-allocated and the OldArgv must not be deallocated by the caller.

Parameters:
[in,out]ShellParameterspointer to parameter structure to modify
[in]OldArgvpointer to old list of parameters
[in]OldArgcpointer to old number of items in Argv list

Definition at line 1257 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI RestoreStdInStdOutStdErr ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL ShellParameters,
IN SHELL_FILE_HANDLE OldStdIn,
IN SHELL_FILE_HANDLE OldStdOut,
IN SHELL_FILE_HANDLE OldStdErr,
IN SYSTEM_TABLE_INFO SystemTableInfo 
)

Funcion will replace the current StdIn and StdOut in the ShellParameters protocol structure with StdIn and StdOut. The current values are de-allocated.

Parameters:
[in,out]ShellParametersPointer to parameter structure to modify.
[in]OldStdInPointer to old StdIn.
[in]OldStdOutPointer to old StdOut.
[in]OldStdErrPointer to old StdErr.
[in]SystemTableInfoPointer to old system table information.

Definition at line 1151 of file ShellParametersProtocol.c.

VOID EFIAPI StripQuotes ( IN OUT CHAR16 TheString)

Strips out quotes sections of a string.

All of the characters between quotes is replaced with spaces.

Parameters:
[in,out]TheStringA pointer to the string to update.

Definition at line 456 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI UpdateArgcArgv ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL ShellParameters,
IN CONST CHAR16 NewCommandLine,
OUT CHAR16 ***OldArgv  OPTIONAL,
OUT UINTN *OldArgc  OPTIONAL 
)

Funcion will replace the current Argc and Argv in the ShellParameters protocol structure by parsing NewCommandLine. The current values are returned to the user.

If OldArgv or OldArgc is NULL then that value is not returned.

Parameters:
[in,out]ShellParametersPointer to parameter structure to modify.
[in]NewCommandLineThe new command line to parse and use.
[out]OldArgvPointer to old list of parameters.
[out]OldArgcPointer to old number of items in Argv list.
Return values:
EFI_SUCCESSOperation was sucessful, Argv and Argc are valid.
EFI_OUT_OF_RESOURCESA memory allocation failed.

Definition at line 1227 of file ShellParametersProtocol.c.

EFI_STATUS EFIAPI UpdateStdInStdOutStdErr ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL ShellParameters,
IN CHAR16 NewCommandLine,
OUT SHELL_FILE_HANDLE OldStdIn,
OUT SHELL_FILE_HANDLE OldStdOut,
OUT SHELL_FILE_HANDLE OldStdErr,
OUT SYSTEM_TABLE_INFO SystemTableInfo 
)

Funcion will replace the current StdIn and StdOut in the ShellParameters protocol structure by parsing NewCommandLine. The current values are returned to the user.

This will also update the system table.

Parameters:
[in,out]ShellParametersPointer to parameter structure to modify.
[in]NewCommandLineThe new command line to parse and use.
[out]OldStdInPointer to old StdIn.
[out]OldStdOutPointer to old StdOut.
[out]OldStdErrPointer to old StdErr.
[out]SystemTableInfoPointer to old system table information.
Return values:
EFI_SUCCESSOperation was sucessful, Argv and Argc are valid.
EFI_OUT_OF_RESOURCESA memory allocation failed.

Definition at line 557 of file ShellParametersProtocol.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines