diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index ef97d67653..5ee5e1c554 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -589,13 +589,16 @@ QFile::rename(const QString &newName)
     // Note: this does not take file engines into account.
     bool changingCase = false;
     QByteArray targetId = QFileSystemEngine::id(QFileSystemEntry(newName));
+    qDebug() << __FUNCTION__ << newName << "targetId=" << targetId;
     if (!targetId.isNull()) {
         QByteArray fileId = d->fileEngine ?
                     d->fileEngine->id() :
                     QFileSystemEngine::id(QFileSystemEntry(d->fileName));
         changingCase = (fileId == targetId && d->fileName.compare(newName, Qt::CaseInsensitive) == 0);
+        qDebug() << __FUNCTION__ << newName << "changingCase=" << changingCase << "fileId=" << fileId;
         if (!changingCase) {
             d->setError(QFile::RenameError, tr("Destination file exists"));
+            qDebug() << __FUNCTION__ << "Exists!";
             return false;
         }
 
@@ -639,6 +642,7 @@ QFile::rename(const QString &newName)
     }
     unsetError();
     close();
+    qDebug() << __FUNCTION__ << "changingCase=" << changingCase;
     if(error() == QFile::NoError) {
         if (changingCase ? d->engine()->renameOverwrite(newName) : d->engine()->rename(newName)) {
             unsetError();
@@ -655,6 +659,7 @@ QFile::rename(const QString &newName)
 
         QFile out(newName);
         if (open(QIODevice::ReadOnly)) {
+            qDebug() << __FUNCTION__ << "falling back to QFile copy";
             if (out.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
                 bool error = false;
                 char block[4096];
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 3f4b46573b..687aad3e96 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -558,6 +558,7 @@ typedef struct _FILE_ID_INFO {
 // File ID for Windows up to version 7.
 static inline QByteArray fileId(HANDLE handle)
 {
+   qDebug() << __FUNCTION__ << handle;
 #ifndef Q_OS_WINRT
     BY_HANDLE_FILE_INFORMATION info;
     if (GetFileInformationByHandle(handle, &info)) {
@@ -578,6 +579,7 @@ static inline QByteArray fileId(HANDLE handle)
 // File ID for Windows starting from version 8.
 QByteArray fileIdWin8(HANDLE handle)
 {
+    qDebug() << __FUNCTION__ << handle;
 #if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)
     QByteArray result;
     FILE_ID_INFO infoEx;
@@ -588,6 +590,9 @@ QByteArray fileIdWin8(HANDLE handle)
         result += ':';
         // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
         result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex();
+    } else {
+        qErrnoWarning("GetFileInformationByHandleEx failed!");
+
     }
     return result;
 #else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
@@ -598,6 +603,7 @@ QByteArray fileIdWin8(HANDLE handle)
 //static
 QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
 {
+    qDebug() << __FUNCTION__ << entry.filePath();
     QByteArray result;
 
 #ifndef Q_OS_WINRT
@@ -618,8 +624,12 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
                     FILE_SHARE_READ, OPEN_EXISTING, &params);
 #endif // Q_OS_WINRT
     if (handle != INVALID_HANDLE_VALUE) {
+        qDebug() << __FUNCTION__ << "handle=" << handle;
         result = id(handle);
         CloseHandle(handle);
+    } else   {
+        qErrnoWarning("CreateFile failed!");
+
     }
     return result;
 }
@@ -627,7 +637,9 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
 //static
 QByteArray QFileSystemEngine::id(HANDLE fHandle)
 {
-    return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
+    bool win8 = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8
+            && !qEnvironmentVariableIsSet("win7");
+    return win8 ?
                 fileIdWin8(HANDLE(fHandle)) : fileId(HANDLE(fHandle));
 }
 
@@ -1373,6 +1385,7 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy
 #ifndef Q_OS_WINRT
     bool ret = ::MoveFile((wchar_t*)source.nativeFilePath().utf16(),
                           (wchar_t*)target.nativeFilePath().utf16()) != 0;
+    qDebug() << __FUNCTION__ << ret << source.nativeFilePath() << target.nativeFilePath();
 #else // !Q_OS_WINRT
     bool ret = ::MoveFileEx((const wchar_t*)source.nativeFilePath().utf16(),
                             (const wchar_t*)target.nativeFilePath().utf16(), 0) != 0;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 19cc3e6402..3bfdfba76f 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -465,16 +465,19 @@ bool QFSFileEngine::copy(const QString &copyName)
 
 bool QFSFileEngine::rename(const QString &newName)
 {
+    qDebug() << __FUNCTION__ << newName;
     Q_D(QFSFileEngine);
     QSystemError error;
     bool ret = QFileSystemEngine::renameFile(d->fileEntry, QFileSystemEntry(newName), error);
     if (!ret)
         setError(QFile::RenameError, error.toString());
+    qDebug() << __FUNCTION__ << "rets" << ret;
     return ret;
 }
 
 bool QFSFileEngine::renameOverwrite(const QString &newName)
 {
+    qDebug() << __FUNCTION__ << newName;
     Q_D(QFSFileEngine);
     QSystemError error;
     bool ret = QFileSystemEngine::renameOverwriteFile(d->fileEntry, QFileSystemEntry(newName), error);
