From 87326ba7c3f9cc82324dd4b154763ec17864be08 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 18 Jan 2004 23:17:13 +0000 Subject: [PATCH] IStream_fnWrite: only return write count if the given pointer parameter is not NULL. --- dlls/shell32/memorystream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/shell32/memorystream.c b/dlls/shell32/memorystream.c index 5e91a19ea57..7738e340f40 100644 --- a/dlls/shell32/memorystream.c +++ b/dlls/shell32/memorystream.c @@ -198,6 +198,7 @@ static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) { + DWORD dummy_count; ICOM_THIS(ISHFileStream, iface); TRACE("(%p)\n",This); @@ -205,6 +206,10 @@ static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb if( !pv ) return STG_E_INVALIDPOINTER; + /* WriteFile() doesn't allow to specify NULL as write count pointer */ + if (!pcbWritten) + pcbWritten = &dummy_count; + if( ! WriteFile( This->handle, pv, cb, pcbWritten, NULL ) ) return E_FAIL;