From 7dfcd73350baed554caaa19f5522f1a5a98ec0bb Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 19 Sep 2022 13:21:12 +0200 Subject: don't call GetFileInformationByHandle on Universal Windows Platform builds It cannot be called: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle We can get the same information with GetFileInformationByHandleEx(FileIdInfo): https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex --- src/share/grabbag/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/share/grabbag/file.c b/src/share/grabbag/file.c index 3c4fd6a0..479a2e97 100644 --- a/src/share/grabbag/file.c +++ b/src/share/grabbag/file.c @@ -140,6 +140,7 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) h2 = CreateFile_utf8(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE) ok = 0; +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) ok &= GetFileInformationByHandle(h1, &info1); ok &= GetFileInformationByHandle(h2, &info2); if(ok) @@ -148,6 +149,13 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) info1.nFileIndexHigh == info2.nFileIndexHigh && info1.nFileIndexLow == info2.nFileIndexLow ; +#else // !WINAPI_PARTITION_DESKTOP + FILE_ID_INFO id_info1, id_info2; + same = GetFileInformationByHandleEx(h1, FileIdInfo, &id_info1, sizeof (id_info1)) && + GetFileInformationByHandleEx(h2, FileIdInfo, &id_info2, sizeof (id_info2)) && + id_info1.VolumeSerialNumber == id_info2.VolumeSerialNumber && + memcmp(&id_info1.FileId, &id_info2.FileId, sizeof(id_info1.FileId)) == 0; +#endif // !WINAPI_PARTITION_DESKTOP if(h1 != INVALID_HANDLE_VALUE) CloseHandle(h1); if(h2 != INVALID_HANDLE_VALUE) -- cgit v1.2.1