Author: akhaldi Date: Tue Nov 4 20:13:22 2014 New Revision: 65251
URL: http://svn.reactos.org/svn/reactos?rev=65251&view=rev Log: [SHELL32] * Partial sync of brsfolder.c with Wine 1.7.27. CORE-8540
Modified: branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c
Modified: branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c [iso-8859-1] Tue Nov 4 20:13:22 2014 @@ -195,7 +195,7 @@ HIMAGELIST hImageList; HRESULT hr; IShellFolder *lpsfParent, *lpsfRoot; - IEnumIDList * pEnumChildren; + IEnumIDList * pEnumChildren = NULL; HTREEITEM item; DWORD flags; LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot; @@ -245,14 +245,16 @@ return; }
- if (pidlChild && pidlChild->mkid.cb) { + if (!_ILIsEmpty(pidlChild)) { hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot); } else { lpsfRoot = lpsfParent; + hr = IShellFolder_AddRef(lpsfParent); }
if (FAILED(hr)) { WARN("Could not bind to root shell folder! hr = %08x\n", hr); + IShellFolder_Release(lpsfParent); ILFree(pidlChild); ILFree(pidlParent); return; @@ -262,6 +264,8 @@ hr = IShellFolder_EnumObjects( lpsfRoot, info->hWnd, flags, &pEnumChildren ); if (FAILED(hr)) { WARN("Could not get child iterator! hr = %08x\n", hr); + IShellFolder_Release(lpsfParent); + IShellFolder_Release(lpsfRoot); ILFree(pidlChild); ILFree(pidlParent); return; @@ -274,6 +278,8 @@
ILFree(pidlChild); ILFree(pidlParent); + IShellFolder_Release(lpsfRoot); + IShellFolder_Release(lpsfParent); }
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags) @@ -423,8 +429,8 @@ while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) { ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - IEnumIDList* pEnumIL; - IShellFolder* pSFChild; + IEnumIDList* pEnumIL = NULL; + IShellFolder* pSFChild = NULL; IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs); if (ulAttrs & SFGAO_FOLDER) { @@ -438,9 +444,11 @@ if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL))) { + IEnumIDList_Release(pEnumIL); pEnumIL = NULL; } } + IShellFolder_Release(pSFChild); } }
@@ -519,7 +527,7 @@
static LRESULT BrsFolder_Treeview_Expand( browse_info *info, NMTREEVIEWW *pnmtv ) { - IShellFolder *lpsf2; + IShellFolder *lpsf2 = NULL; LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam; HRESULT r;
@@ -528,7 +536,7 @@ if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) return 0;
- if (lptvid->lpi && lptvid->lpi->mkid.cb) { + if (!_ILIsEmpty(lptvid->lpi)) { r = IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi, 0, &IID_IShellFolder, (void**)&lpsf2); } else { lpsf2 = lptvid->lpsfParent; @@ -564,7 +572,7 @@ browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED, (LPARAM)info->pidlRet ); BrsFolder_CheckValidSelection( info, lptvid ); - return 0; + return S_OK; }
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv) @@ -745,6 +753,7 @@ if(FAILED(hr)) return hr; hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur); + IShellFolder_Release(desktop); if(FAILED(hr)) return hr;
@@ -760,6 +769,7 @@ if(len<MAX_PATH) name[len++] = '\'; hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len); + ISFHelper_Release(sfhelper); if(FAILED(hr)) goto cleanup;
@@ -801,6 +811,7 @@ goto cleanup;
added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent); + IShellFolder_Release(cur); SHFree(new_item);
SendMessageW(info->hwndTreeView, TVM_SORTCHILDREN, FALSE, (LPARAM)parent); @@ -859,6 +870,7 @@
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, (LPOLESTR)selection, NULL, &pidlSelection, NULL); + IShellFolder_Release(psfDesktop); if (FAILED(hr)) goto done; }