FW: shell32: ILGetDisplayName corrections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resending the patch with minor modifications. If there is still any
problems with it I would appreciate a short message.

Changelog
  * dlls/shell32/shell32.spec
    Change some signatures to match the function prototype and fix
    ILGetDisplayName to link to ANSI/Unicode implementation. Add
    ILGetDisplayNameEx entry.
  * dlls/shell32/undocshell.h
    Fix prototype for ILGetDisplayNameAW and add ILGetDisplayNameExAW entry.
  * dlls/shell32/pidl.h
    Add prototypes for internal fucntions ILGetDisplayNameExA and ILGetDisplayNameExW
  * dlls/shell32/pidl.c
    Implement ILGetDisplayNameExA and ILGetDisplayNameExW and call them from
    ILGetDisplayNameAW and ILGetDisplayNameExAW
  * dlls/shell32/shlmenu.c
    Call the new ANSI specific function

License: X11/LGPL

Rolf Kalbermatter

Index: dlls/shell32/shell32.spec
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32.spec,v
retrieving revision 1.67
diff -u -r1.67 shell32.spec
--- dlls/shell32/shell32.spec	26 Mar 2003 23:59:51 -0000	1.67
+++ dlls/shell32/shell32.spec	15 Apr 2003 19:08:33 -0000
@@ -3,7 +3,7 @@
 #  win95 and winNT dlls import shell32.dll by ordinal)
 # This list was updated to dll version 4.72
 
-   2 stdcall SHChangeNotifyRegister(long long long long long long)
+   2 stdcall SHChangeNotifyRegister(long long long long long ptr)
    4 stdcall SHChangeNotifyDeregister (long)
    5 stdcall SHChangeNotifyUpdateEntryList (long long long long)
    9 stub PifMgr_OpenProperties@16
@@ -173,6 +173,7 @@
  183 varargs ShellMessageBoxA(long long long str long)
  184 stdcall ArrangeWindows(long long long long long)
  185 stub SHHandleDiskFull
+ 186 stdcall ILGetDisplayNameEx(ptr ptr ptr long)
  195 stdcall SHFree(ptr)
  196 stdcall SHAlloc(long)
  197 stub SHGlobalDefect

Index: dlls/shell32/undocshell.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/undocshell.h,v
retrieving revision 1.10
diff -u -r1.10 undocshell.h
--- dlls/shell32/undocshell.h	1 Apr 2003 04:35:54 -0000	1.10
+++ dlls/shell32/undocshell.h	15 Apr 2003 19:11:53 -0000
@@ -63,7 +63,18 @@
 
 BOOL WINAPI ILGetDisplayName(
 	LPCITEMIDLIST pidl,
-	LPSTR path);
+	LPVOID path);
+
+/* type parameter for ILGetDisplayNameEx() */
+#define ILGDN_FORPARSING  0
+#define ILGDN_NORMAL      1
+#define ILGDN_INFOLDER    2
+
+BOOL WINAPI ILGetDisplayNameEx(
+	LPSHELLFOLDER psf,
+	LPCITEMIDLIST pidl,
+	LPVOID path,
+	DWORD type);
 
 DWORD WINAPI ILFree(LPITEMIDLIST pidl);
   
Index: dlls/shell32/pidl.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.h,v
retrieving revision 1.26
diff -u -r1.26 pidl.h
--- dlls/shell32/pidl.h	26 Mar 2003 23:35:23 -0000	1.26
+++ dlls/shell32/pidl.h	15 Apr 2003 19:12:44 -0000
@@ -197,5 +197,8 @@
 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
 LPITEMIDLIST * _ILCopyaPidl(LPITEMIDLIST * apidlsrc, UINT cidl);
 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
+
+BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type);
+BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
 
 #endif
 
