summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell/FileHandleWrappers.h
blob: af133b09637e73b4f0596976cd0803a0b77ee630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/** @file
  EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables, StdIn, StdOut, StdErr, etc...)

  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
  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.

**/

#ifndef _SHELL_FILE_HANDLE_WRAPPERS_HEADER_
#define _SHELL_FILE_HANDLE_WRAPPERS_HEADER_

typedef struct {
  LIST_ENTRY        Link;
  CHAR16*           Buffer;
} SHELL_LINE_LIST;

typedef struct {
  UINTN             LogCount;
  SHELL_LINE_LIST   *Log;
} SHELL_LINE_LOG;

///
/// FILE sytle interfaces for StdIn.
///
extern EFI_FILE_PROTOCOL FileInterfaceStdIn;

///
/// FILE sytle interfaces for StdOut.
///
extern EFI_FILE_PROTOCOL FileInterfaceStdOut;

///
/// FILE sytle interfaces for StdErr.
///
extern EFI_FILE_PROTOCOL FileInterfaceStdErr;

///
/// FILE style interface for NUL file.
///
extern EFI_FILE_PROTOCOL FileInterfaceNulFile;

/**
  Creates a EFI_FILE_PROTOCOL (almost) object for using to access
  environment variables through file operations.

  @param EnvName    The name of the Environment Variable to be operated on.

  @retval NULL      Memory could not be allocated.
  @return other     a pointer to an EFI_FILE_PROTOCOL structure
**/
EFI_FILE_PROTOCOL*
EFIAPI
CreateFileInterfaceEnv(
  CONST CHAR16 *EnvName
  );

/**
  Creates a EFI_FILE_PROTOCOL (almost) object for using to access
  a file entirely in memory through file operations.

  @param[in] Unicode  TRUE if the data is UNICODE, FALSE otherwise.

  @retval NULL      Memory could not be allocated.
  @return other     a pointer to an EFI_FILE_PROTOCOL structure
**/
EFI_FILE_PROTOCOL*
EFIAPI
CreateFileInterfaceMem(
  IN CONST BOOLEAN Unicode
  );

/**
  Creates a EFI_FILE_PROTOCOL (almost) object for using to access
  a file entirely with unicode awareness through file operations.

  @param[in] Template The pointer to the handle to start with.
  @param[in] Unicode  TRUE if the data is UNICODE, FALSE otherwise.

  @retval NULL      Memory could not be allocated.
  @return other     a pointer to an EFI_FILE_PROTOCOL structure
**/
EFI_FILE_PROTOCOL*
CreateFileInterfaceFile(
  IN CONST EFI_FILE_PROTOCOL  *Template,
  IN CONST BOOLEAN            Unicode
  );

#endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_