ole32: Use the raw directory entry functions in getFreeProperty.

The meaning of the "index" argument in Read/WriteProperty will likely
change in the future, but getFreeProperty must work with real indexes
into the file's real directory stream.
This commit is contained in:
Vincent Povirk 2009-10-28 12:49:09 -05:00 committed by Alexandre Julliard
parent e71c696b51
commit ac9d77cd10
1 changed files with 19 additions and 15 deletions

View File

@ -1182,20 +1182,24 @@ static ULONG getFreeProperty(
{
ULONG currentPropertyIndex = 0;
ULONG newPropertyIndex = PROPERTY_NULL;
BOOL readSuccessful = TRUE;
StgProperty currentProperty;
HRESULT readRes = S_OK;
BYTE currentData[PROPSET_BLOCK_SIZE];
WORD sizeOfNameString;
do
{
/*
* Start by reading the root property
*/
readSuccessful = StorageImpl_ReadProperty(storage->base.ancestorStorage,
currentPropertyIndex,
&currentProperty);
if (readSuccessful)
readRes = StorageImpl_ReadRawDirEntry(storage->base.ancestorStorage,
currentPropertyIndex,
currentData);
if (SUCCEEDED(readRes))
{
if (currentProperty.sizeOfNameString == 0)
StorageUtl_ReadWord(
currentData,
OFFSET_PS_NAMELENGTH,
&sizeOfNameString);
if (sizeOfNameString == 0)
{
/*
* The property existis and is available, we found it.
@ -1217,9 +1221,9 @@ static ULONG getFreeProperty(
/*
* grow the property chain
*/
if (! readSuccessful)
if (!SUCCEEDED(readRes))
{
StgProperty emptyProperty;
BYTE emptyData[PROPSET_BLOCK_SIZE];
ULARGE_INTEGER newSize;
ULONG propertyIndex;
ULONG lastProperty = 0;
@ -1246,7 +1250,7 @@ static ULONG getFreeProperty(
* memset the empty property in order to initialize the unused newly
* created property
*/
memset(&emptyProperty, 0, sizeof(StgProperty));
memset(&emptyData, 0, PROPSET_BLOCK_SIZE);
/*
* initialize them
@ -1258,10 +1262,10 @@ static ULONG getFreeProperty(
propertyIndex < lastProperty;
propertyIndex++)
{
StorageImpl_WriteProperty(
StorageImpl_WriteRawDirEntry(
storage->base.ancestorStorage,
propertyIndex,
&emptyProperty);
emptyData);
}
}