Changelog * dlls/shell32/pidl.c Resolve SHGetPathFromIDListW -> SHGetPathFromIDListA call Remove Fixme comment in SHGetPathFromIDList as StrRetToStrN should take care of this Get rid of some unsigned/signed comparison warnings with default warnings in MSVC Rolf Kalbermatter Index: dlls/shell32/pidl.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/pidl.c,v retrieving revision 1.77 diff -u -r1.77 pidl.c --- dlls/shell32/pidl.c 21 Nov 2002 23:56:42 -0000 1.77 +++ dlls/shell32/pidl.c 12 Dec 2002 13:39:12 -0000 @@ -912,11 +912,8 @@ * NULL returns FALSE * desktop pidl gives path to desktopdirectory back * special pidls returning FALSE - * - * FIXME - * fnGetDisplayNameOf can return different types of OLEString */ -BOOL WINAPI SHGetPathFromIDListA (LPCITEMIDLIST pidl, LPSTR pszPath) +BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath) { HRESULT hr; STRRET str; @@ -942,17 +939,28 @@ /************************************************************************* * SHGetPathFromIDListW [SHELL32.@] */ -BOOL WINAPI SHGetPathFromIDListW (LPCITEMIDLIST pidl,LPWSTR pszPath) -{ char sTemp[MAX_PATH]; +BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath) +{ + HRESULT hr; + STRRET str; + LPSHELLFOLDER shellfolder; - TRACE_(shell)("(pidl=%p)\n", pidl); + TRACE_(shell)("(pidl=%p,%p)\n", pidl, debugstr_w(pszPath)); + pdump(pidl); - SHGetPathFromIDListA (pidl, sTemp); - MultiByteToWideChar( CP_ACP, 0, sTemp, -1, pszPath, MAX_PATH ); + if (!pidl) return FALSE; - TRACE_(shell)("-- (%s)\n",debugstr_w(pszPath)); + hr = SHGetDesktopFolder(&shellfolder); + if (SUCCEEDED(hr)) { + hr = IShellFolder_GetDisplayNameOf(shellfolder, pidl, SHGDN_FORPARSING, &str); + if (SUCCEEDED(hr)) { + StrRetToStrNW(pszPath, MAX_PATH, &str, pidl); + } + IShellFolder_Release(shellfolder); + } - return TRUE; + TRACE_(shell)("-- %s, 0x%08lx\n",debugstr_w(pszPath), hr); + return SUCCEEDED(hr); } /************************************************************************* @@ -1745,11 +1753,11 @@ */ void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) { - int i; + UINT i; - if(apidl) + if (apidl) { - for(i = 0; i < cidl; i++) SHFree(apidl[i]); + for (i = 0; i < cidl; i++) SHFree(apidl[i]); SHFree(apidl); } } @@ -1761,11 +1769,11 @@ */ LPITEMIDLIST * _ILCopyaPidl(LPITEMIDLIST * apidlsrc, UINT cidl) { - int i; + UINT i; LPITEMIDLIST * apidldest = (LPITEMIDLIST*)SHAlloc(cidl * sizeof(LPITEMIDLIST)); if(!apidlsrc) return NULL; - for(i = 0; i < cidl; i++) + for (i = 0; i < cidl; i++) apidldest[i] = ILClone(apidlsrc[i]); return apidldest; @@ -1778,7 +1786,7 @@ */ LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida) { - int i; + UINT i; LPITEMIDLIST * dst = (LPITEMIDLIST*)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); if(!dst) return NULL; @@ -1786,7 +1794,7 @@ if (pidl) *pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[0]])); - for(i = 0; i < cida->cidl; i++) + for (i = 0; i < cida->cidl; i++) dst[i] = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[i + 1]])); return dst;