ole32: More tests and fixes for STGM_PRIORITY.

This commit is contained in:
Mike McCormack 2006-04-18 17:18:51 +09:00 committed by Alexandre Julliard
parent d7424771ea
commit 11e4b21a30
2 changed files with 30 additions and 1 deletions

View File

@ -5911,8 +5911,14 @@ HRESULT WINAPI StgOpenStorage(
/* STGM_PRIORITY implies exclusive access */
if (grfMode & STGM_PRIORITY)
{
if (grfMode & (STGM_TRANSACTED|STGM_SIMPLE|STGM_NOSCRATCH|STGM_NOSNAPSHOT))
return STG_E_INVALIDFLAG;
if (grfMode & STGM_DELETEONRELEASE)
return STG_E_INVALIDFUNCTION;
if(STGM_ACCESS_MODE(grfMode) != STGM_READ)
return STG_E_INVALIDFLAG;
grfMode &= ~0xf0; /* remove the existing sharing mode */
grfMode |= STGM_SHARE_EXCLUSIVE;
grfMode |= STGM_SHARE_DENY_WRITE;
}
/*

View File

@ -478,9 +478,32 @@ static void test_open_storage(void)
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg2);
ok(r == S_OK, "should succeed\n");
if (stg2)
IStorage_Release(stg2);
if (stg)
IStorage_Release(stg);
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY | STGM_READWRITE, NULL, 0, &stg);
ok(r == STG_E_INVALIDFLAG, "should fail\n");
r = StgOpenStorage( filename, NULL, STGM_TRANSACTED | STGM_PRIORITY, NULL, 0, &stg);
ok(r == STG_E_INVALIDFLAG, "should fail\n");
r = StgOpenStorage( filename, NULL, STGM_SIMPLE | STGM_PRIORITY, NULL, 0, &stg);
ok(r == STG_E_INVALIDFLAG, "should fail\n");
r = StgOpenStorage( filename, NULL, STGM_DELETEONRELEASE | STGM_PRIORITY, NULL, 0, &stg);
ok(r == STG_E_INVALIDFUNCTION, "should fail\n");
r = StgOpenStorage( filename, NULL, STGM_NOSCRATCH | STGM_PRIORITY, NULL, 0, &stg);
ok(r == STG_E_INVALIDFLAG, "should fail\n");
r = StgOpenStorage( filename, NULL, STGM_NOSNAPSHOT | STGM_PRIORITY, NULL, 0, &stg);
ok(r == STG_E_INVALIDFLAG, "should fail\n");
r = DeleteFileW(filename);
ok(r, "file didn't exist\n");
}