Hi Jacek,
Jacek Caban jacek@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?
On 03/11/16 13:38, Dmitry Timoshkov wrote:
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?
My reasoning was that I intended to test OpenFileMapping implementation detail (although I added a few more generic tests while I was at this), so kernel32 tests felt like the right place. We obviously could do that in advapi32 as well, but I as far as I'm concerned, I don't care where it is. I will send another version and leave it to your and Alexandre's taste ;)
Thanks for review, Jacek