https://bugs.winehq.org/show_bug.cgi?id=45359
Bug ID: 45359 Summary: Kingdom Come: SHGetKnownFolderPath(FOLDERID_SavedGames) returns incorrect folder Product: Wine Version: 3.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: jaapbuurman@gmail.com Distribution: ---
Kingdom Come saves to the "C:/users/username/Saved Games/" folder on my Windows PC. However, on my Linux PC running Wine, it saves to the folder "C:/users/username/My Documents/" folder instead. Because Steam expects the save games in the first folder mentioned, the save games do not get synced to Steam's cloud.
I have contacted the Kingdom Come developers, which mentioned that they use SHGetKnownFolderPath(FOLDERID_SavedGames) function to fetch the path to the save game location. My Wine logging shows the following error:
00d8:fixme:shell:SHGetKnownFolderPath flags 0x0000a000 not supported
https://bugs.winehq.org/show_bug.cgi?id=45359
jaapbuurman@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |normal
https://bugs.winehq.org/show_bug.cgi?id=45359
jaapbuurman@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |ArchLinux
https://bugs.winehq.org/show_bug.cgi?id=45359
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- For me SHGetKnownFolderPath returns "C:\users\fabian\Saved Games" though.
Does the folder "C:/users/username/Saved Games/" exist on your system? Because if not, it might use some fallback.
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #2 from jaapbuurman@gmail.com --- Yes, that folder does exist in the Wine prefix I am using. Is there an easy way to run the SHGetKnownFolderPath command manually myself? Perhaps the information I got from Kingdom Come's developers is not accurate?
Or is it possible to up the verbosity of Wine's debugging to figure out what function call is being done by Kingdom Come?
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #3 from jaapbuurman@gmail.com --- Some additional information: I sent the error from the Wine logs back to Kingdom Come's developers and asked if that rang any bell. And this is the response that I received:
it does a ring a bell, flag 0x0000a000 is combination of KF_FLAG_CREATE|KF_FLAG_DONT_UNEXPAND
SHGetKnownFolderPath(FOLDERID_SavedGames, KF_FLAG_CREATE|KF_FLAG_DONT_UNEXPAND, NULL, &wMyDocumentsPath); // Make sure that the folder already exists or create it and apply security specified in folder definition // If folder can not be created then function will return failure and no folder path (IDList) will be returned // If folder is located on the network the function may take long time to execute KF_FLAG_CREATE = 0x00008000, // Set folder path as is and do not try to substitute parts of the path with environments variables. // If flag is not specified then Known Folder will try to replace parts of the path with some // known environment variables (%USERPROFILE%, %APPDATA% etc.) KF_FLAG_DONT_UNEXPAND = 0x00002000,
So perhaps the vanilla SHGetKnownFolderPath does work properly, but not with the flags they are using? And hence the failure the grab the correct "Saved Games" folder's path?
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #4 from jaapbuurman@gmail.com --- I forgot to mention: Their function call also has the My Documents folder as a fallback: &wMyDocumentsPath
Given the fact Wine's error complains about those flags, I assume it then simply evaluates the function to the fallback rather than getting the correct "Saved Games" folder, because it does not know how to handle those flags.
Am I correct in my thinking here?
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #5 from Fabian Maurer dark.shadow4@web.de --- Created attachment 61666 --> https://bugs.winehq.org/attachment.cgi?id=61666 Test case
Yes you're correct. I knew about the flags, I even looked them up, but of course I forget them in my tests...
You're right, when KF_FLAG_DONT_UNEXPAND is used as flag, wine simply returns an error.
Since you asked for it, attaching a test case.
https://bugs.winehq.org/show_bug.cgi?id=45359
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Kingdom Come: |SHGetKnownFolderPath |SHGetKnownFolderPath(FOLDER |doesn't handle flag |ID_SavedGames) returns |KF_FLAG_DONT_UNEXPAND |incorrect folder | Keywords| |testcase Component|-unknown |shell32 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #6 from Fabian Maurer dark.shadow4@web.de --- Also confirming issue and filling in fields
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #7 from jaapbuurman@gmail.com --- Should I compile and run that testcase? Or is that just for when a proposed fix is developed so we can test it?
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #8 from Fabian Maurer dark.shadow4@web.de --- This is only as answer to
Is there an easy way to run the SHGetKnownFolderPath command manually myself?
and for anyone who wants to test the issue. Only thing left is to make an actual fix.
https://bugs.winehq.org/show_bug.cgi?id=45359
jaapbuurman@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jaapbuurman@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #9 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Fabian Maurer from comment #8)
This is only as answer to
Is there an easy way to run the SHGetKnownFolderPath command manually myself?
and for anyone who wants to test the issue. Only thing left is to make an actual fix.
Isn't that what https://source.winehq.org/patches/data/147739 is about?
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #10 from Fabian Maurer dark.shadow4@web.de --- Yes indeed, didn't see that yet!
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #11 from jaapbuurman@gmail.com --- That's a very fortunate coincidence! Does Wine work with nightlies by any chance that have this commit already included? Or would I have to compile it myself manually to test this? And in which release would this commit be included most likely? 3.11?
https://bugs.winehq.org/show_bug.cgi?id=45359
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |ff7c2c51718e8f64c9b708847f3 | |a322bd136eb75 Status|NEW |RESOLVED
--- Comment #12 from Fabian Maurer dark.shadow4@web.de --- Yes, this is fixed in in wine-3.11 with https://source.winehq.org/git/wine.git/?a=commit;h=ff7c2c51718e8f64c9b708847...
https://bugs.winehq.org/show_bug.cgi?id=45359
--- Comment #13 from jaapbuurman@gmail.com --- Wine 3.11 just hit my distro's repository (Arch), and the bug is indeed fixed :) Kingdom Come now properly saves to the Saved Games folder and Steam is able to sync the save files. Thank you very much for patching this issue!
https://bugs.winehq.org/show_bug.cgi?id=45359
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.12.
https://bugs.winehq.org/show_bug.cgi?id=45359
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |3.0.x
https://bugs.winehq.org/show_bug.cgi?id=45359
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.0.x |---
--- Comment #15 from Michael Stefaniuc mstefani@winehq.org --- Removing the 3.0.x milestone from bugs included in 3.0.3.
https://bugs.winehq.org/show_bug.cgi?id=45359
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |holzminister@t-online.de
--- Comment #16 from Anastasius Focht focht@gmx.net --- *** Bug 45293 has been marked as a duplicate of this bug. ***