| 142 | |
| 143 | #ifndef SILENT |
| 144 | static void GetPasswordText(wchar *Str,uint MaxLength) |
| 145 | { |
| 146 | if (MaxLength==0) |
| 147 | return; |
| 148 | if (StdinRedirected) |
| 149 | getwstr(Str,MaxLength); // Read from pipe or redirected file. |
| 150 | else |
| 151 | { |
| 152 | #ifdef _WIN_ALL |
| 153 | HANDLE hConIn=GetStdHandle(STD_INPUT_HANDLE); |
| 154 | HANDLE hConOut=GetStdHandle(STD_OUTPUT_HANDLE); |
| 155 | DWORD ConInMode,ConOutMode; |
| 156 | DWORD Read=0; |
| 157 | GetConsoleMode(hConIn,&ConInMode); |
| 158 | GetConsoleMode(hConOut,&ConOutMode); |
| 159 | SetConsoleMode(hConIn,ENABLE_LINE_INPUT); |
| 160 | SetConsoleMode(hConOut,ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT); |
| 161 | |
| 162 | ReadConsole(hConIn,Str,MaxLength-1,&Read,NULL); |
| 163 | Str[Read]=0; |
| 164 | SetConsoleMode(hConIn,ConInMode); |
| 165 | SetConsoleMode(hConOut,ConOutMode); |
| 166 | #else |
| 167 | char StrA[MAXPASSWORD]; |
| 168 | #if defined(_EMX) || defined (__VMS) |
| 169 | fgets(StrA,ASIZE(StrA)-1,stdin); |
| 170 | #elif defined(__sun) |
| 171 | strncpyz(StrA,getpassphrase(""),ASIZE(StrA)); |
| 172 | #else |
| 173 | strncpyz(StrA,getpass(""),ASIZE(StrA)); |
| 174 | #endif |
| 175 | CharToWide(StrA,Str,MaxLength); |
| 176 | cleandata(StrA,sizeof(StrA)); |
| 177 | #endif |
| 178 | } |
| 179 | Str[MaxLength-1]=0; |
| 180 | RemoveLF(Str); |
| 181 | } |
| 182 | #endif |
| 183 | |
| 184 |
no test coverage detected