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
1 changed files with 5 additions and 0 deletions

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)
{
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;