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
32 #define NO_SHLWAPI_STREAM
34 #include "filedlgbrowser.h"
37 #include "wine/obj_serviceprovider.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
45 ICOM_VTABLE(IShellBrowser) * lpVtbl;
46 ICOM_VTABLE(ICommDlgBrowser) * lpVtblCommDlgBrowser;
47 ICOM_VTABLE(IServiceProvider)* lpVtblServiceProvider;
48 DWORD ref; /* Reference counter */
49 HWND hwndOwner; /* Owner dialog of the interface */
53 /**************************************************************************
56 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl;
57 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl;
58 static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl;
60 /**************************************************************************
64 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
66 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
69 /**************************************************************************
72 extern const char *FileOpenDlgInfosStr;
74 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
75 extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
76 extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
77 extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl);
78 extern LPITEMIDLIST GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
80 extern BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
81 LPITEMIDLIST pidlCurrentFolder,
84 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
85 extern BOOL FILEDLG95_OnOpen(HWND hwnd);
86 extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
93 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos)
95 char lpstrPath[MAX_PATH];
96 if(SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath)) {
97 SetCurrentDirectoryA(lpstrPath);
98 TRACE("new current folder %s\n", lpstrPath);
102 /* copied from shell32 to avoid linking to it */
103 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
105 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
110 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
111 COMDLG32_SHFree(src->u.pOleStr);
115 if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len ))
116 ((LPWSTR)dest)[len-1] = 0;
122 if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset,
123 -1, (LPWSTR)dest, len ))
124 ((LPWSTR)dest)[len-1] = 0;
129 FIXME("unknown type!\n");
131 { *(LPWSTR)dest = '\0';
142 /**************************************************************************
143 * IShellBrowserImpl_Construct
145 IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
147 IShellBrowserImpl *sb;
148 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
150 sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
152 /* Initialisation of the member variables */
154 sb->hwndOwner = hwndOwner;
156 /* Initialisation of the vTables */
157 sb->lpVtbl = &IShellBrowserImpl_Vtbl;
158 sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
159 sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl;
160 SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
161 &fodInfos->ShellInfos.pidlAbsCurrent);
165 return (IShellBrowser *) sb;
168 /***************************************************************************
169 * IShellBrowserImpl_QueryInterface
171 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
175 ICOM_THIS(IShellBrowserImpl, iface);
177 TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
181 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
184 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/
185 { *ppvObj = (IOleWindow*)This;
188 else if(IsEqualIID(riid, &IID_IShellBrowser)) /*IShellBrowser*/
189 { *ppvObj = (IShellBrowser*)This;
192 else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
193 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblCommDlgBrowser);
196 else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */
197 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblServiceProvider);
201 { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
204 FIXME("Unknown interface requested\n");
205 return E_NOINTERFACE;
208 /**************************************************************************
209 * IShellBrowser::AddRef
211 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
213 ICOM_THIS(IShellBrowserImpl, iface);
215 TRACE("(%p,%lu)\n", This, This->ref);
217 return ++(This->ref);
220 /**************************************************************************
221 * IShellBrowserImpl_Release
223 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
225 ICOM_THIS(IShellBrowserImpl, iface);
227 TRACE("(%p,%lu)\n", This, This->ref);
231 COMDLG32_SHFree(This);
232 TRACE("-- destroyed\n");
242 /**************************************************************************
243 * IShellBrowserImpl_GetWindow (IOleWindow)
245 * Inherited from IOleWindow::GetWindow
247 * See Windows documentation for more details
249 * Note : We will never be window less in the File Open dialog
252 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
255 ICOM_THIS(IShellBrowserImpl, iface);
257 TRACE("(%p)\n", This);
262 *phwnd = This->hwndOwner;
264 return (*phwnd) ? S_OK : E_UNEXPECTED;
268 /**************************************************************************
269 * IShellBrowserImpl_ContextSensitiveHelp
271 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
274 ICOM_THIS(IShellBrowserImpl, iface);
276 TRACE("(%p)\n", This);
278 /* Feature not implemented */
286 /**************************************************************************
287 * IShellBrowserImpl_BrowseObject
289 * See Windows documentation on IShellBrowser::BrowseObject for more details
291 * This function will override user specified flags and will always
292 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
294 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
299 IShellFolder *psfTmp;
301 FileOpenDlgInfos *fodInfos;
302 LPITEMIDLIST pidlTmp;
307 ICOM_THIS(IShellBrowserImpl, iface);
309 TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags,
310 (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" :
311 (wFlags & SBSP_PARENT) ? "SBSP_PARENT" :
312 (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????");
314 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
316 /* Format the pidl according to its parameter's category */
317 if(wFlags & SBSP_RELATIVE)
320 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
321 if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
322 pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
324 ERR("bind to object failed\n");
327 /* create an absolute pidl */
328 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
331 else if(wFlags & SBSP_PARENT)
333 /* Browse the parent folder (ignores the pidl) */
334 pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
335 psfTmp = GetShellFolderFromPidl(pidlTmp);
338 else /* SBSP_ABSOLUTE is 0x0000 */
340 /* An absolute pidl (relative from the desktop) */
341 pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
342 psfTmp = GetShellFolderFromPidl(pidlTmp);
347 ERR("could not browse to folder\n");
351 /* If the pidl to browse to is equal to the actual pidl ...
352 do nothing and pretend you did it*/
353 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
355 IShellFolder_Release(psfTmp);
356 COMDLG32_SHFree(pidlTmp);
357 TRACE("keep current folder\n");
361 /* Release the current DataObject */
362 if (fodInfos->Shell.FOIDataObject)
364 IDataObject_Release(fodInfos->Shell.FOIDataObject);
365 fodInfos->Shell.FOIDataObject = NULL;
368 /* Create the associated view */
369 TRACE("create view object\n");
370 if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
371 &IID_IShellView, (LPVOID *)&psvTmp))) goto error;
373 /* Check if listview has focus */
374 bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
376 /* Get the foldersettings from the old view */
377 if(fodInfos->Shell.FOIShellView)
378 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
380 /* Release the old fodInfos->Shell.FOIShellView and update its value.
381 We have to update this early since ShellView_CreateViewWindow of native
382 shell32 calls OnStateChange and needs the correct view here.*/
383 if(fodInfos->Shell.FOIShellView)
385 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
386 IShellView_Release(fodInfos->Shell.FOIShellView);
388 fodInfos->Shell.FOIShellView = psvTmp;
390 /* Release old FOIShellFolder and update its value */
391 if (fodInfos->Shell.FOIShellFolder)
392 IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
393 fodInfos->Shell.FOIShellFolder = psfTmp;
395 /* Release old pidlAbsCurrent and update its value */
396 COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
397 fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
399 COMDLG32_UpdateCurrentDir(fodInfos);
401 /* Create the window */
402 TRACE("create view window\n");
403 if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
404 &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
405 &fodInfos->ShellInfos.rectView, &hwndView))) goto error;
407 fodInfos->ShellInfos.hwndView = hwndView;
409 /* Select the new folder in the Look In combo box of the Open file dialog */
410 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
412 /* changes the tab order of the ListView to reflect the window's File Dialog */
413 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
414 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
416 /* Since we destroyed the old view if it had focus set focus to the newly created view */
418 SetFocus(fodInfos->ShellInfos.hwndView);
422 ERR("Failed with error 0x%08lx\n", hRes);
426 /**************************************************************************
427 * IShellBrowserImpl_EnableModelessSB
429 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
433 ICOM_THIS(IShellBrowserImpl, iface);
435 TRACE("(%p)\n", This);
437 /* Feature not implemented */
441 /**************************************************************************
442 * IShellBrowserImpl_GetControlWindow
444 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
449 ICOM_THIS(IShellBrowserImpl, iface);
451 TRACE("(%p)\n", This);
453 /* Feature not implemented */
456 /**************************************************************************
457 * IShellBrowserImpl_GetViewStateStream
459 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
464 ICOM_THIS(IShellBrowserImpl, iface);
466 FIXME("(%p 0x%08lx %p)\n", This, grfMode, ppStrm);
468 /* Feature not implemented */
471 /**************************************************************************
472 * IShellBrowserImpl_InsertMenusSB
474 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
476 LPOLEMENUGROUPWIDTHS lpMenuWidths)
479 ICOM_THIS(IShellBrowserImpl, iface);
481 TRACE("(%p)\n", This);
483 /* Feature not implemented */
486 /**************************************************************************
487 * IShellBrowserImpl_OnViewWindowActive
489 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
493 ICOM_THIS(IShellBrowserImpl, iface);
495 TRACE("(%p)\n", This);
497 /* Feature not implemented */
500 /**************************************************************************
501 * IShellBrowserImpl_QueryActiveShellView
503 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
507 ICOM_THIS(IShellBrowserImpl, iface);
509 FileOpenDlgInfos *fodInfos;
511 TRACE("(%p)\n", This);
513 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
515 if(!(*ppshv = fodInfos->Shell.FOIShellView))
519 IShellView_AddRef(fodInfos->Shell.FOIShellView);
522 /**************************************************************************
523 * IShellBrowserImpl_RemoveMenusSB
525 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
529 ICOM_THIS(IShellBrowserImpl, iface);
531 TRACE("(%p)\n", This);
533 /* Feature not implemented */
536 /**************************************************************************
537 * IShellBrowserImpl_SendControlMsg
539 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
547 ICOM_THIS(IShellBrowserImpl, iface);
550 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
555 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
558 FIXME("ctrl id: %x\n", id);
561 if (pret) *pret = lres;
564 /**************************************************************************
565 * IShellBrowserImpl_SetMenuSB
567 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
569 HOLEMENU holemenuReserved,
570 HWND hwndActiveObject)
573 ICOM_THIS(IShellBrowserImpl, iface);
575 TRACE("(%p)\n", This);
577 /* Feature not implemented */
580 /**************************************************************************
581 * IShellBrowserImpl_SetStatusTextSB
583 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
584 LPCOLESTR lpszStatusText)
587 ICOM_THIS(IShellBrowserImpl, iface);
589 TRACE("(%p)\n", This);
591 /* Feature not implemented */
594 /**************************************************************************
595 * IShellBrowserImpl_SetToolbarItems
597 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
598 LPTBBUTTON lpButtons,
603 ICOM_THIS(IShellBrowserImpl, iface);
605 TRACE("(%p)\n", This);
607 /* Feature not implemented */
610 /**************************************************************************
611 * IShellBrowserImpl_TranslateAcceleratorSB
613 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
618 ICOM_THIS(IShellBrowserImpl, iface);
620 TRACE("(%p)\n", This);
622 /* Feature not implemented */
626 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
628 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
630 IShellBrowserImpl_QueryInterface,
631 IShellBrowserImpl_AddRef,
632 IShellBrowserImpl_Release,
634 IShellBrowserImpl_GetWindow,
635 IShellBrowserImpl_ContextSensitiveHelp,
637 IShellBrowserImpl_InsertMenusSB,
638 IShellBrowserImpl_SetMenuSB,
639 IShellBrowserImpl_RemoveMenusSB,
640 IShellBrowserImpl_SetStatusTextSB,
641 IShellBrowserImpl_EnableModelessSB,
642 IShellBrowserImpl_TranslateAcceleratorSB,
643 IShellBrowserImpl_BrowseObject,
644 IShellBrowserImpl_GetViewStateStream,
645 IShellBrowserImpl_GetControlWindow,
646 IShellBrowserImpl_SendControlMsg,
647 IShellBrowserImpl_QueryActiveShellView,
648 IShellBrowserImpl_OnViewWindowActive,
649 IShellBrowserImpl_SetToolbarItems
658 /***************************************************************************
659 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
661 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
662 ICommDlgBrowser *iface,
666 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
668 TRACE("(%p)\n", This);
670 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
673 /**************************************************************************
674 * IShellBrowserImpl_ICommDlgBrowser_AddRef
676 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface)
678 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
680 TRACE("(%p)\n", This);
682 return IShellBrowserImpl_AddRef(This);
685 /**************************************************************************
686 * IShellBrowserImpl_ICommDlgBrowser_Release
688 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface)
690 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
692 TRACE("(%p)\n", This);
694 return IShellBrowserImpl_Release(This);
696 /**************************************************************************
697 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
699 * Called when a user double-clicks in the view or presses the ENTER key
701 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
705 FileOpenDlgInfos *fodInfos;
707 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
709 TRACE("(%p)\n", This);
711 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
713 /* If the selected object is not a folder, send a IDOK command to parent window */
714 if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
718 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
719 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
720 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
722 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
726 /* Tell the dialog that the user selected a file */
727 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
730 /* Free memory used by pidl */
731 COMDLG32_SHFree((LPVOID)pidl);
739 /**************************************************************************
740 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
742 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
747 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
749 TRACE("(%p shv=%p)\n", This, ppshv);
753 case CDBOSC_SETFOCUS:
754 /* FIXME: Reset the default button.
755 This should be taken care of by defdlg. If control
756 other than button receives focus the default button
757 should be restored. */
758 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
761 case CDBOSC_KILLFOCUS:
763 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
764 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
765 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
768 case CDBOSC_SELCHANGE:
769 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
778 /**************************************************************************
779 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
781 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
785 FileOpenDlgInfos *fodInfos;
788 WCHAR szPathW[MAX_PATH];
790 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
792 TRACE("(%p)\n", This);
794 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
796 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
797 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
799 if( (ulAttr & SFGAO_HIDDEN) /* hidden */
800 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
803 /* always include directories and links */
804 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
807 /* Check if there is a mask to apply if not */
808 if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
811 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
813 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
815 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
823 /**************************************************************************
824 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
826 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
828 FileOpenDlgInfos *fodInfos;
830 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
832 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
833 TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
835 /* release old selections */
836 if (fodInfos->Shell.FOIDataObject)
837 IDataObject_Release(fodInfos->Shell.FOIDataObject);
839 /* get a new DataObject from the ShellView */
840 if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
841 &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
844 FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
846 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
850 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
852 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
854 IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
855 IShellBrowserImpl_ICommDlgBrowser_AddRef,
856 IShellBrowserImpl_ICommDlgBrowser_Release,
857 /* ICommDlgBrowser */
858 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
859 IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
860 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
870 /***************************************************************************
871 * IShellBrowserImpl_IServiceProvider_QueryInterface
873 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
874 IServiceProvider *iface,
878 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
880 FIXME("(%p)\n", This);
882 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
885 /**************************************************************************
886 * IShellBrowserImpl_IServiceProvider_AddRef
888 ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
890 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
892 FIXME("(%p)\n", This);
894 return IShellBrowserImpl_AddRef(This);
897 /**************************************************************************
898 * IShellBrowserImpl_IServiceProvider_Release
900 ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
902 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
904 FIXME("(%p)\n", This);
906 return IShellBrowserImpl_Release(This);
909 /**************************************************************************
910 * IShellBrowserImpl_IServiceProvider_Release
913 * the w2k shellview asks for (guidService = SID_STopLevelBrowser,
914 * riid = IShellBrowser) to call SendControlMsg ().
920 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
921 IServiceProvider * iface,
926 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
928 FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
931 if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
933 return IShellBrowserImpl_QueryInterface(This,riid,ppv);
935 FIXME("(%p) unknown interface requested\n", This);
936 return E_NOINTERFACE;
940 static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl =
942 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
944 IShellBrowserImpl_IServiceProvider_QueryInterface,
945 IShellBrowserImpl_IServiceProvider_AddRef,
946 IShellBrowserImpl_IServiceProvider_Release,
947 /* IServiceProvider */
948 IShellBrowserImpl_IServiceProvider_QueryService