/* Remove a SHELL_FILE_HANDLE from the list of SHELL_FILE_HANDLES. */
BOOLEAN EFIAPI ShellFileHandleRemove(IN CONST SHELL_FILE_HANDLE Handle)
/* Remove a SHELL_FILE_HANDLE from the list of SHELL_FILE_HANDLES. */
BOOLEAN EFIAPI ShellFileHandleRemove(IN CONST SHELL_FILE_HANDLE Handle)
{
  BUFFER_LIST  *Node;
  for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
       ; !IsNull (&mFileHandleList.Link, &Node->Link)
       ; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
       )
  {
    if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
      RemoveEntryList (&Node->Link);
      SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
      SHELL_FREE_NON_NULL (Node->Buffer);
      SHELL_FREE_NON_NULL (Node);
      return (TRUE);
    }
  }
  return (FALSE);
}