ole32: Move the low-level functionality of WriteProperty to a new function.

This commit is contained in:
Vincent Povirk 2009-10-28 11:41:50 -05:00 committed by Alexandre Julliard
parent 56622de951
commit e71c696b51
2 changed files with 32 additions and 10 deletions

View File

@ -3071,6 +3071,32 @@ HRESULT StorageImpl_ReadRawDirEntry(StorageImpl *This, ULONG index, BYTE *buffer
return hr;
}
/******************************************************************************
* StorageImpl_WriteRawDirEntry
*
* This method will write the raw data from a directory entry in the file.
*
* buffer must be PROPSET_BLOCK_SIZE bytes long.
*/
HRESULT StorageImpl_WriteRawDirEntry(StorageImpl *This, ULONG index, const BYTE *buffer)
{
ULARGE_INTEGER offset;
HRESULT hr;
ULONG bytesRead;
offset.u.HighPart = 0;
offset.u.LowPart = index * PROPSET_BLOCK_SIZE;
hr = BlockChainStream_WriteAt(
This->rootBlockChain,
offset,
PROPSET_BLOCK_SIZE,
buffer,
&bytesRead);
return hr;
}
/******************************************************************************
* Storage32Impl_ReadProperty
*
@ -3171,12 +3197,7 @@ BOOL StorageImpl_WriteProperty(
const StgProperty* buffer)
{
BYTE currentProperty[PROPSET_BLOCK_SIZE];
ULARGE_INTEGER offsetInPropSet;
HRESULT writeRes;
ULONG bytesWritten;
offsetInPropSet.u.HighPart = 0;
offsetInPropSet.u.LowPart = index * PROPSET_BLOCK_SIZE;
memset(currentProperty, 0, PROPSET_BLOCK_SIZE);
@ -3242,11 +3263,7 @@ BOOL StorageImpl_WriteProperty(
OFFSET_PS_SIZE,
buffer->size.u.LowPart);
writeRes = BlockChainStream_WriteAt(This->rootBlockChain,
offsetInPropSet,
PROPSET_BLOCK_SIZE,
currentProperty,
&bytesWritten);
writeRes = StorageImpl_WriteRawDirEntry(This, index, currentProperty);
return SUCCEEDED(writeRes) ? TRUE : FALSE;
}

View File

@ -295,6 +295,11 @@ HRESULT StorageImpl_ReadRawDirEntry(
ULONG index,
BYTE *buffer);
HRESULT StorageImpl_WriteRawDirEntry(
StorageImpl *This,
ULONG index,
const BYTE *buffer);
BOOL StorageImpl_ReadProperty(
StorageImpl* This,
ULONG index,