Commit 79f7318a authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

ole32: Convert the *_{Read,Write}At structured storage functions to

return HRESULTs instead of BOOLs so that errors can be properly propagated from lower levels.
parent bfc1bdc3
...@@ -302,15 +302,11 @@ static HRESULT WINAPI StgStreamImpl_Read( ...@@ -302,15 +302,11 @@ static HRESULT WINAPI StgStreamImpl_Read(
} }
else if (This->bigBlockChain!=0) else if (This->bigBlockChain!=0)
{ {
BOOL success = BlockChainStream_ReadAt(This->bigBlockChain, res = BlockChainStream_ReadAt(This->bigBlockChain,
This->currentPosition, This->currentPosition,
bytesToReadFromBuffer, bytesToReadFromBuffer,
pv, pv,
pcbRead); pcbRead);
if (success)
res = S_OK;
else
res = STG_E_READFAULT;
} }
else else
{ {
...@@ -363,6 +359,7 @@ static HRESULT WINAPI StgStreamImpl_Write( ...@@ -363,6 +359,7 @@ static HRESULT WINAPI StgStreamImpl_Write(
ULARGE_INTEGER newSize; ULARGE_INTEGER newSize;
ULONG bytesWritten = 0; ULONG bytesWritten = 0;
HRESULT res;
TRACE("(%p, %p, %ld, %p)\n", TRACE("(%p, %p, %ld, %p)\n",
iface, pv, cb, pcbWritten); iface, pv, cb, pcbWritten);
...@@ -427,7 +424,7 @@ static HRESULT WINAPI StgStreamImpl_Write( ...@@ -427,7 +424,7 @@ static HRESULT WINAPI StgStreamImpl_Write(
*/ */
if (This->smallBlockChain!=0) if (This->smallBlockChain!=0)
{ {
SmallBlockChainStream_WriteAt(This->smallBlockChain, res = SmallBlockChainStream_WriteAt(This->smallBlockChain,
This->currentPosition, This->currentPosition,
cb, cb,
pv, pv,
...@@ -436,13 +433,15 @@ static HRESULT WINAPI StgStreamImpl_Write( ...@@ -436,13 +433,15 @@ static HRESULT WINAPI StgStreamImpl_Write(
} }
else if (This->bigBlockChain!=0) else if (This->bigBlockChain!=0)
{ {
BlockChainStream_WriteAt(This->bigBlockChain, res = BlockChainStream_WriteAt(This->bigBlockChain,
This->currentPosition, This->currentPosition,
cb, cb,
pv, pv,
pcbWritten); pcbWritten);
} }
else else
/* this should never happen because the IStream_SetSize call above will
* make sure a big or small block chain is created */
assert(FALSE); assert(FALSE);
/* /*
...@@ -451,7 +450,7 @@ static HRESULT WINAPI StgStreamImpl_Write( ...@@ -451,7 +450,7 @@ static HRESULT WINAPI StgStreamImpl_Write(
This->currentPosition.u.LowPart += *pcbWritten; This->currentPosition.u.LowPart += *pcbWritten;
TRACE("<-- S_OK, written %lu\n", *pcbWritten); TRACE("<-- S_OK, written %lu\n", *pcbWritten);
return S_OK; return res;
} }
/*** /***
......
...@@ -455,14 +455,14 @@ BlockChainStream* BlockChainStream_Construct( ...@@ -455,14 +455,14 @@ BlockChainStream* BlockChainStream_Construct(
void BlockChainStream_Destroy( void BlockChainStream_Destroy(
BlockChainStream* This); BlockChainStream* This);
BOOL BlockChainStream_ReadAt( HRESULT BlockChainStream_ReadAt(
BlockChainStream* This, BlockChainStream* This,
ULARGE_INTEGER offset, ULARGE_INTEGER offset,
ULONG size, ULONG size,
void* buffer, void* buffer,
ULONG* bytesRead); ULONG* bytesRead);
BOOL BlockChainStream_WriteAt( HRESULT BlockChainStream_WriteAt(
BlockChainStream* This, BlockChainStream* This,
ULARGE_INTEGER offset, ULARGE_INTEGER offset,
ULONG size, ULONG size,
...@@ -502,7 +502,7 @@ HRESULT SmallBlockChainStream_ReadAt( ...@@ -502,7 +502,7 @@ HRESULT SmallBlockChainStream_ReadAt(
void* buffer, void* buffer,
ULONG* bytesRead); ULONG* bytesRead);
BOOL SmallBlockChainStream_WriteAt( HRESULT SmallBlockChainStream_WriteAt(
SmallBlockChainStream* This, SmallBlockChainStream* This,
ULARGE_INTEGER offset, ULARGE_INTEGER offset,
ULONG size, ULONG size,
......
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