From 310ae1f1eff3ebc5cab6cfdf5e27403b8d5ba284 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 15 Oct 2009 15:22:26 -0500 Subject: [PATCH] ole32: Don't use IEnumSTATSTGImpl to search in RenameElement. --- dlls/ole32/storage32.c | 27 +++++++++------------------ 1 files changed, 9 insertions(+), 18 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 6d525fe..b78b7dc 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -708,45 +708,36 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement( const OLECHAR* pwcsNewName) /* [in] */ { StorageBaseImpl *This = (StorageBaseImpl *)iface; - IEnumSTATSTGImpl* propertyEnumeration; StgProperty currentProperty; ULONG foundPropertyIndex; + HRESULT hr; + Dirent currentDirent; TRACE("(%p, %s, %s)\n", iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName)); - propertyEnumeration = IEnumSTATSTGImpl_Construct(This->ancestorStorage, - This->rootPropertySetIndex); - - foundPropertyIndex = IEnumSTATSTGImpl_FindProperty(propertyEnumeration, - pwcsNewName, - ¤tProperty); + hr = Dirent_FindElement(&This->dirent, pwcsNewName, ¤tDirent); - if (foundPropertyIndex != PROPERTY_NULL) + if (SUCCEEDED(hr)) { /* * There is already a property with the new name */ - IEnumSTATSTGImpl_Destroy(propertyEnumeration); return STG_E_FILEALREADYEXISTS; } - IEnumSTATSTG_Reset((IEnumSTATSTG*)propertyEnumeration); - /* * Search the enumeration for the old property name */ - foundPropertyIndex = IEnumSTATSTGImpl_FindProperty(propertyEnumeration, - pwcsOldName, - ¤tProperty); + hr = Dirent_FindElement(&This->dirent, pwcsOldName, ¤tDirent); - IEnumSTATSTGImpl_Destroy(propertyEnumeration); - - if (foundPropertyIndex != PROPERTY_NULL) + if (SUCCEEDED(hr)) { StgProperty renamedProperty; ULONG renamedPropertyIndex; + foundPropertyIndex = Dirent_GetIndex(¤tDirent); + /* * Setup a new property for the renamed property */ @@ -838,7 +829,7 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement( return STG_E_FILENOTFOUND; } - return S_OK; + return hr; } /************************************************************************ -- 1.5.4.3