0fe4decf |
1 | Index: drivers/drivers.c\r |
2 | ===================================================================\r |
3 | --- drivers/drivers.c (revision 30)\r |
4 | +++ drivers/drivers.c (working copy)\r |
5 | @@ -130,6 +130,7 @@\r |
6 | UINTN StringIndex; |
7 | UINTN Index; |
8 | CHAR8 *Language; |
9 | + CHAR8 *PlatformLanguage; |
10 | UINTN DriverImageHandleCount; |
11 | EFI_HANDLE *DriverImageHandleBuffer; |
12 | UINTN HandleIndex; |
13 | @@ -152,6 +153,7 @@\r |
14 | SHELL_VAR_CHECK_PACKAGE ChkPck; |
15 | |
16 | Language = NULL; |
17 | + PlatformLanguage = NULL; |
18 | DriverImageHandleCount = 0; |
19 | DriverImageHandleBuffer = NULL; |
20 | IsHelp = FALSE; |
21 | @@ -241,7 +243,7 @@\r |
22 | goto Done; |
23 | } |
24 | |
25 | - Language = LibGetVariableLang (); |
26 | + Language = LibGetVariable (L"Lang", &gEfiGlobalVariableGuid); |
27 | if (Language == NULL) { |
28 | Language = (CHAR8 *)AllocateZeroPool(strlena(LanguageCodeEnglish) + 1); |
29 | if (Language == NULL) { |
30 | @@ -250,6 +252,15 @@\r |
31 | strcpya(Language, LanguageCodeEnglish); |
32 | } |
33 | |
34 | + PlatformLanguage = LibGetVariable (L"PlatformLang", &gEfiGlobalVariableGuid); |
35 | + if (PlatformLanguage == NULL) { |
36 | + PlatformLanguage = (CHAR8 *)AllocateZeroPool(strlena(PlatformLanguageCodeEnglish) + 1); |
37 | + if (PlatformLanguage == NULL) { |
38 | + return EFI_OUT_OF_RESOURCES; |
39 | + } |
40 | + strcpya(PlatformLanguage, PlatformLanguageCodeEnglish); |
41 | + } |
42 | + |
43 | Item = LibCheckVarGetFlag (&ChkPck, L"-l"); |
44 | if (Item) { |
45 | if (Language != NULL) { |
46 | @@ -314,14 +325,6 @@\r |
47 | EFI_OPEN_PROTOCOL_GET_PROTOCOL |
48 | ); |
49 | |
50 | - ComponentName = NULL; |
51 | - ComponentName2 = NULL; |
52 | - Status = LibGetComponentNameProtocol ( |
53 | - DriverImageHandleBuffer[Index], |
54 | - &ComponentName, |
55 | - &ComponentName2 |
56 | - ); |
57 | - |
58 | DiagnosticsStatus = BS->OpenProtocol ( |
59 | DriverImageHandleBuffer[Index], |
60 | &gEfiDriverDiagnostics2ProtocolGuid, |
61 | @@ -418,37 +421,73 @@\r |
62 | } else { |
63 | PrintToken (STRING_TOKEN (STR_SHELLENV_PROTID_ONE_VAR_D), HiiHandle, NumberOfChildren); |
64 | } |
65 | - |
66 | - Status = EFI_SUCCESS; |
67 | + |
68 | DriverName = L"<UNKNOWN>"; |
69 | - SupportedLanguage = NULL; |
70 | - if (ComponentName != NULL) { |
71 | - if (ComponentName->GetDriverName != NULL) { |
72 | - SupportedLanguage = LibConvertSupportedLanguage (ComponentName->SupportedLanguages, Language); |
73 | + Status = BS->OpenProtocol ( |
74 | + DriverImageHandleBuffer[Index], |
75 | + &gEfiComponentName2ProtocolGuid, |
76 | + (VOID **) &ComponentName2, |
77 | + NULL, |
78 | + NULL, |
79 | + EFI_OPEN_PROTOCOL_GET_PROTOCOL |
80 | + ); |
81 | + if (!EFI_ERROR (Status)) { |
82 | + // |
83 | + // Driver has Component Name 2 Protocol is available, we get the |
84 | + // driver name var RFC 3066 language code |
85 | + // |
86 | + Status = ComponentName2->GetDriverName ( |
87 | + ComponentName2, |
88 | + PlatformLanguage, |
89 | + &DriverName |
90 | + ); |
91 | + if (EFI_ERROR (Status)) { |
92 | + // |
93 | + // Current RFC3066 language code fails, we then extract the supported |
94 | + // language from Component Name 2 protocol interface. |
95 | + // |
96 | + SupportedLanguage = ExtractSupportedLanguage(ComponentName2->SupportedLanguages, Language); |
97 | + if (SupportedLanguage != NULL) { |
98 | + Status = ComponentName2->GetDriverName ( |
99 | + ComponentName2, |
100 | + SupportedLanguage, |
101 | + &DriverName |
102 | + ); |
103 | + FreePool(SupportedLanguage); |
104 | + } |
105 | + } |
106 | + } |
107 | + if (EFI_ERROR (Status)) { |
108 | + // |
109 | + // In case Component Name 2 protocol is not available or some error occurs |
110 | + // when getting driver name from Component Name 2 protocol, we get driver |
111 | + // name from Component Name protocol. |
112 | + // |
113 | + Status = BS->OpenProtocol ( |
114 | + DriverImageHandleBuffer[Index], |
115 | + &gEfiComponentNameProtocolGuid, |
116 | + (VOID **) &ComponentName, |
117 | + NULL, |
118 | + NULL, |
119 | + EFI_OPEN_PROTOCOL_GET_PROTOCOL |
120 | + ); |
121 | + if (!EFI_ERROR (Status)) { |
122 | Status = ComponentName->GetDriverName ( |
123 | ComponentName, |
124 | - SupportedLanguage, |
125 | + Language, |
126 | &DriverName |
127 | ); |
128 | } |
129 | - } else if (ComponentName2 != NULL) { |
130 | - if (ComponentName2->GetDriverName != NULL) { |
131 | - SupportedLanguage = LibConvertSupportedLanguage (ComponentName2->SupportedLanguages, Language); |
132 | - Status = ComponentName2->GetDriverName ( |
133 | - ComponentName2, |
134 | - SupportedLanguage, |
135 | - &DriverName |
136 | - ); |
137 | - } |
138 | } |
139 | - if (SupportedLanguage != NULL) { |
140 | - FreePool (SupportedLanguage); |
141 | - } |
142 | - |
143 | if (EFI_ERROR (Status)) { |
144 | + // |
145 | + // Fails to get driver name from either Component Name 2 & Component Name |
146 | + // Protocol, we show "<UNKNOWN>" string as driver name. |
147 | + // |
148 | DriverName = L"<UNKNOWN>"; |
149 | } |
150 | |
151 | + |
152 | for (StringIndex = 0; StringIndex < StrLen (DriverName) && StringIndex < 35; StringIndex++) { |
153 | FormattedDriverName[StringIndex] = DriverName[StringIndex]; |
154 | } |
155 | @@ -491,6 +530,10 @@\r |
156 | FreePool (Language); |
157 | } |
158 | |
159 | + if (PlatformLanguage != NULL) { |
160 | + FreePool (PlatformLanguage); |
161 | + } |
162 | + |
163 | ShellCloseHandleEnumerator (); |
164 | LibCheckVarFreeVarList (&ChkPck); |
165 | LibUnInitializeStrings (); |
157398c2 |
166 | Index: edit/libEditor.c\r |
167 | ===================================================================\r |
168 | --- edit/libEditor.c (revision 30)\r |
169 | +++ edit/libEditor.c (working copy)\r |
170 | @@ -88,8 +88,6 @@\r |
e672aeba |
171 | ) |
172 | { |
173 | EFI_STATUS Status; |
174 | - EFI_HANDLE *HandleBuffer; |
175 | - UINTN HandleCount; |
176 | |
177 | // |
178 | // basic initialization |
157398c2 |
179 | @@ -117,38 +115,22 @@\r |
e672aeba |
180 | ); |
181 | |
182 | // |
183 | - // Find mouse |
184 | + // Find mouse in System Table ConsoleInHandle |
185 | // |
186 | - HandleBuffer = NULL; |
187 | - Status = LibLocateHandle ( |
188 | - ByProtocol, |
189 | - &gEfiPrimaryConsoleInDeviceGuid, |
190 | - NULL, |
191 | - &HandleCount, |
192 | - &HandleBuffer |
193 | - ); |
194 | + Status = BS->HandleProtocol ( |
195 | + In, |
196 | + &gEfiSimplePointerProtocolGuid, |
197 | + &MainEditor.MouseInterface |
198 | + ); |
199 | |
200 | - if (!EFI_ERROR (Status)) { |
201 | - if (HandleCount > 0) { |
202 | - Status = BS->HandleProtocol ( |
203 | - HandleBuffer[0], |
204 | - &gEfiSimplePointerProtocolGuid, |
205 | - &MainEditor.MouseInterface |
206 | - ); |
207 | - |
208 | - if (EFI_ERROR (Status)) { |
209 | - MainEditor.MouseInterface = NULL; |
210 | - } else { |
211 | - MainEditor.MouseAccumulatorX = 0; |
212 | - MainEditor.MouseAccumulatorY = 0; |
213 | - MainEditor.MouseSupported = TRUE; |
214 | - } |
215 | - } |
216 | + if (EFI_ERROR (Status)) { |
217 | + MainEditor.MouseInterface = NULL; |
218 | + } else { |
219 | + MainEditor.MouseAccumulatorX = 0; |
220 | + MainEditor.MouseAccumulatorY = 0; |
221 | + MainEditor.MouseSupported = TRUE; |
222 | } |
223 | |
224 | - if (HandleBuffer) { |
225 | - FreePool (HandleBuffer); |
226 | - } |
227 | // |
228 | // below will call the five components' init function |
229 | // |
f8a6b282 |
230 | Index: edit/libFileBuffer.c\r |
231 | ===================================================================\r |
232 | --- edit/libFileBuffer.c (revision 30)\r |
233 | +++ edit/libFileBuffer.c (working copy)\r |
234 | @@ -735,7 +735,7 @@\r |
235 | UINTN LineSize; |
236 | VOID *Buffer; |
237 | CHAR16 *UnicodeBuffer; |
238 | - CHAR8 *AsciiBuffer; |
239 | + UINT8 *AsciiBuffer; |
240 | UINTN FileSize; |
241 | EFI_FILE_HANDLE Handle; |
242 | BOOLEAN CreateFile; |
243 | @@ -1047,7 +1047,7 @@\r |
244 | // |
245 | // Unicode file |
246 | // |
247 | - if (AsciiBuffer[0] == 0xff && AsciiBuffer[1] == 0xfe) { |
248 | + if ((FileSize >= 2) && (*((UINT16 *) Buffer) == EFI_UNICODE_BYTE_ORDER_MARK)) { |
249 | // |
250 | // Unicode file's size should be even |
e672aeba |
251 | // |
157398c2 |
252 | Index: hexedit/libEditor.c\r |
253 | ===================================================================\r |
254 | --- hexedit/libEditor.c (revision 30)\r |
255 | +++ hexedit/libEditor.c (working copy)\r |
256 | @@ -100,8 +100,6 @@\r |
e672aeba |
257 | --*/ |
258 | { |
259 | EFI_STATUS Status; |
260 | - EFI_HANDLE *HandleBuffer; |
261 | - UINTN HandleCount; |
262 | |
263 | // |
264 | // basic initialization |
157398c2 |
265 | @@ -129,36 +127,19 @@\r |
e672aeba |
266 | &(HMainEditor.ScreenSize.Row) |
267 | ); |
268 | |
269 | - HandleBuffer = NULL; |
270 | - Status = LibLocateHandle ( |
271 | - ByProtocol, |
272 | - &gEfiPrimaryConsoleInDeviceGuid, |
273 | - NULL, |
274 | - &HandleCount, |
275 | - &HandleBuffer |
276 | - ); |
277 | - |
278 | - if (!EFI_ERROR (Status)) { |
279 | - |
280 | - if (HandleCount > 0) { |
281 | - Status = BS->HandleProtocol ( |
282 | - HandleBuffer[0], |
283 | - &gEfiSimplePointerProtocolGuid, |
284 | - &HMainEditor.MouseInterface |
285 | - ); |
286 | - if (EFI_ERROR (Status)) { |
287 | - HMainEditor.MouseInterface = NULL; |
288 | - } else { |
289 | - HMainEditor.MouseAccumulatorX = 0; |
290 | - HMainEditor.MouseAccumulatorY = 0; |
291 | - HMainEditor.MouseSupported = TRUE; |
292 | - } |
293 | - } |
294 | + Status = BS->HandleProtocol ( |
295 | + In, |
296 | + &gEfiSimplePointerProtocolGuid, |
297 | + &HMainEditor.MouseInterface |
298 | + ); |
299 | + if (EFI_ERROR (Status)) { |
300 | + HMainEditor.MouseInterface = NULL; |
301 | + } else { |
302 | + HMainEditor.MouseAccumulatorX = 0; |
303 | + HMainEditor.MouseAccumulatorY = 0; |
304 | + HMainEditor.MouseSupported = TRUE; |
305 | } |
306 | |
307 | - if (HandleBuffer != NULL) { |
308 | - FreePool (HandleBuffer); |
309 | - } |
310 | // |
311 | // below will call the five components' init function |
157398c2 |
312 | // |
0fe4decf |
313 | Index: Library/EfiShellLib.h\r |
314 | ===================================================================\r |
315 | --- Library/EfiShellLib.h (revision 30)\r |
316 | +++ Library/EfiShellLib.h (working copy)\r |
317 | @@ -174,22 +174,23 @@\r |
318 | // |
319 | // Environment variable name constants |
320 | // |
321 | -#define VarLanguageCodes L"LangCodes" |
322 | -#define VarLanguage L"Lang" |
323 | -#define VarTimeout L"Timeout" |
324 | -#define VarConsoleIn L"ConIn" |
325 | -#define VarConsoleOut L"ConOut" |
326 | -#define VarErrorOut L"ErrOut" |
327 | -#define VarBootOption L"Boot%04x" |
328 | -#define VarBootOrder L"BootOrder" |
329 | -#define VarBootNext L"BootNext" |
330 | -#define VarBootCurrent L"BootCurrent" |
331 | -#define VarDriverOption L"Driver%04x" |
332 | -#define VarDriverOrder L"DriverOrder" |
333 | -#define VarConsoleInpDev L"ConInDev" |
334 | -#define VarConsoleOutDev L"ConOutDev" |
335 | -#define VarErrorOutDev L"ErrOutDev" |
336 | -#define LanguageCodeEnglish "eng" |
337 | +#define VarLanguageCodes L"LangCodes" |
338 | +#define VarLanguage L"Lang" |
339 | +#define VarTimeout L"Timeout" |
340 | +#define VarConsoleIn L"ConIn" |
341 | +#define VarConsoleOut L"ConOut" |
342 | +#define VarErrorOut L"ErrOut" |
343 | +#define VarBootOption L"Boot%04x" |
344 | +#define VarBootOrder L"BootOrder" |
345 | +#define VarBootNext L"BootNext" |
346 | +#define VarBootCurrent L"BootCurrent" |
347 | +#define VarDriverOption L"Driver%04x" |
348 | +#define VarDriverOrder L"DriverOrder" |
349 | +#define VarConsoleInpDev L"ConInDev" |
350 | +#define VarConsoleOutDev L"ConOutDev" |
351 | +#define VarErrorOutDev L"ErrOutDev" |
352 | +#define LanguageCodeEnglish "eng" |
353 | +#define PlatformLanguageCodeEnglish "en-US" |
354 | |
355 | #define ISO_639_2_ENTRY_SIZE 3 |
356 | #define RFC_3066_ENTRY_SIZE 12 |
357 | @@ -333,4 +334,10 @@\r |
358 | IN CHAR8 *LangCode |
359 | ); |
360 | |
361 | +CHAR8 * |
362 | +ExtractSupportedLanguage ( |
363 | + IN CONST CHAR8 *SupportedLanguages, |
364 | + IN CONST CHAR8 *Language |
365 | + ); |
366 | + |
367 | #endif |
368 | Index: Library/Misc.c\r |
369 | ===================================================================\r |
370 | --- Library/Misc.c (revision 30)\r |
371 | +++ Library/Misc.c (working copy)\r |
372 | @@ -1905,13 +1905,13 @@\r |
373 | IN VOID *UserData |
374 | ) |
375 | { |
376 | - CHAR8 *Data; |
377 | + UINT8 *Data; |
378 | |
379 | CHAR8 Val[50]; |
380 | |
381 | CHAR8 Str[20]; |
382 | |
383 | - CHAR8 c; |
384 | + UINT8 c; |
385 | UINTN Size; |
386 | UINTN Index; |
387 | |
388 | @@ -2271,3 +2271,76 @@\r |
389 | } |
390 | return Lang; |
391 | } |
392 | + |
393 | +CHAR8 * |
394 | +ExtractSupportedLanguage ( |
395 | + IN CONST CHAR8 *SupportedLanguages, |
396 | + IN CONST CHAR8 *Language |
397 | + ) |
398 | +/*++ |
399 | + |
400 | + Routine Description: |
401 | + |
402 | + This function matches the major language code (first two characters) in the |
403 | + SupportedLanguages. The first language code in the SupportedLanguages that |
404 | + matches first two characters of the input Language is returned. If there is no |
405 | + such match, then NULL is returned. |
406 | + |
407 | + Arguments: |
408 | + |
409 | + SupportedLanguages - A Null-terminated ASCII string that contains one |
410 | + or more supported language codes. |
411 | + |
412 | + LangCode - A pointer to a Null-terminated ASCII string |
413 | + array indicating the RFC 3066 language. |
414 | + |
415 | + Returns: |
416 | + |
417 | + The RFC3066 language code that matches the major language. |
418 | + |
419 | +--*/ |
420 | +{ |
421 | + CONST CHAR8 *CurrentLanguage; |
422 | + CHAR8 *SupportedLanguage; |
423 | + UINTN LanguageLen; |
424 | + |
425 | + CurrentLanguage = SupportedLanguages; |
426 | + |
427 | + while (CurrentLanguage != '\0') { |
428 | + // |
429 | + // Search till the end of current language. |
430 | + // |
431 | + LanguageLen = 0; |
432 | + while (CurrentLanguage[LanguageLen] != ';' && CurrentLanguage[LanguageLen] != '\0') { |
433 | + LanguageLen++; |
434 | + } |
435 | + |
436 | + // |
437 | + // should use AsciiStrnCmp(CurrentLanguage, Language, 2) == 0 |
438 | + // |
439 | + if ((CurrentLanguage[0] == Language[0]) && (CurrentLanguage[1] == Language[1])) { |
440 | + // |
441 | + // Match the major language code, then return a new copy of |
442 | + // NULL-terminated SupportedLanguage. |
443 | + // |
444 | + SupportedLanguage = AllocatePool (LanguageLen + 1); |
445 | + CopyMem (SupportedLanguage, (VOID *) CurrentLanguage, LanguageLen); |
446 | + |
447 | + SupportedLanguage[LanguageLen] = '\0'; |
448 | + |
449 | + return SupportedLanguage; |
450 | + } |
451 | + // |
452 | + // Make CurrentLangue point to the next candiate language code. |
453 | + // |
454 | + CurrentLanguage += LanguageLen; |
455 | + if (*CurrentLanguage == ';') { |
456 | + CurrentLanguage++; |
457 | + } |
458 | + } |
459 | + |
460 | + return NULL; |
461 | +} |
462 | + |
463 | + |
464 | + |
f8a6b282 |
465 | Index: shellenv/batch.c\r |
466 | ===================================================================\r |
467 | --- shellenv/batch.c (revision 30)\r |
468 | +++ shellenv/batch.c (working copy)\r |
469 | @@ -2074,17 +2074,17 @@\r |
470 | --*/ |
471 | { |
472 | // |
473 | - // UNICODE byte-order-mark is two bytes |
474 | + // UNICODE byte-order-mark is 16 bits |
475 | // |
476 | - CHAR8 Buffer8[2]; |
477 | + UINT16 Uint16; |
478 | UINTN BufSize; |
479 | EFI_STATUS Status; |
480 | |
481 | // |
482 | // Read the first two bytes to check for byte order mark |
483 | // |
484 | - BufSize = sizeof (Buffer8); |
485 | - Status = File->Read (File, &BufSize, Buffer8); |
486 | + BufSize = sizeof (Uint16); |
487 | + Status = File->Read (File, &BufSize, &Uint16); |
488 | if (EFI_ERROR (Status)) { |
489 | return Status; |
490 | } |
491 | @@ -2098,9 +2098,8 @@\r |
492 | // otherwise assume it is ASCII. UNICODE byte order mark on |
493 | // IA little endian is first byte 0xff and second byte 0xfe |
494 | // |
495 | - if ((Buffer8[0] | (Buffer8[1] << 8)) == EFI_UNICODE_BYTE_ORDER_MARK) { |
496 | + if ((BufSize == 2) && (Uint16 == EFI_UNICODE_BYTE_ORDER_MARK)) { |
497 | *IsAscii = FALSE; |
498 | - |
499 | } else { |
500 | *IsAscii = TRUE; |
501 | } |
157398c2 |
502 | Index: shellenv/Connect.c\r |
503 | ===================================================================\r |
504 | --- shellenv/Connect.c (revision 30)\r |
505 | +++ shellenv/Connect.c (working copy)\r |
506 | @@ -831,6 +831,16 @@\r |
e672aeba |
507 | return Status; |
508 | } |
509 | |
510 | + // |
511 | + // Close proxy console before disconnect all devices. |
512 | + // |
513 | + SEnvCloseConsoleProxy ( |
514 | + ST->ConsoleInHandle, |
515 | + &ST->ConIn, |
516 | + ST->ConsoleOutHandle, |
517 | + &ST->ConOut |
518 | + ); |
519 | + |
520 | for (Index = 0; Index < AllHandleCount; Index++) { |
521 | // |
522 | // Check whether the handle is still in handle database |
157398c2 |
523 | @@ -1004,7 +1014,6 @@\r |
e672aeba |
524 | VOID |
525 | SEnvConnectConsole ( |
526 | CHAR16 *VariableName, |
527 | - EFI_GUID *PrimaryGuid, |
528 | EFI_GUID *ConsoleGuid, |
529 | EFI_HANDLE *ConsoleHandle, |
530 | VOID **ConsoleInterface |
531 | @@ -1018,27 +1027,36 @@\r |
532 | EFI_HANDLE *AllHandleBuffer; |
533 | VOID *Interface; |
534 | |
535 | - *ConsoleHandle = NULL; |
536 | - *ConsoleInterface = NULL; |
537 | ConsoleIndex = 0; |
538 | + AllHandleBuffer = NULL; |
539 | |
540 | DevicePath = LibGetVariable (VariableName, &gEfiGlobalVariableGuid); |
541 | - if (DevicePath != NULL) { |
542 | - SEnvConnectDevicePath (DevicePath); |
543 | - FreePool (DevicePath); |
544 | + if (DevicePath == NULL) { |
545 | + // |
546 | + // If no any device defined in EFI variable, do nothing |
547 | + // |
548 | + return; |
549 | } |
550 | |
551 | - AllHandleBuffer = NULL; |
552 | - Status = BS->LocateHandleBuffer ( |
553 | - ByProtocol, |
554 | - PrimaryGuid, |
555 | - NULL, |
556 | - &AllHandleCount, |
557 | - &AllHandleBuffer |
558 | - ); |
559 | - if (!EFI_ERROR (Status) && AllHandleCount > 0) { |
560 | - *ConsoleHandle = AllHandleBuffer[0]; |
561 | - } else if (*ConsoleHandle == NULL) { |
562 | + // |
563 | + // Connect all console devices |
564 | + // |
565 | + SEnvConnectDevicePath (DevicePath); |
566 | + FreePool (DevicePath); |
567 | + |
568 | + Status = EFI_NOT_FOUND; |
569 | + // |
570 | + // Check ConsoleHandle validation whatever it was updated or not. |
571 | + // |
572 | + if (*ConsoleHandle != NULL) { |
573 | + Status = BS->HandleProtocol ( |
574 | + *ConsoleHandle, |
575 | + ConsoleGuid, |
576 | + &Interface |
577 | + ); |
578 | + } |
579 | + |
580 | + if (EFI_ERROR (Status)) { |
581 | AllHandleBuffer = NULL; |
582 | Status = BS->LocateHandleBuffer ( |
583 | ByProtocol, |
584 | @@ -1063,16 +1081,16 @@\r |
585 | &gEfiDevicePathProtocolGuid, |
586 | &Interface |
587 | ); |
588 | - if (EFI_ERROR (Status)) { |
589 | + if (!EFI_ERROR (Status)) { |
590 | ConsoleIndex = Index; |
591 | break; |
592 | } |
593 | } |
594 | + |
595 | + *ConsoleHandle = AllHandleBuffer[ConsoleIndex]; |
596 | } |
597 | } |
598 | |
599 | - *ConsoleHandle = AllHandleBuffer[ConsoleIndex]; |
600 | - |
601 | if (*ConsoleHandle != NULL) { |
602 | BS->HandleProtocol ( |
603 | *ConsoleHandle, |
604 | @@ -1081,7 +1099,7 @@\r |
605 | ); |
606 | } |
607 | |
608 | - if (AllHandleBuffer) { |
609 | + if (AllHandleBuffer != NULL) { |
610 | FreePool (AllHandleBuffer); |
611 | } |
612 | } |
613 | @@ -1189,8 +1207,7 @@\r |
614 | EFI_STATUS Status; |
615 | |
616 | // |
617 | - // Check current ConIn and ConOut to ensure it is the ConsoleProxy |
618 | - // Otherwise, the Console should not be close |
619 | + // Check current ConIn and ConOut to judge it is the ConsoleProxy |
620 | // |
621 | Status = SEnvCheckConsoleProxy ( |
622 | ST->ConsoleInHandle, |
623 | @@ -1203,23 +1220,21 @@\r |
624 | // Indicate the Console is replaced by redirection operation |
625 | // It is not safe to connect Console here |
626 | // |
627 | - if (EFI_ERROR (Status)) { |
628 | - return ; |
629 | + if (!EFI_ERROR (Status)) { |
630 | + // |
631 | + // It is proxy console, to prevent the proxy console form being restored to original console, |
632 | + // close it temporary before connect all console |
633 | + // |
634 | + SEnvCloseConsoleProxy ( |
635 | + ST->ConsoleInHandle, |
636 | + &ST->ConIn, |
637 | + ST->ConsoleOutHandle, |
638 | + &ST->ConOut |
639 | + ); |
640 | } |
641 | - // |
642 | - // To prevent the proxy console form being restored to original console, |
643 | - // close it temporary before connect all console |
644 | - // |
645 | - SEnvCloseConsoleProxy ( |
646 | - ST->ConsoleInHandle, |
647 | - &ST->ConIn, |
648 | - ST->ConsoleOutHandle, |
649 | - &ST->ConOut |
650 | - ); |
651 | |
652 | SEnvConnectConsole ( |
653 | VarErrorOut, |
654 | - &gEfiPrimaryStandardErrorDeviceGuid, |
655 | &gEfiSimpleTextOutProtocolGuid, |
656 | &ST->StandardErrorHandle, |
657 | (VOID **) &ST->StdErr |
658 | @@ -1227,7 +1242,6 @@\r |
659 | |
660 | SEnvConnectConsole ( |
661 | VarConsoleOut, |
662 | - &gEfiPrimaryConsoleOutDeviceGuid, |
663 | &gEfiSimpleTextOutProtocolGuid, |
664 | &ST->ConsoleOutHandle, |
665 | (VOID **) &ST->ConOut |
666 | @@ -1235,7 +1249,6 @@\r |
667 | |
668 | SEnvConnectConsole ( |
669 | VarConsoleIn, |
670 | - &gEfiPrimaryConsoleInDeviceGuid, |
671 | &gEfiSimpleTextInProtocolGuid, |
672 | &ST->ConsoleInHandle, |
673 | (VOID **) &ST->ConIn |
674 | @@ -1254,6 +1267,8 @@\r |
675 | SetCrc (&ST->Hdr); |
676 | } |
677 | |
678 | + |
679 | + |
680 | EFI_STATUS |
681 | EFIAPI |
682 | SEnvCmdReconnect ( |
0fe4decf |
683 | Index: SmbiosView/PrintInfo.c\r |
684 | ===================================================================\r |
685 | --- SmbiosView/PrintInfo.c (revision 30)\r |
686 | +++ SmbiosView/PrintInfo.c (working copy)\r |
687 | @@ -1779,7 +1779,7 @@\r |
688 | // |
689 | // MaxSize is determined by follow formula |
690 | // |
691 | - MaxSize = 1 << Size; |
692 | + MaxSize = (UINTN) 1 << Size; |
693 | PrintToken (STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), HiiHandle, MaxSize); |
694 | |
695 | if (Option >= SHOW_DETAIL) { |
696 | Index: SmbiosView/Smbios.h\r |
697 | ===================================================================\r |
698 | --- SmbiosView/Smbios.h (revision 30)\r |
699 | +++ SmbiosView/Smbios.h (working copy)\r |
700 | @@ -34,11 +34,6 @@\r |
701 | |
702 | extern EFI_HII_HANDLE HiiHandle; |
703 | |
704 | -#define EFI_SMBIOS_TABLE_GUID \ |
705 | - { \ |
706 | - 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \ |
707 | - } |
708 | |
709 | -extern EFI_GUID gEfiSmbiosTableGuid; |
710 | |
711 | #endif |