Normalizes NT paths as returned by some low-level APIs. */
| 427 | |
| 428 | /* Normalizes NT paths as returned by some low-level APIs. */ |
| 429 | static wchar_t *normalize_ntpath(wchar_t *wbuf) |
| 430 | { |
| 431 | int i; |
| 432 | /* fix absolute path prefixes */ |
| 433 | if (wbuf[0] == '\\') { |
| 434 | /* strip NT namespace prefixes */ |
| 435 | if (!wcsncmp(wbuf, L"\\??\\", 4) || |
| 436 | !wcsncmp(wbuf, L"\\\\?\\", 4)) |
| 437 | wbuf += 4; |
| 438 | else if (!wcsnicmp(wbuf, L"\\DosDevices\\", 12)) |
| 439 | wbuf += 12; |
| 440 | /* replace remaining '...UNC\' with '\\' */ |
| 441 | if (!wcsnicmp(wbuf, L"UNC\\", 4)) { |
| 442 | wbuf += 2; |
| 443 | *wbuf = '\\'; |
| 444 | } |
| 445 | } |
| 446 | /* convert backslashes to slashes */ |
| 447 | for (i = 0; wbuf[i]; i++) |
| 448 | if (wbuf[i] == '\\') |
| 449 | wbuf[i] = '/'; |
| 450 | return wbuf; |
| 451 | } |
| 452 | |
| 453 | /* |
| 454 | * Use SetFileInformationByHandle(FileDispositionInfo) to force legacy |
no outgoing calls
no test coverage detected