diff options
author | Steve Lhomme <robux4@ycbcr.xyz> | 2022-09-19 13:21:12 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-09-20 11:51:05 +0200 |
commit | 7dfcd73350baed554caaa19f5522f1a5a98ec0bb (patch) | |
tree | 8b2ef9196a46db13099b26930cde737db2d03c38 /src | |
parent | ebf02df10deeddf22bec3915c034dfbd10624515 (diff) | |
download | flac-7dfcd73350baed554caaa19f5522f1a5a98ec0bb.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/share/grabbag/file.c | 8 |
1 files changed, 8 insertions, 0 deletions
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) |