shell32: Implement SHFreeNameMappings

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Thu Oct 14 07:07:45 CDT 2004


Changelog:
  dlls/shell32/shell32.spec
  dlls/shell32/shlfileop.c
    Add SHFreeNameMappings implementation

License: X11/LGPL

Rolf Kalbermatter


Index: shell32.spec
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32.spec,v
retrieving revision 1.87
diff -u -r1.87 shell32.spec
--- shell32.spec	6 Sep 2004 20:24:10 -0000	1.87
+++ shell32.spec	14 Oct 2004 10:58:20 -0000
@@ -382,7 +382,7 @@
 @ stdcall SHFileOperationA(ptr)
 @ stdcall SHFileOperationW(ptr)
 @ stub SHFormatDrive
-@ stub SHFreeNameMappings
+@ stdcall SHFreeNameMappings(ptr)
 @ stdcall SHGetDesktopFolder(ptr)
 @ stdcall SHGetFileInfo(ptr long ptr long long)SHGetFileInfoAW
 @ stdcall SHGetFileInfoA(ptr long ptr long long)

Index: shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfileop.c,v
retrieving revision 1.43
diff -u -r1.43 shlfileop.c
--- shlfileop.c	6 Oct 2004 00:04:39 -0000	1.43
+++ shlfileop.c	14 Oct 2004 10:58:22 -0000
@@ -1291,6 +1291,35 @@
 	if (SHELL_OsIsUnicode())
 	  return SHFileOperationW(lpFileOp);
 	return SHFileOperationA(lpFileOp);
+}
+
+#define SHDSA_GetItemCount(hdsa) (*(int*)(hdsa))
+
+/*************************************************************************
+ * SHFreeNameMappings      [shell32.246]
+ *
+ * Free the mapping handle returned by SHFileoperation if FOF_WANTSMAPPINGHANDLE
+ * was specified.
+ *
+ * PARAMS
+ *  hNameMapping [I] handle to the name mappings used during renaming of files
+ *
+ */
+void WINAPI SHFreeNameMappings(HANDLE hNameMapping)
+{
+	if (hNameMapping)
+	{
+	  int i = SHDSA_GetItemCount((HDSA)hNameMapping) - 1;
+
+	  for (; i>= 0; i--)
+	  {
+	    LPSHNAMEMAPPINGW lp = DSA_GetItemPtr((HDSA)hNameMapping, i);
+
+	    SHFree(lp->pszOldPath);
+	    SHFree(lp->pszNewPath);
+	  }
+	  DSA_Destroy((HDSA)hNameMapping);
+	}
 }
 
 /*************************************************************************





More information about the wine-patches mailing list