Nikolay Sivov : ole32: Store SMWR storage instance role separately.
Alexandre Julliard
julliard at winehq.org
Fri Apr 19 14:25:07 CDT 2013
Module: wine
Branch: master
Commit: 5132f60298dfaffa44a31cbea6d579c779705067
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5132f60298dfaffa44a31cbea6d579c779705067
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Apr 19 12:37:01 2013 +0400
ole32: Store SMWR storage instance role separately.
---
dlls/ole32/storage32.c | 12 +++++++++---
dlls/ole32/storage32.h | 7 +++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index aa82b66..db47423 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 b037847..8cb330f 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 */
More information about the wine-cvs
mailing list