ole32: Store SMWR storage instance role separately.

This commit is contained in:
Nikolay Sivov 2013-04-19 12:37:01 +04:00 committed by Alexandre Julliard
parent 8a9ab424ff
commit 5132f60298
2 changed files with 16 additions and 3 deletions

View File

@ -385,9 +385,8 @@ static HRESULT WINAPI StorageBaseImpl_QueryInterface(
{
*ppvObject = &This->IPropertySetStorage_iface;
}
/* locking interface is report for writer only */
else if (IsEqualGUID(&IID_IDirectWriterLock, riid) &&
(This->openFlags == (STGM_DIRECT_SWMR|STGM_READWRITE|STGM_SHARE_DENY_WRITE)))
/* locking interface is reported for writer only */
else if (IsEqualGUID(&IID_IDirectWriterLock, riid) && This->lockingrole == SWMR_Writer)
{
*ppvObject = &This->IDirectWriterLock_iface;
}
@ -2785,6 +2784,13 @@ static HRESULT StorageImpl_Construct(
This->base.ref = 1;
This->base.create = create;
if (openFlags == (STGM_DIRECT_SWMR|STGM_READWRITE|STGM_SHARE_DENY_WRITE))
This->base.lockingrole = SWMR_Writer;
else if (openFlags == (STGM_DIRECT_SWMR|STGM_READ|STGM_SHARE_DENY_NONE))
This->base.lockingrole = SWMR_Reader;
else
This->base.lockingrole = SWMR_None;
This->base.reverted = 0;
/*

View File

@ -163,6 +163,12 @@ HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, LPCWSTR pwcsN
HRESULT STORAGE_CreateOleStream(IStorage*, DWORD) DECLSPEC_HIDDEN;
HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) DECLSPEC_HIDDEN;
enum swmr_mode
{
SWMR_None,
SWMR_Writer,
SWMR_Reader
};
/****************************************************************************
* StorageBaseImpl definitions.
@ -223,6 +229,7 @@ struct StorageBaseImpl
* the transacted snapshot or cache.
*/
StorageBaseImpl *transactedChild;
enum swmr_mode lockingrole;
};
/* virtual methods for StorageBaseImpl objects */