IStream_fnWrite: only return write count if the given pointer

parameter is not NULL.
This commit is contained in:
Martin Fuchs 2004-01-18 23:17:13 +00:00 committed by Alexandre Julliard
parent b89525fb06
commit 87326ba7c3

View File

@ -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) static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten)
{ {
DWORD dummy_count;
ICOM_THIS(ISHFileStream, iface); ICOM_THIS(ISHFileStream, iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -205,6 +206,10 @@ static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb
if( !pv ) if( !pv )
return STG_E_INVALIDPOINTER; 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 ) ) if( ! WriteFile( This->handle, pv, cb, pcbWritten, NULL ) )
return E_FAIL; return E_FAIL;