shell32: ILGetDisplayName corrections

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Sun Mar 30 16:33:33 CST 2003


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	30 Mar 2003 22:06:48 -0000
@@ -3,14 +3,14 @@
 #  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 at 16
   10 stub PifMgr_GetProperties at 20
   11 stub PifMgr_SetProperties at 20
   13 stub PifMgr_CloseProperties at 8
-  15 stdcall ILGetDisplayName(ptr ptr)
+  15 stdcall ILGetDisplayName(ptr ptr) ILGetDisplayNameAW
   16 stdcall ILFindLastID(ptr)
   17 stdcall ILRemoveLastID(ptr)
   18 stdcall ILClone(ptr)
@@ -144,7 +144,7 @@
  154 stdcall ILAppend (long long long)
  155 stdcall ILFree (ptr)
  156 stdcall ILGlobalFree (ptr)
- 157 stdcall ILCreateFromPath (ptr) ILCreateFromPathAW
+ 157 stdcall ILCreateFromPath(ptr) ILCreateFromPathAW
  158 stdcall PathGetExtension(str long long) PathGetExtensionAW
  159 stdcall PathIsDirectory(ptr)PathIsDirectoryAW
  160 stub SHNetConnectionDialog
@@ -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) ILGetDisplayNameExAW
  195 stdcall SHFree(ptr)
  196 stdcall SHAlloc(long)
  197 stub SHGlobalDefect
@@ -416,6 +417,8 @@
 @ stdcall SHGetFolderPathA(long long long long ptr)
 @ stdcall SHGetFolderPathW(long long long long ptr)
 @ stdcall SHGetFolderLocation(long long long long ptr)
+@ stub SHGetIconOverlayIndexA(str long)
+@ stub SHGetIconOverlayIndexW(wstr long)
 
 # version 6.0 (WinXP)
 # _WIN32_IE >= 0x600
Index: dlls/shell32/undocshell.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/undocshell.h,v
retrieving revision 1.9
diff -u -r1.9 undocshell.h
--- dlls/shell32/undocshell.h	26 Mar 2003 23:59:51 -0000	1.9
+++ dlls/shell32/undocshell.h	30 Mar 2003 22:11:52 -0000
@@ -63,7 +63,18 @@
 
 BOOL WINAPI ILGetDisplayNameAW(
 	LPCITEMIDLIST pidl,
-	LPSTR path);
+	LPVOID path);
+
+/* type parameter for ILGetDisplayNameEx() */
+#define ILGDN_FORPARSING  0
+#define ILGDN_NORMAL      1
+#define ILGDN_INFOLDER    2
+
+BOOL WINAPI ILGetDisplayNameExAW(
+	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	30 Mar 2003 22:25:07 -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	30 Mar 2003 22:27:44 -0000
@@ -50,13 +50,167 @@
 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)
+{
+	LPSHELLFOLDER parent, lsf = psf;
+	HRESULT ret = NO_ERROR;
+	LPITEMIDLIST pidllast;
+	STRRET strret;
+	DWORD flag;
+
+	TRACE_(shell)("%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 (SUCCEEDED(ret))
+	{
+	  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 = StrRetToStrNA(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 = StrRetToStrNA(path, MAX_PATH, &strret, pidllast);
+	        }
+	        IShellFolder_Release(parent);
+	      }
+	    }
+	  }
+	  if (!psf)
+	    IShellFolder_Release(lsf);
+	}
+	return SUCCEEDED(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_(shell)("%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 (SUCCEEDED(ret))
+	{
+	  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);
+	      }
+	    }
+	  }
+	  if (!psf)
+	    IShellFolder_Release(lsf);
+	}
+	return SUCCEEDED(ret);
+}
+
+BOOL WINAPI ILGetDisplayNameExAW(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 ILGetDisplayNameAW(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, 0);
+	return ILGetDisplayNameExA(NULL, pidl, path, 0);
 }
+
 /*************************************************************************
  * ILFindLastID [SHELL32.16]
  *
@@ -217,8 +372,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	30 Mar 2003 22:31:39 -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)




More information about the wine-patches mailing list