[internal] align msapi_utf8.h to the one we use for libwdi

This commit is contained in:
Pete Batard 2018-07-28 11:59:44 +01:00
parent 038e835886
commit ff2548b559
2 changed files with 12 additions and 6 deletions

View file

@ -681,7 +681,13 @@ static __inline DWORD GetFileAttributesU(const char* lpFileName)
{
DWORD ret = 0xFFFFFFFF, err = ERROR_INVALID_DATA;
wconvert(lpFileName);
ret = GetFileAttributesW(wlpFileName);
// Unlike Microsoft's version, ours doesn't fail if the string is quoted
if ((wlpFileName[0] == L'"') && (wlpFileName[wcslen(wlpFileName) - 1] == L'"')) {
wlpFileName[wcslen(wlpFileName) - 1] = 0;
ret = GetFileAttributesW(&wlpFileName[1]);
} else {
ret = GetFileAttributesW(wlpFileName);
}
err = GetLastError();
wfree(lpFileName);
SetLastError(err);