Commit 52100e96 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Do not allow renaming streams that are open.

parent 371f6a48
...@@ -731,6 +731,12 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement( ...@@ -731,6 +731,12 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement(
if (currentEntryRef != DIRENTRY_NULL) 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 */ /* Remove the element from its current position in the tree */
removeFromTree(This->ancestorStorage, This->storageDirEntry, removeFromTree(This->ancestorStorage, This->storageDirEntry,
currentEntryRef); currentEntryRef);
......
...@@ -1113,7 +1113,7 @@ static void test_substorage_share(void) ...@@ -1113,7 +1113,7 @@ static void test_substorage_share(void)
/* cannot rename the stream while it's open */ /* cannot rename the stream while it's open */
r = IStorage_RenameElement(stg, stmname, othername); 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); if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stmname);
/* destroying an object while it's open invalidates it */ /* destroying an object while it's open invalidates it */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment