ole32: Do not allow renaming streams that are open.

This commit is contained in:
Vincent Povirk 2009-11-18 11:19:18 -06:00 committed by Alexandre Julliard
parent 371f6a4818
commit 52100e9620
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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 */