From 15602ccf4072510e3911c860433a2a995b1084d5 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sun, 7 Nov 1999 22:31:18 +0000 Subject: [PATCH] - new interface declaration for IShellfolder2 - added this interface to all shell folders - small fixes to shellview (crash with native comdlg32) --- dlls/shell32/shlfolder.c | 196 ++++++++++++++++++++++++--------- dlls/shell32/shlview.c | 82 +++++++++----- include/wine/obj_shellfolder.h | 126 ++++++++++++++++++++- 3 files changed, 325 insertions(+), 79 deletions(-) diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index e7a007dda43..f42638ed8d0 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -69,7 +69,7 @@ static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut) static HRESULT SHELL32_ParseNextElement( HWND hwndOwner, - IShellFolder * psf, + IShellFolder2 * psf, LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD *pEaten, @@ -117,7 +117,7 @@ static HRESULT SHELL32_CoCreateInitSF ( { HRESULT hr; LPITEMIDLIST absPidl; - IShellFolder *pShellFolder; + IShellFolder2 *pShellFolder; IPersistFolder *pPersistFolder; TRACE("%p %p\n", pidlRoot, pidlChild); @@ -144,14 +144,14 @@ static HRESULT SHELL32_CoCreateInitSF ( } static HRESULT SHELL32_GetDisplayNameOfChild( - IShellFolder * psf, + IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTR szOut, DWORD dwOutLen) { LPITEMIDLIST pidlFirst, pidlNext; - IShellFolder * psfChild; + IShellFolder2 * psfChild; HRESULT hr = E_OUTOFMEMORY; STRRET strTemp; @@ -187,7 +187,7 @@ static HRESULT SHELL32_GetDisplayNameOfChild( typedef struct { - ICOM_VFIELD(IShellFolder); + ICOM_VFIELD(IShellFolder2); DWORD ref; ICOM_VTABLE(IPersistFolder)* lpvtblPersistFolder; @@ -202,7 +202,7 @@ typedef struct BOOL fAcceptFmt; /* flag for pending Drop */ } IGenericSFImpl; -static struct ICOM_VTABLE(IShellFolder) sfvt; +static struct ICOM_VTABLE(IShellFolder2) sfvt; static struct ICOM_VTABLE(IPersistFolder) psfvt; static struct ICOM_VTABLE(IDropTarget) dtvt; @@ -218,7 +218,7 @@ static struct ICOM_VTABLE(IDropTarget) dtvt; /************************************************************************** * registers clipboardformat once */ -static void SF_RegisterClipFmt (IShellFolder * iface) +static void SF_RegisterClipFmt (IShellFolder2 * iface) { ICOM_THIS(IGenericSFImpl, iface); @@ -302,7 +302,7 @@ static IShellFolder * IShellFolder_Constructor( * LPVOID* ppvObject [out] Interface* to hold the result */ static HRESULT WINAPI IShellFolder_fnQueryInterface( - IShellFolder * iface, + IShellFolder2 * iface, REFIID riid, LPVOID *ppvObj) { @@ -321,6 +321,10 @@ static HRESULT WINAPI IShellFolder_fnQueryInterface( { *ppvObj = (IShellFolder*)This; } + else if(IsEqualIID(riid, &IID_IShellFolder2)) + { + *ppvObj = (IShellFolder2*)This; + } else if(IsEqualIID(riid, &IID_IPersist)) { *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder); @@ -332,7 +336,7 @@ static HRESULT WINAPI IShellFolder_fnQueryInterface( else if(IsEqualIID(riid, &IID_IDropTarget)) { *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget); - SF_RegisterClipFmt((IShellFolder*)This); + SF_RegisterClipFmt((IShellFolder2*)This); } if(*ppvObj) @@ -349,7 +353,7 @@ static HRESULT WINAPI IShellFolder_fnQueryInterface( * IShellFolder_AddRef */ -static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder * iface) +static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 * iface) { ICOM_THIS(IGenericSFImpl, iface); @@ -365,7 +369,7 @@ static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder * iface) /************************************************************************** * IShellFolder_fnRelease */ -static ULONG WINAPI IShellFolder_fnRelease(IShellFolder * iface) +static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface) { ICOM_THIS(IGenericSFImpl, iface); @@ -378,7 +382,7 @@ static ULONG WINAPI IShellFolder_fnRelease(IShellFolder * iface) if (!--(This->ref)) { TRACE("-- destroying IShellFolder(%p)\n",This); - if (pdesktopfolder == iface) + if (pdesktopfolder == (IShellFolder*) iface) { pdesktopfolder=NULL; TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This); } @@ -418,7 +422,7 @@ static ULONG WINAPI IShellFolder_fnRelease(IShellFolder * iface) * pchEaten: not set like in windows */ static HRESULT WINAPI IShellFolder_fnParseDisplayName( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, @@ -461,7 +465,7 @@ static HRESULT WINAPI IShellFolder_fnParseDisplayName( /* try to analyse the next element */ if (szNext && *szNext) { - hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); + hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); } else { @@ -485,7 +489,7 @@ static HRESULT WINAPI IShellFolder_fnParseDisplayName( * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface */ static HRESULT WINAPI IShellFolder_fnEnumObjects( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST* ppEnumIDList) @@ -512,7 +516,7 @@ static HRESULT WINAPI IShellFolder_fnEnumObjects( * REFIID riid, //[in ] Initial Interface * LPVOID* ppvObject //[out] Interface* */ -static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, +static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -578,7 +582,7 @@ static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder * iface, LPCITEM * LPVOID* ppvObject //[out] Interface* returned */ static HRESULT WINAPI IShellFolder_fnBindToStorage( - IShellFolder * iface, + IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, @@ -612,7 +616,7 @@ static HRESULT WINAPI IShellFolder_fnBindToStorage( */ static HRESULT WINAPI IShellFolder_fnCompareIDs( - IShellFolder * iface, + IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) @@ -700,7 +704,7 @@ static HRESULT WINAPI IShellFolder_fnCompareIDs( /************************************************************************** * IShellFolder_fnCreateViewObject */ -static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder * iface, +static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID *ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -748,7 +752,7 @@ static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder * iface, * ULONG* rgfInOut) //[out] result array * */ -static HRESULT WINAPI IShellFolder_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) +static HRESULT WINAPI IShellFolder_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -804,7 +808,7 @@ next: apidl++; * and GetData's it if the drop is in another explorer window that needs the positions. */ static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, @@ -879,7 +883,7 @@ static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( #define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF) static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( - IShellFolder * iface, + IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) @@ -921,7 +925,7 @@ static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( PathAddBackslashA(szPath); len = strlen(szPath); - if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath + len, MAX_PATH - len))) + if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags, szPath + len, MAX_PATH - len))) return E_OUTOFMEMORY; } strRet->uType = STRRET_CSTRA; @@ -944,7 +948,7 @@ static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned */ static HRESULT WINAPI IShellFolder_fnSetNameOf( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl*/ LPCOLESTR lpName, @@ -962,7 +966,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf( /************************************************************************** * IShellFolder_fnGetFolderPath */ -static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder * iface, LPSTR lpszOut, DWORD dwOutSize) +static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder2 * iface, LPSTR lpszOut, DWORD dwOutSize) { ICOM_THIS(IGenericSFImpl, iface); @@ -980,7 +984,72 @@ static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder * iface, LPSTR l return TRUE; } -static ICOM_VTABLE(IShellFolder) sfvt = +static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID( + IShellFolder2 * iface, + GUID *pguid) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnEnumSearches( + IShellFolder2 * iface, + IEnumExtraSearch **ppenum) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( + IShellFolder2 * iface, + DWORD dwRes, + ULONG *pSort, + ULONG *pDisplay) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( + IShellFolder2 * iface, + UINT iColumn, + DWORD *pcsFlags) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnGetDetailsEx( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + const SHCOLUMNID *pscid, + VARIANT *pv) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnGetDetailsOf( + IShellFolder2 * iface, + LPCITEMIDLIST pidl, + UINT iColumn, + SHELLDETAILS *psd) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} +static HRESULT WINAPI IShellFolder_fnMapNameToSCID( + IShellFolder2 * iface, + LPCWSTR pwszName, + SHCOLUMNID *pscid) +{ + ICOM_THIS(IGenericSFImpl, iface); + TRACE("(%p)\n",This); + return E_NOTIMPL; +} + +static ICOM_VTABLE(IShellFolder2) sfvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IShellFolder_fnQueryInterface, @@ -996,13 +1065,21 @@ static ICOM_VTABLE(IShellFolder) sfvt = IShellFolder_fnGetUIObjectOf, IShellFolder_fnGetDisplayNameOf, IShellFolder_fnSetNameOf, - IShellFolder_fnGetFolderPath + + /* ShellFolder2 */ + IShellFolder_fnGetDefaultSearchGUID, + IShellFolder_fnEnumSearches, + IShellFolder_fnGetDefaultColumn, + IShellFolder_fnGetDefaultColumnState, + IShellFolder_fnGetDetailsEx, + IShellFolder_fnGetDetailsOf, + IShellFolder_fnMapNameToSCID }; /*********************************************************************** * [Desktopfolder] IShellFolder implementation */ -static struct ICOM_VTABLE(IShellFolder) sfdvt; +static struct ICOM_VTABLE(IShellFolder2) sfdvt; /************************************************************************** * ISF_Desktop_Constructor @@ -1029,7 +1106,7 @@ IShellFolder * ISF_Desktop_Constructor() * NOTES supports not IPersist/IPersistFolder */ static HRESULT WINAPI ISF_Desktop_fnQueryInterface( - IShellFolder * iface, + IShellFolder2 * iface, REFIID riid, LPVOID *ppvObj) { @@ -1047,6 +1124,9 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface( else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/ { *ppvObj = (IShellFolder*)This; } + else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/ + { *ppvObj = (IShellFolder2*)This; + } if(*ppvObj) { @@ -1066,7 +1146,7 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface( * to MyComputer */ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, @@ -1093,7 +1173,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( if (szNext && *szNext) { - hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); + hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); } else { @@ -1111,7 +1191,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( * ISF_Desktop_fnEnumObjects */ static HRESULT WINAPI ISF_Desktop_fnEnumObjects( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST* ppEnumIDList) @@ -1133,7 +1213,7 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects( /************************************************************************** * ISF_Desktop_fnBindToObject */ -static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, +static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1189,7 +1269,7 @@ static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder * iface, LPCITEMI /************************************************************************** * ISF_Desktop_fnCreateViewObject */ -static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder * iface, +static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID *ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1232,7 +1312,7 @@ static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder * iface, /************************************************************************** * ISF_Desktop_fnGetAttributesOf */ -static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) +static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1294,7 +1374,7 @@ next: apidl++; * special case: pidl = null gives desktop-name back */ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( - IShellFolder * iface, + IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) @@ -1318,7 +1398,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( } else { - if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath, MAX_PATH))) + if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags, szPath, MAX_PATH))) return E_OUTOFMEMORY; } strRet->uType = STRRET_CSTRA; @@ -1329,7 +1409,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( return S_OK; } -static ICOM_VTABLE(IShellFolder) sfdvt = +static ICOM_VTABLE(IShellFolder2) sfdvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ISF_Desktop_fnQueryInterface, @@ -1345,7 +1425,15 @@ static ICOM_VTABLE(IShellFolder) sfdvt = IShellFolder_fnGetUIObjectOf, ISF_Desktop_fnGetDisplayNameOf, IShellFolder_fnSetNameOf, - IShellFolder_fnGetFolderPath + + /* ShellFolder2 */ + IShellFolder_fnGetDefaultSearchGUID, + IShellFolder_fnEnumSearches, + IShellFolder_fnGetDefaultColumn, + IShellFolder_fnGetDefaultColumnState, + IShellFolder_fnGetDetailsEx, + IShellFolder_fnGetDetailsOf, + IShellFolder_fnMapNameToSCID }; @@ -1353,7 +1441,7 @@ static ICOM_VTABLE(IShellFolder) sfdvt = * IShellFolder [MyComputer] implementation */ -static struct ICOM_VTABLE(IShellFolder) sfmcvt; +static struct ICOM_VTABLE(IShellFolder2) sfmcvt; /************************************************************************** * ISF_MyComputer_Constructor @@ -1380,7 +1468,7 @@ static IShellFolder * ISF_MyComputer_Constructor(void) * ISF_MyComputer_fnParseDisplayName */ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, @@ -1411,7 +1499,7 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( if (szNext && *szNext) { - hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); + hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); } else { @@ -1429,7 +1517,7 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( * ISF_MyComputer_fnEnumObjects */ static HRESULT WINAPI ISF_MyComputer_fnEnumObjects( - IShellFolder * iface, + IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST* ppEnumIDList) @@ -1451,7 +1539,7 @@ static HRESULT WINAPI ISF_MyComputer_fnEnumObjects( /************************************************************************** * ISF_MyComputer_fnBindToObject */ -static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, +static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1503,7 +1591,7 @@ static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder * iface, LPCIT /************************************************************************** * ISF_MyComputer_fnCreateViewObject */ -static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder * iface, +static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID *ppvOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1546,7 +1634,7 @@ static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder * iface, /************************************************************************** * ISF_MyComputer_fnGetAttributesOf */ -static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) +static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) { ICOM_THIS(IGenericSFImpl, iface); @@ -1596,7 +1684,7 @@ next: apidl++; * SHGDN_INFOLDER makes no sense. */ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( - IShellFolder * iface, + IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) @@ -1653,7 +1741,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( PathAddBackslashA(szPath); len = strlen(szPath); - if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len))) + if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len))) return E_OUTOFMEMORY; } strRet->uType = STRRET_CSTRA; @@ -1664,7 +1752,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( return S_OK; } -static ICOM_VTABLE(IShellFolder) sfmcvt = +static ICOM_VTABLE(IShellFolder2) sfmcvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IShellFolder_fnQueryInterface, @@ -1680,7 +1768,15 @@ static ICOM_VTABLE(IShellFolder) sfmcvt = IShellFolder_fnGetUIObjectOf, ISF_MyComputer_fnGetDisplayNameOf, IShellFolder_fnSetNameOf, - IShellFolder_fnGetFolderPath + + /* ShellFolder2 */ + IShellFolder_fnGetDefaultSearchGUID, + IShellFolder_fnEnumSearches, + IShellFolder_fnGetDefaultColumn, + IShellFolder_fnGetDefaultColumnState, + IShellFolder_fnGetDetailsEx, + IShellFolder_fnGetDetailsOf, + IShellFolder_fnMapNameToSCID }; diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index d8ed936ab2b..0913e5b7112 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -1,11 +1,23 @@ /* * ShellView * - * Copyright 1998,1999 + * Copyright 1998,1999 * * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a * Release() ??? * + * FIXME: There is still a design problem in this implementation. + * This implementation is more or less ok for file system folders + * but there are many more kinds of folders. + * The shellview is not supposed to know much about the colums + * appearing in the view. To fix this it should use the IShellFolder2 + * interface when possible to get the informations dynamically + * this will take a lot of work to implemet and wont likely not + * be done in near future + * Please considder this when code new features. Mail me if you + * are in doubt how to do things. (jsch 25/10/99) + * + * FIXME: Set the buttons in the filedialog according to the view state */ #include @@ -220,7 +232,6 @@ static void CheckToolbar(IShellViewImpl * This) /********************************************************** * change the style of the listview control */ - static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) { DWORD tmpstyle; @@ -278,6 +289,11 @@ static BOOL ShellView_CreateList (IShellViewImpl * This) } /********************************************************** * ShellView_InitList() +* +* NOTES +* FIXME: the headers should depend on the kind of shellfolder +* thats creating the shellview. this hack implements only the +* correct headers for a filesystem folder (jsch 25/10/99) */ static BOOL ShellView_InitList(IShellViewImpl * This) { @@ -297,11 +313,11 @@ static BOOL ShellView_InitList(IShellViewImpl * This) LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, szString, sizeof(szString)); ListView_InsertColumnA(This->hWndList, 0, &lvColumn); - lvColumn.cx = 80; + lvColumn.cx = 60; LoadStringA(shell32_hInstance, IDS_SHV_COLUMN2, szString, sizeof(szString)); ListView_InsertColumnA(This->hWndList, 1, &lvColumn); - lvColumn.cx = 170; + lvColumn.cx = 120; LoadStringA(shell32_hInstance, IDS_SHV_COLUMN3, szString, sizeof(szString)); ListView_InsertColumnA(This->hWndList, 2, &lvColumn); @@ -332,7 +348,6 @@ static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARA return ret; } - /************************************************************************* * ShellView_ListViewCompareItems * @@ -349,7 +364,13 @@ static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARA * or zero if the two items are equivalent * * NOTES - * + * FIXME: function does what ShellView_CompareItems is supposed to do. + * unify it and figure out how to use the undocumented first parameter + * of IShellFolder_CompareIDs to do the job this function does and + * move this code to IShellFolder. + * make LISTVIEW_SORT_INFO obsolete + * the way this function works is only usable if we had only + * filesystemfolders (25/10/99 jsch) */ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) { @@ -961,7 +982,11 @@ static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dw case 0x31: case 0x32: case 0x33: - ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (dwCmdID - 0x30)); + This->ListViewSortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30); + This->ListViewSortInfo.bIsAscending = TRUE; + This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; + ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); + CheckToolbar(This); break; default: @@ -1014,23 +1039,20 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn break; case LVN_COLUMNCLICK: - { - This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem; - if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID) - { - This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending; - } - else - { - This->ListViewSortInfo.bIsAscending = TRUE; - } - This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; + This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem; + if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID) + { + This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending; + } + else + { + This->ListViewSortInfo.bIsAscending = TRUE; + } + This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); - break; - } - + case LVN_GETDISPINFOA: TRACE("-- LVN_GETDISPINFOA %p\n",This); pidl = (LPITEMIDLIST)lpdi->item.lParam; @@ -1319,13 +1341,15 @@ static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG { ICOM_THIS(IShellViewImpl, iface); +#if 0 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); - +#endif - switch (lpmsg->message) - { case WM_KEYDOWN: TRACE("-- key=0x04%x",lpmsg->wParam) ; + if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST)) + { + TRACE("-- key=0x04%x",lpmsg->wParam) ; } - return NOERROR; + return S_FALSE; /* not handled */ } static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable) @@ -1341,7 +1365,9 @@ static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState) { ICOM_THIS(IShellViewImpl, iface); +/* CHAR szName[MAX_PATH]; +*/ LRESULT lResult; int nPartArray[1] = {-1}; @@ -1360,15 +1386,19 @@ static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState) if(uState != SVUIA_DEACTIVATE) { +/* + GetFolderPath is not a method of IShellFolder IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) ); - +*/ /* set the number of parts */ IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult); /* set the text for the parts */ +/* IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA, 0, (LPARAM)szName, &lResult); +*/ } return S_OK; diff --git a/include/wine/obj_shellfolder.h b/include/wine/obj_shellfolder.h index b9f32ffab47..58cfbf1db66 100644 --- a/include/wine/obj_shellfolder.h +++ b/include/wine/obj_shellfolder.h @@ -10,6 +10,7 @@ #include "wine/obj_base.h" #include "wine/obj_moniker.h" /* for LPBC */ #include "wine/obj_enumidlist.h" +#include "wine/obj_oleaut.h" #include "winbase.h" #include "shell.h" @@ -48,6 +49,49 @@ typedef struct IShellFolder IShellFolder, *LPSHELLFOLDER; DEFINE_SHLGUID(IID_IPersistFolder, 0x000214EAL, 0, 0); typedef struct IPersistFolder IPersistFolder, *LPPERSISTFOLDER; +DEFINE_GUID(IID_IShellFolder2, 0xB82C5AA8, 0xA41B, 0x11D2, 0xBE, 0x32, 0x0, 0xc0, 0x4F, 0xB9, 0x36, 0x61); +typedef struct IShellFolder2 IShellFolder2, *LPSHELLFOLDER2; + +DEFINE_GUID(IID_IEnumExtraSearch, 0xE700BE1, 0x9DB6, 0x11D1, 0xA1, 0xCE, 0x0, 0xc0, 0x4F, 0xD7, 0x5D, 0x13); +typedef struct IEnumExtraSearch IEnumExtraSearch, *LPENUMEXTRASEARCH; + +/***************************************************************************** + * IEnumExtraSearch interface + */ + +typedef struct +{ + GUID guidSearch; + WCHAR wszFriendlyName[80]; + WCHAR wszMenuText[80]; + WCHAR wszHelpText[MAX_PATH]; + WCHAR wszUrl[2084]; + WCHAR wszIcon[MAX_PATH+10]; + WCHAR wszGreyIcon[MAX_PATH+10]; + WCHAR wszClrIcon[MAX_PATH+10]; +} EXTRASEARCH,* LPEXTRASEARCH; + +#define ICOM_INTERFACE IEnumExtraSearch +#define IEnumExtraSearch_METHODS \ + ICOM_METHOD3(HRESULT, Next, ULONG, celt, LPEXTRASEARCH*, rgelt, ULONG*, pceltFetched) \ + ICOM_METHOD1(HRESULT, Skip, ULONG, celt) \ + ICOM_METHOD (HRESULT, Reset) \ + ICOM_METHOD1(HRESULT, Clone, IEnumExtraSearch**, ppenum) +#define IEnumExtraSearch_IMETHODS \ + IUnknown_IMETHODS \ + IEnumExtraSearch_METHODS +ICOM_DEFINE(IEnumExtraSearch,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IEnumIDList_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IEnumIDList_AddRef(p) ICOM_CALL (AddRef,p) +#define IEnumIDList_Release(p) ICOM_CALL (Release,p) +/*** IEnumIDList methods ***/ +#define IEnumIDList_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) +#define IEnumIDList_Skip(p,a) ICOM_CALL1(Skip,p,a) +#define IEnumIDList_Reset(p) ICOM_CALL(Reset,p) +#define IEnumIDList_Clone(p,a) ICOM_CALL1(Clone,p,a) /***************************************************************************** * IShellFolder::GetDisplayNameOf/SetNameOf uFlags @@ -156,8 +200,7 @@ DWORD WINAPI SHGetDesktopFolder(IShellFolder * *); ICOM_METHOD3( HRESULT, GetAttributesOf, UINT, cidl, LPCITEMIDLIST *, apidl, ULONG *, rgfInOut)\ ICOM_METHOD6( HRESULT, GetUIObjectOf, HWND, hwndOwner, UINT, cidl, LPCITEMIDLIST *, apidl, REFIID, riid, UINT *, prgfInOut, LPVOID *, ppvOut)\ ICOM_METHOD3( HRESULT, GetDisplayNameOf, LPCITEMIDLIST, pidl, DWORD, uFlags, LPSTRRET, lpName)\ - ICOM_METHOD5( HRESULT, SetNameOf, HWND, hwndOwner, LPCITEMIDLIST, pidl,LPCOLESTR, lpszName, DWORD, uFlags,LPITEMIDLIST *, ppidlOut)\ - ICOM_METHOD2( HRESULT, GetFolderPath, LPSTR, lpszOut, DWORD, dwOutSize) + ICOM_METHOD5( HRESULT, SetNameOf, HWND, hwndOwner, LPCITEMIDLIST, pidl,LPCOLESTR, lpszName, DWORD, uFlags,LPITEMIDLIST *, ppidlOut) #define IShellFolder_IMETHODS \ IUnknown_IMETHODS \ IShellFolder_METHODS @@ -179,12 +222,89 @@ ICOM_DEFINE(IShellFolder,IUnknown) #define IShellFolder_GetUIObjectOf(p,a,b,c,d,e,f) ICOM_CALL6(GetUIObjectOf,p,a,b,c,d,e,f) #define IShellFolder_GetDisplayNameOf(p,a,b,c) ICOM_CALL3(GetDisplayNameOf,p,a,b,c) #define IShellFolder_SetNameOf(p,a,b,c,d,e) ICOM_CALL5(SetNameOf,p,a,b,c,d,e) -#define IShellFolder_GetFolderPath(p,a,b) ICOM_CALL2(GetFolderPath,p,a,b) + +/***************************************************************************** + * IShellFolder2 interface + */ +/* IShellFolder2 */ + +/* GetDefaultColumnState */ +typedef enum +{ + SHCOLSTATE_TYPE_STR = 0x00000001, + SHCOLSTATE_TYPE_INT = 0x00000002, + SHCOLSTATE_TYPE_DATE = 0x00000003, + SHCOLSTATE_TYPEMASK = 0x0000000F, + SHCOLSTATE_ONBYDEFAULT = 0x00000010, + SHCOLSTATE_SLOW = 0x00000020, + SHCOLSTATE_EXTENDED = 0x00000040, + SHCOLSTATE_SECONDARYUI = 0x00000080, + SHCOLSTATE_HIDDEN = 0x00000100, +} SHCOLSTATE; + +typedef struct +{ + GUID fmtid; + DWORD pid; +} SHCOLUMNID, *LPSHCOLUMNID; +typedef const SHCOLUMNID* LPCSHCOLUMNID; + +/* GetDetailsEx */ +#define PID_FINDDATA 0 +#define PID_NETRESOURCE 1 +#define PID_DESCRIPTIONID 2 + +typedef struct +{ + int fmt; + int cxChar; + STRRET str; +} SHELLDETAILS, *LPSHELLDETAILS; + +#define ICOM_INTERFACE IShellFolder2 +#define IShellFolder2_METHODS \ + ICOM_METHOD1( HRESULT, GetDefaultSearchGUID, LPGUID, lpguid)\ + ICOM_METHOD1( HRESULT, EnumSearches, LPENUMEXTRASEARCH *, ppEnum) \ + ICOM_METHOD3( HRESULT, GetDefaultColumn, DWORD, dwReserved, ULONG *, pSort, ULONG *, pDisplay)\ + ICOM_METHOD2( HRESULT, GetDefaultColumnState, UINT, iColumn, DWORD *, pcsFlags)\ + ICOM_METHOD3( HRESULT, GetDetailsEx, LPCITEMIDLIST, pidl, const SHCOLUMNID *, pscid, VARIANT *, pv)\ + ICOM_METHOD3( HRESULT, GetDetailsOf, LPCITEMIDLIST, pidl, UINT, iColumn, LPSHELLDETAILS, pDetails)\ + ICOM_METHOD2( HRESULT, MapNameToSCID, LPCWSTR, pwszName, SHCOLUMNID *, pscid) +#define IShellFolder2_IMETHODS \ + IShellFolder_METHODS \ + IShellFolder2_METHODS +ICOM_DEFINE(IShellFolder2, IShellFolder) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IShellFolder2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IShellFolder2_AddRef(p) ICOM_CALL (AddRef,p) +#define IShellFolder2_Release(p) ICOM_CALL (Release,p) +/*** IShellFolder methods ***/ +#define IShellFolder2_ParseDisplayName(p,a,b,c,d,e,f) ICOM_CALL6(ParseDisplayName,p,a,b,c,d,e,f) +#define IShellFolder2_EnumObjects(p,a,b,c) ICOM_CALL3(EnumObjects,p,a,b,c) +#define IShellFolder2_BindToObject(p,a,b,c,d) ICOM_CALL4(BindToObject,p,a,b,c,d) +#define IShellFolder2_BindToStorage(p,a,b,c,d) ICOM_CALL4(BindToStorage,p,a,b,c,d) +#define IShellFolder2_CompareIDs(p,a,b,c) ICOM_CALL3(CompareIDs,p,a,b,c) +#define IShellFolder2_CreateViewObject(p,a,b,c) ICOM_CALL3(CreateViewObject,p,a,b,c) +#define IShellFolder2_GetAttributesOf(p,a,b,c) ICOM_CALL3(GetAttributesOf,p,a,b,c) +#define IShellFolder2_GetUIObjectOf(p,a,b,c,d,e,f) ICOM_CALL6(GetUIObjectOf,p,a,b,c,d,e,f) +#define IShellFolder2_GetDisplayNameOf(p,a,b,c) ICOM_CALL3(GetDisplayNameOf,p,a,b,c) +#define IShellFolder2_SetNameOf(p,a,b,c,d,e) ICOM_CALL5(SetNameOf,p,a,b,c,d,e) +/*** IShellFolder2 methods ***/ +#define IShellFolder2_GetDefaultSearchGUID(p,a) ICOM_CALL1(GetDefaultSearchGUID,p,a) +#define IShellFolder2_EnumSearches(p,a) ICOM_CALL1(EnumSearches,p,a) +#define IShellFolder2_GetDefaultColumn(p,a,b,c) ICOM_CALL3(GetDefaultColumn,p,a,b,c) +#define IShellFolder2_GetDefaultColumnState(p,a,b) ICOM_CALL2(GetDefaultColumnState,p,a,b) +#define IShellFolder2_GetDetailsEx(p,a,b,c) ICOM_CALL3(GetDetailsEx,p,a,b,c) +#define IShellFolder2_GetDetailsOf(p,a,b,c) ICOM_CALL3(GetDetailsOf,p,a,b,c) +#define IShellFolder2_MapNameToSCID(p,a,b) ICOM_CALL2(MapNameToSCID,p,a,b) /***************************************************************************** * IPersistFolder interface */ +/* ClassID's */ DEFINE_GUID (CLSID_SFMyComp,0x20D04FE0,0x3AEA,0x1069,0xA2,0xD8,0x08,0x00,0x2B,0x30,0x30,0x9D); DEFINE_GUID (CLSID_SFINet, 0x871C5380,0x42A0,0x1069,0xA2,0xEA,0x08,0x00,0x2B,0x30,0x30,0x9D); DEFINE_GUID (CLSID_SFFile, 0xF3364BA0,0x65B9,0x11CE,0xA9,0xBA,0x00,0xAA,0x00,0x4A,0xE8,0x37);