From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/kernel32/tests/loader.c | 12 ++++++------ dlls/kernel32/tests/virtual.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index cd621a04ff4..d0fed82c54e 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1632,7 +1632,7 @@ static void test_image_mapping(const char *dll_name, DWORD scn_page_access, BOOL addr1 = NULL; size = 0; status = pNtMapViewOfSection(hmap, GetCurrentProcess(), &addr1, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY); + &size, ViewShare, 0, PAGE_READONLY); ok(NT_SUCCESS(status), "NtMapViewOfSection error %lx\n", status); ok(addr1 != 0, "mapped address should be valid\n");
@@ -1650,7 +1650,7 @@ static void test_image_mapping(const char *dll_name, DWORD scn_page_access, BOOL addr2 = NULL; size = 0; status = pNtMapViewOfSection(hmap, GetCurrentProcess(), &addr2, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY); + &size, ViewShare, 0, PAGE_READONLY); ok(status == STATUS_IMAGE_NOT_AT_BASE, "expected STATUS_IMAGE_NOT_AT_BASE, got %lx\n", status); ok(addr2 != 0, "mapped address should be valid\n"); ok(addr2 != addr1, "mapped addresses should be different\n"); @@ -2370,7 +2370,7 @@ static void test_import_resolution(void) size = 0; offset.QuadPart = 0; status = pNtMapViewOfSection( mapping, GetCurrentProcess(), (void **)&mod, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY ); + &size, ViewShare, 0, PAGE_READONLY ); todo_wine_if (test == 5) ok( status == (test == 6 ? STATUS_IMAGE_NOT_AT_BASE : STATUS_SUCCESS), "NtMapViewOfSection failed %lx\n", status ); @@ -3259,7 +3259,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) addr = NULL; size = 0; ret = pNtMapViewOfSection(handle, process, &addr, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY); + &size, ViewShare, 0, PAGE_READONLY); ok(ret == STATUS_SUCCESS, "NtMapViewOfSection error %#lx\n", ret); ret = pNtUnmapViewOfSection(process, addr); ok(ret == STATUS_SUCCESS, "NtUnmapViewOfSection error %#lx\n", ret); @@ -4029,7 +4029,7 @@ static void test_ExitProcess(void) addr = NULL; size = 0; ret = pNtMapViewOfSection(hmap, pi.hProcess, &addr, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY); + &size, ViewShare, 0, PAGE_READONLY); ok(!ret, "NtMapViewOfSection error %#lx\n", ret); ret = pNtUnmapViewOfSection(pi.hProcess, addr); ok(!ret, "NtUnmapViewOfSection error %#lx\n", ret); @@ -4172,7 +4172,7 @@ if (0) addr = NULL; size = 0; ret = pNtMapViewOfSection(hmap, pi.hProcess, &addr, 0, 0, &offset, - &size, 1 /* ViewShare */, 0, PAGE_READONLY); + &size, ViewShare, 0, PAGE_READONLY); ok(ret == STATUS_PROCESS_IS_TERMINATING, "expected STATUS_PROCESS_IS_TERMINATING, got %#lx\n", ret);
SetLastError(0xdeadbeef); diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index fed33701a02..c9dce00c00b 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -3983,7 +3983,7 @@ static void *map_view_of_file(HANDLE handle, DWORD access) protect = file_access_to_prot( access ); addr = NULL; status = pNtMapViewOfSection(handle, GetCurrentProcess(), &addr, 0, 0, &offset, - &count, 1 /* ViewShare */, 0, protect); + &count, ViewShare, 0, protect); if ((int)status < 0) addr = NULL; return addr; }
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/ntdll/tests/file.c | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index dee5b04d77e..a2ccf3f5332 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -6054,6 +6054,52 @@ static void test_set_io_completion_ex(void) CloseHandle(completion); }
+static void test_file_map_large_size(void) +{ + char temp_path[MAX_PATH], source[MAX_PATH]; + HANDLE hfile, hmapfile; + NTSTATUS status; + SIZE_T size; + void *addr; + DWORD ret; + + ret = GetTempPathA(MAX_PATH, temp_path); + ok(!!ret, "GetTempPath() failed error %ld\n", GetLastError()); + + ret = GetTempFileNameA(temp_path, "pfx", 0, source); + ok(!!ret, "GetTempFileName() failed %ld\n", GetLastError()); + + hfile = CreateFileA(source, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); + ok(hfile != INVALID_HANDLE_VALUE, "Failed to create a test file.\n"); + + SetFilePointer(hfile, 0x400, NULL, FILE_BEGIN); + SetEndOfFile(hfile); + + status = NtCreateSection(&hmapfile, SECTION_MAP_READ, NULL, NULL, PAGE_READWRITE, SEC_RESERVE, hfile); + ok(!status, "Failed to create a section %#lx.\n", status); + + size = 0x400 * 4; + addr = 0; + status = NtMapViewOfSection(hmapfile, GetCurrentProcess(), &addr, 0, 0, NULL, &size, + ViewUnmap, MEM_RESERVE, PAGE_READONLY); + todo_wine + ok(!status, "Failed to map the section %#lx.\n", status); + + ret = GetFileSize(hfile, NULL); + ok(ret == 0x400, "Unexpected size %lu.\n", ret); + + addr = VirtualAlloc(addr, 0x400 * 2, MEM_COMMIT, PAGE_READWRITE); + ok(!!addr, "Failed to resize.\n"); + + ret = GetFileSize(hfile, NULL); + todo_wine + ok(ret == 4 * 0x400, "Unexpected size %lu.\n", ret); + + CloseHandle(hmapfile); + CloseHandle(hfile); + DeleteFileA(source); +} + START_TEST(file) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); @@ -6137,4 +6183,5 @@ START_TEST(file) test_flush_buffers_file(); test_mailslot_name(); test_reparse_points(); + test_file_map_large_size(); }