diff --git a/dlls/shell32/memorystream.c b/dlls/shell32/memorystream.c index 5e91a19ea5..7738e340f4 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;