Commit 693da8c4 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

ole32: Check that the storage was opened with write access before creating a new…

ole32: Check that the storage was opened with write access before creating a new stream or sub-storage.
parent 5d051af6
......@@ -914,6 +914,11 @@ HRESULT WINAPI StorageBaseImpl_CreateStream(
else
return STG_E_FILEALREADYEXISTS;
}
else if (STGM_ACCESS_MODE(This->openFlags) == STGM_READ)
{
WARN("read-only storage\n");
return STG_E_ACCESSDENIED;
}
/*
* memset the empty property
......@@ -1120,6 +1125,11 @@ HRESULT WINAPI StorageImpl_CreateStorage(
return STG_E_FILEALREADYEXISTS;
}
}
else if (STGM_ACCESS_MODE(This->base.openFlags) == STGM_READ)
{
WARN("read-only storage\n");
return STG_E_ACCESSDENIED;
}
/*
* memset the empty property
......
......@@ -719,10 +719,8 @@ static void test_storage_refcount(void)
r = IStorage_CreateStorage( stg2, stgname2, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stg3 );
ok(r == STG_E_ACCESSDENIED, "CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
todo_wine {
r = IStorage_CreateStream( stg2, stmname2, STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
ok(r == STG_E_ACCESSDENIED, "CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
}
IStorage_Release(stg2);
......
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