From 44417772e4e7b7fbf0b7803dc2c7c474111b3487 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 18 Nov 2009 11:19:18 -0600 Subject: [PATCH 6/6] ole32: Do not allow renaming streams that are open. --- dlls/ole32/storage32.c | 6 ++++++ dlls/ole32/tests/storage32.c | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 23b47ad..8613aa8 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -731,6 +731,12 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement( if (currentEntryRef != DIRENTRY_NULL) { + if (StorageBaseImpl_IsStreamOpen(This, currentEntryRef)) + { + WARN("Stream is already open; cannot rename.\n"); + return STG_E_ACCESSDENIED; + } + /* Remove the element from its current position in the tree */ removeFromTree(This->ancestorStorage, This->storageDirEntry, currentEntryRef); diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 10767e1..75c0dae 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -1113,7 +1113,7 @@ static void test_substorage_share(void) /* cannot rename the stream while it's open */ r = IStorage_RenameElement(stg, stmname, othername); - todo_wine ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r); + ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r); if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stmname); /* destroying an object while it's open invalidates it */ -- 1.6.3.3