diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index aa82b6667a1..db4742396cd 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -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; /* diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index b037847e899..8cb330f2b60 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -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 */