kernel32: Don't set unconditionally SECTION_QUERY flag in OpenFileMapping.
Dmitry Timoshkov
dmitry at baikal.ru
Fri Mar 11 06:38:41 CST 2016
Hi Jacek,
Jacek Caban <jacek at codeweavers.com> wrote:
> +static void test_OpenFileMapping(void)
> +{
> + HANDLE created_handle, handle;
> + DWORD access;
> + int i;
> +
> + static const struct {
> + DWORD open_access;
> + DWORD handle_access;
> + } access_tests[] = {
> + { FILE_MAP_ALL_ACCESS, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_EXTEND_SIZE | SECTION_MAP_EXECUTE | SECTION_MAP_READ | SECTION_MAP_WRITE },
> + { SECTION_MAP_READ | SECTION_MAP_WRITE, SECTION_MAP_READ | SECTION_MAP_WRITE},
> + { SECTION_MAP_WRITE, SECTION_MAP_WRITE},
> + { SECTION_MAP_READ | SECTION_QUERY, SECTION_MAP_READ | SECTION_QUERY},
> + { SECTION_QUERY, SECTION_MAP_READ },
> + { SECTION_QUERY | SECTION_MAP_READ, SECTION_QUERY | SECTION_MAP_READ },
> + { GENERIC_READ, READ_CONTROL | SECTION_MAP_READ | SECTION_QUERY }
> + };
> +
> + created_handle = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 0x1000,
> + "Wine Test Open Mapping");
> + ok( created_handle != NULL, "CreateFileMapping failed with error %u\n", GetLastError());
> +
> + for(i=0; i < sizeof(access_tests)/sizeof(*access_tests); i++)
> + {
> + handle = OpenFileMappingA( access_tests[i].open_access, FALSE, "Wine Test Open Mapping");
> + ok( handle != NULL, "OpenFileMapping failed with error %d\n", GetLastError());
> + access = get_obj_access( handle );
> + ok( access == access_tests[i].handle_access, "[%d] unexpected access flags %x, expected %x\n",
> + i, access, access_tests[i].handle_access );
> + CloseHandle( handle );
> + }
> +
> + CloseHandle( created_handle );
> + }
Please correct me if I'm mistaken but this test is basically a modified copy
of test_filemap_security() from dlls/advapi32/tests/security.c, why not add
it there and extend the test if needed so that all related tests are collected
in one place?
--
Dmitry.
More information about the wine-devel
mailing list