Commit b4ade51a authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Accept STGM_TRANSACTED with no share mode specified.

parent 6417a277
...@@ -8251,6 +8251,10 @@ static HRESULT validateSTGM(DWORD stgm) ...@@ -8251,6 +8251,10 @@ static HRESULT validateSTGM(DWORD stgm)
case STGM_SHARE_DENY_WRITE: case STGM_SHARE_DENY_WRITE:
case STGM_SHARE_EXCLUSIVE: case STGM_SHARE_EXCLUSIVE:
break; break;
case 0:
if (!(stgm & STGM_TRANSACTED))
return E_FAIL;
break;
default: default:
return E_FAIL; return E_FAIL;
} }
...@@ -8306,6 +8310,9 @@ static DWORD GetShareModeFromSTGM(DWORD stgm) ...@@ -8306,6 +8310,9 @@ static DWORD GetShareModeFromSTGM(DWORD stgm)
{ {
switch (STGM_SHARE_MODE(stgm)) switch (STGM_SHARE_MODE(stgm))
{ {
case 0:
assert(stgm & STGM_TRANSACTED);
/* fall-through */
case STGM_SHARE_DENY_NONE: case STGM_SHARE_DENY_NONE:
return FILE_SHARE_READ | FILE_SHARE_WRITE; return FILE_SHARE_READ | FILE_SHARE_WRITE;
case STGM_SHARE_DENY_READ: case STGM_SHARE_DENY_READ:
......
...@@ -3178,9 +3178,9 @@ static const struct lock_test lock_tests[] = { ...@@ -3178,9 +3178,9 @@ static const struct lock_test lock_tests[] = {
{ STGM_CREATE|STGM_WRITE|STGM_SHARE_DENY_WRITE|STGM_TRANSACTED, TRUE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, wodw_locked_bytes, 0, FALSE }, { STGM_CREATE|STGM_WRITE|STGM_SHARE_DENY_WRITE|STGM_TRANSACTED, TRUE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, wodw_locked_bytes, 0, FALSE },
{ STGM_SHARE_EXCLUSIVE|STGM_READWRITE, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, rwex_locked_bytes, rwex_fail_ranges, FALSE }, { STGM_SHARE_EXCLUSIVE|STGM_READWRITE, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, rwex_locked_bytes, rwex_fail_ranges, FALSE },
{ STGM_SHARE_EXCLUSIVE|STGM_READWRITE|STGM_TRANSACTED, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, rwex_locked_bytes, rwex_fail_ranges, FALSE }, { STGM_SHARE_EXCLUSIVE|STGM_READWRITE|STGM_TRANSACTED, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, rwex_locked_bytes, rwex_fail_ranges, FALSE },
{ STGM_READWRITE|STGM_TRANSACTED, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, rw_locked_bytes, rw_fail_ranges, TRUE }, { STGM_READWRITE|STGM_TRANSACTED, FALSE, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, rw_locked_bytes, rw_fail_ranges, FALSE },
{ STGM_READ|STGM_SHARE_DENY_WRITE, FALSE, GENERIC_READ, FILE_SHARE_READ, no_locked_bytes, dw_fail_ranges, TRUE }, { STGM_READ|STGM_SHARE_DENY_WRITE, FALSE, GENERIC_READ, FILE_SHARE_READ, no_locked_bytes, dw_fail_ranges, TRUE },
{ STGM_READ|STGM_TRANSACTED, FALSE, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, tr_locked_bytes, tr_fail_ranges, TRUE }, { STGM_READ|STGM_TRANSACTED, FALSE, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, tr_locked_bytes, tr_fail_ranges, FALSE },
{ STGM_READ|STGM_SHARE_EXCLUSIVE, FALSE, GENERIC_READ, FILE_SHARE_READ, roex_locked_bytes, roex_fail_ranges, TRUE }, { STGM_READ|STGM_SHARE_EXCLUSIVE, FALSE, GENERIC_READ, FILE_SHARE_READ, roex_locked_bytes, roex_fail_ranges, TRUE },
{ STGM_READ|STGM_SHARE_EXCLUSIVE|STGM_TRANSACTED, FALSE, GENERIC_READ, FILE_SHARE_READ, roex_locked_bytes, roex_fail_ranges, TRUE }, { STGM_READ|STGM_SHARE_EXCLUSIVE|STGM_TRANSACTED, FALSE, GENERIC_READ, FILE_SHARE_READ, roex_locked_bytes, roex_fail_ranges, TRUE },
}; };
...@@ -3280,10 +3280,7 @@ static void test_locking(void) ...@@ -3280,10 +3280,7 @@ static void test_locking(void)
IStorage_Release(stg); IStorage_Release(stg);
hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg); hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg);
if (current->stg_mode == (STGM_READ|STGM_TRANSACTED) || current->stg_mode == (STGM_READWRITE|STGM_TRANSACTED)) ok(SUCCEEDED(hr), "StgOpenStorage with mode %x failed with hr %x\n", current->stg_mode, hr);
todo_wine ok(SUCCEEDED(hr), "StgOpenStorage with mode %x failed with hr %x\n", current->stg_mode, hr);
else
ok(SUCCEEDED(hr), "StgOpenStorage with mode %x failed with hr %x\n", current->stg_mode, hr);
if (FAILED(hr)) if (FAILED(hr))
{ {
DeleteFileW(filename); DeleteFileW(filename);
......
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