Failed to find .sys file when converting qt version from 5.1.1 to 5.3
I have a project in QT version 5.1.1. I tried to check in this project if the OS version is windows 8.1 as I saw in this page http://qt-project.org/doc/qt-5/QSysInfo.html
But this check (of OS win 8.1) available only from QT 5.2. So I converted my QT version to the latest (5.3.1), but now I have a new problem, very strange problem:
In my project I check if specific file (.sys) in the “C:\Windows\System32\Drivers" is exist. I see that the file is exist but the
returns me false.
I try to look into the folder with:
QStringList list = folder.entryList(); @
And the function returned me only 7 files (.txt, .sys and etc.) when in the folder there is more than 50 files.
Can someone help me with that problem?
easy question: are you running your application as administrator?
Windows 8 has enforced the Windows 7 file protection so now you can only view protected content if you are administrator.
not-so-hard question: are you running 32-bit application on 64-bit windows? If so, please note that you might be redirected to the 32-bit version of System32, this being, C:/Windows/SysWOW64, where the file you're looking for might not exists.
thanks- actually i saw that i can see in my QT app only the files in the WOW64 folder. Do you know how can I canceling the default redirection to the WOW64 folder and stay in the system32 folder?
Kernel32.dll provides a function, Wow64DisableWow64FsRedirection, that disables the file system redirection, it is documented here:
It allows 32-bit applications to access directories meant for 64-bit only software. But obviously, this doesn't overcome the 32-bit limitations over 64-bit software (you may not load the 64-bit user32.dll from your 32-bit application). For your simple file check, it is going to work fine.
I'm not sure there exists any function for this ready-made in Qt, I think you may have to use the Windows SDK for this task.
Thank you! it works now...
I'm glad it works now. Remember to read-enable the FSredirection as soon as possible, or you're going to have more problems after.
Also, please note that this issue is not due to the port from qt 5.1.1 to 5.3.1, it is a behavior of all 32-bit apps on 64-bit windows.
Good luck :-)