Index: dlls/shell32/pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.82
diff -u -r1.82 pidl.c
--- dlls/shell32/pidl.c	26 Mar 2003 23:35:23 -0000	1.82
+++ dlls/shell32/pidl.c	15 Apr 2003 19:13:46 -0000
@@ -50,13 +50,122 @@
 extern BOOL WINAPI Free(LPVOID);
 
 /*************************************************************************
+ * ILGetDisplayNameEx		[SHELL32.186]
+ * 
+ * Retrieves the display name of an ItemIDList
+ *
+ * PARAMS
+ *  psf        [I]   Shell Folder to start with, if NULL the desktop is used
+ *  pidl       [I]   ItemIDList relativ to the psf to get the display name for
+ *  path       [O]   Filled in with the display name, assumed to be at least MAX_PATH long
+ *  type       [I]   Type of display name to retrieve
+ *                    0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root
+ *                    1 = SHGDN_NORMAL relative to the root folder
+ *                    2 = SHGDN_INFOLDER relative to the root folder, only the last name
+ *
+ * RETURNS
+ *  True if the display name could be retrieved successfully, False otherwise
+ */
+BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type)
+{
+	BOOL ret = FALSE;
+	WCHAR wPath[MAX_PATH];
+
+	TRACE("%p %p %p %p\n", psf, pidl, path, type);
+
+	if (!pidl || !path)
+	  return FALSE;
+
+	ret = ILGetDisplayNameExW(psf, pidl, wPath, type);
+	WideCharToMultiByte(CP_ACP, 0, wPath, -1, path, MAX_PATH, NULL, NULL);
+	TRACE("%p %p %s\n", psf, pidl, debugstr_a(path));
+
+	return ret;
+}
+
+BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
+{
+	LPSHELLFOLDER parent, lsf = psf;
+	HRESULT ret = NO_ERROR;
+	LPITEMIDLIST pidllast;
+	STRRET strret;
+	DWORD flag;
+
+	TRACE("%p %p %p %p\n", psf, pidl, path, type);
+
+	if (!pidl || !path)
+	  return FALSE;
+
+	if (!lsf)
+	{
+	  ret = SHGetDesktopFolder(&lsf);
+	  if (FAILED(ret))
+	    return FALSE;
+	}
+
+	if (type >= 0 && type <= 2)
+	{
+	  switch (type)
+	  {
+	    case ILGDN_FORPARSING:
+	      flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+	      break;
+	    case ILGDN_NORMAL:
+	      flag = SHGDN_NORMAL;
+	      break;
+	    case ILGDN_INFOLDER:
+	      flag = SHGDN_INFOLDER;
+	      break;
+	  }
+	  if (!*(LPWORD)pidl || !type)
+	  {
+	    ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret);
+	    if (SUCCEEDED(ret))
+	    {
+	      ret = StrRetToStrNW(path, MAX_PATH, &strret, pidl);
+	    }
+	  }
+	  else
+	  {
+	    ret = SHBindToParent(pidl, &IID_IShellFolder, &parent, &pidllast);
+	    if (SUCCEEDED(ret))
+	    {
+	      ret = IShellFolder_GetDisplayNameOf(parent, pidllast, flag, &strret);
+	      if (SUCCEEDED(ret))
+	      {
+	        ret = StrRetToStrNW(path, MAX_PATH, &strret, pidllast);
+	      }
+	      IShellFolder_Release(parent);
+	    }
+	  }
+	}
+
+	TRACE("%p %p %s\n", psf, pidl, debugstr_w(path));
+
+	if (!psf)
+	  IShellFolder_Release(lsf);
+	return SUCCEEDED(ret);
+}
+
+BOOL WINAPI ILGetDisplayNameEx(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type)
+{
+	TRACE_(shell)("%p %p %p %d\n", psf, pidl, path, type);
+	if (SHELL_OsIsUnicode())
+	  return ILGetDisplayNameExW(psf, pidl, path, type);
+	return ILGetDisplayNameExA(psf, pidl, path, type);
+}
+
+/*************************************************************************
  * ILGetDisplayName			[SHELL32.15]
  */
-BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl,LPSTR path)
+BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl, LPVOID path)
 {
-	TRACE_(shell)("pidl=%p %p semi-stub\n",pidl,path);
-	return SHGetPathFromIDListA(pidl, path);
+	TRACE_(shell)("%p %p\n", pidl, path);
+	if (SHELL_OsIsUnicode())
+	  return ILGetDisplayNameExW(NULL, pidl, path, ILGDN_FORPARSING);
+	return ILGetDisplayNameExA(NULL, pidl, path, ILGDN_FORPARSING);
 }
+
 /*************************************************************************
  * ILFindLastID [SHELL32.16]
  *
@@ -217,8 +326,6 @@
 	  { ret = S_OK;
 	  }
 	}
-
-
 	IStream_Release (pStream);
 
 	return ret;

Index: dlls/shell32/shlmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlmenu.c,v
retrieving revision 1.31
diff -u -r1.31 shlmenu.c
--- dlls/shell32/shlmenu.c	8 Jan 2003 21:09:27 -0000	1.31
+++ dlls/shell32/shlmenu.c	15 Apr 2003 19:18:19 -0000
@@ -178,7 +178,7 @@
 	      {
 		if (SUCCEEDED (IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulItemAttr)))
 		{
-		  ILGetDisplayName( pidlTemp, sTemp);
+		  ILGetDisplayNameExA(NULL, pidlTemp, sTemp, 0);
 		  if (! (PidlToSicIndex(lpsf, pidlTemp, FALSE, 0, &iIcon)))
 		    iIcon = FM_BLANK_ICON;
 		  if ( SFGAO_FOLDER & ulItemAttr)



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux