From c4b09c71d176c6f8d00393259ee975fa53aaec1c Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 15 Oct 2009 15:39:13 -0500 Subject: [PATCH] ole32: Don't use IEnumSTATSTGImpl to search in CreateStream. --- dlls/ole32/storage32.c | 33 +++++++++++---------------------- 1 files changed, 11 insertions(+), 22 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index f80e810..9d35de9 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -387,11 +387,11 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream( IStream** ppstm) /* [out] */ { StorageBaseImpl *This = (StorageBaseImpl *)iface; - IEnumSTATSTGImpl* propertyEnumeration; StgStreamImpl* newStream; - StgProperty currentProperty; ULONG foundPropertyIndex; HRESULT res = STG_E_UNKNOWN; + Dirent streamDirent; + DirentData streamData; TRACE("(%p, %s, %p, %x, %d, %p)\n", iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm); @@ -432,31 +432,19 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream( } } - /* - * Create a property enumeration to search the properties - */ - propertyEnumeration = IEnumSTATSTGImpl_Construct( - This->ancestorStorage, - This->rootPropertySetIndex); + res = Dirent_FindElement(&This->dirent, pwcsName, &streamDirent); - /* - * Search the enumeration for the property with the given name - */ - foundPropertyIndex = IEnumSTATSTGImpl_FindProperty( - propertyEnumeration, - pwcsName, - ¤tProperty); + if (SUCCEEDED(res)) + { + foundPropertyIndex = Dirent_GetIndex(&streamDirent); - /* - * Delete the property enumeration since we don't need it anymore - */ - IEnumSTATSTGImpl_Destroy(propertyEnumeration); + res = Dirent_GetData(&streamDirent, &streamData); + } /* * If it was found, construct the stream object and return a pointer to it. */ - if ( (foundPropertyIndex!=PROPERTY_NULL) && - (currentProperty.propertyType==PROPTYPE_STREAM) ) + if (SUCCEEDED(res) && streamData.direntType == PROPTYPE_STREAM) { newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex); @@ -475,7 +463,8 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream( goto end; } - res = STG_E_FILENOTFOUND; + if (SUCCEEDED(res)) /* not a stream */ + res = STG_E_FILENOTFOUND; end: if (res == S_OK) -- 1.5.4.3