diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index 712ec86991c..fe1dfa3eed1 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -411,7 +411,10 @@ HRESULT WINAPI StgStreamImpl_Write( TRACE("(%p, %p, %ld, %p)\n", iface, pv, cb, pcbWritten); - + + if (!(This->grfMode & STGM_WRITE)) + return STG_E_ACCESSDENIED; + /* * If the caller is not interested in the number of bytes written, * we use another buffer to avoid "if" statements in the code. diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index f8a42dee926..4c6aaed101f 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -336,6 +336,7 @@ HRESULT WINAPI StorageBaseImpl_OpenStream( if (newStream!=0) { + newStream->grfMode = grfMode; *ppstm = (IStream*)newStream; /* diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 564efbf19fe..70481bd8977 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -626,7 +626,7 @@ struct StgStreamImpl */ BlockChainStream* bigBlockChain; SmallBlockChainStream* smallBlockChain; - + DWORD grfMode; }; /*