https://bugs.winehq.org/show_bug.cgi?id=42469
Bug ID: 42469 Summary: GetOpenFileName should expand environment variables in lpstrInitialDir Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: comdlg32 Assignee: wine-bugs@winehq.org Reporter: kamil.hornicek@reactos.org Distribution: ---
Created attachment 57319 --> https://bugs.winehq.org/attachment.cgi?id=57319 testcase
When passing an environment variables such as %programfiles% to GetOpenFileName via lpstrInitialDir these get expanded in Windows 2000 / XP but not in Wine, where it fails the PathFileExistsW check in filedlg on line 1598 and is later set to null. I checked and the orignial dll imports ExpandEnvironmentStrings.
Attaching a minimal testcase and a possible solution.
https://bugs.winehq.org/show_bug.cgi?id=42469
--- Comment #1 from Kamil Hornicek kamil.hornicek@reactos.org --- Created attachment 57320 --> https://bugs.winehq.org/attachment.cgi?id=57320 possible fix
https://bugs.winehq.org/show_bug.cgi?id=42469
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |2.2
https://bugs.winehq.org/show_bug.cgi?id=42469
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Assignee|wine-bugs@winehq.org |bunglehead@gmail.com
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 57326 --> https://bugs.winehq.org/attachment.cgi?id=57326 patch
Hi, Kamil.
I can confirm this. I think it's better to do expansion earlier, so you don't need to make a copy of original path only to free it on dialog initialization. Does this work for you?
https://bugs.winehq.org/show_bug.cgi?id=42469
--- Comment #3 from Kamil Hornicek kamil.hornicek@reactos.org --- Hi and thanks for the quick reply! Your solution works, but GetFileDialog95A needs to be modified in the same way. I wasn't sure if it's preferable to do this earlier and don't allocate and free memory immediately, or duplicate the code in two places.
I should have clarified that both ANSI and Unicode versions of GetOpenFileName should expand env. variables.
https://bugs.winehq.org/show_bug.cgi?id=42469
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- Yes, it needs some cleanup in general. It already duplicates some bits, and it doesn't have to. I'll take a look.
https://bugs.winehq.org/show_bug.cgi?id=42469
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #57326|0 |1 is obsolete| |
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 57327 --> https://bugs.winehq.org/attachment.cgi?id=57327 patch2
Please try this one, it should work now for both A and W.
https://bugs.winehq.org/show_bug.cgi?id=42469
--- Comment #6 from Kamil Hornicek kamil.hornicek@reactos.org --- Perfect. Both A/U versions now work as expected. Thanks for your effort!
https://bugs.winehq.org/show_bug.cgi?id=42469
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #7 from winetest@luukku.com --- http://source.winehq.org/git/wine.git/commit/aef84332a2dc3a05a3e1b433158b2e9...
https://bugs.winehq.org/show_bug.cgi?id=42469
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |aef84332a2dc3a05a3e1b433158 | |b2e91abc48ed0 Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #8 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Marking as fixed
https://bugs.winehq.org/show_bug.cgi?id=42469
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|bunglehead@gmail.com |wine-bugs@winehq.org
https://bugs.winehq.org/show_bug.cgi?id=42469
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 2.3.
https://bugs.winehq.org/show_bug.cgi?id=42469
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.0.x
https://bugs.winehq.org/show_bug.cgi?id=42469
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.0.x |---
--- Comment #10 from Michael Stefaniuc mstefani@winehq.org --- Removing the 2.0.x milestone from bugs included in 2.0.1.