Relax the share mode validation for transacted storage, with a test.

This commit is contained in:
Richard Cohen 2005-09-07 09:22:15 +00:00 committed by Alexandre Julliard
parent 3915b16762
commit 908e9e889e
2 changed files with 18 additions and 9 deletions

View File

@ -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

View File

@ -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)