Aptio UEFI returns File DevPath as 2 nodes (dir, file) and DevicePathToStr connects them with /, but we need '\\'
| 1642 | // Aptio UEFI returns File DevPath as 2 nodes (dir, file) |
| 1643 | // and DevicePathToStr connects them with /, but we need '\\' |
| 1644 | XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath) |
| 1645 | { |
| 1646 | CHAR16 *FilePath; |
| 1647 | CHAR16 *Char; |
| 1648 | CONST CHAR16 *Tail; |
| 1649 | |
| 1650 | FilePath = ConvertDevicePathToText(DevPath, TRUE, TRUE); |
| 1651 | // fix / into '\\' |
| 1652 | if (FilePath != NULL) { |
| 1653 | for (Char = FilePath; *Char != L'\0'; Char++) { |
| 1654 | if (*Char == L'/') { |
| 1655 | *Char = L'\\'; |
| 1656 | } |
| 1657 | } |
| 1658 | } |
| 1659 | // "\\\\" into '\\' |
| 1660 | Char = (CHAR16*)StrStr(FilePath, L"\\\\"); // cast is ok because FilePath is not const, and we know that StrStr returns a pointer in FilePath. Will disappear when using a string object instead of CHAR16* |
| 1661 | while (Char != NULL) { |
| 1662 | // StrCpyS(Char, 4, Char + 1); //can't overlap |
| 1663 | Tail = Char + 1; |
| 1664 | while (*Char != 0) { |
| 1665 | *(Char++) = *(Tail++); |
| 1666 | } |
| 1667 | Char = (CHAR16*)StrStr(FilePath, L"\\\\"); // cast is ok because FilePath is not const, and we know that StrStr returns a pointer in FilePath. Will disappear when using a string object instead of CHAR16* |
| 1668 | } |
| 1669 | XStringW returnValue; |
| 1670 | returnValue.stealValueFrom(FilePath); // do not FreePool FilePath, it's now owned by returnValue |
| 1671 | return returnValue; |
| 1672 | } |
| 1673 | |
| 1674 | XStringW FileDevicePathFileToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath) |
| 1675 | { |
no test coverage detected