Returns an error if trying to write to a stream opened for read.
diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c
index 712ec86..fe1dfa3 100644
--- a/dlls/ole32/stg_stream.c
+++ b/dlls/ole32/stg_stream.c
@@ -411,7 +411,10 @@
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 f8a42de..4c6aaed 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -336,6 +336,7 @@
if (newStream!=0)
{
+ newStream->grfMode = grfMode;
*ppstm = (IStream*)newStream;
/*
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index 564efbf..70481bd 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -626,7 +626,7 @@
*/
BlockChainStream* bigBlockChain;
SmallBlockChainStream* smallBlockChain;
-
+ DWORD grfMode;
};
/*