From 617f6908de9468818ca020ec6666dcca2489c842 Mon Sep 17 00:00:00 2001 From: Gerard Patel Date: Wed, 26 Jan 2000 02:04:44 +0000 Subject: [PATCH] Returns an error if trying to write to a stream opened for read. --- dlls/ole32/stg_stream.c | 5 ++++- dlls/ole32/storage32.c | 1 + dlls/ole32/storage32.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) 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; }; /* -- 2.11.4.GIT