Commit e71c696b authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

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

parent 56622de9
...@@ -3072,6 +3072,32 @@ HRESULT StorageImpl_ReadRawDirEntry(StorageImpl *This, ULONG index, BYTE *buffer ...@@ -3072,6 +3072,32 @@ HRESULT StorageImpl_ReadRawDirEntry(StorageImpl *This, ULONG index, BYTE *buffer
} }
/****************************************************************************** /******************************************************************************
* 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 * Storage32Impl_ReadProperty
* *
* This method will read the specified property from the property chain. * This method will read the specified property from the property chain.
...@@ -3171,12 +3197,7 @@ BOOL StorageImpl_WriteProperty( ...@@ -3171,12 +3197,7 @@ BOOL StorageImpl_WriteProperty(
const StgProperty* buffer) const StgProperty* buffer)
{ {
BYTE currentProperty[PROPSET_BLOCK_SIZE]; BYTE currentProperty[PROPSET_BLOCK_SIZE];
ULARGE_INTEGER offsetInPropSet;
HRESULT writeRes; HRESULT writeRes;
ULONG bytesWritten;
offsetInPropSet.u.HighPart = 0;
offsetInPropSet.u.LowPart = index * PROPSET_BLOCK_SIZE;
memset(currentProperty, 0, PROPSET_BLOCK_SIZE); memset(currentProperty, 0, PROPSET_BLOCK_SIZE);
...@@ -3242,11 +3263,7 @@ BOOL StorageImpl_WriteProperty( ...@@ -3242,11 +3263,7 @@ BOOL StorageImpl_WriteProperty(
OFFSET_PS_SIZE, OFFSET_PS_SIZE,
buffer->size.u.LowPart); buffer->size.u.LowPart);
writeRes = BlockChainStream_WriteAt(This->rootBlockChain, writeRes = StorageImpl_WriteRawDirEntry(This, index, currentProperty);
offsetInPropSet,
PROPSET_BLOCK_SIZE,
currentProperty,
&bytesWritten);
return SUCCEEDED(writeRes) ? TRUE : FALSE; return SUCCEEDED(writeRes) ? TRUE : FALSE;
} }
......
...@@ -295,6 +295,11 @@ HRESULT StorageImpl_ReadRawDirEntry( ...@@ -295,6 +295,11 @@ HRESULT StorageImpl_ReadRawDirEntry(
ULONG index, ULONG index,
BYTE *buffer); BYTE *buffer);
HRESULT StorageImpl_WriteRawDirEntry(
StorageImpl *This,
ULONG index,
const BYTE *buffer);
BOOL StorageImpl_ReadProperty( BOOL StorageImpl_ReadProperty(
StorageImpl* This, StorageImpl* This,
ULONG index, ULONG index,
......
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