]>
Commit | Line | Data |
---|---|---|
caf89d64 DM |
1 | /** @file\r |
2 | Implement the getpass function.\r | |
d7ce7006 | 3 | \r |
caf89d64 | 4 | Copyright (c) 2011 - 2014, Intel Corporation <BR>\r |
d7ce7006 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
d7ce7006 | 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 | |
19 | static CHAR8 *ReturnStringAscii = NULL;\r | |
20 | \r | |
21 | char *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 | |
47 | EFI_STATUS\r | |
48 | EFIAPI\r | |
49 | DestructMePlease (\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 | |
caf89d64 | 57 | }\r |