2 * Implementation of IShellBrowser for the File Open common dialog
4 * Copyright 1999 Francois Boisvert
5 * Copyright 1999, 2000 Juergen Schmied
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
34 #define NO_SHLWAPI_STREAM
36 #include "filedlgbrowser.h"
39 #include "wine/obj_serviceprovider.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
47 ICOM_VTABLE(IShellBrowser) * lpVtbl;
48 ICOM_VTABLE(ICommDlgBrowser) * lpVtblCommDlgBrowser;
49 ICOM_VTABLE(IServiceProvider)* lpVtblServiceProvider;
50 DWORD ref; /* Reference counter */
51 HWND hwndOwner; /* Owner dialog of the interface */
55 /**************************************************************************
58 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl;
59 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl;
60 static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl;
62 /**************************************************************************
66 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
68 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
71 /**************************************************************************
74 extern const char *FileOpenDlgInfosStr;
76 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
77 extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
78 extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
79 extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl);
80 extern LPITEMIDLIST GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
82 extern BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
83 LPITEMIDLIST pidlCurrentFolder,
86 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
87 extern BOOL FILEDLG95_OnOpen(HWND hwnd);
88 extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
95 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos)
97 char lpstrPath[MAX_PATH];
98 if(SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath)) {
99 SetCurrentDirectoryA(lpstrPath);
100 TRACE("new current folder %s\n", lpstrPath);
104 /* copied from shell32 to avoid linking to it */
105 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
107 TRACE("dest=%p len=0x%lx strret=%p pidl=%p stub\n",dest,len,src,pidl);
112 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
113 COMDLG32_SHFree(src->u.pOleStr);
117 if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len ))
118 ((LPWSTR)dest)[len-1] = 0;
124 if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset,
125 -1, (LPWSTR)dest, len ))
126 ((LPWSTR)dest)[len-1] = 0;
131 FIXME("unknown type!\n");
133 { *(LPWSTR)dest = '\0';
144 /**************************************************************************
145 * IShellBrowserImpl_Construct
147 IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
149 IShellBrowserImpl *sb;
150 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
152 sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
154 /* Initialisation of the member variables */
156 sb->hwndOwner = hwndOwner;
158 /* Initialisation of the vTables */
159 sb->lpVtbl = &IShellBrowserImpl_Vtbl;
160 sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
161 sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl;
162 SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
163 &fodInfos->ShellInfos.pidlAbsCurrent);
167 return (IShellBrowser *) sb;
170 /***************************************************************************
171 * IShellBrowserImpl_QueryInterface
173 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
177 ICOM_THIS(IShellBrowserImpl, iface);
179 TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
183 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
186 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/
187 { *ppvObj = (IOleWindow*)This;
190 else if(IsEqualIID(riid, &IID_IShellBrowser)) /*IShellBrowser*/
191 { *ppvObj = (IShellBrowser*)This;
194 else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
195 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblCommDlgBrowser);
198 else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */
199 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblServiceProvider);
203 { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
206 FIXME("Unknown interface requested\n");
207 return E_NOINTERFACE;
210 /**************************************************************************
211 * IShellBrowser::AddRef
213 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
215 ICOM_THIS(IShellBrowserImpl, iface);
217 TRACE("(%p,%lu)\n", This, This->ref);
219 return ++(This->ref);
222 /**************************************************************************
223 * IShellBrowserImpl_Release
225 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
227 ICOM_THIS(IShellBrowserImpl, iface);
229 TRACE("(%p,%lu)\n", This, This->ref);
233 COMDLG32_SHFree(This);
234 TRACE("-- destroyed\n");
244 /**************************************************************************
245 * IShellBrowserImpl_GetWindow (IOleWindow)
247 * Inherited from IOleWindow::GetWindow
249 * See Windows documentation for more details
251 * Note : We will never be window less in the File Open dialog
254 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
257 ICOM_THIS(IShellBrowserImpl, iface);
259 TRACE("(%p)\n", This);
264 *phwnd = This->hwndOwner;
266 return (*phwnd) ? S_OK : E_UNEXPECTED;
270 /**************************************************************************
271 * IShellBrowserImpl_ContextSensitiveHelp
273 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
276 ICOM_THIS(IShellBrowserImpl, iface);
278 TRACE("(%p)\n", This);
280 /* Feature not implemented */
288 /**************************************************************************
289 * IShellBrowserImpl_BrowseObject
291 * See Windows documentation on IShellBrowser::BrowseObject for more details
293 * This function will override user specified flags and will always
294 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
296 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
301 IShellFolder *psfTmp;
303 FileOpenDlgInfos *fodInfos;
304 LPITEMIDLIST pidlTmp;
309 ICOM_THIS(IShellBrowserImpl, iface);
311 TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags,
312 (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" :
313 (wFlags & SBSP_PARENT) ? "SBSP_PARENT" :
314 (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????");
316 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
318 /* Format the pidl according to its parameter's category */
319 if(wFlags & SBSP_RELATIVE)
322 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
323 if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
324 pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
326 ERR("bind to object failed\n");
329 /* create an absolute pidl */
330 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
333 else if(wFlags & SBSP_PARENT)
335 /* Browse the parent folder (ignores the pidl) */
336 pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
337 psfTmp = GetShellFolderFromPidl(pidlTmp);
340 else /* SBSP_ABSOLUTE is 0x0000 */
342 /* An absolute pidl (relative from the desktop) */
343 pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
344 psfTmp = GetShellFolderFromPidl(pidlTmp);
349 ERR("could not browse to folder\n");
353 /* If the pidl to browse to is equal to the actual pidl ...
354 do nothing and pretend you did it*/
355 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
357 IShellFolder_Release(psfTmp);
358 COMDLG32_SHFree(pidlTmp);
359 TRACE("keep current folder\n");
363 /* Release the current DataObject */
364 if (fodInfos->Shell.FOIDataObject)
366 IDataObject_Release(fodInfos->Shell.FOIDataObject);
367 fodInfos->Shell.FOIDataObject = NULL;
370 /* Create the associated view */
371 TRACE("create view object\n");
372 if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
373 &IID_IShellView, (LPVOID *)&psvTmp))) goto error;
375 /* Check if listview has focus */
376 bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
378 /* Get the foldersettings from the old view */
379 if(fodInfos->Shell.FOIShellView)
380 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
382 /* Release the old fodInfos->Shell.FOIShellView and update its value.
383 We have to update this early since ShellView_CreateViewWindow of native
384 shell32 calls OnStateChange and needs the correct view here.*/
385 if(fodInfos->Shell.FOIShellView)
387 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
388 IShellView_Release(fodInfos->Shell.FOIShellView);
390 fodInfos->Shell.FOIShellView = psvTmp;
392 /* Release old FOIShellFolder and update its value */
393 if (fodInfos->Shell.FOIShellFolder)
394 IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
395 fodInfos->Shell.FOIShellFolder = psfTmp;
397 /* Release old pidlAbsCurrent and update its value */
398 COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
399 fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
401 COMDLG32_UpdateCurrentDir(fodInfos);
403 /* Create the window */
404 TRACE("create view window\n");
405 if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
406 &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
407 &fodInfos->ShellInfos.rectView, &hwndView))) goto error;
409 fodInfos->ShellInfos.hwndView = hwndView;
411 /* Select the new folder in the Look In combo box of the Open file dialog */
412 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
414 /* changes the tab order of the ListView to reflect the window's File Dialog */
415 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
416 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
418 /* Since we destroyed the old view if it had focus set focus to the newly created view */
420 SetFocus(fodInfos->ShellInfos.hwndView);
424 ERR("Failed with error 0x%08lx\n", hRes);
428 /**************************************************************************
429 * IShellBrowserImpl_EnableModelessSB
431 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
435 ICOM_THIS(IShellBrowserImpl, iface);
437 TRACE("(%p)\n", This);
439 /* Feature not implemented */
443 /**************************************************************************
444 * IShellBrowserImpl_GetControlWindow
446 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
451 ICOM_THIS(IShellBrowserImpl, iface);
453 TRACE("(%p)\n", This);
455 /* Feature not implemented */
458 /**************************************************************************
459 * IShellBrowserImpl_GetViewStateStream
461 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
466 ICOM_THIS(IShellBrowserImpl, iface);
468 FIXME("(%p 0x%08lx %p)\n", This, grfMode, ppStrm);
470 /* Feature not implemented */
473 /**************************************************************************
474 * IShellBrowserImpl_InsertMenusSB
476 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
478 LPOLEMENUGROUPWIDTHS lpMenuWidths)
481 ICOM_THIS(IShellBrowserImpl, iface);
483 TRACE("(%p)\n", This);
485 /* Feature not implemented */
488 /**************************************************************************
489 * IShellBrowserImpl_OnViewWindowActive
491 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
495 ICOM_THIS(IShellBrowserImpl, iface);
497 TRACE("(%p)\n", This);
499 /* Feature not implemented */
502 /**************************************************************************
503 * IShellBrowserImpl_QueryActiveShellView
505 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
509 ICOM_THIS(IShellBrowserImpl, iface);
511 FileOpenDlgInfos *fodInfos;
513 TRACE("(%p)\n", This);
515 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
517 if(!(*ppshv = fodInfos->Shell.FOIShellView))
521 IShellView_AddRef(fodInfos->Shell.FOIShellView);
524 /**************************************************************************
525 * IShellBrowserImpl_RemoveMenusSB
527 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
531 ICOM_THIS(IShellBrowserImpl, iface);
533 TRACE("(%p)\n", This);
535 /* Feature not implemented */
538 /**************************************************************************
539 * IShellBrowserImpl_SendControlMsg
541 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
549 ICOM_THIS(IShellBrowserImpl, iface);
552 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
557 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
560 FIXME("ctrl id: %x\n", id);
563 if (pret) *pret = lres;
566 /**************************************************************************
567 * IShellBrowserImpl_SetMenuSB
569 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
571 HOLEMENU holemenuReserved,
572 HWND hwndActiveObject)
575 ICOM_THIS(IShellBrowserImpl, iface);
577 TRACE("(%p)\n", This);
579 /* Feature not implemented */
582 /**************************************************************************
583 * IShellBrowserImpl_SetStatusTextSB
585 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
586 LPCOLESTR lpszStatusText)
589 ICOM_THIS(IShellBrowserImpl, iface);
591 TRACE("(%p)\n", This);
593 /* Feature not implemented */
596 /**************************************************************************
597 * IShellBrowserImpl_SetToolbarItems
599 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
600 LPTBBUTTON lpButtons,
605 ICOM_THIS(IShellBrowserImpl, iface);
607 TRACE("(%p)\n", This);
609 /* Feature not implemented */
612 /**************************************************************************
613 * IShellBrowserImpl_TranslateAcceleratorSB
615 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
620 ICOM_THIS(IShellBrowserImpl, iface);
622 TRACE("(%p)\n", This);
624 /* Feature not implemented */
628 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
630 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
632 IShellBrowserImpl_QueryInterface,
633 IShellBrowserImpl_AddRef,
634 IShellBrowserImpl_Release,
636 IShellBrowserImpl_GetWindow,
637 IShellBrowserImpl_ContextSensitiveHelp,
639 IShellBrowserImpl_InsertMenusSB,
640 IShellBrowserImpl_SetMenuSB,
641 IShellBrowserImpl_RemoveMenusSB,
642 IShellBrowserImpl_SetStatusTextSB,
643 IShellBrowserImpl_EnableModelessSB,
644 IShellBrowserImpl_TranslateAcceleratorSB,
645 IShellBrowserImpl_BrowseObject,
646 IShellBrowserImpl_GetViewStateStream,
647 IShellBrowserImpl_GetControlWindow,
648 IShellBrowserImpl_SendControlMsg,
649 IShellBrowserImpl_QueryActiveShellView,
650 IShellBrowserImpl_OnViewWindowActive,
651 IShellBrowserImpl_SetToolbarItems
660 /***************************************************************************
661 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
663 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
664 ICommDlgBrowser *iface,
668 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
670 TRACE("(%p)\n", This);
672 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
675 /**************************************************************************
676 * IShellBrowserImpl_ICommDlgBrowser_AddRef
678 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface)
680 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
682 TRACE("(%p)\n", This);
684 return IShellBrowserImpl_AddRef(This);
687 /**************************************************************************
688 * IShellBrowserImpl_ICommDlgBrowser_Release
690 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface)
692 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
694 TRACE("(%p)\n", This);
696 return IShellBrowserImpl_Release(This);
698 /**************************************************************************
699 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
701 * Called when a user double-clicks in the view or presses the ENTER key
703 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
707 FileOpenDlgInfos *fodInfos;
709 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
711 TRACE("(%p)\n", This);
713 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
715 /* If the selected object is not a folder, send a IDOK command to parent window */
716 if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
720 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
721 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
722 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
724 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
728 /* Tell the dialog that the user selected a file */
729 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
732 /* Free memory used by pidl */
733 COMDLG32_SHFree((LPVOID)pidl);
741 /**************************************************************************
742 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
744 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
749 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
751 TRACE("(%p shv=%p)\n", This, ppshv);
755 case CDBOSC_SETFOCUS:
756 /* FIXME: Reset the default button.
757 This should be taken care of by defdlg. If control
758 other than button receives focus the default button
759 should be restored. */
760 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
763 case CDBOSC_KILLFOCUS:
765 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
766 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
767 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
770 case CDBOSC_SELCHANGE:
771 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
780 /**************************************************************************
781 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
783 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
787 FileOpenDlgInfos *fodInfos;
790 WCHAR szPathW[MAX_PATH];
792 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
794 TRACE("(%p)\n", This);
796 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
798 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
799 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
801 if( (ulAttr & SFGAO_HIDDEN) /* hidden */
802 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
805 /* always include directories and links */
806 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
809 /* Check if there is a mask to apply if not */
810 if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
813 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
815 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
817 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
825 /**************************************************************************
826 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
828 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
830 FileOpenDlgInfos *fodInfos;
832 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
834 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
835 TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
837 /* release old selections */
838 if (fodInfos->Shell.FOIDataObject)
839 IDataObject_Release(fodInfos->Shell.FOIDataObject);
841 /* get a new DataObject from the ShellView */
842 if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
843 &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
846 FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
848 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
852 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
854 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
856 IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
857 IShellBrowserImpl_ICommDlgBrowser_AddRef,
858 IShellBrowserImpl_ICommDlgBrowser_Release,
859 /* ICommDlgBrowser */
860 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
861 IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
862 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
872 /***************************************************************************
873 * IShellBrowserImpl_IServiceProvider_QueryInterface
875 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
876 IServiceProvider *iface,
880 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
882 FIXME("(%p)\n", This);
884 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
887 /**************************************************************************
888 * IShellBrowserImpl_IServiceProvider_AddRef
890 ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
892 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
894 FIXME("(%p)\n", This);
896 return IShellBrowserImpl_AddRef(This);
899 /**************************************************************************
900 * IShellBrowserImpl_IServiceProvider_Release
902 ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
904 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
906 FIXME("(%p)\n", This);
908 return IShellBrowserImpl_Release(This);
911 /**************************************************************************
912 * IShellBrowserImpl_IServiceProvider_Release
915 * the w2k shellview asks for (guidService = SID_STopLevelBrowser,
916 * riid = IShellBrowser) to call SendControlMsg ().
922 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
923 IServiceProvider * iface,
928 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
930 FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
933 if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
935 return IShellBrowserImpl_QueryInterface(This,riid,ppv);
937 FIXME("(%p) unknown interface requested\n", This);
938 return E_NOINTERFACE;
942 static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl =
944 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
946 IShellBrowserImpl_IServiceProvider_QueryInterface,
947 IShellBrowserImpl_IServiceProvider_AddRef,
948 IShellBrowserImpl_IServiceProvider_Release,
949 /* IServiceProvider */
950 IShellBrowserImpl_IServiceProvider_QueryService