ole32: Check that the storage was opened with write access before creating a new stream or sub-storage.
This commit is contained in:
parent
5d051af6ae
commit
693da8c471
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue