ole32: Change ReadDirEntry return type to HRESULT.
This commit is contained in:
parent
df13a1d1fe
commit
8a332db2c5
|
@ -188,7 +188,7 @@ static void StgStreamImpl_OpenBlockChain(
|
||||||
StgStreamImpl* This)
|
StgStreamImpl* This)
|
||||||
{
|
{
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure no old object is left over.
|
* Make sure no old object is left over.
|
||||||
|
@ -208,11 +208,11 @@ static void StgStreamImpl_OpenBlockChain(
|
||||||
/*
|
/*
|
||||||
* Read the information from the directory entry.
|
* Read the information from the directory entry.
|
||||||
*/
|
*/
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
hr = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
||||||
This->dirEntry,
|
This->dirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
This->streamSize = currentEntry.size;
|
This->streamSize = currentEntry.size;
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
|
||||||
StgStreamImpl* const This=(StgStreamImpl*)iface;
|
StgStreamImpl* const This=(StgStreamImpl*)iface;
|
||||||
|
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL Success;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p, %d)\n", iface, libNewSize.u.LowPart);
|
TRACE("(%p, %d)\n", iface, libNewSize.u.LowPart);
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
|
||||||
/*
|
/*
|
||||||
* Read this stream's size to see if it's small blocks or big blocks
|
* Read this stream's size to see if it's small blocks or big blocks
|
||||||
*/
|
*/
|
||||||
Success = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
||||||
This->dirEntry,
|
This->dirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
/*
|
/*
|
||||||
|
@ -640,24 +640,24 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
|
||||||
|
|
||||||
if (This->smallBlockChain!=0)
|
if (This->smallBlockChain!=0)
|
||||||
{
|
{
|
||||||
Success = SmallBlockChainStream_SetSize(This->smallBlockChain, libNewSize);
|
SmallBlockChainStream_SetSize(This->smallBlockChain, libNewSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Success = BlockChainStream_SetSize(This->bigBlockChain, libNewSize);
|
BlockChainStream_SetSize(This->bigBlockChain, libNewSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the new information about this stream to the directory entry
|
* Write the new information about this stream to the directory entry
|
||||||
*/
|
*/
|
||||||
Success = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
hr = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
||||||
This->dirEntry,
|
This->dirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
|
|
||||||
currentEntry.size.u.HighPart = libNewSize.u.HighPart;
|
currentEntry.size.u.HighPart = libNewSize.u.HighPart;
|
||||||
currentEntry.size.u.LowPart = libNewSize.u.LowPart;
|
currentEntry.size.u.LowPart = libNewSize.u.LowPart;
|
||||||
|
|
||||||
if (Success)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
StorageImpl_WriteDirEntry(This->parentStorage->ancestorStorage,
|
StorageImpl_WriteDirEntry(This->parentStorage->ancestorStorage,
|
||||||
This->dirEntry,
|
This->dirEntry,
|
||||||
|
@ -835,7 +835,7 @@ static HRESULT WINAPI StgStreamImpl_Stat(
|
||||||
StgStreamImpl* const This=(StgStreamImpl*)iface;
|
StgStreamImpl* const This=(StgStreamImpl*)iface;
|
||||||
|
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("%p %p %d\n", This, pstatstg, grfStatFlag);
|
TRACE("%p %p %d\n", This, pstatstg, grfStatFlag);
|
||||||
|
|
||||||
|
@ -852,11 +852,11 @@ static HRESULT WINAPI StgStreamImpl_Stat(
|
||||||
/*
|
/*
|
||||||
* Read the information from the directory entry.
|
* Read the information from the directory entry.
|
||||||
*/
|
*/
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
hr = StorageImpl_ReadDirEntry(This->parentStorage->ancestorStorage,
|
||||||
This->dirEntry,
|
This->dirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
StorageUtl_CopyDirEntryToSTATSTG(This->parentStorage,
|
StorageUtl_CopyDirEntryToSTATSTG(This->parentStorage,
|
||||||
pstatstg,
|
pstatstg,
|
||||||
|
@ -873,7 +873,7 @@ static HRESULT WINAPI StgStreamImpl_Stat(
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("failed to read entry\n");
|
WARN("failed to read entry\n");
|
||||||
return E_FAIL;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -673,7 +673,6 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
|
||||||
{
|
{
|
||||||
StorageBaseImpl *This = (StorageBaseImpl *)iface;
|
StorageBaseImpl *This = (StorageBaseImpl *)iface;
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL readSuccessful;
|
|
||||||
HRESULT res = STG_E_UNKNOWN;
|
HRESULT res = STG_E_UNKNOWN;
|
||||||
|
|
||||||
TRACE("(%p, %p, %x)\n",
|
TRACE("(%p, %p, %x)\n",
|
||||||
|
@ -691,12 +690,12 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
res = StorageImpl_ReadDirEntry(
|
||||||
This->ancestorStorage,
|
This->ancestorStorage,
|
||||||
This->storageDirEntry,
|
This->storageDirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(res))
|
||||||
{
|
{
|
||||||
StorageUtl_CopyDirEntryToSTATSTG(
|
StorageUtl_CopyDirEntryToSTATSTG(
|
||||||
This,
|
This,
|
||||||
|
@ -706,13 +705,8 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
|
||||||
|
|
||||||
pstatstg->grfMode = This->openFlags;
|
pstatstg->grfMode = This->openFlags;
|
||||||
pstatstg->grfStateBits = This->stateBits;
|
pstatstg->grfStateBits = This->stateBits;
|
||||||
|
|
||||||
res = S_OK;
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res = E_FAIL;
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (res == S_OK)
|
if (res == S_OK)
|
||||||
{
|
{
|
||||||
|
@ -962,19 +956,18 @@ static HRESULT WINAPI StorageBaseImpl_SetClass(
|
||||||
REFCLSID clsid) /* [in] */
|
REFCLSID clsid) /* [in] */
|
||||||
{
|
{
|
||||||
StorageBaseImpl *This = (StorageBaseImpl *)iface;
|
StorageBaseImpl *This = (StorageBaseImpl *)iface;
|
||||||
HRESULT hRes = E_FAIL;
|
HRESULT hRes;
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL success;
|
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", iface, clsid);
|
TRACE("(%p, %p)\n", iface, clsid);
|
||||||
|
|
||||||
if (!This->ancestorStorage)
|
if (!This->ancestorStorage)
|
||||||
return STG_E_REVERTED;
|
return STG_E_REVERTED;
|
||||||
|
|
||||||
success = StorageImpl_ReadDirEntry(This->ancestorStorage,
|
hRes = StorageImpl_ReadDirEntry(This->ancestorStorage,
|
||||||
This->storageDirEntry,
|
This->storageDirEntry,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
if (success)
|
if (SUCCEEDED(hRes))
|
||||||
{
|
{
|
||||||
currentEntry.clsid = *clsid;
|
currentEntry.clsid = *clsid;
|
||||||
|
|
||||||
|
@ -2065,13 +2058,15 @@ static HRESULT removeFromTree(
|
||||||
DirRef deletedIndex)
|
DirRef deletedIndex)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
BOOL res = TRUE;
|
|
||||||
DirEntry entryToDelete;
|
DirEntry entryToDelete;
|
||||||
DirEntry parentEntry;
|
DirEntry parentEntry;
|
||||||
DirRef parentEntryRef;
|
DirRef parentEntryRef;
|
||||||
ULONG typeOfRelation;
|
ULONG typeOfRelation;
|
||||||
|
|
||||||
res = StorageImpl_ReadDirEntry(This, deletedIndex, &entryToDelete);
|
hr = StorageImpl_ReadDirEntry(This, deletedIndex, &entryToDelete);
|
||||||
|
|
||||||
|
if (hr != S_OK)
|
||||||
|
return hr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the element that links to the one we want to delete.
|
* Find the element that links to the one we want to delete.
|
||||||
|
@ -2110,13 +2105,13 @@ static HRESULT removeFromTree(
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
res = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This,
|
This,
|
||||||
newRightChildParent,
|
newRightChildParent,
|
||||||
&newRightChildParentEntry);
|
&newRightChildParentEntry);
|
||||||
if (!res)
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
return E_FAIL;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newRightChildParentEntry.rightChild != DIRENTRY_NULL)
|
if (newRightChildParentEntry.rightChild != DIRENTRY_NULL)
|
||||||
|
@ -2230,7 +2225,6 @@ static HRESULT StorageImpl_Construct(
|
||||||
StorageImpl* This;
|
StorageImpl* This;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
DirEntry currentEntry;
|
DirEntry currentEntry;
|
||||||
BOOL readSuccessful;
|
|
||||||
DirRef currentEntryRef;
|
DirRef currentEntryRef;
|
||||||
|
|
||||||
if ( FAILED( validateSTGM(openFlags) ))
|
if ( FAILED( validateSTGM(openFlags) ))
|
||||||
|
@ -2405,12 +2399,12 @@ static HRESULT StorageImpl_Construct(
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This,
|
This,
|
||||||
currentEntryRef,
|
currentEntryRef,
|
||||||
¤tEntry);
|
¤tEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
if ( (currentEntry.sizeOfNameString != 0 ) &&
|
if ( (currentEntry.sizeOfNameString != 0 ) &&
|
||||||
(currentEntry.stgType == STGTY_ROOT) )
|
(currentEntry.stgType == STGTY_ROOT) )
|
||||||
|
@ -2421,9 +2415,9 @@ static HRESULT StorageImpl_Construct(
|
||||||
|
|
||||||
currentEntryRef++;
|
currentEntryRef++;
|
||||||
|
|
||||||
} while (readSuccessful && (This->base.storageDirEntry == DIRENTRY_NULL) );
|
} while (SUCCEEDED(hr) && (This->base.storageDirEntry == DIRENTRY_NULL) );
|
||||||
|
|
||||||
if (!readSuccessful)
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
hr = STG_E_READFAULT;
|
hr = STG_E_READFAULT;
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -3247,7 +3241,7 @@ void UpdateRawDirEntry(BYTE *buffer, const DirEntry *newData)
|
||||||
*
|
*
|
||||||
* This method will read the specified directory entry.
|
* This method will read the specified directory entry.
|
||||||
*/
|
*/
|
||||||
BOOL StorageImpl_ReadDirEntry(
|
HRESULT StorageImpl_ReadDirEntry(
|
||||||
StorageImpl* This,
|
StorageImpl* This,
|
||||||
DirRef index,
|
DirRef index,
|
||||||
DirEntry* buffer)
|
DirEntry* buffer)
|
||||||
|
@ -3326,7 +3320,7 @@ BOOL StorageImpl_ReadDirEntry(
|
||||||
buffer->size.u.HighPart = 0;
|
buffer->size.u.HighPart = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCEEDED(readRes) ? TRUE : FALSE;
|
return readRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -3858,7 +3852,7 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Reset(
|
||||||
IEnumSTATSTGImpl* const This=(IEnumSTATSTGImpl*)iface;
|
IEnumSTATSTGImpl* const This=(IEnumSTATSTGImpl*)iface;
|
||||||
|
|
||||||
DirEntry storageEntry;
|
DirEntry storageEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Re-initialize the search stack to an empty stack
|
* Re-initialize the search stack to an empty stack
|
||||||
|
@ -3868,12 +3862,12 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Reset(
|
||||||
/*
|
/*
|
||||||
* Read the storage entry from the top-level storage.
|
* Read the storage entry from the top-level storage.
|
||||||
*/
|
*/
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This->parentStorage,
|
This->parentStorage,
|
||||||
This->storageDirEntry,
|
This->storageDirEntry,
|
||||||
&storageEntry);
|
&storageEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
assert(storageEntry.sizeOfNameString!=0);
|
assert(storageEntry.sizeOfNameString!=0);
|
||||||
|
|
||||||
|
@ -3883,7 +3877,7 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Reset(
|
||||||
IEnumSTATSTGImpl_PushSearchNode(This, storageEntry.dirRootEntry);
|
IEnumSTATSTGImpl_PushSearchNode(This, storageEntry.dirRootEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IEnumSTATSTGImpl_Clone(
|
static HRESULT WINAPI IEnumSTATSTGImpl_Clone(
|
||||||
|
@ -3934,7 +3928,7 @@ static void IEnumSTATSTGImpl_PushSearchNode(
|
||||||
DirRef nodeToPush)
|
DirRef nodeToPush)
|
||||||
{
|
{
|
||||||
DirEntry storageEntry;
|
DirEntry storageEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First, make sure we're not trying to push an unexisting node.
|
* First, make sure we're not trying to push an unexisting node.
|
||||||
|
@ -3962,12 +3956,12 @@ static void IEnumSTATSTGImpl_PushSearchNode(
|
||||||
/*
|
/*
|
||||||
* Read the storage entry from the top-level storage.
|
* Read the storage entry from the top-level storage.
|
||||||
*/
|
*/
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This->parentStorage,
|
This->parentStorage,
|
||||||
nodeToPush,
|
nodeToPush,
|
||||||
&storageEntry);
|
&storageEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
assert(storageEntry.sizeOfNameString!=0);
|
assert(storageEntry.sizeOfNameString!=0);
|
||||||
|
|
||||||
|
@ -4327,19 +4321,19 @@ void BlockChainStream_Destroy(BlockChainStream* This)
|
||||||
static ULONG BlockChainStream_GetHeadOfChain(BlockChainStream* This)
|
static ULONG BlockChainStream_GetHeadOfChain(BlockChainStream* This)
|
||||||
{
|
{
|
||||||
DirEntry chainEntry;
|
DirEntry chainEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
if (This->headOfStreamPlaceHolder != 0)
|
if (This->headOfStreamPlaceHolder != 0)
|
||||||
return *(This->headOfStreamPlaceHolder);
|
return *(This->headOfStreamPlaceHolder);
|
||||||
|
|
||||||
if (This->ownerDirEntry != DIRENTRY_NULL)
|
if (This->ownerDirEntry != DIRENTRY_NULL)
|
||||||
{
|
{
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This->parentStorage,
|
This->parentStorage,
|
||||||
This->ownerDirEntry,
|
This->ownerDirEntry,
|
||||||
&chainEntry);
|
&chainEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
return chainEntry.startingBlock;
|
return chainEntry.startingBlock;
|
||||||
}
|
}
|
||||||
|
@ -4855,19 +4849,19 @@ static ULONG SmallBlockChainStream_GetHeadOfChain(
|
||||||
SmallBlockChainStream* This)
|
SmallBlockChainStream* This)
|
||||||
{
|
{
|
||||||
DirEntry chainEntry;
|
DirEntry chainEntry;
|
||||||
BOOL readSuccessful;
|
HRESULT hr;
|
||||||
|
|
||||||
if (This->headOfStreamPlaceHolder != NULL)
|
if (This->headOfStreamPlaceHolder != NULL)
|
||||||
return *(This->headOfStreamPlaceHolder);
|
return *(This->headOfStreamPlaceHolder);
|
||||||
|
|
||||||
if (This->ownerDirEntry)
|
if (This->ownerDirEntry)
|
||||||
{
|
{
|
||||||
readSuccessful = StorageImpl_ReadDirEntry(
|
hr = StorageImpl_ReadDirEntry(
|
||||||
This->parentStorage,
|
This->parentStorage,
|
||||||
This->ownerDirEntry,
|
This->ownerDirEntry,
|
||||||
&chainEntry);
|
&chainEntry);
|
||||||
|
|
||||||
if (readSuccessful)
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
return chainEntry.startingBlock;
|
return chainEntry.startingBlock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ HRESULT StorageImpl_WriteRawDirEntry(
|
||||||
ULONG index,
|
ULONG index,
|
||||||
const BYTE *buffer);
|
const BYTE *buffer);
|
||||||
|
|
||||||
BOOL StorageImpl_ReadDirEntry(
|
HRESULT StorageImpl_ReadDirEntry(
|
||||||
StorageImpl* This,
|
StorageImpl* This,
|
||||||
DirRef index,
|
DirRef index,
|
||||||
DirEntry* buffer);
|
DirEntry* buffer);
|
||||||
|
|
Loading…
Reference in New Issue