Commit c29f3dff authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Accept STGM_DIRECT_SWMR mode.

parent a90c1efe
...@@ -7604,7 +7604,16 @@ HRESULT WINAPI StgOpenStorage( ...@@ -7604,7 +7604,16 @@ HRESULT WINAPI StgOpenStorage(
/* /*
* Validate the sharing mode * 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)) switch(STGM_SHARE_MODE(grfMode))
{ {
case STGM_SHARE_EXCLUSIVE: case STGM_SHARE_EXCLUSIVE:
......
...@@ -1889,7 +1889,7 @@ static void test_access(void) ...@@ -1889,7 +1889,7 @@ static void test_access(void)
STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &stg); STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &stg);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); 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); hr = IStorage_Commit(stg, STGC_DEFAULT);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
...@@ -1955,6 +1955,21 @@ static void test_access(void) ...@@ -1955,6 +1955,21 @@ static void test_access(void)
test_file_access(fileA, create_close); test_file_access(fileA, create_close);
DeleteFileA(fileA); 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) static void test_readonly(void)
......
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