本文整理汇总了C++中SHELL_FREE_NON_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ SHELL_FREE_NON_NULL函数的具体用法?C++ SHELL_FREE_NON_NULL怎么用?C++ SHELL_FREE_NON_NULL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SHELL_FREE_NON_NULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeFileHandleList
/**
Frees list of file handles.
@param[in] List The list to free.
**/
VOID
EFIAPI
FreeFileHandleList (
IN BUFFER_LIST *List
)
{
BUFFER_LIST *BufferListEntry;
if (List == NULL){
return;
}
//
// enumerate through the buffer list and free all memory
//
for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link)
; !IsListEmpty (&List->Link)
; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link)
){
RemoveEntryList(&BufferListEntry->Link);
ASSERT(BufferListEntry->Buffer != NULL);
SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE*)(BufferListEntry->Buffer))->Path);
SHELL_FREE_NON_NULL(BufferListEntry->Buffer);
SHELL_FREE_NON_NULL(BufferListEntry);
}
}
示例2: IsValidDeleteTarget
/**
Determines if a Node is a valid delete target. Will prevent deleting the root directory.
@param[in] List RESERVED. Not used.
@param[in] Node The node to analyze.
@param[in] Package RESERVED. Not used.
**/
BOOLEAN
IsValidDeleteTarget(
IN CONST EFI_SHELL_FILE_INFO *List,
IN CONST EFI_SHELL_FILE_INFO *Node,
IN CONST LIST_ENTRY *Package
)
{
CONST CHAR16 *TempLocation;
BOOLEAN RetVal;
CHAR16 *SearchString;
CHAR16 *Pattern;
UINTN Size;
if (Node == NULL || Node->FullName == NULL) {
return (FALSE);
}
TempLocation = StrStr(Node->FullName, L":");
if (StrLen(TempLocation) <= 2) {
//
// Deleting the root directory is invalid.
//
return (FALSE);
}
TempLocation = ShellGetCurrentDir(NULL);
if (TempLocation == NULL) {
//
// No working directory is specified so whatever is left is ok.
//
return (TRUE);
}
Pattern = NULL;
SearchString = NULL;
Size = 0;
Pattern = StrnCatGrow(&Pattern, &Size, TempLocation , 0);
Pattern = StrnCatGrow(&Pattern, &Size, L"\\" , 0);
Size = 0;
SearchString = StrnCatGrow(&SearchString, &Size, Node->FullName, 0);
if (!EFI_ERROR(ShellIsDirectory(SearchString))) {
SearchString = StrnCatGrow(&SearchString, &Size, L"\\", 0);
SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0);
}
if (Pattern == NULL || SearchString == NULL) {
RetVal = FALSE;
} else {
RetVal = TRUE;
if (gUnicodeCollation->MetaiMatch(gUnicodeCollation, Pattern, SearchString)) {
RetVal = FALSE;
}
}
SHELL_FREE_NON_NULL(Pattern );
SHELL_FREE_NON_NULL(SearchString);
return (RetVal);
}
示例3: HDiskImageCleanup
/**
Cleanup function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HDiskImageCleanup (
VOID
)
{
SHELL_FREE_NON_NULL (HDiskImage.Name);
SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
return EFI_SUCCESS;
}
示例4: CreateSimpleTextOutOnFile
EFIAPI
CreateSimpleTextOutOnFile(
IN SHELL_FILE_HANDLE FileHandleToUse,
IN EFI_HANDLE *HandleLocation,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
)
{
SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
EFI_STATUS Status;
if (HandleLocation == NULL || FileHandleToUse == NULL) {
return (NULL);
}
ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));
if (ProtocolToReturn == NULL) {
return (NULL);
}
ProtocolToReturn->FileHandle = FileHandleToUse;
ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol;
ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset;
ProtocolToReturn->SimpleTextOut.TestString = FileBasedSimpleTextOutTestString;
ProtocolToReturn->SimpleTextOut.QueryMode = FileBasedSimpleTextOutQueryMode;
ProtocolToReturn->SimpleTextOut.SetMode = FileBasedSimpleTextOutSetMode;
ProtocolToReturn->SimpleTextOut.SetAttribute = FileBasedSimpleTextOutSetAttribute;
ProtocolToReturn->SimpleTextOut.ClearScreen = FileBasedSimpleTextOutClearScreen;
ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition;
ProtocolToReturn->SimpleTextOut.EnableCursor = FileBasedSimpleTextOutEnableCursor;
ProtocolToReturn->SimpleTextOut.OutputString = FileBasedSimpleTextOutOutputString;
ProtocolToReturn->SimpleTextOut.Mode = AllocateZeroPool(sizeof(EFI_SIMPLE_TEXT_OUTPUT_MODE));
if (ProtocolToReturn->SimpleTextOut.Mode == NULL) {
FreePool(ProtocolToReturn);
return (NULL);
}
ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode;
ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode;
ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute;
ProtocolToReturn->SimpleTextOut.Mode->CursorColumn = OriginalProtocol->Mode->CursorColumn;
ProtocolToReturn->SimpleTextOut.Mode->CursorRow = OriginalProtocol->Mode->CursorRow;
ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible;
Status = gBS->InstallProtocolInterface(
&(ProtocolToReturn->TheHandle),
&gEfiSimpleTextOutProtocolGuid,
EFI_NATIVE_INTERFACE,
&(ProtocolToReturn->SimpleTextOut));
if (!EFI_ERROR(Status)) {
*HandleLocation = ProtocolToReturn->TheHandle;
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn);
} else {
SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode);
SHELL_FREE_NON_NULL(ProtocolToReturn);
return (NULL);
}
}
示例5: HFileImageCleanup
/**
Cleanup function for HFileImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFileImageCleanup (
VOID
)
{
SHELL_FREE_NON_NULL (HFileImage.FileName);
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
return EFI_SUCCESS;
}
示例6: InputBarCleanup
/**
Cleanup function for input bar.
**/
VOID
InputBarCleanup (
VOID
)
{
//
// free input bar's prompt and input string
//
SHELL_FREE_NON_NULL (mPrompt);
SHELL_FREE_NON_NULL (mReturnString);
mPrompt = NULL;
mReturnString = NULL;
}
示例7: LineFree
/**
Free a EFI_EDITOR_LINE structure.
@param Src The line structure to free.
**/
VOID
LineFree (
IN EFI_EDITOR_LINE *Src
)
{
if (Src == NULL) {
return ;
}
//
// free the line buffer and then the line structure itself
//
SHELL_FREE_NON_NULL (Src->Buffer);
SHELL_FREE_NON_NULL (Src);
}
示例8: HDiskImageSetDiskNameOffsetSize
/**
Set FileName field in HFileImage.
@param[in] Str File name to set.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
EFIAPI
HDiskImageSetDiskNameOffsetSize (
IN CONST CHAR16 *Str,
IN UINTN Offset,
IN UINTN Size
)
{
UINTN Len;
UINTN Index;
//
// free the old file name
//
SHELL_FREE_NON_NULL (HDiskImage.Name);
Len = StrLen (Str);
HDiskImage.Name = AllocateZeroPool (2 * (Len + 1));
if (HDiskImage.Name == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (Index = 0; Index < Len; Index++) {
HDiskImage.Name[Index] = Str[Index];
}
HDiskImage.Name[Len] = L'\0';
HDiskImage.Offset = Offset;
HDiskImage.Size = Size;
return EFI_SUCCESS;
}
示例9: PrintNonSfoHeader
/**
print out the header when not using standard format output.
@param[in] Path String with starting path.
**/
VOID
PrintNonSfoHeader(
IN CONST CHAR16 *Path
)
{
CHAR16 *DirectoryName;
//
// get directory name from path...
//
DirectoryName = GetFullyQualifiedPath(Path);
if (DirectoryName != NULL) {
//
// print header
//
ShellPrintHiiEx (
0,
gST->ConOut->Mode->CursorRow,
NULL,
STRING_TOKEN (STR_LS_HEADER_LINE1),
gShellLevel2HiiHandle,
DirectoryName
);
SHELL_FREE_NON_NULL(DirectoryName);
}
}
示例10: HFileImageSetFileName
/**
Set FileName field in HFileImage
@param[in] Str File name to set.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HFileImageSetFileName (
IN CONST CHAR16 *Str
)
{
UINTN Size;
UINTN Index;
//
// free the old file name
//
SHELL_FREE_NON_NULL (HFileImage.FileName);
Size = StrLen (Str);
HFileImage.FileName = AllocateZeroPool (2 * (Size + 1));
if (HFileImage.FileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (Index = 0; Index < Size; Index++) {
HFileImage.FileName[Index] = Str[Index];
}
HFileImage.FileName[Size] = L'\0';
return EFI_SUCCESS;
}
示例11: MenuBarCleanup
/**
Cleanup function for a menu bar. frees all allocated memory.
**/
VOID
MenuBarCleanup (
VOID
)
{
SHELL_FREE_NON_NULL(MenuItems);
}
示例12: MainTitleBarCleanup
/**
Clean up the memory used.
**/
VOID
MainTitleBarCleanup (
VOID
)
{
SHELL_FREE_NON_NULL (Title);
Title = NULL;
}
示例13: PrintConfigInfoOnAll
/**
Function to print out configuration information on all configurable handles.
@param[in] ChildrenToo TRUE to tewst for children.
@param[in] Language ASCII string for language code.
@param[in] UseHii TRUE to check for Hii and DPC, FALSE for DCP only.
@retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
EFIAPI
PrintConfigInfoOnAll(
IN CONST BOOLEAN ChildrenToo,
IN CONST CHAR8 *Language,
IN CONST BOOLEAN UseHii
)
{
EFI_HANDLE *HandleList;
EFI_HANDLE *CurrentHandle;
BOOLEAN Found;
UINTN Index2;
Found = FALSE;
HandleList = NULL;
CurrentHandle = NULL;
if (UseHii) {
//
// HII method
//
HandleList = GetHandleListByProtocol(&gEfiHiiConfigAccessProtocolGuid);
for (CurrentHandle = HandleList ; CurrentHandle != NULL && *CurrentHandle != NULL; CurrentHandle++){
Found = TRUE;
Index2 = *CurrentHandle == NULL ? 0 : ConvertHandleToHandleIndex(*CurrentHandle);
ShellPrintHiiEx(
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_LINE_HII),
gShellDriver1HiiHandle,
Index2
);
}
SHELL_FREE_NON_NULL(HandleList);
}
if (PreHiiDrvCfg (
Language,
FALSE,
0,
ChildrenToo,
FALSE,
FALSE,
0,
0,
0) == SHELL_SUCCESS) {
Found = TRUE;
}
if (!Found) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle);
return (SHELL_SUCCESS);
}
return (SHELL_SUCCESS);
}
示例14: ProcessValidateAndCopyFiles
/**
Validate and if successful copy all the files from the list into
destination directory.
@param[in] FileList The list of files to copy.
@param[in] DestDir The directory to copy files to.
@param[in] SilentMode TRUE to eliminate screen output.
@param[in] RecursiveMode TRUE to copy directories.
@retval SHELL_INVALID_PARAMETER A parameter was invalid.
@retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
EFIAPI
ProcessValidateAndCopyFiles(
IN EFI_SHELL_FILE_INFO *FileList,
IN CONST CHAR16 *DestDir,
IN BOOLEAN SilentMode,
IN BOOLEAN RecursiveMode
)
{
SHELL_STATUS ShellStatus;
EFI_SHELL_FILE_INFO *List;
EFI_FILE_INFO *FileInfo;
CHAR16 *FullName;
List = NULL;
FullName = NULL;
FileInfo = NULL;
ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List);
if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, DestDir);
ShellStatus = SHELL_INVALID_PARAMETER;
ShellCloseFileMetaArg(&List);
} else if (List != NULL) {
ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL);
ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL);
FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle);
ASSERT(FileInfo != NULL);
StrnCatGrow(&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0);
ShellCloseFileMetaArg(&List);
if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) == 0) {
ShellStatus = ValidateAndCopyFiles(FileList, FullName, SilentMode, RecursiveMode, NULL);
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle);
ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
ShellCloseFileMetaArg(&List);
ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL);
}
SHELL_FREE_NON_NULL(FileInfo);
SHELL_FREE_NON_NULL(FullName);
return (ShellStatus);
}
示例15: StatusBarCleanup
/**
Cleanup function for the status bar.
**/
VOID
StatusBarCleanup (
VOID
)
{
//
// free the status string and backvar's status string
//
SHELL_FREE_NON_NULL (StatusString);
}