| 68 | } |
| 69 | |
| 70 | static int WindowsPath_isDriveAbsolute(const wchar_t* data, int length) { |
| 71 | return length >= 3 && WindowsPath_isDriveLetter(data[0]) && data[1] == L':' && data[2] == L'\\'; |
| 72 | } |
| 73 | |
| 74 | static int WindowsPath_stripTransportPrefix(wchar_t* logicalPath, int* logicalLength) { |
| 75 | int length = *logicalLength; |
| 76 | int hasWin32Prefix = |
| 77 | length >= 4 && logicalPath[0] == L'\\' && logicalPath[1] == L'\\' && logicalPath[2] == L'?' && |
| 78 | logicalPath[3] == L'\\'; |
| 79 | int hasNtPrefix = |
| 80 | length >= 4 && logicalPath[0] == L'\\' && logicalPath[1] == L'?' && logicalPath[2] == L'?' && |
| 81 | logicalPath[3] == L'\\'; |
| 82 | if (hasWin32Prefix || hasNtPrefix) { |
| 83 | if (length >= 8 && (logicalPath[4] == L'U' || logicalPath[4] == L'u') && |
| 84 | (logicalPath[5] == L'N' || logicalPath[5] == L'n') && |
| 85 | (logicalPath[6] == L'C' || logicalPath[6] == L'c') && logicalPath[7] == L'\\') { |
| 86 | if (!WindowsPath_hasUNCServerAndShare(logicalPath + 8, length - 8)) return 0; |
| 87 | memmove(logicalPath + 2, logicalPath + 8, (size_t)(length - 8 + 1) * sizeof(wchar_t)); |
| 88 | logicalPath[0] = L'\\'; |
| 89 | logicalPath[1] = L'\\'; |
| 90 | *logicalLength = length - 6; |
| 91 | return 1; |
| 92 | } |
| 93 | if (length >= 7 && WindowsPath_isDriveLetter(logicalPath[4]) && logicalPath[5] == L':' && |
| 94 | logicalPath[6] == L'\\') { |
| 95 | memmove(logicalPath, logicalPath + 4, (size_t)(length - 4 + 1) * sizeof(wchar_t)); |
| 96 | *logicalLength = length - 4; |
| 97 | return 1; |
| 98 | } |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | if (length >= 3 && logicalPath[0] == L'\\' && logicalPath[1] == L'\\' && logicalPath[2] == L'?') return 0; |
| 103 | if (length >= 3 && logicalPath[0] == L'\\' && logicalPath[1] == L'?' && logicalPath[2] == L'?') return 0; |
| 104 | return 1; |
no test coverage detected