Qt Application loading Qt DLLs from OneDrive installation
-
@JKSH I think you are correct that this is not looking like a Qt issue. Depending on what the root cause is, potentially this might still be of interest to Qt developers working on Windows. I will report back if I get to the bottom of it.
Some things to note are that this has only recently started to happen, I have now had a second report from a different user, and nothing has changed in my application or in our Qt installation recently. I wonder if perhaps a OneDrive change is being rolled out that is causing this.
@Bob64 said in Qt Application loading Qt DLLs from OneDrive installation:
Some things to note are that this has only recently started to happen, I have now had a second report from a different user, and nothing has changed in my application or in our Qt installation recently. I wonder if perhaps a OneDrive change is being rolled out that is causing this.
Hmm... that doesn't sound good. I'll keep an eye out for cases too.
Please do let us know if you uncover any clues
-
Hi, note that your qt.conf file is immaterial for this problem (it's used for plugins, translations etc. but not for loading .dlls)
Just guessing, but perhaps your user is logged in to OneDrive, so injects its shell dll (FileSyncShell.dll) into your process and puts its directory C:\Users<username>\AppData\Local\Microsoft\OneDrive\21.150.0725.0001 into the PATH setting of your process.
I think you need to do as @ChrisW67 says, copy all the Qt*.dlls into the same directory as your .exe file.
Or rebuild your app into a static version of Qt, i.e. with no dependencies of any Qt dlls. -
Hi, note that your qt.conf file is immaterial for this problem (it's used for plugins, translations etc. but not for loading .dlls)
Just guessing, but perhaps your user is logged in to OneDrive, so injects its shell dll (FileSyncShell.dll) into your process and puts its directory C:\Users<username>\AppData\Local\Microsoft\OneDrive\21.150.0725.0001 into the PATH setting of your process.
I think you need to do as @ChrisW67 says, copy all the Qt*.dlls into the same directory as your .exe file.
Or rebuild your app into a static version of Qt, i.e. with no dependencies of any Qt dlls.@hskoglund said in Qt Application loading Qt DLLs from OneDrive installation:
Just guessing, but perhaps your user is logged in to OneDrive, so injects its shell dll (FileSyncShell.dll) into your process and puts its directory C:\Users<username>\AppData\Local\Microsoft\OneDrive\21.150.0725.0001 into the PATH setting of your process.
Interesting. I'm logged into OneDrive but I don't think I have Qt DLL Hell.
My OneDrive installation (and Qt DLLs) are at C:\Program Files (x86)\Microsoft OneDrive\21.150.0725.0001 though; I wonder if that makes a difference.
-
@hskoglund said in Qt Application loading Qt DLLs from OneDrive installation:
Just guessing, but perhaps your user is logged in to OneDrive, so injects its shell dll (FileSyncShell.dll) into your process and puts its directory C:\Users<username>\AppData\Local\Microsoft\OneDrive\21.150.0725.0001 into the PATH setting of your process.
Interesting. I'm logged into OneDrive but I don't think I have Qt DLL Hell.
My OneDrive installation (and Qt DLLs) are at C:\Program Files (x86)\Microsoft OneDrive\21.150.0725.0001 though; I wonder if that makes a difference.
@JKSH said in Qt Application loading Qt DLLs from OneDrive installation:
My OneDrive installation (and Qt DLLs) are at C:\Program Files (x86)\Microsoft OneDrive\21.150.0725.0001 though; I wonder if that makes a difference.
Mine is the same and I do not see this issue. I have sent out an email to see if I can gather any clues as to whether there is any pattern to it.
-
Hmm, I just logged in to OneDrive to test it, and for me it installed in C:\Users\Henry\AppData\Local\Microsoft\OneDrive\21.150.0725.0001
In that directory there are one .exe file that loads Qt dlls: (OneDriveSetup.exe but that is the installer) and one dll: FileSyncViews.dll that also loads the Qt dlls.I tried to provoke Qt dll hell but to no avail :-(
I can see that Windows File explorer gets injected with that OneDrive dll when you log in to OneDrive, but a simple Hello World Qt program does not.Perhaps in your Qt app you have some browsing/file open support that causes OneDrive to be loaded (because it pretends to be an extra disk drive)?
-
Hi, note that your qt.conf file is immaterial for this problem (it's used for plugins, translations etc. but not for loading .dlls)
Just guessing, but perhaps your user is logged in to OneDrive, so injects its shell dll (FileSyncShell.dll) into your process and puts its directory C:\Users<username>\AppData\Local\Microsoft\OneDrive\21.150.0725.0001 into the PATH setting of your process.
I think you need to do as @ChrisW67 says, copy all the Qt*.dlls into the same directory as your .exe file.
Or rebuild your app into a static version of Qt, i.e. with no dependencies of any Qt dlls.@hskoglund Yes, you are correct about qt.conf. I should not have mentioned that.
I am logged into OneDrive myself and I do not see this issue. I have obtained from the affected user a Process Monitor log and am able to examine the environment of the process. The OneDrive directory is not injected into the PATH. There is some other mechanism going on somewhere.
Moving Qt DLLs or static linking would not be ideal. My company had a big push a few years ago to rationalise the third party dependencies of our different software products to reduce the overall footprint. Hence the common Qt package that all products are meant to share.
-
Sorry forgot to mention: ask your users with this problem to try to turn of their antivirus program, it could be the antivirus program that tries to browse all connected drives (including OneDrive) for malware and thus causes that OneDrive dll to be injected (just a guess)
-
@hskoglund it's an interesting theory about antivirus but I have never heard of anything like that before (AV injecting into DLL search path). In my experience, AV effects tend to be more intermittent and random than we are seeing and usually cause issues when applications are trying to access files at the same time as the AV.
Anyway, I am now seeing the same issue myself which in a way is good news as I might be able to make more progress on my own machine in diagnosing the issue.
-
@hskoglund it's an interesting theory about antivirus but I have never heard of anything like that before (AV injecting into DLL search path). In my experience, AV effects tend to be more intermittent and random than we are seeing and usually cause issues when applications are trying to access files at the same time as the AV.
Anyway, I am now seeing the same issue myself which in a way is good news as I might be able to make more progress on my own machine in diagnosing the issue.
@Bob64 said in Qt Application loading Qt DLLs from OneDrive installation:
Anyway, I am now seeing the same issue myself which in a way is good news as I might be able to make more progress on my own machine in diagnosing the issue.
Sounds like a way forward.
Please keep us posted!
-
Subsequent to my last post, I found that OneDrive had been updated on my machine the night before I started to see the issue.
One thing I did notice in Process Explorer was that OneDrive was appearing as a root process, with explorer as a child and then any Qt-based apps I launched were parented to explorer. I am not sure whether this provides an explanation as to why the OneDrive Qt DLLs were being preferentially loaded. As far as I am aware, the fact that a parent process has loaded a DLL from a particular location should not affect the child process, unless the load location is based on an inherited PATH (not the case here).
I found that a reboot was sufficient to resolve the problem. Following the reboot, I did not see the process structure described above on launching applications.
Although I have not been able to obtain definitive evidence, we suspect that the other people affected had recently received earlier OneDrive updates.
The conclusion appears to be that a OneDrive update without a reboot can leave ones machine in a somewhat odd state and, because the OneDrive client uses Qt, it can have a particular impact on Qt-based applications. The fact that it has happened to three different people in my organisation so far suggests that it could happen quite easily. Hopefully, a reboot will always resolve it if it happens.