diff --git a/reactos/include/wine/shlguid.h b/reactos/include/wine/shlguid.h index 384570729e3..b63e25525f2 100644 --- a/reactos/include/wine/shlguid.h +++ b/reactos/include/wine/shlguid.h @@ -46,6 +46,8 @@ DEFINE_GUID(CLSID_RecycleBin, 0x645FF040, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA DEFINE_GUID(CLSID_ControlPanel, 0x21EC2020, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_Printers, 0x2227A280, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_MyDocuments, 0x450d8fba, 0xad25, 0x11d0, 0x98, 0xa8, 0x08, 0x00, 0x36, 0x1b, 0x11, 0x03); +DEFINE_GUID(CLSID_FolderShortcut, 0x0AFACED1, 0xE828, 0x11D1, 0x91, 0x87, 0xB5, 0x32, 0xF1, 0xE9, 0x57, 0x5D); + DEFINE_GUID(IID_IQueryAssociations, 0xc46ca590, 0x3c3f, 0x11d2, 0xbe, 0xe6, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57); diff --git a/reactos/lib/shell32/Makefile.in b/reactos/lib/shell32/Makefile.in index 690fe27f309..fa528fcd208 100644 --- a/reactos/lib/shell32/Makefile.in +++ b/reactos/lib/shell32/Makefile.in @@ -5,7 +5,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = shell32.dll IMPORTLIB = libshell32.$(IMPLIBEXT) -IMPORTS = shlwapi comctl32 user32 gdi32 advapi32 kernel32 +IMPORTS = shlwapi comctl32 user32 gdi32 advapi32 kernel32 ntdll DELAYIMPORTS = ole32 EXTRALIBS = -luuid $(LIBUNICODE) @@ -61,6 +61,7 @@ RC_BINARIES = \ folder.ico \ folder_open.ico \ mycomputer.ico \ + mydocs.ico \ netdrive.ico \ netdrive2.ico \ printer.ico \ diff --git a/reactos/lib/shell32/autocomplete.c b/reactos/lib/shell32/autocomplete.c index c7603e30f60..5abbc60ee77 100644 --- a/reactos/lib/shell32/autocomplete.c +++ b/reactos/lib/shell32/autocomplete.c @@ -79,8 +79,11 @@ typedef struct static const IAutoCompleteVtbl acvt; static const IAutoComplete2Vtbl ac2vt; -#define _IAutoComplete2_Offset ((int)(&(((IAutoCompleteImpl*)0)->lpvtblAutoComplete2))) -#define _ICOM_THIS_From_IAutoComplete2(class, name) class* This = (class*)(((char*)name)-_IAutoComplete2_Offset); +static inline IAutoCompleteImpl *impl_from_IAutoComplete2( IAutoComplete2 *iface ) +{ + return (IAutoCompleteImpl *)((char*)iface - FIELD_OFFSET(IAutoCompleteImpl, lpvtblAutoComplete2)); +} + /* converts This to an interface pointer @@ -329,7 +332,7 @@ static HRESULT WINAPI IAutoComplete2_fnQueryInterface( REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj); @@ -342,7 +345,7 @@ static HRESULT WINAPI IAutoComplete2_fnQueryInterface( static ULONG WINAPI IAutoComplete2_fnAddRef( IAutoComplete2 * iface) { - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl,iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -355,7 +358,7 @@ static ULONG WINAPI IAutoComplete2_fnAddRef( static ULONG WINAPI IAutoComplete2_fnRelease( IAutoComplete2 * iface) { - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl,iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -369,7 +372,7 @@ static HRESULT WINAPI IAutoComplete2_fnEnable( IAutoComplete2 * iface, BOOL fEnable) { - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE ("(%p)->(%s)\n", This, (fEnable)?"true":"false"); @@ -386,7 +389,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( LPCOLESTR pwzsRegKeyPath, LPCOLESTR pwszQuickComplete) { - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE("(%p)\n", This); @@ -402,7 +405,7 @@ static HRESULT WINAPI IAutoComplete2_fnGetOptions( { HRESULT hr = S_OK; - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE("(%p) -> (%p)\n", This, pdwFlag); @@ -420,7 +423,7 @@ static HRESULT WINAPI IAutoComplete2_fnSetOptions( { HRESULT hr = S_OK; - _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface); + IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); TRACE("(%p) -> (0x%lx)\n", This, dwFlag); diff --git a/reactos/lib/shell32/cpanelfolder.c b/reactos/lib/shell32/cpanelfolder.c index 3b9dcfe4def..01742c72ab9 100644 --- a/reactos/lib/shell32/cpanelfolder.c +++ b/reactos/lib/shell32/cpanelfolder.c @@ -76,14 +76,20 @@ static const IPersistFolder2Vtbl vt_PersistFolder2; static const IShellExecuteHookWVtbl vt_ShellExecuteHookW; static const IShellExecuteHookAVtbl vt_ShellExecuteHookA; -#define _IPersistFolder2_Offset ((int)(&(((ICPanelImpl*)0)->lpVtblPersistFolder2))) -#define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset); +static inline ICPanelImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface ) +{ + return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblPersistFolder2)); +} -#define IShellExecuteHookW_Offset ((int)(&(((ICPanelImpl*)0)->lpVtblShellExecuteHookW))) -#define _ICOM_THIS_From_IShellExecuteHookW(class, name) class* This = (class*)(((char*)name)-IShellExecuteHookW_Offset); +static inline ICPanelImpl *impl_from_IShellExecuteHookW( IShellExecuteHookW *iface ) +{ + return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblShellExecuteHookW)); +} -#define IShellExecuteHookA_Offset ((int)(&(((ICPanelImpl*)0)->lpVtblShellExecuteHookA))) -#define _ICOM_THIS_From_IShellExecuteHookA(class, name) class* This = (class*)(((char*)name)-IShellExecuteHookA_Offset); +static inline ICPanelImpl *impl_from_IShellExecuteHookA( IShellExecuteHookA *iface ) +{ + return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblShellExecuteHookA)); +} /* @@ -824,7 +830,7 @@ static const IShellFolder2Vtbl vt_ShellFolder2 = */ static HRESULT WINAPI ICPanel_PersistFolder2_QueryInterface(IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObject) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)\n", This); @@ -836,7 +842,7 @@ static HRESULT WINAPI ICPanel_PersistFolder2_QueryInterface(IPersistFolder2 * if */ static ULONG WINAPI ICPanel_PersistFolder2_AddRef(IPersistFolder2 * iface) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -848,7 +854,7 @@ static ULONG WINAPI ICPanel_PersistFolder2_AddRef(IPersistFolder2 * iface) */ static ULONG WINAPI ICPanel_PersistFolder2_Release(IPersistFolder2 * iface) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -860,7 +866,7 @@ static ULONG WINAPI ICPanel_PersistFolder2_Release(IPersistFolder2 * iface) */ static HRESULT WINAPI ICPanel_PersistFolder2_GetClassID(IPersistFolder2 * iface, CLSID * lpClassId) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)\n", This); @@ -878,7 +884,7 @@ static HRESULT WINAPI ICPanel_PersistFolder2_GetClassID(IPersistFolder2 * iface, */ static HRESULT WINAPI ICPanel_PersistFolder2_Initialize(IPersistFolder2 * iface, LPCITEMIDLIST pidl) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)->(%p)\n", This, pidl); return E_NOTIMPL; } @@ -888,7 +894,7 @@ static HRESULT WINAPI ICPanel_PersistFolder2_Initialize(IPersistFolder2 * iface, */ static HRESULT WINAPI ICPanel_PersistFolder2_GetCurFolder(IPersistFolder2 * iface, LPITEMIDLIST * pidl) { - _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IPersistFolder2(iface); TRACE("(%p)->(%p)\n", This, pidl); @@ -931,7 +937,7 @@ HRESULT CPanel_GetIconLocationW(LPITEMIDLIST pidl, static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface( IShellExecuteHookW* iface, REFIID riid, void** ppvObject) { - _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookW(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -940,7 +946,7 @@ static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface( static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnAddRef(IShellExecuteHookW* iface) { - _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookW(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -949,7 +955,7 @@ static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnAddRef(IShellExecuteHookW* i static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnRelease(IShellExecuteHookW* iface) { - _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookW(iface); TRACE("(%p)\n", This); @@ -1017,7 +1023,7 @@ static const IShellExecuteHookWVtbl vt_ShellExecuteHookW = static HRESULT WINAPI IShellExecuteHookA_fnQueryInterface(IShellExecuteHookA* iface, REFIID riid, void** ppvObject) { - _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookA(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -1026,7 +1032,7 @@ static HRESULT WINAPI IShellExecuteHookA_fnQueryInterface(IShellExecuteHookA* if static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnAddRef(IShellExecuteHookA* iface) { - _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookA(iface); TRACE("(%p)->(count=%lu)\n", This, This->ref); @@ -1035,7 +1041,7 @@ static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnAddRef(IShellExecuteHookA* i static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnRelease(IShellExecuteHookA* iface) { - _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface); + ICPanelImpl *This = impl_from_IShellExecuteHookA(iface); TRACE("(%p)\n", This); diff --git a/reactos/lib/shell32/debughlp.c b/reactos/lib/shell32/debughlp.c index 28e6a2df673..03dceaf04fe 100644 --- a/reactos/lib/shell32/debughlp.c +++ b/reactos/lib/shell32/debughlp.c @@ -245,7 +245,7 @@ static void dump_pidl_hex( LPCITEMIDLIST pidl ) if( i!=(n-1) && (i%max_line) != (max_line-1) ) continue; szAscii[ (i%max_line)+1 ] = 0; - DPRINTF("%-*s %s\n", max_line*3, szHex, szAscii ); + ERR("%-*s %s\n", max_line*3, szHex, szAscii ); } } diff --git a/reactos/lib/shell32/folders.c b/reactos/lib/shell32/folders.c index c989ccaea07..6e92845a13b 100644 --- a/reactos/lib/shell32/folders.c +++ b/reactos/lib/shell32/folders.c @@ -60,11 +60,16 @@ static const IExtractIconAVtbl eiavt; static const IExtractIconWVtbl eivt; static const IPersistFileVtbl pfvt; -#define _IPersistFile_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblPersistFile))) -#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset); +static inline IExtractIconW *impl_from_IPersistFile( IPersistFile *iface ) +{ + return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblPersistFile)); +} + +static inline IExtractIconW *impl_from_IExtractIconA( IExtractIconA *iface ) +{ + return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblExtractIconA)); +} -#define _IExtractIconA_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblExtractIconA))) -#define _ICOM_THIS_From_IExtractIconA(class, name) class* This = (class*)(((char*)name)-_IExtractIconA_Offset); /************************************************************************** * IExtractIconW_Constructor @@ -261,7 +266,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation( if(IsEqualGUID(riid, &CLSID_MyComputer)) *piIndex = -IDI_SHELL_MY_COMPUTER; else if(IsEqualGUID(riid, &CLSID_MyDocuments)) - *piIndex = -IDI_SHELL_FOLDER; + *piIndex = -IDI_SHELL_MY_DOCUMENTS; else if(IsEqualGUID(riid, &CLSID_NetworkPlaces)) *piIndex = -IDI_SHELL_MY_NETWORK_PLACES; else @@ -419,7 +424,7 @@ IExtractIconA* IExtractIconA_Constructor(LPCITEMIDLIST pidl) */ static HRESULT WINAPI IExtractIconA_fnQueryInterface(IExtractIconA * iface, REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IExtractIconA(IExtractIconW, iface); + IExtractIconW *This = impl_from_IExtractIconA(iface); return IExtractIconW_QueryInterface(This, riid, ppvObj); } @@ -429,7 +434,7 @@ static HRESULT WINAPI IExtractIconA_fnQueryInterface(IExtractIconA * iface, REFI */ static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface) { - _ICOM_THIS_From_IExtractIconA(IExtractIconW, iface); + IExtractIconW *This = impl_from_IExtractIconA(iface); return IExtractIconW_AddRef(This); } @@ -438,7 +443,7 @@ static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface) */ static ULONG WINAPI IExtractIconA_fnRelease(IExtractIconA * iface) { - _ICOM_THIS_From_IExtractIconA(IExtractIconW, iface); + IExtractIconW *This = impl_from_IExtractIconA(iface); return IExtractIconW_AddRef(This); } @@ -457,7 +462,7 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation( { HRESULT ret; LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR)); - _ICOM_THIS_From_IExtractIconA(IExtractIconW, iface); + IExtractIconW *This = impl_from_IExtractIconA(iface); TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags); @@ -476,7 +481,7 @@ static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszF HRESULT ret; INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - _ICOM_THIS_From_IExtractIconA(IExtractIconW, iface); + IExtractIconW *This = impl_from_IExtractIconA(iface); TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize); @@ -503,7 +508,7 @@ static HRESULT WINAPI IEIPersistFile_fnQueryInterface( REFIID iid, LPVOID *ppvObj) { - _ICOM_THIS_From_IPersistFile(IExtractIconW, iface); + IExtractIconW *This = impl_from_IPersistFile(iface); return IExtractIconW_QueryInterface(This, iid, ppvObj); } @@ -514,7 +519,7 @@ static HRESULT WINAPI IEIPersistFile_fnQueryInterface( static ULONG WINAPI IEIPersistFile_fnAddRef( IPersistFile *iface) { - _ICOM_THIS_From_IPersistFile(IExtractIconW, iface); + IExtractIconW *This = impl_from_IPersistFile(iface); return IExtractIconW_AddRef(This); } @@ -525,7 +530,7 @@ static ULONG WINAPI IEIPersistFile_fnAddRef( static ULONG WINAPI IEIPersistFile_fnRelease( IPersistFile *iface) { - _ICOM_THIS_From_IPersistFile(IExtractIconW, iface); + IExtractIconW *This = impl_from_IPersistFile(iface); return IExtractIconW_Release(This); } @@ -552,7 +557,7 @@ static HRESULT WINAPI IEIPersistFile_fnGetClassID( */ static HRESULT WINAPI IEIPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) { - _ICOM_THIS_From_IPersistFile(IExtractIconW, iface); + IExtractIconW *This = impl_from_IPersistFile(iface); FIXME("%p\n", This); return E_NOTIMPL; diff --git a/reactos/lib/shell32/iconcache.c b/reactos/lib/shell32/iconcache.c index 9af214ff5d5..fcacbaaea54 100644 --- a/reactos/lib/shell32/iconcache.c +++ b/reactos/lib/shell32/iconcache.c @@ -407,24 +407,27 @@ BOOL SIC_Initialize(void) return(FALSE); } - ShellSmallIconList = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,0x20); - ShellBigIconList = ImageList_Create(32,32,ILC_COLOR32|ILC_MASK,0,0x20); + ShellSmallIconList = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,0x20); + ShellBigIconList = ImageList_Create(32,32,ILC_COLOR32|ILC_MASK,0,0x20); - ImageList_SetBkColor(ShellSmallIconList, CLR_NONE); - ImageList_SetBkColor(ShellBigIconList, CLR_NONE); + ImageList_SetBkColor(ShellSmallIconList, CLR_NONE); + ImageList_SetBkColor(ShellBigIconList, CLR_NONE); - for (index=1; index<39; index++) + /* + * Wine will extract and cache all shell32 icons here. That's because + * they are unable to extract resources from their built-in DLLs. + * We don't need that, but we still want to make sure that the very + * first icon in the image lists is icon 1 from shell32.dll, since + * that's the default icon. + */ + index = 1; + hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED); + hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED); + + if(hSm) { - hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED); - hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED); - - if(!hSm) - { - hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_small, cy_small, LR_SHARED); - hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_large, cy_large, LR_SHARED); - } - SIC_IconAppend (swShell32Name, index - 1, hSm, hLg, 0); - SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0); + SIC_IconAppend (swShell32Name, index - 1, hSm, hLg, 0); + SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0); } TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList); diff --git a/reactos/lib/shell32/pidl.c b/reactos/lib/shell32/pidl.c index 54efcc123f4..892f523b0f3 100644 --- a/reactos/lib/shell32/pidl.c +++ b/reactos/lib/shell32/pidl.c @@ -1209,87 +1209,6 @@ HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, return E_INVALIDARG; } -/************************************************************************* - * SHELL_GetPathFromIDListA - */ -HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSize) -{ - HRESULT hr = S_OK; - - pszPath[0]=0; - - /* One case is a PIDL rooted at desktop level */ - if (_ILIsDesktop(pidl) || _ILIsValue(pidl) || _ILIsFolder(pidl)) - { - hr = SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOP, FALSE); - - if (SUCCEEDED(hr)) - PathAddBackslashA(pszPath); - } - /* The only other valid case is an item ID list beginning at "My Computer" */ - else if (_ILIsMyComputer(pidl)) - pidl = ILGetNext(pidl); - - if (SUCCEEDED(hr)) - { - LPSTR txt; - - while(pidl && pidl->mkid.cb) - { - if (_ILIsSpecialFolder(pidl)) - { - hr = E_INVALIDARG; - break; - } - - txt = _ILGetTextPointer(pidl); - if (!txt) - { - hr = E_INVALIDARG; - break; - } - - if (lstrlenA(txt) > pidl->mkid.cb) - ERR("pidl %p is borked\n",pidl); - - /* make sure there's enough space for the next segment */ - if ((lstrlenA(txt) + lstrlenA(pszPath)) > uOutSize) - { - hr = E_INVALIDARG; - break; - } - lstrcatA( pszPath, txt ); - - pidl = ILGetNext(pidl); - if (!pidl) - { - hr = E_INVALIDARG; - break; - } - - /* Are we at the end and successfully converted the complete PIDL? */ - if (!pidl->mkid.cb) - break; - - if ((lstrlenA(pszPath) + 1) > uOutSize) - { - hr = E_INVALIDARG; - break; - } - if (!PathAddBackslashA(pszPath)) - { - hr = E_INVALIDARG; - break; - } - } - } - else - hr = E_INVALIDARG; - - TRACE_(shell)("-- %s, 0x%08lx\n", pszPath, hr); - return hr; -} - /************************************************************************* * SHGetPathFromIDListA [SHELL32.@][NT 4.0: SHELL32.220] * @@ -1307,100 +1226,14 @@ HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSiz */ BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath) { - HRESULT hr; + WCHAR wszPath[MAX_PATH]; + BOOL bSuccess; - TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath); - pdump(pidl); + bSuccess = SHGetPathFromIDListW(pidl, wszPath); + if (bSuccess) + WideCharToMultiByte(CP_ACP, 0, wszPath, -1, pszPath, MAX_PATH, NULL, NULL); - if (!pidl) - return FALSE; - - hr = SHELL_GetPathFromIDListA(pidl, pszPath, MAX_PATH); - - return SUCCEEDED(hr); -} - -/************************************************************************* - * SHELL_GetPathFromIDListW - */ -HRESULT SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath, UINT uOutSize) -{ - HRESULT hr = S_OK; - UINT len; - - pszPath[0]=0; - - /* One case is a PIDL rooted at desktop level */ - if (_ILIsDesktop(pidl) ||_ILIsValue(pidl) || _ILIsFolder(pidl)) - { - hr = SHGetSpecialFolderPathW(0, pszPath, CSIDL_DESKTOP, FALSE); - - if (SUCCEEDED(hr)) - PathAddBackslashW(pszPath); - } - /* The only other valid case is an item ID list beginning at "My Computer" */ - else if (_ILIsMyComputer(pidl)) - pidl = ILGetNext(pidl); - - if (SUCCEEDED(hr)) - { - LPSTR txt; - - while(pidl && pidl->mkid.cb) - { - if (_ILIsSpecialFolder(pidl)) - { - hr = E_INVALIDARG; - break; - } - - txt = _ILGetTextPointer(pidl); - if (!txt) - { - hr = E_INVALIDARG; - break; - } - - if (lstrlenA(txt) > pidl->mkid.cb) - ERR("pidl %p is borked\n",pidl); - len = MultiByteToWideChar(CP_ACP, 0, txt, -1, NULL, 0); - if ( (lstrlenW(pszPath) + len) > uOutSize ) - { - hr = E_INVALIDARG; - break; - } - - MultiByteToWideChar(CP_ACP, 0, txt, -1, - &pszPath[lstrlenW(pszPath)], len); - - pidl = ILGetNext(pidl); - if (!pidl) - { - hr = E_INVALIDARG; - break; - } - - /* Are we at the end and successfully converted the complete PIDL? */ - if (!pidl->mkid.cb) - break; - - if ((lstrlenW(pszPath) + 1) > uOutSize ) - { - hr = E_INVALIDARG; - break; - } - if (!PathAddBackslashW(pszPath)) - { - hr = E_INVALIDARG; - break; - } - } - } - else - hr = E_INVALIDARG; - - TRACE_(shell)("-- %s, 0x%08lx\n", debugstr_w(pszPath), hr); - return hr; + return bSuccess; } /************************************************************************* @@ -1409,6 +1242,10 @@ HRESULT SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath, UINT uOutSi BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath) { HRESULT hr; + LPCITEMIDLIST pidlLast; + LPSHELLFOLDER psfFolder; + DWORD dwAttributes; + STRRET strret; TRACE_(shell)("(pidl=%p,%p)\n", pidl, debugstr_w(pszPath)); pdump(pidl); @@ -1416,7 +1253,21 @@ BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath) if (!pidl) return FALSE; - hr = SHELL_GetPathFromIDListW(pidl, pszPath, MAX_PATH); + hr = SHBindToParent(pidl, &IID_IShellFolder, (VOID**)&psfFolder, &pidlLast); + if (FAILED(hr)) return FALSE; + + dwAttributes = SFGAO_FILESYSTEM; + hr = IShellFolder_GetAttributesOf(psfFolder, 1, &pidlLast, &dwAttributes); + if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) { + IShellFolder_Release(psfFolder); + return FALSE; + } + + hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret); + IShellFolder_Release(psfFolder); + if (FAILED(hr)) return FALSE; + + hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH); TRACE_(shell)("-- %s, 0x%08lx\n",debugstr_w(pszPath), hr); return SUCCEEDED(hr); @@ -2135,7 +1986,14 @@ BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) { FileTimeToLocalFileTime(&ft, &lft); FileTimeToSystemTime (&lft, &time); + ret = GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, pOut, uOutSize); + if (ret) + { + /* Append space + time without seconds */ + pOut[ret-1] = ' '; + GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &pOut[ret], uOutSize - ret); + } } else { diff --git a/reactos/lib/shell32/regsvr.c b/reactos/lib/shell32/regsvr.c index 7375d247e67..21170b45fc1 100644 --- a/reactos/lib/shell32/regsvr.c +++ b/reactos/lib/shell32/regsvr.c @@ -313,7 +313,7 @@ static HRESULT register_coclasses(struct regsvr_coclass const *list) &shellfolder_key, NULL); if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->flags & SHELLFOLDER_WANTSFORPARSING) - res = RegSetValueExA(shellfolder_key, wfparsing_valuename, 0, REG_SZ, "", 1); + res = RegSetValueExA(shellfolder_key, wfparsing_valuename, 0, REG_SZ, (LPBYTE)"", 1); if (list->flags & SHELLFOLDER_ATTRIBUTES) res = RegSetValueExA(shellfolder_key, attributes_valuename, 0, REG_DWORD, (LPBYTE)&list->dwAttributes, sizeof(DWORD)); @@ -605,6 +605,24 @@ static struct regsvr_coclass const coclass_list[] = { "shell32.dll", "Apartment", }, + { &CLSID_FolderShortcut, + "Foldershortcut", + NULL, + "shell32.dll", + "Apartment", + SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES, + SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK, + SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR + }, + { &CLSID_MyDocuments, + "My Documents", + NULL, + "shell32.dll", + "Apartment", + SHELLFOLDER_WANTSFORPARSING|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES, + SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, + SFGAO_FILESYSTEM + }, { NULL } /* list terminator */ }; @@ -621,15 +639,21 @@ static struct regsvr_interface const interface_list[] = { */ static const WCHAR wszDesktop[] = { 'D','e','s','k','t','o','p',0 }; static const WCHAR wszSlash[] = { '/', 0 }; +static const WCHAR wszMyDocuments[] = { 'M','y',' ','D','o','c','u','m','e','n','t','s', 0 }; static struct regsvr_namespace const namespace_extensions_list[] = { + { + &CLSID_MyDocuments, + wszDesktop, + wszMyDocuments + }, { NULL } }; /*********************************************************************** * DllRegisterServer (SHELL32.@) */ -HRESULT WINAPI SHELL32_DllRegisterServer() +HRESULT WINAPI DllRegisterServer(void) { HRESULT hr; @@ -648,7 +672,7 @@ HRESULT WINAPI SHELL32_DllRegisterServer() /*********************************************************************** * DllUnregisterServer (SHELL32.@) */ -HRESULT WINAPI SHELL32_DllUnregisterServer() +HRESULT WINAPI DllUnregisterServer(void) { HRESULT hr; diff --git a/reactos/lib/shell32/shell.c b/reactos/lib/shell32/shell.c index 16f12e0633b..262ac49bb7d 100644 --- a/reactos/lib/shell32/shell.c +++ b/reactos/lib/shell32/shell.c @@ -574,7 +574,7 @@ DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count { fix_win16_hkey( &hkey ); if (count) *count &= 0xffff; - return RegQueryValueA( hkey, name, data, count ); + return RegQueryValueA( hkey, name, data, (LONG*) count ); } /****************************************************************************** diff --git a/reactos/lib/shell32/shell32.spec b/reactos/lib/shell32/shell32.spec index afd3aee72fc..7d172c93b33 100644 --- a/reactos/lib/shell32/shell32.spec +++ b/reactos/lib/shell32/shell32.spec @@ -260,12 +260,12 @@ @ stdcall Control_RunDLLA(ptr ptr str long) @ stub Control_RunDLLAsUserW @ stdcall Control_RunDLLW(ptr ptr wstr long) -@ stdcall -private DllCanUnloadNow() SHELL32_DllCanUnloadNow -@ stdcall -private DllGetClassObject(long long ptr) SHELL32_DllGetClassObject -@ stdcall DllGetVersion(ptr)SHELL32_DllGetVersion -@ stdcall DllInstall(long wstr)SHELL32_DllInstall -@ stdcall -private DllRegisterServer() SHELL32_DllRegisterServer -@ stdcall -private DllUnregisterServer() SHELL32_DllUnregisterServer +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllGetVersion(ptr) +@ stdcall -private DllInstall(long wstr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() @ stdcall DoEnvironmentSubstA(str str) @ stdcall DoEnvironmentSubstW(wstr wstr) @ stdcall DragAcceptFiles(long long) diff --git a/reactos/lib/shell32/shell32_main.c b/reactos/lib/shell32/shell32_main.c index 253635b3250..3503dce50a5 100644 --- a/reactos/lib/shell32/shell32_main.c +++ b/reactos/lib/shell32/shell32_main.c @@ -386,6 +386,8 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, { hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&pidlLast ); + if (SUCCEEDED(hr)) + pidlLast = ILClone(pidlLast); ILFree(pidl); } else @@ -1058,7 +1060,7 @@ void WINAPI FreeIconList( DWORD dw ) * Returns version of a shell32.dll from IE4.01 SP1. */ -HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi) +HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi) { /* FIXME: shouldn't these values come from the version resource? */ if (pdvi->cbSize == sizeof(DLLVERSIONINFO) || @@ -1144,7 +1146,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) * LPCWSTR pszCmdLine - command line (unused by shell32?) */ -HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline) +HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline) { FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline)); return S_OK; /* indicate success */ @@ -1153,7 +1155,7 @@ HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline) /*********************************************************************** * DllCanUnloadNow (SHELL32.@) */ -HRESULT WINAPI SHELL32_DllCanUnloadNow(void) +HRESULT WINAPI DllCanUnloadNow(void) { FIXME("stub\n"); return S_FALSE; diff --git a/reactos/lib/shell32/shell32_main.h b/reactos/lib/shell32/shell32_main.h index 6cf42409219..996b5781760 100644 --- a/reactos/lib/shell32/shell32_main.h +++ b/reactos/lib/shell32/shell32_main.h @@ -94,6 +94,8 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv); +HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv); +HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv); extern HRESULT CPanel_GetIconLocationW(LPITEMIDLIST, LPWSTR, UINT, int*); HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); @@ -103,11 +105,6 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO LPEXTRACTICONA IExtractIconA_Constructor(LPCITEMIDLIST); LPEXTRACTICONW IExtractIconW_Constructor(LPCITEMIDLIST); -/* FIXME: rename the functions when the shell32.dll has it's own exports namespace */ -HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv); -HRESULT WINAPI SHELL32_DllCanUnloadNow(void); - - /* menu merging */ #define MM_ADDSEPARATOR 0x00000001L #define MM_SUBMENUSHAVEIDS 0x00000002L diff --git a/reactos/lib/shell32/shelllink.c b/reactos/lib/shell32/shelllink.c index 51350b914c6..2b9a0937861 100644 --- a/reactos/lib/shell32/shelllink.c +++ b/reactos/lib/shell32/shelllink.c @@ -161,43 +161,31 @@ static inline IShellLinkImpl *impl_from_IShellLinkW( IShellLinkW *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblw)); } -#define _ICOM_THIS_From_IShellLinkW(class, iface) \ - class* This = impl_from_IShellLinkW( iface ) static inline IShellLinkImpl *impl_from_IPersistFile( IPersistFile *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblPersistFile)); } -#define _ICOM_THIS_From_IPersistFile(class, iface) \ - class* This = impl_from_IPersistFile( iface ) static inline IShellLinkImpl *impl_from_IPersistStream( IPersistStream *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblPersistStream)); } -#define _ICOM_THIS_From_IPersistStream(class, iface) \ - class* This = impl_from_IPersistStream( iface ) static inline IShellLinkImpl *impl_from_IShellLinkDataList( IShellLinkDataList *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblShellLinkDataList)); } -#define _ICOM_THIS_From_IShellLinkDataList(class, iface) \ - class* This = impl_from_IShellLinkDataList( iface ) static inline IShellLinkImpl *impl_from_IShellExtInit( IShellExtInit *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblShellExtInit)); } -#define _ICOM_THIS_From_IShellExtInit(class, iface) \ - class* This = impl_from_IShellExtInit( iface ) static inline IShellLinkImpl *impl_from_IContextMenu( IContextMenu *iface ) { return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblContextMenu)); } -#define _ICOM_THIS_From_IContextMenu(class, iface) \ - class* This = impl_from_IContextMenu( iface ) static HRESULT ShellLink_UpdatePath(LPWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir, LPWSTR* psPath); @@ -316,7 +304,7 @@ static HRESULT WINAPI IPersistFile_fnQueryInterface( REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); return ShellLink_QueryInterface( This, riid, ppvObj ); } @@ -325,7 +313,7 @@ static HRESULT WINAPI IPersistFile_fnQueryInterface( */ static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); return ShellLink_AddRef( This ); } @@ -334,19 +322,19 @@ static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface) */ static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); return IShellLinkA_Release((IShellLinkA*)This); } static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); return ShellLink_GetClassID( This, pClassID ); } static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); TRACE("(%p)\n",This); @@ -358,7 +346,7 @@ static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface) static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); IPersistStream *StreamThis = (IPersistStream *)&This->lpvtblPersistStream; HRESULT r; IStream *stm; @@ -414,7 +402,7 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink ) static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); IPersistStream *StreamThis = (IPersistStream *)&This->lpvtblPersistStream; HRESULT r; IStream *stm; @@ -448,14 +436,14 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName)); return NOERROR; } static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName) { - _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistFile(iface); FIXME("(%p)\n",This); return NOERROR; } @@ -481,7 +469,7 @@ static HRESULT WINAPI IPersistStream_fnQueryInterface( REFIID riid, VOID** ppvObj) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); return ShellLink_QueryInterface( This, riid, ppvObj ); } @@ -491,7 +479,7 @@ static HRESULT WINAPI IPersistStream_fnQueryInterface( static ULONG WINAPI IPersistStream_fnRelease( IPersistStream* iface) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); return IShellLinkA_Release((IShellLinkA*)This); } @@ -501,7 +489,7 @@ static ULONG WINAPI IPersistStream_fnRelease( static ULONG WINAPI IPersistStream_fnAddRef( IPersistStream* iface) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); return ShellLink_AddRef( This ); } @@ -513,7 +501,7 @@ static HRESULT WINAPI IPersistStream_fnGetClassID( IPersistStream* iface, CLSID* pClassID) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); return ShellLink_GetClassID( This, pClassID ); } @@ -523,7 +511,7 @@ static HRESULT WINAPI IPersistStream_fnGetClassID( static HRESULT WINAPI IPersistStream_fnIsDirty( IPersistStream* iface) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); TRACE("(%p)\n", This); @@ -768,7 +756,7 @@ static HRESULT WINAPI IPersistStream_fnLoad( HRESULT r; DWORD zero; - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); TRACE("%p %p\n", This, stm); @@ -1032,7 +1020,7 @@ static HRESULT WINAPI IPersistStream_fnSave( DWORD zero; HRESULT r; - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); TRACE("%p %p %x\n", This, stm, fClearDirty); @@ -1138,7 +1126,7 @@ static HRESULT WINAPI IPersistStream_fnGetSizeMax( IPersistStream* iface, ULARGE_INTEGER* pcbSize) { - _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IPersistStream(iface); TRACE("(%p)\n", This); @@ -1675,7 +1663,7 @@ static const IShellLinkAVtbl slvt = static HRESULT WINAPI IShellLinkW_fnQueryInterface( IShellLinkW * iface, REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); return ShellLink_QueryInterface( This, riid, ppvObj ); } @@ -1684,7 +1672,7 @@ static HRESULT WINAPI IShellLinkW_fnQueryInterface( */ static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); return ShellLink_AddRef( This ); } @@ -1693,13 +1681,13 @@ static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface) */ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); return ShellLink_Release( This ); } static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n", This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath)); @@ -1719,7 +1707,7 @@ static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile, static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(ppidl=%p)\n",This, ppidl); @@ -1731,7 +1719,7 @@ static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(pidl=%p)\n",This, pidl); @@ -1748,7 +1736,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); @@ -1761,7 +1749,7 @@ static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR p static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); @@ -1779,7 +1767,7 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath); @@ -1793,7 +1781,7 @@ static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPW static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); @@ -1810,7 +1798,7 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); @@ -1824,7 +1812,7 @@ static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR psz static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); @@ -1841,7 +1829,7 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p)\n",This, pwHotkey); @@ -1852,7 +1840,7 @@ static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotke static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(hotkey=%x)\n",This, wHotkey); @@ -1864,7 +1852,7 @@ static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey) static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p)\n",This, piShowCmd); @@ -1875,7 +1863,7 @@ static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowC static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); This->iShowCmd = iShowCmd; This->bDirty = TRUE; @@ -1908,7 +1896,7 @@ static HRESULT SHELL_PidlGeticonLocationW(IShellFolder* psf, LPITEMIDLIST pidl, static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); @@ -1959,7 +1947,7 @@ static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon); @@ -1978,7 +1966,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved); @@ -1998,7 +1986,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR HRESULT hr = S_OK; BOOL bSuccess; - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); TRACE("(%p)->(hwnd=%p flags=%lx)\n",This, hwnd, fFlags); @@ -2134,7 +2122,7 @@ static BOOL ShellLink_GetVolumeInfo(LPWSTR path, volume_info *volume) static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile) { - _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkW(iface); WCHAR buffer[MAX_PATH]; LPWSTR fname; HRESULT hr = S_OK; @@ -2207,21 +2195,21 @@ static const IShellLinkWVtbl slvtw = static HRESULT WINAPI ShellLink_DataList_QueryInterface( IShellLinkDataList* iface, REFIID riid, void** ppvObject) { - _ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkDataList(iface); return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObject); } static ULONG WINAPI ShellLink_DataList_AddRef( IShellLinkDataList* iface ) { - _ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkDataList(iface); return IShellLinkA_AddRef((IShellLinkA*)This); } static ULONG WINAPI ShellLink_DataList_Release( IShellLinkDataList* iface ) { - _ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellLinkDataList(iface); return ShellLink_Release( This ); } @@ -2275,21 +2263,21 @@ static const IShellLinkDataListVtbl dlvt = static HRESULT WINAPI ShellLink_ExtInit_QueryInterface( IShellExtInit* iface, REFIID riid, void** ppvObject ) { - _ICOM_THIS_From_IShellExtInit(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellExtInit(iface); return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObject); } static ULONG WINAPI ShellLink_ExtInit_AddRef( IShellExtInit* iface ) { - _ICOM_THIS_From_IShellExtInit(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellExtInit(iface); return IShellLinkA_AddRef((IShellLinkA*)This); } static ULONG WINAPI ShellLink_ExtInit_Release( IShellExtInit* iface ) { - _ICOM_THIS_From_IShellExtInit(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellExtInit(iface); return ShellLink_Release( This ); } @@ -2302,7 +2290,7 @@ static HRESULT WINAPI ShellLink_ExtInit_Initialize( IShellExtInit* iface, LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID ) { - _ICOM_THIS_From_IShellExtInit(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IShellExtInit(iface); FORMATETC format; STGMEDIUM stgm; UINT count; @@ -2355,21 +2343,21 @@ static const IShellExtInitVtbl eivt = static HRESULT WINAPI ShellLink_ContextMenu_QueryInterface( IContextMenu* iface, REFIID riid, void** ppvObject ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObject); } static ULONG WINAPI ShellLink_ContextMenu_AddRef( IContextMenu* iface ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); return IShellLinkA_AddRef((IShellLinkA*)This); } static ULONG WINAPI ShellLink_ContextMenu_Release( IContextMenu* iface ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); return ShellLink_Release( This ); } @@ -2377,7 +2365,7 @@ static HRESULT WINAPI ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); FIXME("%p %p %u %u %u %u\n", This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); @@ -2388,7 +2376,7 @@ ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu, static HRESULT WINAPI ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); FIXME("%p %p\n", This, lpici ); @@ -2399,7 +2387,7 @@ static HRESULT WINAPI ShellLink_GetCommandString( IContextMenu* iface, UINT idCmd, UINT uType, UINT* pwReserved, LPSTR pszName, UINT cchMax ) { - _ICOM_THIS_From_IContextMenu(IShellLinkImpl, iface); + IShellLinkImpl *This = impl_from_IContextMenu(iface); FIXME("%p %u %u %p %p %u\n", This, idCmd, uType, pwReserved, pszName, cchMax ); diff --git a/reactos/lib/shell32/shellole.c b/reactos/lib/shell32/shellole.c index d032b84ba79..9f52ff72258 100644 --- a/reactos/lib/shell32/shellole.c +++ b/reactos/lib/shell32/shellole.c @@ -163,7 +163,7 @@ HRESULT WINAPI SHCoCreateInstance( /* now we create an instance */ if (bLoadFromShell32) { - if (! SUCCEEDED(SHELL32_DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf))) { + if (! SUCCEEDED(DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf))) { ERR("LoadFromShell failed for CLSID=%s\n", shdebugstr_guid(myclsid)); } } else if (bLoadWithoutCOM) { @@ -214,7 +214,7 @@ end: /************************************************************************* * DllGetClassObject [SHELL32.@] */ -HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { HRESULT hres = E_OUTOFMEMORY; IClassFactory * pcf = NULL; @@ -639,7 +639,7 @@ HRESULT WINAPI SHCreateDefClassObject( shdebugstr_guid(riid), ppv, lpfnCI, pcRefDll, shdebugstr_guid(riidInst)); if (! IsEqualCLSID(riid, &IID_IClassFactory) ) return E_NOINTERFACE; - if (! (pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst))) return E_OUTOFMEMORY; + if (! (pcf = IDefClF_fnConstructor(lpfnCI, (PLONG)pcRefDll, riidInst))) return E_OUTOFMEMORY; *ppv = pcf; return NOERROR; } diff --git a/reactos/lib/shell32/shellreg.c b/reactos/lib/shell32/shellreg.c index 700ab519d8f..a34f00fe6ee 100644 --- a/reactos/lib/shell32/shellreg.c +++ b/reactos/lib/shell32/shellreg.c @@ -95,7 +95,7 @@ HRESULT WINAPI SHRegQueryValueW( { WARN("%p %s %p %p semi-stub\n", hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); - return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData ); + return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData ); } /************************************************************************* diff --git a/reactos/lib/shell32/shfldr_desktop.c b/reactos/lib/shell32/shfldr_desktop.c index 0c535fd7181..31dbf9d4843 100644 --- a/reactos/lib/shell32/shfldr_desktop.c +++ b/reactos/lib/shell32/shfldr_desktop.c @@ -662,8 +662,19 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, } else { - /* file system folder */ - _ILSimpleGetText (pidl, strRet->u.cStr, MAX_PATH); + int cLen = 0; + + /* file system folder or file rooted at the desktop */ + if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) && + (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER)) + { + WideCharToMultiByte(CP_ACP, 0, This->sPathTarget, -1, strRet->u.cStr, MAX_PATH, + NULL, NULL); + PathAddBackslashA(strRet->u.cStr); + cLen = lstrlenA(strRet->u.cStr); + } + + _ILSimpleGetText (pidl, strRet->u.cStr + cLen, MAX_PATH - cLen); if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags); diff --git a/reactos/lib/shell32/shfldr_fs.c b/reactos/lib/shell32/shfldr_fs.c index f7bce84e9c7..cb92d73eceb 100644 --- a/reactos/lib/shell32/shfldr_fs.c +++ b/reactos/lib/shell32/shfldr_fs.c @@ -86,20 +86,26 @@ static const IPersistFolder3Vtbl vt_FSFldr_PersistFolder3; /* IPersistFolder3 fo static const IDropTargetVtbl dtvt; static const ISFHelperVtbl shvt; -#define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder))) -#define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset); +static inline IGenericSFImpl *impl_from_IShellFolder2( IShellFolder2 *iface ) +{ + return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblShellFolder)); +} -#define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3))) -#define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset); +static inline IGenericSFImpl *impl_from_IPersistFolder3( IPersistFolder3 *iface ) +{ + return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblPersistFolder3)); +} -#define _IPersistFolder3_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3))) -#define _ICOM_THIS_From_IPersistFolder3(class, name) class* This = (class*)(((char*)name)-_IPersistFolder3_Offset); +static inline IGenericSFImpl *impl_from_IDropTarget( IDropTarget *iface ) +{ + return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblDropTarget)); +} -#define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) -#define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); +static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface ) +{ + return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblSFHelper)); +} -#define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper))) -#define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset); /* converts This to an interface pointer @@ -264,7 +270,7 @@ static HRESULT WINAPI IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj); @@ -277,7 +283,7 @@ IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid, static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -289,7 +295,7 @@ static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface) */ static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -373,7 +379,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = E_INVALIDARG; LPCWSTR szNext = NULL; @@ -444,7 +450,7 @@ static HRESULT WINAPI IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList); @@ -474,7 +480,7 @@ static HRESULT WINAPI IShellFolder_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, LPVOID * ppvOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbc, shdebugstr_guid (riid), ppvOut); @@ -495,7 +501,7 @@ static HRESULT WINAPI IShellFolder_fnBindToStorage (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut); @@ -512,7 +518,7 @@ static HRESULT WINAPI IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); int nReturn; @@ -529,7 +535,7 @@ static HRESULT WINAPI IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); LPSHELLVIEW pShellView; HRESULT hr = E_INVALIDARG; @@ -570,7 +576,7 @@ static HRESULT WINAPI IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = S_OK; @@ -640,7 +646,7 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); LPITEMIDLIST pidl; IUnknown *pObj = NULL; @@ -774,7 +780,7 @@ static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = S_OK; int len = 0; @@ -834,7 +840,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, DWORD dwFlags, LPITEMIDLIST * pPidlOut) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); WCHAR szSrc[MAX_PATH], szDest[MAX_PATH]; LPWSTR ptr; BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl)); @@ -885,14 +891,14 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID (IShellFolder2 *iface, GUID * pguid) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); FIXME ("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI IShellFolder_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); FIXME ("(%p)\n", This); return E_NOTIMPL; } @@ -901,7 +907,7 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)\n", This); @@ -917,7 +923,7 @@ static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); TRACE ("(%p)\n", This); @@ -933,7 +939,7 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); FIXME ("(%p)\n", This); return E_NOTIMPL; @@ -943,7 +949,7 @@ static HRESULT WINAPI IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = E_FAIL; TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd); @@ -990,7 +996,7 @@ static HRESULT WINAPI IShellFolder_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid) { - _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_IShellFolder2(iface); FIXME ("(%p)\n", This); return E_NOTIMPL; } @@ -1027,7 +1033,7 @@ static const IShellFolder2Vtbl sfvt = static HRESULT WINAPI ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_ISFHelper(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -1036,7 +1042,7 @@ ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj) static ULONG WINAPI ISFHelper_fnAddRef (ISFHelper * iface) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_ISFHelper(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -1045,7 +1051,7 @@ static ULONG WINAPI ISFHelper_fnAddRef (ISFHelper * iface) static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_ISFHelper(iface); TRACE ("(%p)\n", This); @@ -1061,7 +1067,7 @@ static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface) static HRESULT WINAPI ISFHelper_fnGetUniqueName (ISFHelper * iface, LPSTR lpName, UINT uLen) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_ISFHelper(iface); IEnumIDList *penum; HRESULT hr; char szText[MAX_PATH]; @@ -1111,7 +1117,7 @@ static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCSTR lpName, LPITEMIDLIST * ppidlOut) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_ISFHelper(iface); char lpstrNewDir[MAX_PATH]; DWORD bRes; HRESULT hres = E_FAIL; @@ -1154,7 +1160,7 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCSTR lpName, static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl) { - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface) + IGenericSFImpl *This = impl_from_ISFHelper(iface); UINT i; char szPath[MAX_PATH]; BOOL bConfirm = TRUE; @@ -1218,7 +1224,7 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, char szSrcPath[MAX_PATH], szDstPath[MAX_PATH]; - _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_ISFHelper(iface); TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl); @@ -1266,7 +1272,7 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * iface, REFIID iid, LPVOID * ppvObj) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)\n", This); @@ -1280,7 +1286,7 @@ IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * iface, REFIID iid, static ULONG WINAPI IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -1294,7 +1300,7 @@ IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface) static ULONG WINAPI IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -1307,7 +1313,7 @@ IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface) static HRESULT WINAPI IFSFldr_PersistFolder3_GetClassID (IPersistFolder3 * iface, CLSID * lpClassId) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)\n", This); @@ -1329,7 +1335,7 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl) { char sTemp[MAX_PATH]; - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)->(%p)\n", This, pidl); @@ -1357,7 +1363,7 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3 * iface, LPITEMIDLIST * pidl) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)->(%p)\n", This, pidl); @@ -1378,7 +1384,7 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface, { char sTemp[MAX_PATH]; - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); TRACE ("(%p)->(%p,%p,%p)\n", This, pbc, pidlRoot, ppfti); if (ppfti) @@ -1429,7 +1435,7 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3 * iface, PERSIST_FOLDER_TARGET_INFO * ppfti) { - _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder3(iface); FIXME ("(%p)->(%p)\n", This, ppfti); ZeroMemory (ppfti, sizeof (ppfti)); return E_NOTIMPL; @@ -1456,7 +1462,7 @@ ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState, { DWORD dwEffect = *pdwEffect; - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); *pdwEffect = DROPEFFECT_NONE; @@ -1474,7 +1480,7 @@ ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState, static HRESULT WINAPI ISFDropTarget_QueryInterface (IDropTarget * iface, REFIID riid, LPVOID * ppvObj) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)\n", This); @@ -1483,7 +1489,7 @@ ISFDropTarget_QueryInterface (IDropTarget * iface, REFIID riid, LPVOID * ppvObj) static ULONG WINAPI ISFDropTarget_AddRef (IDropTarget * iface) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)\n", This); @@ -1492,7 +1498,7 @@ static ULONG WINAPI ISFDropTarget_AddRef (IDropTarget * iface) static ULONG WINAPI ISFDropTarget_Release (IDropTarget * iface) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)\n", This); @@ -1505,7 +1511,7 @@ ISFDropTarget_DragEnter (IDropTarget * iface, IDataObject * pDataObject, { FORMATETC fmt; - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)->(DataObject=%p)\n", This, pDataObject); @@ -1523,7 +1529,7 @@ static HRESULT WINAPI ISFDropTarget_DragOver (IDropTarget * iface, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)\n", This); @@ -1537,7 +1543,7 @@ ISFDropTarget_DragOver (IDropTarget * iface, DWORD dwKeyState, POINTL pt, static HRESULT WINAPI ISFDropTarget_DragLeave (IDropTarget * iface) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); TRACE ("(%p)\n", This); @@ -1550,7 +1556,7 @@ static HRESULT WINAPI ISFDropTarget_Drop (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect) { - _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IDropTarget(iface); FIXME ("(%p) object dropped\n", This); diff --git a/reactos/lib/shell32/shfldr_mycomp.c b/reactos/lib/shell32/shfldr_mycomp.c index 8eb24f6447a..abbafd50250 100644 --- a/reactos/lib/shell32/shfldr_mycomp.c +++ b/reactos/lib/shell32/shfldr_mycomp.c @@ -66,8 +66,11 @@ typedef struct { static const IShellFolder2Vtbl vt_ShellFolder2; static const IPersistFolder2Vtbl vt_PersistFolder2; -#define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpVtblPersistFolder2))) -#define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset); +static inline IGenericSFImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface ) +{ + return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpVtblPersistFolder2)); +} + /* converts This to an interface pointer @@ -855,7 +858,7 @@ static const IShellFolder2Vtbl vt_ShellFolder2 = static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface ( IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)\n", This); @@ -867,7 +870,7 @@ static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface ( */ static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -879,7 +882,7 @@ static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface) */ static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)->(count=%lu)\n", This, This->ref); @@ -892,7 +895,7 @@ static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface) static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID ( IPersistFolder2 * iface, CLSID * lpClassId) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)\n", This); @@ -911,7 +914,7 @@ static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID ( static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize ( IPersistFolder2 * iface, LPCITEMIDLIST pidl) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)->(%p)\n", This, pidl); return E_NOTIMPL; } @@ -922,7 +925,7 @@ static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize ( static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder ( IPersistFolder2 * iface, LPITEMIDLIST * pidl) { - _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface); + IGenericSFImpl *This = impl_from_IPersistFolder2(iface); TRACE ("(%p)->(%p)\n", This, pidl); diff --git a/reactos/lib/shell32/shlexec.c b/reactos/lib/shell32/shlexec.c index 30df2aed80b..4159e268711 100644 --- a/reactos/lib/shell32/shlexec.c +++ b/reactos/lib/shell32/shlexec.c @@ -57,6 +57,8 @@ static const WCHAR wszShell[] = {'\\','s','h','e','l','l','\\',0}; static const WCHAR wszFolder[] = {'F','o','l','d','e','r',0}; static const WCHAR wszEmpty[] = {0}; +#define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY) + /*********************************************************************** * SHELL_ArgifyW [Internal] @@ -80,6 +82,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp { WCHAR xlpFile[1024]; BOOL done = FALSE; + BOOL found_p1 = FALSE; PWSTR res = out; PCWSTR cmd; LPVOID pv; @@ -153,6 +156,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp res += strlenW(cmd); } } + found_p1 = TRUE; break; /* @@ -166,6 +170,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp strcpyW(res, lpFile); res += strlenW(lpFile); } + found_p1 = TRUE; break; case 'i': @@ -176,6 +181,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp res += sprintfW(res, wszILPtr, pv); SHUnlockShared(pv); } + found_p1 = TRUE; break; default: @@ -219,7 +225,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp *res = '\0'; - return done; + return found_p1; } HRESULT SHELL_GetPathFromIDListForExecuteA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSize) @@ -996,15 +1002,25 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun sei_tmp.fMask, sei_tmp.hwnd, debugstr_w(sei_tmp.lpVerb), debugstr_w(sei_tmp.lpFile), debugstr_w(sei_tmp.lpParameters), debugstr_w(sei_tmp.lpDirectory), sei_tmp.nShow, - (sei_tmp.fMask & SEE_MASK_CLASSNAME) ? debugstr_w(sei_tmp.lpClass) : "not used"); + ((sei_tmp.fMask & SEE_MASK_CLASSALL) == SEE_MASK_CLASSNAME) ? + debugstr_w(sei_tmp.lpClass) : "not used"); sei->hProcess = NULL; /* make copies of all path/command strings */ - if (sei_tmp.lpFile) - strcpyW(wszApplicationName, sei_tmp.lpFile); + if (!sei_tmp.lpFile) + *wszApplicationName = '\0'; + else if (*sei_tmp.lpFile == '\"') + { + UINT l; + strcpyW(wszApplicationName, sei_tmp.lpFile+1); + l=lstrlenW(wszApplicationName); + if (wszApplicationName[l-1] == '\"') + wszApplicationName[l-1] = '\0'; + TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName)); + } else - *wszApplicationName = '\0'; + strcpyW(wszApplicationName, sei_tmp.lpFile); if (sei_tmp.lpParameters) strcpyW(wszParameters, sei_tmp.lpParameters); @@ -1049,13 +1065,14 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun TRACE("-- idlist=%p (%s)\n", sei_tmp.lpIDList, debugstr_w(wszApplicationName)); } - if (sei_tmp.fMask & (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY)) + if (sei_tmp.fMask & SEE_MASK_CLASSALL) { /* launch a document by fileclass like 'WordPad.Document.1' */ /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */ /* FIXME: szCommandline should not be of a fixed size. Fixed to 1024, MAX_PATH is way too short! */ - HCR_GetExecuteCommandW((sei_tmp.fMask & SEE_MASK_CLASSKEY) ? sei_tmp.hkeyClass : NULL, - (sei_tmp.fMask & SEE_MASK_CLASSNAME) ? sei_tmp.lpClass: NULL, + ULONG cmask=(sei_tmp.fMask & SEE_MASK_CLASSALL); + HCR_GetExecuteCommandW((cmask == SEE_MASK_CLASSKEY) ? sei_tmp.hkeyClass : NULL, + (cmask == SEE_MASK_CLASSNAME) ? sei_tmp.lpClass: NULL, (sei_tmp.lpVerb) ? sei_tmp.lpVerb : wszOpen, wszParameters, sizeof(wszParameters)/sizeof(WCHAR)); @@ -1345,7 +1362,8 @@ HINSTANCE WINAPI ShellExecuteA(HWND hWnd, LPCSTR lpOperation,LPCSTR lpFile, HANDLE hProcess = 0; TRACE("%p,%s,%s,%s,%s,%d\n", - hWnd, lpOperation, lpFile, lpParameters, lpDirectory, iShowCmd); + hWnd, debugstr_a(lpOperation), debugstr_a(lpFile), + debugstr_a(lpParameters), debugstr_a(lpDirectory), iShowCmd); sei.cbSize = sizeof(sei); sei.fMask = 0; @@ -1391,7 +1409,7 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei) if (sei->lpDirectory) seiW.lpDirectory = __SHCloneStrAtoW(&wDirectory, sei->lpDirectory); - if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) + if ((sei->fMask & SEE_MASK_CLASSALL) == SEE_MASK_CLASSNAME && sei->lpClass) seiW.lpClass = __SHCloneStrAtoW(&wClass, sei->lpClass); else seiW.lpClass = NULL; diff --git a/reactos/lib/shell32/shlview.c b/reactos/lib/shell32/shlview.c index 6ca119802fa..a024933797f 100644 --- a/reactos/lib/shell32/shlview.c +++ b/reactos/lib/shell32/shlview.c @@ -104,20 +104,30 @@ typedef struct static const IShellViewVtbl svvt; static const IOleCommandTargetVtbl ctvt; -#define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) -#define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); - static const IDropTargetVtbl dtvt; -#define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) -#define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); - static const IDropSourceVtbl dsvt; -#define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) -#define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); - static const IViewObjectVtbl vovt; -#define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) -#define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); + + +static inline IShellViewImpl *impl_from_IOleCommandTarget( IOleCommandTarget *iface ) +{ + return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblOleCommandTarget)); +} + +static inline IShellViewImpl *impl_from_IDropTarget( IDropTarget *iface ) +{ + return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblDropTarget)); +} + +static inline IShellViewImpl *impl_from_IDropSource( IDropSource *iface ) +{ + return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblDropSource)); +} + +static inline IShellViewImpl *impl_from_IViewObject( IViewObject *iface ) +{ + return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblViewObject)); +} /* ListView Header ID's */ #define LISTVIEW_COLUMN_NAME 0 @@ -1255,6 +1265,16 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn TRACE("-- NM_RCLICK %p\n",This); break; + case NM_DBLCLK: + TRACE("-- NM_DBLCLK %p\n",This); + if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This); + break; + + case NM_RETURN: + TRACE("-- NM_DBLCLK %p\n",This); + if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This); + break; + case HDN_ENDTRACKA: TRACE("-- HDN_ENDTRACKA %p\n",This); /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); @@ -1277,7 +1297,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn case LVN_ITEMACTIVATE: TRACE("-- LVN_ITEMACTIVATE %p\n",This); OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ - ShellView_DoContextMenu(This, 0, 0, TRUE); break; case LVN_COLUMNCLICK: @@ -1487,6 +1506,13 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn /* free pidl array memory */ HeapFree(GetProcessHeap(), 0, pItems); } + + /* Initiate a refresh */ + else if(plvKeyDown->wVKey == VK_F5) + { + IShellView_Refresh((IShellView*)This); + } + else FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey); } @@ -2017,7 +2043,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryInterface( REFIID iid, LPVOID* ppvObj) { - _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IOleCommandTarget(iface); return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj); } @@ -2028,7 +2054,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryInterface( static ULONG WINAPI ISVOleCmdTarget_AddRef( IOleCommandTarget * iface) { - _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface); + IShellViewImpl *This = impl_from_IOleCommandTarget(iface); return IShellFolder_AddRef((IShellFolder*)This); } @@ -2039,7 +2065,7 @@ static ULONG WINAPI ISVOleCmdTarget_AddRef( static ULONG WINAPI ISVOleCmdTarget_Release( IOleCommandTarget * iface) { - _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IOleCommandTarget(iface); return IShellFolder_Release((IShellFolder*)This); } @@ -2055,7 +2081,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( OLECMDTEXT* pCmdText) { UINT i; - _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IOleCommandTarget(iface); FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); @@ -2083,7 +2109,7 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec( VARIANT* pvaIn, VARIANT* pvaOut) { - _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IOleCommandTarget(iface); FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut); @@ -2118,7 +2144,7 @@ static HRESULT WINAPI ISVDropTarget_QueryInterface( REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); @@ -2127,7 +2153,7 @@ static HRESULT WINAPI ISVDropTarget_QueryInterface( static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2136,7 +2162,7 @@ static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface) static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2151,7 +2177,7 @@ static HRESULT WINAPI ISVDropTarget_DragEnter( DWORD *pdwEffect) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject); @@ -2164,7 +2190,7 @@ static HRESULT WINAPI ISVDropTarget_DragOver( POINTL pt, DWORD *pdwEffect) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); FIXME("Stub: This=%p\n",This); @@ -2174,7 +2200,7 @@ static HRESULT WINAPI ISVDropTarget_DragOver( static HRESULT WINAPI ISVDropTarget_DragLeave( IDropTarget *iface) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); FIXME("Stub: This=%p\n",This); @@ -2188,7 +2214,7 @@ static HRESULT WINAPI ISVDropTarget_Drop( POINTL pt, DWORD *pdwEffect) { - _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropTarget(iface); FIXME("Stub: This=%p\n",This); @@ -2215,7 +2241,7 @@ static HRESULT WINAPI ISVDropSource_QueryInterface( REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropSource(iface); TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); @@ -2224,7 +2250,7 @@ static HRESULT WINAPI ISVDropSource_QueryInterface( static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface) { - _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropSource(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2233,7 +2259,7 @@ static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface) static ULONG WINAPI ISVDropSource_Release( IDropSource *iface) { - _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropSource(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2244,7 +2270,7 @@ static HRESULT WINAPI ISVDropSource_QueryContinueDrag( BOOL fEscapePressed, DWORD grfKeyState) { - _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropSource(iface); TRACE("(%p)\n",This); if (fEscapePressed) @@ -2259,7 +2285,7 @@ static HRESULT WINAPI ISVDropSource_GiveFeedback( IDropSource *iface, DWORD dwEffect) { - _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IDropSource(iface); TRACE("(%p)\n",This); return DRAGDROP_S_USEDEFAULTCURSORS; @@ -2282,7 +2308,7 @@ static HRESULT WINAPI ISVViewObject_QueryInterface( REFIID riid, LPVOID *ppvObj) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); @@ -2291,7 +2317,7 @@ static HRESULT WINAPI ISVViewObject_QueryInterface( static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2300,7 +2326,7 @@ static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface) static ULONG WINAPI ISVViewObject_Release( IViewObject *iface) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); TRACE("(%p)->(count=%lu)\n",This,This->ref); @@ -2321,7 +2347,7 @@ static HRESULT WINAPI ISVViewObject_Draw( ULONG_PTR dwContinue) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); FIXME("Stub: This=%p\n",This); @@ -2337,7 +2363,7 @@ static HRESULT WINAPI ISVViewObject_GetColorSet( LOGPALETTE** ppColorSet) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); FIXME("Stub: This=%p\n",This); @@ -2351,7 +2377,7 @@ static HRESULT WINAPI ISVViewObject_Freeze( DWORD* pdwFreeze) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); FIXME("Stub: This=%p\n",This); @@ -2362,7 +2388,7 @@ static HRESULT WINAPI ISVViewObject_Unfreeze( DWORD dwFreeze) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); FIXME("Stub: This=%p\n",This); @@ -2375,7 +2401,7 @@ static HRESULT WINAPI ISVViewObject_SetAdvise( IAdviseSink* pAdvSink) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); FIXME("partial stub: %p %08lx %08lx %p\n", This, aspects, advf, pAdvSink); @@ -2395,7 +2421,7 @@ static HRESULT WINAPI ISVViewObject_GetAdvise( IAdviseSink** ppAdvSink) { - _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); + IShellViewImpl *This = impl_from_IViewObject(iface); TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n", This, pAspects, pAdvf, ppAdvSink); diff --git a/reactos/lib/shell32/shres.rc b/reactos/lib/shell32/shres.rc index 286e36768b7..87d3748cf7a 100644 --- a/reactos/lib/shell32/shres.rc +++ b/reactos/lib/shell32/shres.rc @@ -24316,6 +24316,30 @@ IDI_SHELL_DESKTOP ICON desktop.ico 'FF FF FF FF 00 00 FF FF FF FF FF FF 00 00' } */ +/* BINRES mydocs.ico */ +IDI_SHELL_MY_DOCUMENTS ICON mydocs.ico +/* { + '00 00 01 00 01 00 10 10 10 00 01 00 04 00 28 01' + '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00' + '00 00 01 00 04 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 99 99 00 66 CC CC 00 99 CC FF 00 99 FF' + 'FF 00 F8 F8 F8 00 FF FF FF 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 11 11 11 11 11 11 00 00 15' + '34 34 33 33 21 00 01 54 43 43 43 33 20 10 01 54' + '44 44 34 33 10 10 15 44 44 34 43 42 00 20 15 44' + '44 44 34 32 06 00 11 11 11 11 11 11 46 60 01 54' + '06 66 66 66 66 00 01 54 40 66 66 65 50 20 01 54' + '44 06 56 66 01 10 00 15 55 50 66 60 00 00 00 01' + '11 11 06 00 00 00 00 00 00 00 00 00 00 00 FF FF' + '00 00 FF FF 00 00 E0 00 00 00 C0 00 00 00 C0 00' + '00 00 80 00 00 00 80 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 80 00 00 00 80 00 00 00 80 01' + '00 00 C0 0F 00 00 E0 1F 00 00 FF BF 00 00' +} */ /*--------------------- END FIXME ------------------------*/ diff --git a/reactos/lib/shell32/shresdef.h b/reactos/lib/shell32/shresdef.h index ebc844d2e80..472e4c27e89 100644 --- a/reactos/lib/shell32/shresdef.h +++ b/reactos/lib/shell32/shresdef.h @@ -117,5 +117,6 @@ #define IDI_SHELL_CONTROL_PANEL 36 #define IDI_SHELL_PRINTERS_FOLDER 38 #define IDI_SHELL_FONTS_FOLDER 39 +#define IDI_SHELL_MY_DOCUMENTS 235 #endif diff --git a/reactos/lib/shell32/shv_bg_cmenu.c b/reactos/lib/shell32/shv_bg_cmenu.c index 885b5604dd4..00518f6f460 100644 --- a/reactos/lib/shell32/shv_bg_cmenu.c +++ b/reactos/lib/shell32/shv_bg_cmenu.c @@ -361,6 +361,10 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCommand( { switch(LOWORD(lpcmi->lpVerb)) { + case FCIDM_SHVIEW_REFRESH: + if (lpSV) IShellView_Refresh(lpSV); + break; + case FCIDM_SHVIEW_NEWFOLDER: DoNewFolder(iface, lpSV); break; diff --git a/reactos/w32api/include/shlguid.h b/reactos/w32api/include/shlguid.h index f022ca2284b..231feb3ee99 100644 --- a/reactos/w32api/include/shlguid.h +++ b/reactos/w32api/include/shlguid.h @@ -19,6 +19,7 @@ extern const GUID CLSID_NetworkPlaces; extern const GUID CLSID_RecycleBin; extern const GUID CLSID_ShellFSFolder; extern const GUID CLSID_Printers; +extern const GUID CLSID_FolderShortcut; extern const GUID FMTID_Intshcut; extern const GUID FMTID_InternetSite; extern const GUID CGID_Explorer;