Commit 93a15538 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Fix crash when calling CreateStorage on read only storage.

parent 4a0901fb
......@@ -1230,7 +1230,8 @@ static HRESULT WINAPI StorageImpl_CreateStorage(
/*
* 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);
else
{
......
......@@ -1314,13 +1314,11 @@ void test_readonly(void)
if (SUCCEEDED(hr))
IStream_Release(stream);
#if 0 /* crashes on Wine */
/* CreateStorage on read-only storage, name exists */
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);
if (SUCCEEDED(hr))
IStream_Release(stg3);
#endif
/* CreateStorage on read-only storage, name does not exist */
hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
......
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