diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index 79ba06332c..ba34c4213f 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -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) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index 3891b377f1..7a4d6f87db 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -1293,6 +1293,35 @@ DWORD WINAPI SHFileOperationAW(LPVOID 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); + } +} + /************************************************************************* * SheGetDirW [SHELL32.281] *