ole32: Test the entire range lock block for synchronization.
This commit is contained in:
parent
6dfcb29664
commit
06b735ae76
|
@ -505,7 +505,10 @@ StgStreamImpl* StgStreamImpl_Construct(
|
||||||
/* Range lock constants.
|
/* Range lock constants.
|
||||||
*
|
*
|
||||||
* The storage format reserves the region from 0x7fffff00-0x7fffffff for
|
* The storage format reserves the region from 0x7fffff00-0x7fffffff for
|
||||||
* locking and synchronization. Unfortunately, the spec doesn't say which bytes
|
* locking and synchronization. Because it reserves the entire block containing
|
||||||
|
* that range, and the minimum block size is 512 bytes, 0x7ffffe00-0x7ffffeff
|
||||||
|
* also cannot be used for any other purpose.
|
||||||
|
* Unfortunately, the spec doesn't say which bytes
|
||||||
* within that range are used, and for what. These are guesses based on testing.
|
* within that range are used, and for what. These are guesses based on testing.
|
||||||
* In particular, ends of ranges may be wrong.
|
* In particular, ends of ranges may be wrong.
|
||||||
|
|
||||||
|
@ -524,7 +527,7 @@ StgStreamImpl* StgStreamImpl_Construct(
|
||||||
0xe2 through 0xff: Unknown. Causes read-only exclusive opens to fail.
|
0xe2 through 0xff: Unknown. Causes read-only exclusive opens to fail.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RANGELOCK_UNK1_FIRST 0x7fffff00
|
#define RANGELOCK_UNK1_FIRST 0x7ffffe00
|
||||||
#define RANGELOCK_UNK1_LAST 0x7fffff57
|
#define RANGELOCK_UNK1_LAST 0x7fffff57
|
||||||
#define RANGELOCK_PRIORITY1_FIRST 0x7fffff58
|
#define RANGELOCK_PRIORITY1_FIRST 0x7fffff58
|
||||||
#define RANGELOCK_PRIORITY1_LAST 0x7fffff6b
|
#define RANGELOCK_PRIORITY1_LAST 0x7fffff6b
|
||||||
|
|
|
@ -3153,22 +3153,22 @@ struct lock_test
|
||||||
BOOL todo;
|
BOOL todo;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int priority_locked_bytes[] = { 0x58, 0x81, 0x93, -1 };
|
static const int priority_locked_bytes[] = { 0x158, 0x181, 0x193, -1 };
|
||||||
static const int rwex_locked_bytes[] = { 0x93, 0xa7, 0xbb, 0xcf, -1 };
|
static const int rwex_locked_bytes[] = { 0x193, 0x1a7, 0x1bb, 0x1cf, -1 };
|
||||||
static const int rw_locked_bytes[] = { 0x93, 0xa7, -1 };
|
static const int rw_locked_bytes[] = { 0x193, 0x1a7, -1 };
|
||||||
static const int nosn_locked_bytes[] = { 0x6c, 0x93, 0xa7, 0xcf, -1 };
|
static const int nosn_locked_bytes[] = { 0x16c, 0x193, 0x1a7, 0x1cf, -1 };
|
||||||
static const int rwdw_locked_bytes[] = { 0x93, 0xa7, 0xcf, -1 };
|
static const int rwdw_locked_bytes[] = { 0x193, 0x1a7, 0x1cf, -1 };
|
||||||
static const int wodw_locked_bytes[] = { 0xa7, 0xcf, -1 };
|
static const int wodw_locked_bytes[] = { 0x1a7, 0x1cf, -1 };
|
||||||
static const int tr_locked_bytes[] = { 0x93, -1 };
|
static const int tr_locked_bytes[] = { 0x193, -1 };
|
||||||
static const int no_locked_bytes[] = { -1 };
|
static const int no_locked_bytes[] = { -1 };
|
||||||
static const int roex_locked_bytes[] = { 0x93, 0xbb, 0xcf, -1 };
|
static const int roex_locked_bytes[] = { 0x193, 0x1bb, 0x1cf, -1 };
|
||||||
|
|
||||||
static const int rwex_fail_ranges[] = { 0x93,0xe3, -1 };
|
static const int rwex_fail_ranges[] = { 0x193,0x1e3, -1 };
|
||||||
static const int rw_fail_ranges[] = { 0xbb,0xe3, -1 };
|
static const int rw_fail_ranges[] = { 0x1bb,0x1e3, -1 };
|
||||||
static const int rwdw_fail_ranges[] = { 0xa7,0xe3, -1 };
|
static const int rwdw_fail_ranges[] = { 0x1a7,0x1e3, -1 };
|
||||||
static const int dw_fail_ranges[] = { 0xa7,0xcf, -1 };
|
static const int dw_fail_ranges[] = { 0x1a7,0x1cf, -1 };
|
||||||
static const int tr_fail_ranges[] = { 0xbb,0xcf, -1 };
|
static const int tr_fail_ranges[] = { 0x1bb,0x1cf, -1 };
|
||||||
static const int pr_fail_ranges[] = { 0x80,0x81, 0xbb,0xcf, -1 };
|
static const int pr_fail_ranges[] = { 0x180,0x181, 0x1bb,0x1cf, -1 };
|
||||||
static const int roex_fail_ranges[] = { 0x0,-1 };
|
static const int roex_fail_ranges[] = { 0x0,-1 };
|
||||||
|
|
||||||
static const struct lock_test lock_tests[] = {
|
static const struct lock_test lock_tests[] = {
|
||||||
|
@ -3313,7 +3313,7 @@ static void test_locking(void)
|
||||||
ol.u.s.OffsetHigh = 0;
|
ol.u.s.OffsetHigh = 0;
|
||||||
ol.hEvent = NULL;
|
ol.hEvent = NULL;
|
||||||
|
|
||||||
for (ol.u.s.Offset = 0x7fffff00; ol.u.s.Offset != 0x80000000; ol.u.s.Offset++)
|
for (ol.u.s.Offset = 0x7ffffe00; ol.u.s.Offset != 0x80000000; ol.u.s.Offset++)
|
||||||
{
|
{
|
||||||
if (LockFileEx(hfile, LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY, 0, 1, 0, &ol))
|
if (LockFileEx(hfile, LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY, 0, 1, 0, &ol))
|
||||||
locked = FALSE;
|
locked = FALSE;
|
||||||
|
@ -3325,7 +3325,7 @@ static void test_locking(void)
|
||||||
|
|
||||||
UnlockFileEx(hfile, 0, 1, 0, &ol);
|
UnlockFileEx(hfile, 0, 1, 0, &ol);
|
||||||
|
|
||||||
if ((ol.u.s.Offset&0xff) == *next_lock)
|
if ((ol.u.s.Offset&0x1ff) == *next_lock)
|
||||||
{
|
{
|
||||||
expect_locked = TRUE;
|
expect_locked = TRUE;
|
||||||
next_lock++;
|
next_lock++;
|
||||||
|
@ -3362,14 +3362,17 @@ static void test_locking(void)
|
||||||
ol.u.s.OffsetHigh = 0;
|
ol.u.s.OffsetHigh = 0;
|
||||||
ol.hEvent = NULL;
|
ol.hEvent = NULL;
|
||||||
|
|
||||||
for (ol.u.s.Offset = 0x7fffff00; ol.u.s.Offset != 0x80000000; ol.u.s.Offset++)
|
for (ol.u.s.Offset = 0x7ffffe00; ol.u.s.Offset != 0x80000000; ol.u.s.Offset++)
|
||||||
{
|
{
|
||||||
if (ol.u.s.Offset == 0x7fffff92 ||
|
if (ol.u.s.Offset == 0x7fffff92 ||
|
||||||
(ol.u.s.Offset == 0x7fffff80 && current->stg_mode == (STGM_TRANSACTED|STGM_READWRITE)) ||
|
(ol.u.s.Offset == 0x7fffff80 && current->stg_mode == (STGM_TRANSACTED|STGM_READWRITE)) ||
|
||||||
(ol.u.s.Offset == 0x7fffff80 && current->stg_mode == (STGM_TRANSACTED|STGM_READ)))
|
(ol.u.s.Offset == 0x7fffff80 && current->stg_mode == (STGM_TRANSACTED|STGM_READ)))
|
||||||
continue; /* This makes opens hang */
|
continue; /* This makes opens hang */
|
||||||
|
|
||||||
LockFileEx(hfile, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &ol);
|
if (ol.u.s.Offset < 0x7fffff00)
|
||||||
|
LockFileEx(hfile, 0, 0, 1, 0, &ol);
|
||||||
|
else
|
||||||
|
LockFileEx(hfile, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &ol);
|
||||||
|
|
||||||
hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg);
|
hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg);
|
||||||
ok(hr == S_OK || hr == STG_E_LOCKVIOLATION || hr == STG_E_SHAREVIOLATION, "failed with unexpected hr %x\n", hr);
|
ok(hr == S_OK || hr == STG_E_LOCKVIOLATION || hr == STG_E_SHAREVIOLATION, "failed with unexpected hr %x\n", hr);
|
||||||
|
@ -3379,11 +3382,11 @@ static void test_locking(void)
|
||||||
|
|
||||||
failed = FAILED(hr);
|
failed = FAILED(hr);
|
||||||
|
|
||||||
if (!expect_failed && (ol.u.s.Offset&0xff) == next_range[0])
|
if (!expect_failed && (ol.u.s.Offset&0x1ff) == next_range[0])
|
||||||
{
|
{
|
||||||
expect_failed = TRUE;
|
expect_failed = TRUE;
|
||||||
}
|
}
|
||||||
else if (expect_failed && (ol.u.s.Offset&0xff) == next_range[1])
|
else if (expect_failed && (ol.u.s.Offset&0x1ff) == next_range[1])
|
||||||
{
|
{
|
||||||
expect_failed = FALSE;
|
expect_failed = FALSE;
|
||||||
next_range += 2;
|
next_range += 2;
|
||||||
|
|
Loading…
Reference in New Issue