Bug 1496050 - Fallback to GetFileInformationByHandle if GetFileInformationByHandleEx failed. r=mhowell
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 04 Oct 2018 01:04:07 +0900
changeset 439475 831c1cae9dde0bd0f2eff1023fbe80afef8d8e8d
parent 439453 bd37a0888c5220dd112f9a887951303aa2389a41
child 439476 a351e7a11b2cadfd03f942e5f1e5f506011da08c
push id34776
push usernerli@mozilla.com
push dateThu, 04 Oct 2018 04:03:46 +0000
treeherdermozilla-central@8b1f1ebed0f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1496050
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496050 - Fallback to GetFileInformationByHandle if GetFileInformationByHandleEx failed. r=mhowell Since some filesystems do not support FileIdInfo, we can't assume that it will succeed even on Windows 8 or later.
widget/windows/WinHeaderOnlyUtils.h
--- a/widget/windows/WinHeaderOnlyUtils.h
+++ b/widget/windows/WinHeaderOnlyUtils.h
@@ -136,18 +136,21 @@ public:
   {
     return !((*this) == aOther);
   }
 
 private:
   void GetId(const nsAutoHandle& aFile)
   {
     if (IsWin8OrLater()) {
-      ::GetFileInformationByHandleEx(aFile.get(), FileIdInfo, &mId, sizeof(mId));
-      return;
+      if (::GetFileInformationByHandleEx(aFile.get(), FileIdInfo, &mId, sizeof(mId))) {
+        return;
+      }
+      // Only NTFS and ReFS support FileIdInfo. So we have to fallback if
+      // GetFileInformationByHandleEx failed.
     }
 
     BY_HANDLE_FILE_INFORMATION info = {};
     if (!::GetFileInformationByHandle(aFile.get(), &info)) {
       return;
     }
 
     mId.VolumeSerialNumber = info.dwVolumeSerialNumber;