ole32: More tests and fixes for STGM_PRIORITY.
This commit is contained in:
parent
d7424771ea
commit
11e4b21a30
|
@ -5911,8 +5911,14 @@ HRESULT WINAPI StgOpenStorage(
|
||||||
/* STGM_PRIORITY implies exclusive access */
|
/* STGM_PRIORITY implies exclusive access */
|
||||||
if (grfMode & STGM_PRIORITY)
|
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 &= ~0xf0; /* remove the existing sharing mode */
|
||||||
grfMode |= STGM_SHARE_EXCLUSIVE;
|
grfMode |= STGM_SHARE_DENY_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -478,9 +478,32 @@ static void test_open_storage(void)
|
||||||
stg = NULL;
|
stg = NULL;
|
||||||
r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg);
|
r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg);
|
||||||
ok(r == S_OK, "should succeed\n");
|
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)
|
if (stg)
|
||||||
IStorage_Release(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);
|
r = DeleteFileW(filename);
|
||||||
ok(r, "file didn't exist\n");
|
ok(r, "file didn't exist\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue