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.
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 86c174b..b1f19f3 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -1182,20 +1182,24 @@
{
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,
- ¤tProperty);
- 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 @@
/*
* 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 @@
* 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 @@
propertyIndex < lastProperty;
propertyIndex++)
{
- StorageImpl_WriteProperty(
+ StorageImpl_WriteRawDirEntry(
storage->base.ancestorStorage,
propertyIndex,
- &emptyProperty);
+ emptyData);
}
}