+ if (*(UINT16*)Buffer == gUnicodeFileTag) {\r
+ //\r
+ // For unicode files, skip displaying the byte order marker.\r
+ //\r
+ Buffer = ((UINT16*)Buffer) + 1;\r
+ LoopSize = (ReadSize / (sizeof (CHAR16))) - 1;\r
+ } else {\r
+ LoopSize = ReadSize / (sizeof (CHAR16));\r
+ }\r
+ \r
+ for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) {\r
+ //\r
+ // An invalid range of characters is 0x0-0x1F.\r
+ // Display "." when there is an invalid character.\r
+ //\r
+ Ucs2Char = CHAR_NULL;\r
+ Ucs2Char = ((CHAR16*)Buffer)[LoopVar];\r
+ if (Ucs2Char == '\r' || Ucs2Char == '\n') {\r
+ //\r
+ // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)\r
+ // characters to be displayed as is.\r
+ // \r
+ if (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r') {\r
+ //\r
+ // In case Line Feed (0xA) is encountered & Carriage Return (0xD)\r
+ // was not the previous character, print CR and LF. This is because\r
+ // Shell 2.0 requires carriage return with line feed for displaying\r
+ // each new line from left.\r
+ //\r
+ ShellPrintEx (-1, -1, L"\r\n");\r
+ continue;\r
+ }\r
+ } \r
+ else if (Ucs2Char < 0x20) {\r
+ //\r
+ // For all other characters which are not printable, display '.'\r
+ //\r
+ Ucs2Char = L'.';\r
+ }\r
+ ShellPrintEx (-1, -1, L"%c", Ucs2Char);\r
+ }\r
+ }\r
+\r
+ if (ShellGetExecutionBreakFlag()) {\r
+ break;\r