]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Include/Library/ShellCommandLib.h
ShellPkg/ShellCommandLib.h: Formalize EOL
[mirror_edk2.git] / ShellPkg / Include / Library / ShellCommandLib.h
CommitLineData
a405b86d 1/** @file\r
2 Provides interface to shell internal functions for shell commands.\r
3\r
4 This library is for use ONLY by shell commands linked into the shell application.\r
5 This library will not funciton if it is used for UEFI Shell 2.0 Applications.\r
6\r
b464d7ed
RN
7 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
8 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
9 (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>\r
a405b86d 10 This program and the accompanying materials\r
11 are licensed and made available under the terms and conditions of the BSD License\r
12 which accompanies this distribution. The full text of the license may be found at\r
13 http://opensource.org/licenses/bsd-license.php.\r
14\r
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
18**/\r
19\r
20#ifndef _SHELL_COMMAND_LIB_\r
21#define _SHELL_COMMAND_LIB_\r
22\r
23#include <Uefi.h>\r
24#include <ShellBase.h>\r
25\r
26#include <Protocol/EfiShell.h>\r
27#include <Protocol/EfiShellParameters.h>\r
28#include <Protocol/UnicodeCollation.h>\r
a405b86d 29#include <Protocol/SimpleFileSystem.h>\r
30\r
31#include <Library/UefiBootServicesTableLib.h>\r
32\r
33//\r
34// The extern global protocol poionters.\r
35//\r
a405b86d 36extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;\r
a405b86d 37extern CONST CHAR16* SupportLevel[];\r
38\r
39//\r
40// The map list objects.\r
41//\r
42typedef struct {\r
43 LIST_ENTRY Link;\r
44 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
45 CHAR16 *MapName;\r
46 CHAR16 *CurrentDirectoryPath;\r
47 UINT64 Flags;\r
48} SHELL_MAP_LIST;\r
49/// List of Mappings - DeviceName and Drive Letter(ism).\r
50extern SHELL_MAP_LIST gShellMapList;\r
51/// Pointer to node of current directory in the mMapList.\r
52extern SHELL_MAP_LIST *gShellCurDir;\r
53\r
54/**\r
55 Returns the help MAN fileName for a given shell command.\r
56\r
57 @retval !NULL The unicode string of the MAN filename.\r
58 @retval NULL An error ocurred.\r
59\r
60**/\r
61typedef\r
62CONST CHAR16 *\r
63(EFIAPI *SHELL_GET_MAN_FILENAME)(\r
64 VOID\r
65 );\r
66\r
67/**\r
68 Runs a shell command on a given command line.\r
69\r
70 The specific operation of a given shell command is specified in the UEFI Shell\r
71 Specification 2.0, or in the source of the given command.\r
72\r
73 Upon completion of the command run the shell protocol and environment variables\r
74 may have been updated due to the operation.\r
75\r
76 @param[in] ImageHandle The ImageHandle to the app, or NULL if\r
77 the command built into shell.\r
78 @param[in] SystemTable The pointer to the system table.\r
79\r
80 @retval RETURN_SUCCESS The shell command was sucessful.\r
81 @retval RETURN_UNSUPPORTED The command is not supported.\r
82**/\r
83typedef\r
84SHELL_STATUS\r
85(EFIAPI *SHELL_RUN_COMMAND)(\r
86 IN EFI_HANDLE ImageHandle,\r
87 IN EFI_SYSTEM_TABLE *SystemTable\r
88 );\r
89\r
90/**\r
91 Registers the handlers of type SHELL_RUN_COMMAND and\r
92 SHELL_GET_MAN_FILENAME for each shell command.\r
93\r
94 If the ShellSupportLevel is greater than the value of\r
95 PcdShellSupportLevel, then return RETURN_UNSUPPORTED.\r
96\r
97 Registers the the handlers specified by GetHelpInfoHandler and CommandHandler\r
98 with the command specified by CommandString. If the command named by\r
99 CommandString has already been registered, then return\r
100 RETURN_ALREADY_STARTED.\r
101\r
102 If there are not enough resources available to register the handlers, then\r
103 RETURN_OUT_OF_RESOURCES is returned.\r
104\r
105 If CommandString is NULL, then ASSERT().\r
106 If GetHelpInfoHandler is NULL, then ASSERT().\r
107 If CommandHandler is NULL, then ASSERT().\r
108 If ProfileName is NULL, then ASSERT().\r
109\r
110 @param[in] CommandString The pointer to the command name. This is the\r
111 name to look for on the command line in\r
112 the shell.\r
113 @param[in] CommandHandler The pointer to a function that runs the\r
114 specified command.\r
115 @param[in] GetManFileName The pointer to a function that provides man\r
116 filename.\r
117 @param[in] ShellMinSupportLevel The minimum Shell Support Level which has this\r
118 function.\r
119 @param[in] ProfileName The profile name to require for support of this\r
120 function.\r
121 @param[in] CanAffectLE Indicates whether this command's return value\r
122 can change the LASTERROR environment variable.\r
123 @param[in] HiiHandle The handle of this command's HII entry.\r
124 @param[in] ManFormatHelp The HII locator for the help text.\r
125\r
126 @retval RETURN_SUCCESS The handlers were registered.\r
127 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to\r
128 register the shell command.\r
129 @retval RETURN_UNSUPPORTED The ShellMinSupportLevel was higher than the\r
130 currently allowed support level.\r
131 @retval RETURN_ALREADY_STARTED The CommandString represents a command that\r
132 is already registered. Only one handler set for\r
133 a given command is allowed.\r
134 @sa SHELL_GET_MAN_FILENAME\r
135 @sa SHELL_RUN_COMMAND\r
136**/\r
137RETURN_STATUS\r
138EFIAPI\r
139ShellCommandRegisterCommandName (\r
140 IN CONST CHAR16 *CommandString,\r
141 IN SHELL_RUN_COMMAND CommandHandler,\r
142 IN SHELL_GET_MAN_FILENAME GetManFileName,\r
143 IN UINT32 ShellMinSupportLevel,\r
144 IN CONST CHAR16 *ProfileName,\r
145 IN CONST BOOLEAN CanAffectLE,\r
146 IN CONST EFI_HANDLE HiiHandle,\r
147 IN CONST EFI_STRING_ID ManFormatHelp\r
148 );\r
149\r
150/**\r
151 Checks if a command string has been registered for CommandString, and if so, it runs\r
152 the previously registered handler for that command with the command line.\r
153\r
154 If CommandString is NULL, then ASSERT().\r
155\r
156 If Sections is specified, then each section name listed will be compared in a case sensitive\r
157 manner to the section names described in Appendix B UEFI Shell 2.0 Specification. If the section exists,\r
158 it is appended to the returned help text. If the section does not exist, no\r
159 information is returned. If Sections is NULL, then all help text information\r
160 available is returned.\r
161\r
4ff7e37b
ED
162 @param[in] CommandString The pointer to the command name. This is the name\r
163 found on the command line in the shell.\r
164 @param[in, out] RetVal The pointer to the return value from the command handler.\r
a405b86d 165\r
4ff7e37b
ED
166 @param[in, out] CanAffectLE Indicates whether this command's return value\r
167 needs to be placed into LASTERROR environment variable.\r
a405b86d 168\r
169 @retval RETURN_SUCCESS The handler was run.\r
170 @retval RETURN_NOT_FOUND The CommandString did not match a registered\r
171 command name.\r
172 @sa SHELL_RUN_COMMAND\r
173**/\r
174RETURN_STATUS\r
175EFIAPI\r
176ShellCommandRunCommandHandler (\r
177 IN CONST CHAR16 *CommandString,\r
178 IN OUT SHELL_STATUS *RetVal,\r
179 IN OUT BOOLEAN *CanAffectLE OPTIONAL\r
180 );\r
181\r
182/**\r
183 Checks if a command string has been registered for CommandString, and if so, it\r
184 returns the MAN filename specified for that command.\r
185\r
186 If CommandString is NULL, then ASSERT().\r
187\r
188 @param[in] CommandString The pointer to the command name. This is the name\r
189 found on the command line in the shell.\r
190\r
191 @retval NULL The CommandString was not a registered command.\r
192 @retval other The name of the MAN file.\r
193 @sa SHELL_GET_MAN_FILENAME\r
194**/\r
195CONST CHAR16*\r
196EFIAPI\r
197ShellCommandGetManFileNameHandler (\r
198 IN CONST CHAR16 *CommandString\r
199 );\r
200\r
201\r
202typedef struct {\r
203 LIST_ENTRY Link;\r
204 CHAR16 *CommandString;\r
205} COMMAND_LIST;\r
206\r
207/**\r
208 Get the list of all available shell internal commands. This is a linked list,\r
209 via the LIST_ENTRY structure. Enumerate through it using the BaseLib linked\r
210 list functions. Do not modify the values.\r
211\r
4bbdc0e1 212 @param[in] Sort TRUE to alphabetically sort the values first. FALSE otherwise.\r
213\r
a405b86d 214 @return A linked list of all available shell commands.\r
215**/\r
216CONST COMMAND_LIST*\r
217EFIAPI\r
218ShellCommandGetCommandList (\r
4bbdc0e1 219 IN CONST BOOLEAN Sort\r
a405b86d 220 );\r
221\r
222typedef struct {\r
223 LIST_ENTRY Link;\r
224 CHAR16 *CommandString;\r
225 CHAR16 *Alias;\r
226} ALIAS_LIST;\r
227\r
228/**\r
229 Registers aliases to be set as part of the initialization of the shell application.\r
230\r
231 If Command is NULL, then ASSERT().\r
232 If Alias is NULL, then ASSERT().\r
233\r
234 @param[in] Command The pointer to the Command.\r
235 @param[in] Alias The pointer to Alias.\r
236\r
237 @retval RETURN_SUCCESS The handlers were registered.\r
238 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to\r
239 register the shell command.\r
240**/\r
241RETURN_STATUS\r
242EFIAPI\r
243ShellCommandRegisterAlias (\r
244 IN CONST CHAR16 *Command,\r
245 IN CONST CHAR16 *Alias\r
246 );\r
247\r
248/**\r
249 Get the list of all shell alias commands. This is a linked list,\r
250 via LIST_ENTRY structure. Enumerate through it using the BaseLib linked\r
251 list functions. Do not modify the values.\r
252\r
253 @return A linked list of all requested shell aliases.\r
254**/\r
255CONST ALIAS_LIST*\r
256EFIAPI\r
257ShellCommandGetInitAliasList (\r
258 VOID\r
259 );\r
260\r
261/**\r
262 Determine if a given alias is on the list of built in aliases.\r
263\r
264 @param[in] Alias The alias to test for.\r
265\r
266 @retval TRUE The alias is a built in alias.\r
267 @retval FALSE The alias is not a built in alias.\r
268**/\r
269BOOLEAN\r
270EFIAPI\r
271ShellCommandIsOnAliasList (\r
272 IN CONST CHAR16 *Alias\r
273 );\r
274\r
275/**\r
276 Checks if a command is already on the list.\r
277\r
278 @param[in] CommandString The command string to check for on the list.\r
279\r
280 @retval TRUE CommandString represents a registered command.\r
281 @retval FALSE CommandString does not represent a registered command.\r
282**/\r
283BOOLEAN\r
284EFIAPI\r
285ShellCommandIsCommandOnList (\r
286 IN CONST CHAR16 *CommandString\r
287 );\r
288\r
289/**\r
290 Get the help text for a command.\r
291\r
292 @param[in] CommandString The command name.\r
293\r
294 @retval NULL No help text was found.\r
295 @return The string of the help text. The caller required to free.\r
296**/\r
297CHAR16*\r
298EFIAPI\r
299ShellCommandGetCommandHelp (\r
300 IN CONST CHAR16 *CommandString\r
301 );\r
302\r
303/**\r
304 Function to make sure that the above pointers are valid.\r
305**/\r
306EFI_STATUS\r
307EFIAPI\r
308CommandInit (\r
309 VOID\r
310 );\r
311\r
312/**\r
313 Function to determine current state of ECHO. Echo determines if lines from scripts\r
314 and ECHO commands are enabled.\r
315\r
316 @retval TRUE Echo is currently enabled.\r
317 @retval FALSE Echo is currently disabled.\r
318**/\r
319BOOLEAN\r
320EFIAPI\r
321ShellCommandGetEchoState (\r
322 VOID\r
323 );\r
324\r
325/**\r
326 Function to set current state of ECHO. Echo determines if lines from scripts\r
327 and ECHO commands are enabled.\r
328\r
329 @param[in] State TRUE to enable Echo, FALSE otherwise.\r
330**/\r
331VOID\r
332EFIAPI\r
333ShellCommandSetEchoState (\r
334 IN BOOLEAN State\r
335 );\r
336\r
337\r
338\r
339/**\r
340 Indicate that the current shell or script should exit.\r
341\r
342 @param[in] ScriptOnly TRUE if exiting a script; FALSE otherwise.\r
b6b22b13 343 @param[in] ErrorCode The 64 bit error code to return.\r
a405b86d 344**/\r
345VOID\r
346EFIAPI\r
347ShellCommandRegisterExit (\r
b6b22b13 348 IN BOOLEAN ScriptOnly,\r
349 IN CONST UINT64 ErrorCode\r
350 );\r
351\r
352/**\r
353 Retrieve the Exit code.\r
354\r
355 @return the value passed into RegisterExit.\r
356**/\r
357UINT64\r
358EFIAPI\r
359ShellCommandGetExitCode (\r
360 VOID\r
a405b86d 361 );\r
362\r
363/**\r
364 Retrieve the Exit indicator.\r
365\r
366 @retval TRUE Exit was indicated.\r
367 @retval FALSE Exit was not indicated.\r
368**/\r
369BOOLEAN\r
370EFIAPI\r
371ShellCommandGetExit (\r
372 VOID\r
373 );\r
374\r
375/**\r
376 Retrieve the Exit script indicator.\r
377\r
378 If ShellCommandGetExit returns FALSE, then the return from this is undefined.\r
379\r
380 @retval TRUE ScriptOnly was indicated.\r
381 @retval FALSE ScriptOnly was not indicated.\r
382**/\r
383BOOLEAN\r
384EFIAPI\r
385ShellCommandGetScriptExit (\r
386 VOID\r
387 );\r
388\r
389typedef struct {\r
390 LIST_ENTRY Link; ///< List enumerator items.\r
391 UINTN Line; ///< What line of the script file this was on.\r
392 CHAR16 *Cl; ///< The original command line.\r
393 VOID *Data; ///< The data structure format dependant upon Command. (not always used)\r
394 BOOLEAN Reset; ///< Reset the command (it must be treated like a initial run (but it may have data already))\r
395} SCRIPT_COMMAND_LIST;\r
396\r
397typedef struct {\r
398 CHAR16 *ScriptName; ///< The filename of this script.\r
399 CHAR16 **Argv; ///< The parmameters to the script file.\r
400 UINTN Argc; ///< The count of parameters.\r
401 LIST_ENTRY CommandList; ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).\r
402 SCRIPT_COMMAND_LIST *CurrentCommand; ///< The command currently being operated. If !=NULL must be a member of CommandList.\r
403 LIST_ENTRY SubstList; ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).\r
404} SCRIPT_FILE;\r
405\r
406/**\r
407 Function to return a pointer to the currently running script file object.\r
408\r
409 @retval NULL A script file is not currently running.\r
410 @return A pointer to the current script file object.\r
411**/\r
412SCRIPT_FILE*\r
413EFIAPI\r
414ShellCommandGetCurrentScriptFile (\r
415 VOID\r
416 );\r
417\r
418/**\r
419 Function to set a new script as the currently running one.\r
420\r
421 This function will correctly stack and unstack nested scripts.\r
422\r
423 @param[in] Script The pointer to new script information structure. If NULL,\r
424 it removes and de-allocates the topmost Script structure.\r
425\r
426 @return A pointer to the current running script file after this\r
427 change. It is NULL if removing the final script.\r
428**/\r
429SCRIPT_FILE*\r
430EFIAPI\r
431ShellCommandSetNewScript (\r
432 IN SCRIPT_FILE *Script OPTIONAL\r
433 );\r
434\r
0ab85bef 435/**\r
436 Function to cleanup all memory from a SCRIPT_FILE structure.\r
437\r
438 @param[in] Script The pointer to the structure to cleanup.\r
439**/\r
440VOID\r
441EFIAPI\r
442DeleteScriptFileStruct (\r
443 IN SCRIPT_FILE *Script\r
444 );\r
445\r
a405b86d 446/**\r
447 Function to get the current Profile string.\r
448\r
449 This is used to retrieve what profiles were installed.\r
450\r
451 @retval NULL There are no installed profiles.\r
452 @return A semicolon-delimited list of profiles.\r
453**/\r
454CONST CHAR16 *\r
455EFIAPI\r
456ShellCommandGetProfileList (\r
457 VOID\r
458 );\r
459\r
460typedef enum {\r
461 MappingTypeFileSystem,\r
462 MappingTypeBlockIo,\r
463 MappingTypeMax\r
464} SHELL_MAPPING_TYPE;\r
465\r
466/**\r
467 Function to generate the next default mapping name.\r
468\r
469 If the return value is not NULL then it must be callee freed.\r
470\r
471 @param Type What kind of mapping name to make.\r
472\r
473 @retval NULL a memory allocation failed.\r
474 @return a new map name string\r
475**/\r
476CHAR16*\r
477EFIAPI\r
478ShellCommandCreateNewMappingName(\r
479 IN CONST SHELL_MAPPING_TYPE Type\r
480 );\r
481\r
482/**\r
483 Function to initialize the table for creating consistent map names.\r
484\r
485 @param[out] Table The pointer to pointer to pointer to DevicePathProtocol object.\r
486\r
487 @retval EFI_SUCCESS The table was created successfully.\r
488**/\r
489EFI_STATUS\r
490EFIAPI\r
491ShellCommandConsistMappingInitialize (\r
492 EFI_DEVICE_PATH_PROTOCOL ***Table\r
493 );\r
494\r
495/**\r
496 Function to uninitialize the table for creating consistent map names.\r
497\r
498 The parameter must have been received from ShellCommandConsistMappingInitialize.\r
499\r
500 @param[out] Table The pointer to pointer to DevicePathProtocol object.\r
501\r
502 @retval EFI_SUCCESS The table was deleted successfully.\r
503**/\r
504EFI_STATUS\r
505EFIAPI\r
506ShellCommandConsistMappingUnInitialize (\r
507 EFI_DEVICE_PATH_PROTOCOL **Table\r
508 );\r
509\r
510/**\r
511 Create a consistent mapped name for the device specified by DevicePath \r
512 based on the Table.\r
513\r
514 This must be called after ShellCommandConsistMappingInitialize() and \r
515 before ShellCommandConsistMappingUnInitialize() is called.\r
516\r
4bbdc0e1 517 @param[in] DevicePath The pointer to the dev path for the device.\r
a405b86d 518 @param[in] Table The Table of mapping information.\r
519\r
520 @retval NULL A consistent mapped name could not be created.\r
521 @return A pointer to a string allocated from pool with the device name.\r
522**/\r
523CHAR16*\r
524EFIAPI\r
525ShellCommandConsistMappingGenMappingName (\r
526 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
527 IN EFI_DEVICE_PATH_PROTOCOL **Table\r
528 );\r
529\r
530/**\r
531 Function to search the list of mappings for the first matching node on the\r
532 list based on the MapKey.\r
533\r
534 @param[in] MapKey The pointer to the string key to search for in the map.\r
535\r
536 @return the node on the list.\r
537**/\r
538SHELL_MAP_LIST*\r
539EFIAPI\r
540ShellCommandFindMapItem (\r
541 IN CONST CHAR16 *MapKey\r
542 );\r
543\r
544/**\r
545 Function to add a map node to the list of map items and update the "path" environment variable (optionally).\r
546\r
547 If Path is TRUE (during initialization only), the path environment variable will also be updated to include\r
548 default paths on the new map name...\r
549\r
550 Path should be FALSE when this function is called from the protocol SetMap function.\r
551\r
552 @param[in] Name The human readable mapped name.\r
553 @param[in] DevicePath The Device Path for this map.\r
554 @param[in] Flags The Flags attribute for this map item.\r
555 @param[in] Path TRUE to update path, FALSE to skip this step (should only be TRUE during initialization).\r
556\r
557 @retval EFI_SUCCESS The addition was sucessful.\r
558 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
559 @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
560**/\r
561EFI_STATUS\r
562EFIAPI\r
563ShellCommandAddMapItemAndUpdatePath(\r
564 IN CONST CHAR16 *Name,\r
565 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
566 IN CONST UINT64 Flags,\r
567 IN CONST BOOLEAN Path\r
568 );\r
569\r
570/**\r
571 Creates the default map names for each device path in the system with\r
572 a protocol depending on the Type.\r
573\r
574 Also sets up the default path environment variable if Type is FileSystem.\r
575\r
576 @retval EFI_SUCCESS All map names were created sucessfully.\r
577 @retval EFI_NOT_FOUND No protocols were found in the system.\r
578 @return Error returned from gBS->LocateHandle().\r
579\r
580 @sa LocateHandle\r
581**/\r
582EFI_STATUS\r
583EFIAPI\r
584ShellCommandCreateInitialMappingsAndPaths(\r
585 VOID\r
586 );\r
587\r
e71cb452
TS
588/**\r
589 Add mappings for any devices without one. Do not change any existing maps.\r
590\r
591 @retval EFI_SUCCESS The operation was successful.\r
592**/\r
593EFI_STATUS\r
594EFIAPI\r
595ShellCommandUpdateMapping (\r
596 VOID\r
597 );\r
598\r
a405b86d 599/**\r
600 Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.\r
601\r
602 @param[in] Handle The SHELL_FILE_HANDLE to convert.\r
603\r
604 @return a EFI_FILE_PROTOCOL* representing the same file.\r
605**/\r
606EFI_FILE_PROTOCOL*\r
607EFIAPI\r
608ConvertShellHandleToEfiFileProtocol(\r
609 IN CONST SHELL_FILE_HANDLE Handle\r
610 );\r
611\r
612/**\r
613 Remove a SHELL_FILE_HANDLE frmo the list of SHELL_FILE_HANDLES.\r
614\r
615 @param[in] Handle The SHELL_FILE_HANDLE to remove.\r
616\r
617 @retval TRUE The item was removed.\r
618 @retval FALSE The item was not found.\r
619**/\r
620BOOLEAN\r
621EFIAPI\r
622ShellFileHandleRemove(\r
623 IN CONST SHELL_FILE_HANDLE Handle\r
624 );\r
625\r
626/**\r
627 Converts a EFI_FILE_PROTOCOL* to an SHELL_FILE_HANDLE.\r
628\r
629 @param[in] Handle The pointer to EFI_FILE_PROTOCOL to convert.\r
630 @param[in] Path The path to the file for verification.\r
631\r
632 @return a SHELL_FILE_HANDLE representing the same file.\r
633**/\r
634SHELL_FILE_HANDLE\r
635EFIAPI\r
636ConvertEfiFileProtocolToShellHandle(\r
637 IN CONST EFI_FILE_PROTOCOL *Handle,\r
638 IN CONST CHAR16 *Path\r
639 );\r
640\r
641/**\r
642 Find the path that was logged with the specified SHELL_FILE_HANDLE.\r
643\r
644 @param[in] Handle The SHELL_FILE_HANDLE to query on.\r
645\r
646 @return A pointer to the path for the file.\r
647**/\r
648CONST CHAR16*\r
649EFIAPI\r
650ShellFileHandleGetPath(\r
651 IN CONST SHELL_FILE_HANDLE Handle\r
652 );\r
653\r
654\r
655/**\r
656 Function to determine if a SHELL_FILE_HANDLE is at the end of the file.\r
657\r
658 This will NOT work on directories.\r
659\r
660 If Handle is NULL, then ASSERT.\r
661\r
662 @param[in] Handle the file handle\r
663\r
664 @retval TRUE the position is at the end of the file\r
665 @retval FALSE the position is not at the end of the file\r
666**/\r
667BOOLEAN\r
668EFIAPI\r
669ShellFileHandleEof(\r
670 IN SHELL_FILE_HANDLE Handle\r
671 );\r
672\r
a405b86d 673typedef struct {\r
674 LIST_ENTRY Link;\r
675 void *Buffer;\r
676} BUFFER_LIST;\r
677\r
678/**\r
679 Frees any BUFFER_LIST defined type.\r
680\r
681 @param[in] List The pointer to the list head.\r
682**/\r
683VOID\r
684EFIAPI\r
685FreeBufferList (\r
686 IN BUFFER_LIST *List\r
687 );\r
688\r
3bd89603
LE
689/**\r
690 Function printing hex output to the console.\r
691\r
692 @param[in] Indent Number of spaces to indent.\r
693 @param[in] Offset Offset to start with.\r
694 @param[in] DataSize Length of data.\r
695 @param[in] UserData Pointer to some data.\r
696**/\r
697VOID\r
698DumpHex (\r
699 IN UINTN Indent,\r
700 IN UINTN Offset,\r
701 IN UINTN DataSize,\r
702 IN VOID *UserData\r
703 );\r
704\r
b464d7ed
RN
705/**\r
706 Dump HEX data into buffer.\r
707\r
708 @param[in] Buffer HEX data to be dumped in Buffer.\r
709 @param[in] Indent How many spaces to indent the output.\r
710 @param[in] Offset The offset of the printing.\r
711 @param[in] DataSize The size in bytes of UserData.\r
712 @param[in] UserData The data to print out.\r
713**/\r
714CHAR16*\r
715CatSDumpHex (\r
716 IN CHAR16 *Buffer,\r
717 IN UINTN Indent,\r
718 IN UINTN Offset,\r
719 IN UINTN DataSize,\r
720 IN VOID *UserData\r
721 );\r
a405b86d 722#endif //_SHELL_COMMAND_LIB_\r