]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Uefi/GetPass.c
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / LibC / Uefi / GetPass.c
CommitLineData
d7ce7006 1/** @file Implement the getpass function.\r
2\r
3 Copyright (c) 2011, Intel Corporation <BR>\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12**/\r
13\r
14#include <Library/ShellLib.h>\r
15#include <Library/MemoryAllocationLib.h>\r
16#include <Library/UefiLib.h>\r
17#include <Library/PcdLib.h>\r
18\r
19static CHAR8 *ReturnStringAscii = NULL;\r
20\r
21char *getpass(const char *Prompt)\r
22{\r
23 BOOLEAN Ascii;\r
24 CHAR16 *ReturnString;\r
25\r
26 Ascii = FALSE;\r
27\r
28 Print(L"%a", Prompt);\r
29\r
30 ReturnString = ShellFileHandleReturnLine (gEfiShellParametersProtocol->StdIn, &Ascii);\r
31 if (ReturnString == NULL) {\r
32 return (NULL);\r
33 }\r
34\r
35 ReturnStringAscii = AllocateZeroPool((StrLen(ReturnString)+1)*sizeof(CHAR8));\r
36 if (ReturnStringAscii == NULL) {\r
37 return (NULL);\r
38 }\r
39\r
40 UnicodeStrToAsciiStr(ReturnString, ReturnStringAscii);\r
41\r
42 FreePool(ReturnString);\r
43\r
44 return (ReturnStringAscii);\r
45}\r
46\r
47EFI_STATUS\r
48EFIAPI\r
49DestructMePlease (\r
50 IN EFI_HANDLE ImageHandle,\r
51 IN EFI_SYSTEM_TABLE *SystemTable\r
52 )\r
53{\r
54 SHELL_FREE_NON_NULL(ReturnStringAscii);\r
55\r
56 return EFI_SUCCESS;\r
57}