SHELL32: handle IFileSystemBindData in IShellFolder::ParseDisplayName
Mike McCormack
mike at codeweavers.com
Mon Feb 21 20:30:19 CST 2005
IFileSystemBindData is described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/pidl_ovw.asp#pidl_simple
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/ifilesystembinddata/ifilesystembinddata.asp
This needs to be done in ISF_Desktop_fnParseDisplayName too. Depends up
on the previous patch. Heading towards the goal of getting
SHSimpleIDListFromPath to work correctly with a non-existing path... and
thus get IShellLink to generate the correct .lnk file...
Mike
ChangeLog:
* handle IFileSystemBindData in IShellFolder::ParseDisplayName
* convert IShellFolder::ParseDisplayName to use unicode
-------------- next part --------------
Index: dlls/shell32/shfldr_fs.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_fs.c,v
retrieving revision 1.29
diff -u -p -r1.29 shfldr_fs.c
--- dlls/shell32/shfldr_fs.c 14 Jan 2005 16:02:20 -0000 1.29
+++ dlls/shell32/shfldr_fs.c 22 Feb 2005 02:25:25 -0000
@@ -296,6 +296,50 @@ static ULONG WINAPI IShellFolder_fnRelea
}
/**************************************************************************
+ * SHELL32_CreatePidlFromBindCtx [internal]
+ *
+ * If the caller bound File System Bind Data, assume it is the
+ * find data for the path.
+ * This allows binding of pathes that don't exist.
+ */
+LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
+{
+ static const WCHAR szfsbc[] = {
+ 'F','i','l','e',' ','S','y','s','t','e','m',' ',
+ 'B','i','n','d',' ','D','a','t','a',0 };
+ IFileSystemBindData *fsbd = NULL;
+ LPITEMIDLIST pidl = NULL;
+ IUnknown *param = NULL;
+ WIN32_FIND_DATAW wfd;
+ HRESULT r;
+
+ TRACE("%p %s\n", pbc, debugstr_w(path));
+
+ if (!pbc)
+ return NULL;
+
+ /* see if the caller bound File System Bind Data */
+ r = IBindCtx_GetObjectParam( pbc, (LPOLESTR) szfsbc, ¶m );
+ if (FAILED(r))
+ return NULL;
+
+ r = IUnknown_QueryInterface( param, &IID_IFileSystemBindData,
+ (LPVOID*) &fsbd );
+ if (SUCCEEDED(r))
+ {
+ r = IFileSystemBindData_GetFindData( fsbd, &wfd );
+ if (SUCCEEDED(r))
+ {
+ lstrcpynW( &wfd.cFileName[0], path, MAX_PATH );
+ pidl = _ILCreateFromFindDataW( &wfd );
+ }
+ IFileSystemBindData_Release( fsbd );
+ }
+
+ return pidl;
+}
+
+/**************************************************************************
* IShellFolder_ParseDisplayName {SHELL32}
*
* Parse a display name.
@@ -332,7 +376,7 @@ IShellFolder_fnParseDisplayName (IShellF
HRESULT hr = E_INVALIDARG;
LPCWSTR szNext = NULL;
WCHAR szElement[MAX_PATH];
- CHAR szPath[MAX_PATH];
+ WCHAR szPath[MAX_PATH];
LPITEMIDLIST pidlTemp = NULL;
DWORD len;
@@ -345,18 +389,21 @@ IShellFolder_fnParseDisplayName (IShellF
if (pchEaten)
*pchEaten = 0; /* strange but like the original */
- if (*lpszDisplayName) {
+ pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName);
+ if (!pidlTemp && *lpszDisplayName)
+ {
/* get the next element */
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
/* build the full pathname to the element */
- lstrcpyA(szPath, This->sPathTarget);
- PathAddBackslashA(szPath);
- len = lstrlenA(szPath);
- WideCharToMultiByte(CP_ACP, 0, szElement, -1, szPath + len, MAX_PATH - len, NULL, NULL);
+ /* lstrcpyW(szPath, This->sPathTarget); */
+ MultiByteToWideChar(CP_ACP, 0, This->sPathTarget, -1, szPath, MAX_PATH);
+ PathAddBackslashW(szPath);
+ len = lstrlenW(szPath);
+ lstrcpynW(szPath + len, szElement, MAX_PATH - len);
/* get the pidl */
- hr = _ILCreateFromPathA(szPath, &pidlTemp);
+ hr = _ILCreateFromPathW(szPath, &pidlTemp);
if (SUCCEEDED(hr)) {
if (szNext && *szNext) {
Index: dlls/shell32/pidl.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.h,v
retrieving revision 1.44
diff -u -p -r1.44 pidl.h
--- dlls/shell32/pidl.h 26 Oct 2004 00:17:31 -0000 1.44
+++ dlls/shell32/pidl.h 22 Feb 2005 02:25:25 -0000
@@ -212,7 +212,9 @@ LPITEMIDLIST _ILCreateGuidFromStrA(LPCST
/* Commonly used PIDLs representing file system objects. */
LPITEMIDLIST _ILCreateDesktop (void);
LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA *stffile);
+LPITEMIDLIST _ILCreateFromFindDataW(WIN32_FIND_DATAW *stffile);
HRESULT _ILCreateFromPathA (LPCSTR szPath, LPITEMIDLIST* ppidl);
+HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl);
/* Other helpers */
LPITEMIDLIST _ILCreateMyComputer (void);
More information about the wine-patches
mailing list