Commit 11e4b21a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

ole32: More tests and fixes for STGM_PRIORITY.

parent d7424771
......@@ -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;
}
/*
......
......@@ -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");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment