QFileSystemEngine::id/Windows: Use the volume ID too
The MS documentation says that the high/low parts uniquely identify a file within a system, but they actually mean the filesystem. The details on how it's allocated make that clear. So we need the volume identifier. Change-Id: I658f552684924f8aa2cafffd14cfc03c5a09c0e9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
parent
3f18dadeeb
commit
c0bd7ade1a
@ -571,19 +571,21 @@ typedef struct _FILE_ID_INFO {
|
|||||||
// File ID for Windows up to version 7.
|
// File ID for Windows up to version 7.
|
||||||
static inline QByteArray fileId(HANDLE handle)
|
static inline QByteArray fileId(HANDLE handle)
|
||||||
{
|
{
|
||||||
QByteArray result;
|
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
BY_HANDLE_FILE_INFORMATION info;
|
BY_HANDLE_FILE_INFORMATION info;
|
||||||
if (GetFileInformationByHandle(handle, &info)) {
|
if (GetFileInformationByHandle(handle, &info)) {
|
||||||
result = QByteArray::number(uint(info.nFileIndexLow), 16);
|
char buffer[sizeof "01234567:0123456701234567"];
|
||||||
result += ':';
|
qsnprintf(buffer, sizeof(buffer), "%lx:%08lx%08lx",
|
||||||
result += QByteArray::number(uint(info.nFileIndexHigh), 16);
|
info.dwVolumeSerialNumber,
|
||||||
|
info.nFileIndexHigh,
|
||||||
|
info.nFileIndexLow);
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
#else // !Q_OS_WINRT
|
#else // !Q_OS_WINRT
|
||||||
Q_UNUSED(handle);
|
Q_UNUSED(handle);
|
||||||
Q_UNIMPLEMENTED();
|
Q_UNIMPLEMENTED();
|
||||||
#endif // Q_OS_WINRT
|
#endif // Q_OS_WINRT
|
||||||
return result;
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// File ID for Windows starting from version 8.
|
// File ID for Windows starting from version 8.
|
||||||
|
Loading…
Reference in New Issue
Block a user