ole32: Accept STGM_DIRECT_SWMR mode.

This commit is contained in:
Nikolay Sivov 2013-04-18 01:25:23 +04:00 committed by Alexandre Julliard
parent a90c1efe51
commit c29f3dff8c
2 changed files with 26 additions and 2 deletions

View File

@ -7604,7 +7604,16 @@ HRESULT WINAPI StgOpenStorage(
/*
* Validate the sharing mode
*/
if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY)))
if (grfMode & STGM_DIRECT_SWMR)
{
if ((STGM_SHARE_MODE(grfMode) != STGM_SHARE_DENY_WRITE) &&
(STGM_SHARE_MODE(grfMode) != STGM_SHARE_DENY_NONE))
{
hr = STG_E_INVALIDFLAG;
goto end;
}
}
else if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY)))
switch(STGM_SHARE_MODE(grfMode))
{
case STGM_SHARE_EXCLUSIVE:

View File

@ -1889,7 +1889,7 @@ static void test_access(void)
STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &stg);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
test_file_access("winetest", create);
test_file_access(fileA, create);
hr = IStorage_Commit(stg, STGC_DEFAULT);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
@ -1955,6 +1955,21 @@ static void test_access(void)
test_file_access(fileA, create_close);
DeleteFileA(fileA);
/* STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE - reader mode for direct SWMR mode */
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
ok(hr == S_OK, "got %08x\n", hr);
IStorage_Release(stg);
hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg);
ok(hr == S_OK, "got %08x\n", hr);
test_file_access(fileA, create);
IStorage_Release(stg);
test_file_access(fileA, create_close);
DeleteFileA(fileA);
}
static void test_readonly(void)