ole32: Fix StgOpenStorage's handling of the STGM_PRIORITY flag.

This commit is contained in:
Mike McCormack 2006-03-29 17:09:25 +09:00 committed by Alexandre Julliard
parent 3217e534fe
commit 50436da519
2 changed files with 27 additions and 1 deletions

View File

@ -5911,7 +5911,7 @@ HRESULT WINAPI StgOpenStorage(
/*
* Validate the sharing mode
*/
if (!(grfMode & STGM_TRANSACTED))
if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY)))
switch(STGM_SHARE_MODE(grfMode))
{
case STGM_SHARE_EXCLUSIVE:

View File

@ -448,6 +448,32 @@ static void test_open_storage(void)
ok(r == 0, "wrong ref count\n");
}
/* open like visio 2003 */
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY | STGM_SHARE_DENY_NONE, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
if (stg)
IStorage_Release(stg);
/* test other sharing modes with STGM_PRIORITY */
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
if (stg)
IStorage_Release(stg);
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
if (stg)
IStorage_Release(stg);
stg = NULL;
r = StgOpenStorage( filename, NULL, STGM_PRIORITY | STGM_SHARE_DENY_READ, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
if (stg)
IStorage_Release(stg);
r = DeleteFileW(filename);
ok(r, "file didn't exist\n");
}