ole32: Fix crash when calling CreateStorage on read only storage.
This commit is contained in:
parent
4a0901fb87
commit
93a155381f
|
@ -1230,7 +1230,8 @@ static HRESULT WINAPI StorageImpl_CreateStorage(
|
||||||
/*
|
/*
|
||||||
* An element with this name already exists
|
* An element with this name already exists
|
||||||
*/
|
*/
|
||||||
if (STGM_CREATE_MODE(grfMode) == STGM_CREATE)
|
if (STGM_CREATE_MODE(grfMode) == STGM_CREATE &&
|
||||||
|
STGM_ACCESS_MODE(This->base.openFlags) != STGM_READ)
|
||||||
IStorage_DestroyElement(iface, pwcsName);
|
IStorage_DestroyElement(iface, pwcsName);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1314,13 +1314,11 @@ void test_readonly(void)
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
IStream_Release(stream);
|
IStream_Release(stream);
|
||||||
|
|
||||||
#if 0 /* crashes on Wine */
|
|
||||||
/* CreateStorage on read-only storage, name exists */
|
/* CreateStorage on read-only storage, name exists */
|
||||||
hr = IStorage_CreateStorage( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
hr = IStorage_CreateStorage( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
||||||
ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%x\n", hr);
|
ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%x\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
IStream_Release(stg3);
|
IStream_Release(stg3);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* CreateStorage on read-only storage, name does not exist */
|
/* CreateStorage on read-only storage, name does not exist */
|
||||||
hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
||||||
|
|
Loading…
Reference in New Issue