https://bugs.winehq.org/show_bug.cgi?id=40099
Bug ID: 40099 Summary: IFileOpenDialog with FOS_PICKFOLDERS option Product: Wine Version: 1.9.2 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: nozomimasao@gmail.com Distribution: ---
IFileOpenDialog sometimes returns a bad path if FOS_PICKFOLDERS option is specified.
for example, if you selected C:\Windows folder *inside* Windows folder, GetResult method returns C:\Windows\Windows.
Steps of the user: 1. Go inside C:\Windows by double-clicking Windows folder. 2. Click select button. Then the path will be C:\Windows\Windows.
*The user can avoid this issue by below steps. 1. Select C:\Windows by clicking Windows folder *without* going inside it. 2. Click select button. Then the path will be C:\Windows.
For your information, the code is like this;
IFileOpenDialog *fo = nullptr; CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&fo));
DWORD opt = 0; fo->GetOptions(&opt); fo->SetOptions(opt | FOS_PICKFOLDERS);
fo->Show(hWnd);
IShellItem *si = nullptr; fo->GetResult(&si);
LPWSTR path = nullptr; si->GetDisplayName(SIGDN_FILESYSPATH, &path);