Commit b005e9ed authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

ole32: Move the logic in StgCreateDocfile for "if no share mode given then…

ole32: Move the logic in StgCreateDocfile for "if no share mode given then DENY_NONE is the default" to before the validateSTGM check. Add a test that shows this behaviour is correct. Remove a test on the access mode that is redundant because it is already done in validateSTGM.
parent 12aa9e33
......@@ -5680,6 +5680,10 @@ HRESULT WINAPI StgCreateDocfile(
if (reserved != 0)
return STG_E_INVALIDPARAMETER;
/* if no share mode given then DENY_NONE is the default */
if (STGM_SHARE_MODE(grfMode) == 0)
grfMode |= STGM_SHARE_DENY_NONE;
/*
* Validate the STGM flags
*/
......@@ -5696,14 +5700,6 @@ HRESULT WINAPI StgCreateDocfile(
goto end;
}
/* if no share mode given then DENY_NONE is the default */
if (STGM_SHARE_MODE(grfMode) == 0)
grfMode |= STGM_SHARE_DENY_NONE;
/* must have at least one access mode */
if (STGM_ACCESS_MODE(grfMode) == 0)
goto end;
/* in direct mode, can only use SHARE_EXCLUSIVE */
if (!(grfMode & STGM_TRANSACTED) && (STGM_SHARE_MODE(grfMode) != STGM_SHARE_EXCLUSIVE))
goto end;
......
......@@ -163,6 +163,12 @@ static void test_create_storage_modes(void)
ok(r == 0, "storage not released\n");
ok(DeleteFileW(filename), "failed to delete file\n");
r = StgCreateDocfile( filename, STGM_CREATE | STGM_READWRITE |STGM_TRANSACTED, 0, &stg);
ok(r==S_OK, "StgCreateDocfile failed\n");
r = IStorage_Release(stg);
ok(r == 0, "storage not released\n");
ok(DeleteFileW(filename), "failed to delete file\n");
/* test the way excel uses StgCreateDocFile */
r = StgCreateDocfile( filename, STGM_TRANSACTED|STGM_CREATE|STGM_SHARE_DENY_WRITE|STGM_READWRITE, 0, &stg);
ok(r==S_OK, "StgCreateDocfile the excel way failed\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