diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 6f7f22dbfb5..5f9a9097c68 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -5802,15 +5802,16 @@ HRESULT WINAPI StgOpenStorage( /* * Validate the sharing mode */ - switch(STGM_SHARE_MODE(grfMode)) - { - case STGM_SHARE_EXCLUSIVE: - case STGM_SHARE_DENY_WRITE: - break; - default: - hr = STG_E_INVALIDFLAG; - goto end; - } + if (!(grfMode & STGM_TRANSACTED)) + switch(STGM_SHARE_MODE(grfMode)) + { + case STGM_SHARE_EXCLUSIVE: + case STGM_SHARE_DENY_WRITE: + break; + default: + hr = STG_E_INVALIDFLAG; + goto end; + } /* * Validate the STGM flags diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index eb9f1cb9937..f4f02cee4bf 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -393,6 +393,14 @@ static void test_open_storage(void) ok(r==STG_E_INVALIDFLAG, "StgOpenStorage failed\n"); /* open it for real */ + r = StgOpenStorage( filename, NULL, STGM_SHARE_DENY_NONE | STGM_READ | STGM_TRANSACTED, NULL, 0, &stg); /* XLViewer 97/2000 */ + ok(r==S_OK, "StgOpenStorage failed\n"); + if(stg) + { + r = IStorage_Release(stg); + ok(r == 0, "wrong ref count\n"); + } + r = StgOpenStorage( filename, NULL, STGM_SHARE_DENY_WRITE | STGM_READ, NULL, 0, &stg); ok(r==S_OK, "StgOpenStorage failed\n"); if(stg)