]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Application/Shell/ConsoleWrappers.c
ShellPkg: Clean up source files
[mirror_edk2.git] / ShellPkg / Application / Shell / ConsoleWrappers.c
CommitLineData
8be0ba36 1/** @file\r
2 Function definitions for shell simple text in and out on top of file handles.\r
3\r
c011b6c9 4 (C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>\r
ba0014b9 5 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
8be0ba36 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
8be0ba36 16#include "Shell.h"\r
17\r
48cb33ec
QS
18extern BOOLEAN AsciiRedirection;\r
19\r
8be0ba36 20typedef struct {\r
21 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;\r
22 SHELL_FILE_HANDLE FileHandle;\r
23 EFI_HANDLE TheHandle;\r
2c86b6b7 24 UINT64 RemainingBytesOfInputFile;\r
8be0ba36 25} SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL;\r
26\r
27typedef struct {\r
28 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;\r
29 SHELL_FILE_HANDLE FileHandle;\r
30 EFI_HANDLE TheHandle;\r
dcf9b428 31 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalSimpleTextOut;\r
8be0ba36 32} SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;\r
33\r
34/**\r
35 Event notification function for EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey event\r
36 Signal the event if there is key available\r
37\r
38 @param Event Indicates the event that invoke this function.\r
39 @param Context Indicates the calling context.\r
40\r
41**/\r
42VOID\r
43EFIAPI\r
44ConInWaitForKey (\r
45 IN EFI_EVENT Event,\r
46 IN VOID *Context\r
47 )\r
48{\r
2c86b6b7 49 gBS->SignalEvent (Event);\r
8be0ba36 50}\r
51\r
52/**\r
53 Reset function for the fake simple text input.\r
54\r
55 @param[in] This A pointer to the SimpleTextIn structure.\r
56 @param[in] ExtendedVerification TRUE for extra validation, FALSE otherwise.\r
57\r
58 @retval EFI_SUCCESS The reset was successful.\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62FileBasedSimpleTextInReset(\r
63 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
64 IN BOOLEAN ExtendedVerification\r
65 )\r
66{\r
67 return (EFI_SUCCESS);\r
68}\r
69\r
70/**\r
71 ReadKeyStroke function for the fake simple text input.\r
72\r
4ff7e37b
ED
73 @param[in] This A pointer to the SimpleTextIn structure.\r
74 @param[in, out] Key A pointer to the Key structure to fill.\r
8be0ba36 75\r
76 @retval EFI_SUCCESS The read was successful.\r
77**/\r
78EFI_STATUS\r
79EFIAPI\r
80FileBasedSimpleTextInReadKeyStroke(\r
733f138d 81 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
82 IN OUT EFI_INPUT_KEY *Key\r
8be0ba36 83 )\r
84{\r
85 UINTN Size;\r
48cb33ec 86 UINTN CharSize;\r
2c86b6b7
JC
87\r
88 //\r
89 // Verify the parameters\r
90 //\r
8be0ba36 91 if (Key == NULL || This == NULL) {\r
92 return (EFI_INVALID_PARAMETER);\r
93 }\r
2c86b6b7
JC
94\r
95 //\r
96 // Check if we have any characters left in the stream.\r
97 //\r
98 if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile == 0) {\r
99 return (EFI_NOT_READY);\r
100 }\r
101\r
102 Size = sizeof(CHAR16);\r
103\r
48cb33ec
QS
104 if(!AsciiRedirection) {\r
105 CharSize = sizeof(CHAR16);\r
106 } else {\r
107 CharSize = sizeof(CHAR8);\r
ba0014b9 108 }\r
2c86b6b7
JC
109 //\r
110 // Decrement the amount of free space by Size or set to zero (for odd length files)\r
111 //\r
48cb33ec
QS
112 if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile > CharSize) {\r
113 ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile -= CharSize;\r
2c86b6b7
JC
114 } else {\r
115 ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile = 0;\r
116 }\r
117\r
8be0ba36 118 Key->ScanCode = 0;\r
119 return (ShellInfoObject.NewEfiShellProtocol->ReadFile(\r
120 ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,\r
121 &Size,\r
122 &Key->UnicodeChar));\r
123}\r
124\r
125/**\r
ba0014b9 126 Function to create a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a\r
8be0ba36 127 SHELL_FILE_HANDLE to support redirecting input from a file.\r
128\r
129 @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use.\r
130 @param[in] HandleLocation The pointer of a location to copy handle with protocol to.\r
131\r
132 @retval NULL There was insufficient memory available.\r
133 @return A pointer to the allocated protocol structure;\r
134**/\r
135EFI_SIMPLE_TEXT_INPUT_PROTOCOL*\r
8be0ba36 136CreateSimpleTextInOnFile(\r
137 IN SHELL_FILE_HANDLE FileHandleToUse,\r
138 IN EFI_HANDLE *HandleLocation\r
139 )\r
140{\r
141 SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ProtocolToReturn;\r
142 EFI_STATUS Status;\r
2c86b6b7
JC
143 UINT64 CurrentPosition;\r
144 UINT64 FileSize;\r
8be0ba36 145\r
146 if (HandleLocation == NULL || FileHandleToUse == NULL) {\r
147 return (NULL);\r
148 }\r
149\r
150 ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL));\r
151 if (ProtocolToReturn == NULL) {\r
152 return (NULL);\r
153 }\r
2c86b6b7
JC
154\r
155 ShellGetFileSize (FileHandleToUse, &FileSize);\r
156 ShellGetFilePosition(FileHandleToUse, &CurrentPosition);\r
157\r
158 //\r
159 // Initialize the protocol members\r
160 //\r
161 ProtocolToReturn->RemainingBytesOfInputFile = FileSize - CurrentPosition;\r
162 ProtocolToReturn->FileHandle = FileHandleToUse;\r
8be0ba36 163 ProtocolToReturn->SimpleTextIn.Reset = FileBasedSimpleTextInReset;\r
164 ProtocolToReturn->SimpleTextIn.ReadKeyStroke = FileBasedSimpleTextInReadKeyStroke;\r
ba0014b9 165\r
8be0ba36 166 Status = gBS->CreateEvent (\r
167 EVT_NOTIFY_WAIT,\r
168 TPL_NOTIFY,\r
169 ConInWaitForKey,\r
170 &ProtocolToReturn->SimpleTextIn,\r
171 &ProtocolToReturn->SimpleTextIn.WaitForKey\r
172 );\r
173\r
174 if (EFI_ERROR(Status)) {\r
175 FreePool(ProtocolToReturn);\r
176 return (NULL);\r
177 }\r
178 ///@todo possibly also install SimpleTextInputEx on the handle at this point.\r
179 Status = gBS->InstallProtocolInterface(\r
ba0014b9
LG
180 &(ProtocolToReturn->TheHandle),\r
181 &gEfiSimpleTextInProtocolGuid,\r
182 EFI_NATIVE_INTERFACE,\r
8be0ba36 183 &(ProtocolToReturn->SimpleTextIn));\r
184 if (!EFI_ERROR(Status)) {\r
185 *HandleLocation = ProtocolToReturn->TheHandle;\r
186 return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)ProtocolToReturn);\r
187 } else {\r
188 FreePool(ProtocolToReturn);\r
189 return (NULL);\r
190 }\r
191}\r
192\r
193/**\r
ba0014b9 194 Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a\r
8be0ba36 195 SHELL_FILE_HANDLE to support redirecting input from a file.\r
196\r
197 @param[in] SimpleTextIn The pointer to the SimpleTextIn to close.\r
198\r
199 @retval EFI_SUCCESS The object was closed.\r
200**/\r
201EFI_STATUS\r
8be0ba36 202CloseSimpleTextInOnFile(\r
203 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn\r
204 )\r
205{\r
206 EFI_STATUS Status;\r
207 EFI_STATUS Status1;\r
208\r
209 if (SimpleTextIn == NULL) {\r
210 return (EFI_INVALID_PARAMETER);\r
211 }\r
212\r
213 Status = gBS->CloseEvent(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey);\r
214\r
215 Status1 = gBS->UninstallProtocolInterface(\r
ba0014b9
LG
216 ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle,\r
217 &gEfiSimpleTextInProtocolGuid,\r
8be0ba36 218 &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn));\r
219\r
220 FreePool(SimpleTextIn);\r
221 if (!EFI_ERROR(Status)) {\r
222 return (Status1);\r
223 } else {\r
224 return (Status);\r
225 }\r
226}\r
227\r
228/**\r
229 Reset the text output device hardware and optionaly run diagnostics.\r
230\r
231 @param This pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
232 @param ExtendedVerification Indicates that a more extensive test may be performed\r
233\r
234 @retval EFI_SUCCESS The text output device was reset.\r
235**/\r
236EFI_STATUS\r
237EFIAPI\r
238FileBasedSimpleTextOutReset (\r
239 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
240 IN BOOLEAN ExtendedVerification\r
241 )\r
242{\r
243 return (EFI_SUCCESS);\r
244}\r
245\r
246/**\r
247 Verifies that all characters in a Unicode string can be output to the\r
248 target device.\r
249\r
250 @param[in] This Protocol instance pointer.\r
251 @param[in] WString The NULL-terminated Unicode string to be examined.\r
252\r
253 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
254**/\r
255EFI_STATUS\r
256EFIAPI\r
257FileBasedSimpleTextOutTestString (\r
258 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
259 IN CHAR16 *WString\r
260 )\r
261{\r
262 return (EFI_SUCCESS);\r
263}\r
264\r
265/**\r
266 Returns information for an available text mode that the output device(s)\r
267 supports.\r
268\r
269 @param[in] This Protocol instance pointer.\r
270 @param[in] ModeNumber The mode number to return information on.\r
271 @param[out] Columns Upon return, the number of columns in the selected geometry\r
272 @param[out] Rows Upon return, the number of rows in the selected geometry\r
273\r
274 @retval EFI_UNSUPPORTED The mode number was not valid.\r
275**/\r
276EFI_STATUS\r
277EFIAPI\r
278FileBasedSimpleTextOutQueryMode (\r
279 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
280 IN UINTN ModeNumber,\r
281 OUT UINTN *Columns,\r
282 OUT UINTN *Rows\r
283 )\r
284{\r
6f05676d 285 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol;\r
ba0014b9 286\r
6f05676d 287 PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut;\r
ba0014b9 288\r
dcf9b428
CP
289 // Pass the QueryMode call thru to the original SimpleTextOutProtocol\r
290 return (PassThruProtocol->QueryMode(\r
291 PassThruProtocol,\r
292 ModeNumber,\r
293 Columns,\r
294 Rows));\r
8be0ba36 295}\r
296\r
297/**\r
298 Sets the output device(s) to a specified mode.\r
299\r
300 @param[in] This Protocol instance pointer.\r
301 @param[in] ModeNumber The mode number to set.\r
302\r
303 @retval EFI_UNSUPPORTED The mode number was not valid.\r
304**/\r
305EFI_STATUS\r
306EFIAPI\r
307FileBasedSimpleTextOutSetMode (\r
308 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
309 IN UINTN ModeNumber\r
310 )\r
311{\r
312 return (EFI_UNSUPPORTED);\r
313}\r
314\r
315/**\r
316 Sets the background and foreground colors for the OutputString () and\r
317 ClearScreen () functions.\r
318\r
319 @param[in] This Protocol instance pointer.\r
320 @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and\r
321 bits 4..6 are the background color. All other bits are undefined\r
322 and must be zero. The valid Attributes are defined in this file.\r
323\r
324 @retval EFI_SUCCESS The attribute was set.\r
325**/\r
326EFI_STATUS\r
327EFIAPI\r
328FileBasedSimpleTextOutSetAttribute (\r
329 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
330 IN UINTN Attribute\r
331 )\r
332{\r
333 return (EFI_SUCCESS);\r
334}\r
335\r
336/**\r
337 Clears the output device(s) display to the currently selected background\r
338 color.\r
339\r
340 @param[in] This Protocol instance pointer.\r
341\r
342 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
343**/\r
344EFI_STATUS\r
345EFIAPI\r
346FileBasedSimpleTextOutClearScreen (\r
347 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
348 )\r
349{\r
350 return (EFI_SUCCESS);\r
351}\r
352\r
353/**\r
354 Sets the current coordinates of the cursor position\r
355\r
356 @param[in] This Protocol instance pointer.\r
357 @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode\r
358 @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode\r
359\r
360 @retval EFI_SUCCESS The operation completed successfully.\r
361**/\r
362EFI_STATUS\r
363EFIAPI\r
364FileBasedSimpleTextOutSetCursorPosition (\r
365 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
366 IN UINTN Column,\r
367 IN UINTN Row\r
368 )\r
369{\r
370 return (EFI_SUCCESS);\r
371}\r
372\r
373/**\r
374 Makes the cursor visible or invisible\r
375\r
376 @param[in] This Protocol instance pointer.\r
377 @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r
378 set to be invisible.\r
379\r
380 @retval EFI_SUCCESS The operation completed successfully.\r
381**/\r
382EFI_STATUS\r
383EFIAPI\r
384FileBasedSimpleTextOutEnableCursor (\r
385 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
386 IN BOOLEAN Visible\r
387 )\r
388{\r
389 return (EFI_SUCCESS);\r
390}\r
391\r
392/**\r
393 Write a Unicode string to the output device.\r
394\r
395 @param[in] This Protocol instance pointer.\r
396 @param[in] WString The NULL-terminated Unicode string to be displayed on the output\r
397 device(s). All output devices must also support the Unicode\r
398 drawing defined in this file.\r
399 @retval EFI_SUCCESS The string was output to the device.\r
400 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
401 the text.\r
402 @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
403 defined text mode.\r
404 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
405 characters in the Unicode string could not be\r
406 rendered and were skipped.\r
407**/\r
408EFI_STATUS\r
409EFIAPI\r
410FileBasedSimpleTextOutOutputString (\r
411 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
412 IN CHAR16 *WString\r
413 )\r
414{\r
415 UINTN Size;\r
416 Size = StrLen(WString) * sizeof(CHAR16);\r
417 return (ShellInfoObject.NewEfiShellProtocol->WriteFile(\r
418 ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,\r
419 &Size,\r
420 WString));\r
421}\r
422\r
423/**\r
ba0014b9 424 Function to create a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a\r
8be0ba36 425 SHELL_FILE_HANDLE to support redirecting output from a file.\r
426\r
dcf9b428
CP
427 @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use.\r
428 @param[in] HandleLocation The pointer of a location to copy handle with protocol to.\r
429 @param[in] OriginalProtocol The pointer to the original output protocol for pass thru of functions.\r
8be0ba36 430\r
431 @retval NULL There was insufficient memory available.\r
432 @return A pointer to the allocated protocol structure;\r
433**/\r
434EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*\r
8be0ba36 435CreateSimpleTextOutOnFile(\r
dcf9b428
CP
436 IN SHELL_FILE_HANDLE FileHandleToUse,\r
437 IN EFI_HANDLE *HandleLocation,\r
438 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol\r
8be0ba36 439 )\r
440{\r
441 SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;\r
442 EFI_STATUS Status;\r
443\r
444 if (HandleLocation == NULL || FileHandleToUse == NULL) {\r
445 return (NULL);\r
446 }\r
447\r
448 ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));\r
449 if (ProtocolToReturn == NULL) {\r
450 return (NULL);\r
451 }\r
452 ProtocolToReturn->FileHandle = FileHandleToUse;\r
dcf9b428 453 ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol;\r
8be0ba36 454 ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset;\r
455 ProtocolToReturn->SimpleTextOut.TestString = FileBasedSimpleTextOutTestString;\r
456 ProtocolToReturn->SimpleTextOut.QueryMode = FileBasedSimpleTextOutQueryMode;\r
457 ProtocolToReturn->SimpleTextOut.SetMode = FileBasedSimpleTextOutSetMode;\r
458 ProtocolToReturn->SimpleTextOut.SetAttribute = FileBasedSimpleTextOutSetAttribute;\r
459 ProtocolToReturn->SimpleTextOut.ClearScreen = FileBasedSimpleTextOutClearScreen;\r
460 ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition;\r
461 ProtocolToReturn->SimpleTextOut.EnableCursor = FileBasedSimpleTextOutEnableCursor;\r
462 ProtocolToReturn->SimpleTextOut.OutputString = FileBasedSimpleTextOutOutputString;\r
463 ProtocolToReturn->SimpleTextOut.Mode = AllocateZeroPool(sizeof(EFI_SIMPLE_TEXT_OUTPUT_MODE));\r
464 if (ProtocolToReturn->SimpleTextOut.Mode == NULL) {\r
465 FreePool(ProtocolToReturn);\r
466 return (NULL);\r
467 }\r
dcf9b428
CP
468 ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode;\r
469 ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode;\r
470 ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute;\r
471 ProtocolToReturn->SimpleTextOut.Mode->CursorColumn = OriginalProtocol->Mode->CursorColumn;\r
472 ProtocolToReturn->SimpleTextOut.Mode->CursorRow = OriginalProtocol->Mode->CursorRow;\r
473 ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible;\r
8be0ba36 474\r
475 Status = gBS->InstallProtocolInterface(\r
ba0014b9
LG
476 &(ProtocolToReturn->TheHandle),\r
477 &gEfiSimpleTextOutProtocolGuid,\r
478 EFI_NATIVE_INTERFACE,\r
8be0ba36 479 &(ProtocolToReturn->SimpleTextOut));\r
480 if (!EFI_ERROR(Status)) {\r
481 *HandleLocation = ProtocolToReturn->TheHandle;\r
482 return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn);\r
483 } else {\r
5772d0f5
QS
484 SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode);\r
485 SHELL_FREE_NON_NULL(ProtocolToReturn);\r
8be0ba36 486 return (NULL);\r
487 }\r
488}\r
489\r
490/**\r
ba0014b9 491 Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a\r
8be0ba36 492 SHELL_FILE_HANDLE to support redirecting output from a file.\r
493\r
733f138d 494 @param[in] SimpleTextOut The pointer to the SimpleTextOUT to close.\r
8be0ba36 495\r
496 @retval EFI_SUCCESS The object was closed.\r
497**/\r
498EFI_STATUS\r
8be0ba36 499CloseSimpleTextOutOnFile(\r
733f138d 500 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut\r
8be0ba36 501 )\r
502{\r
503 EFI_STATUS Status;\r
504 if (SimpleTextOut == NULL) {\r
505 return (EFI_INVALID_PARAMETER);\r
506 }\r
507 Status = gBS->UninstallProtocolInterface(\r
ba0014b9
LG
508 ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle,\r
509 &gEfiSimpleTextOutProtocolGuid,\r
8be0ba36 510 &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));\r
5772d0f5 511 FreePool(SimpleTextOut->Mode);\r
8be0ba36 512 FreePool(SimpleTextOut);\r
513 return (Status);\r
514}\r