Commit 617f6908 authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Returns an error if trying to write to a stream opened for read.

parent 0b16006b
...@@ -411,7 +411,10 @@ HRESULT WINAPI StgStreamImpl_Write( ...@@ -411,7 +411,10 @@ HRESULT WINAPI StgStreamImpl_Write(
TRACE("(%p, %p, %ld, %p)\n", TRACE("(%p, %p, %ld, %p)\n",
iface, pv, cb, pcbWritten); 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, * If the caller is not interested in the number of bytes written,
* we use another buffer to avoid "if" statements in the code. * we use another buffer to avoid "if" statements in the code.
......
...@@ -336,6 +336,7 @@ HRESULT WINAPI StorageBaseImpl_OpenStream( ...@@ -336,6 +336,7 @@ HRESULT WINAPI StorageBaseImpl_OpenStream(
if (newStream!=0) if (newStream!=0)
{ {
newStream->grfMode = grfMode;
*ppstm = (IStream*)newStream; *ppstm = (IStream*)newStream;
/* /*
......
...@@ -626,7 +626,7 @@ struct StgStreamImpl ...@@ -626,7 +626,7 @@ struct StgStreamImpl
*/ */
BlockChainStream* bigBlockChain; BlockChainStream* bigBlockChain;
SmallBlockChainStream* smallBlockChain; SmallBlockChainStream* smallBlockChain;
DWORD grfMode;
}; };
/* /*
......
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