ole32: Storage sharing should be implemented in ole32, not the lower-level file API.
This commit is contained in:
parent
0e6bfb3b43
commit
5ea0d9d807
|
@ -6362,70 +6362,69 @@ struct access_res
|
|||
{
|
||||
BOOL gothandle;
|
||||
DWORD lasterr;
|
||||
BOOL todo;
|
||||
};
|
||||
|
||||
struct access_res create[16] =
|
||||
static const struct access_res create[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
struct access_res create_commit[16] =
|
||||
static const struct access_res create_commit[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
struct access_res create_close[16] =
|
||||
static const struct access_res create_close[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
static void _test_file_access(LPCSTR file, struct access_res *ares, DWORD line)
|
||||
static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
|
||||
{
|
||||
DWORD access = 0, share = 0;
|
||||
DWORD lasterr;
|
||||
|
@ -6450,37 +6449,15 @@ static void _test_file_access(LPCSTR file, struct access_res *ares, DWORD line)
|
|||
hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, 0);
|
||||
lasterr = GetLastError();
|
||||
if (ares[idx].todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
|
||||
"(%d, handle, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].gothandle,
|
||||
(hfile != INVALID_HANDLE_VALUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
|
||||
"(%d, handle, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].gothandle,
|
||||
(hfile != INVALID_HANDLE_VALUE));
|
||||
|
||||
if (ares[idx].todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
ok(lasterr == ares[idx].lasterr,
|
||||
"(%d, lasterr, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].lasterr, lasterr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(lasterr == ares[idx].lasterr,
|
||||
"(%d, lasterr, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].lasterr, lasterr);
|
||||
}
|
||||
|
||||
CloseHandle(hfile);
|
||||
idx++;
|
||||
|
|
|
@ -5727,7 +5727,7 @@ HRESULT WINAPI StgCreateDocfile(
|
|||
/*
|
||||
* Interpret the STGM value grfMode
|
||||
*/
|
||||
shareMode = GetShareModeFromSTGM(grfMode);
|
||||
shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
accessMode = GetAccessModeFromSTGM(grfMode);
|
||||
|
||||
if (grfMode & STGM_DELETEONRELEASE)
|
||||
|
@ -5735,6 +5735,9 @@ HRESULT WINAPI StgCreateDocfile(
|
|||
else
|
||||
fileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS;
|
||||
|
||||
if (STGM_SHARE_MODE(grfMode) && !(grfMode & STGM_SHARE_DENY_NONE))
|
||||
FIXME("Storage share mode not implemented.\n");
|
||||
|
||||
if (grfMode & STGM_TRANSACTED)
|
||||
FIXME("Transacted mode not implemented.\n");
|
||||
|
||||
|
|
|
@ -1003,70 +1003,69 @@ struct access_res
|
|||
{
|
||||
BOOL gothandle;
|
||||
DWORD lasterr;
|
||||
BOOL todo;
|
||||
};
|
||||
|
||||
struct access_res create[16] =
|
||||
static const struct access_res create[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
struct access_res create_commit[16] =
|
||||
static const struct access_res create_commit[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, TRUE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ FALSE, ERROR_SHARING_VIOLATION },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
struct access_res create_close[16] =
|
||||
static const struct access_res create_close[16] =
|
||||
{
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE },
|
||||
{ TRUE, ERROR_SUCCESS, FALSE }
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS },
|
||||
{ TRUE, ERROR_SUCCESS }
|
||||
};
|
||||
|
||||
static void _test_file_access(LPCSTR file, struct access_res *ares, DWORD line)
|
||||
static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
|
||||
{
|
||||
DWORD access = 0, share = 0;
|
||||
DWORD lasterr;
|
||||
|
@ -1091,37 +1090,15 @@ static void _test_file_access(LPCSTR file, struct access_res *ares, DWORD line)
|
|||
hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, 0);
|
||||
lasterr = GetLastError();
|
||||
if (ares[idx].todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
|
||||
"(%d, handle, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].gothandle,
|
||||
(hfile != INVALID_HANDLE_VALUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
|
||||
"(%d, handle, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].gothandle,
|
||||
(hfile != INVALID_HANDLE_VALUE));
|
||||
|
||||
if (ares[idx].todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
ok(lasterr == ares[idx].lasterr,
|
||||
"(%d, lasterr, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].lasterr, lasterr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(lasterr == ares[idx].lasterr,
|
||||
"(%d, lasterr, %d): Expected %d, got %d\n",
|
||||
line, idx, ares[idx].lasterr, lasterr);
|
||||
}
|
||||
|
||||
CloseHandle(hfile);
|
||||
idx++;
|
||||
|
@ -1176,6 +1153,62 @@ static void test_access(void)
|
|||
|
||||
DeleteFileA("winetest");
|
||||
|
||||
/* STGM_SHARE_DENY_NONE */
|
||||
|
||||
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
|
||||
STGM_SHARE_DENY_NONE | STGM_TRANSACTED, 0, &stg);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create);
|
||||
|
||||
hr = IStorage_Commit(stg, STGC_DEFAULT);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create_commit);
|
||||
|
||||
IStorage_Release(stg);
|
||||
|
||||
test_file_access("winetest", create_close);
|
||||
|
||||
DeleteFileA("winetest");
|
||||
|
||||
/* STGM_SHARE_DENY_READ */
|
||||
|
||||
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
|
||||
STGM_SHARE_DENY_READ | STGM_TRANSACTED, 0, &stg);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create);
|
||||
|
||||
hr = IStorage_Commit(stg, STGC_DEFAULT);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create_commit);
|
||||
|
||||
IStorage_Release(stg);
|
||||
|
||||
test_file_access("winetest", create_close);
|
||||
|
||||
DeleteFileA("winetest");
|
||||
|
||||
/* STGM_SHARE_DENY_WRITE */
|
||||
|
||||
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
|
||||
STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create);
|
||||
|
||||
hr = IStorage_Commit(stg, STGC_DEFAULT);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
test_file_access("winetest", create_commit);
|
||||
|
||||
IStorage_Release(stg);
|
||||
|
||||
test_file_access("winetest", create_close);
|
||||
|
||||
DeleteFileA("winetest");
|
||||
}
|
||||
|
||||
START_TEST(storage32)
|
||||
|
|
Loading…
Reference in New Issue