mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ntdll: Fix access rights checks for mapping objects.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fcd7d4404a
commit
94872cc84f
3 changed files with 13 additions and 16 deletions
|
@ -3710,16 +3710,16 @@ static DWORD map_prot_to_access(DWORD prot)
|
|||
switch (prot)
|
||||
{
|
||||
case PAGE_READWRITE:
|
||||
return SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE | SECTION_QUERY;
|
||||
return SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_QUERY;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
return SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT | SECTION_QUERY;
|
||||
return SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE | SECTION_QUERY;
|
||||
case PAGE_READONLY:
|
||||
case PAGE_WRITECOPY:
|
||||
return SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_QUERY;
|
||||
return SECTION_MAP_READ | SECTION_QUERY;
|
||||
case PAGE_EXECUTE:
|
||||
case PAGE_EXECUTE_READ:
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
return SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT | SECTION_QUERY;
|
||||
return SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_QUERY;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -3909,17 +3909,11 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags )
|
|||
/* FILE_MAP_EXECUTE | FILE_MAP_COPY broken on XP */
|
||||
if (base != NULL && view[j].access == (FILE_MAP_EXECUTE | FILE_MAP_COPY))
|
||||
{
|
||||
todo_wine
|
||||
ok( broken(base != NULL), "%d: MapViewOfFile(%04x/%04x) should fail\n",
|
||||
j, page_prot[i], view[j].access);
|
||||
UnmapViewOfFile( base );
|
||||
}
|
||||
else todo_wine_if ((page_prot[i] == PAGE_READONLY &&
|
||||
is_compatible_access( PAGE_EXECUTE_READ, view[j].access )) ||
|
||||
(page_prot[i] == PAGE_READWRITE &&
|
||||
is_compatible_access( PAGE_EXECUTE_READWRITE, view[j].access )) ||
|
||||
(page_prot[i] == PAGE_WRITECOPY &&
|
||||
is_compatible_access( PAGE_EXECUTE_WRITECOPY, view[j].access )))
|
||||
else
|
||||
{
|
||||
ok(!base, "%d: MapViewOfFile(%04x/%04x) should fail\n",
|
||||
j, page_prot[i], view[j].access);
|
||||
|
|
|
@ -1842,7 +1842,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
|||
TRACE("Trying native dll %s\n", debugstr_w(name));
|
||||
|
||||
size.QuadPart = 0;
|
||||
status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ,
|
||||
status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY |
|
||||
SECTION_MAP_READ | SECTION_MAP_EXECUTE,
|
||||
NULL, &size, PAGE_EXECUTE_READ, SEC_IMAGE, file );
|
||||
if (status != STATUS_SUCCESS) return status;
|
||||
|
||||
|
|
|
@ -2750,18 +2750,20 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
|
|||
switch(protect)
|
||||
{
|
||||
case PAGE_NOACCESS:
|
||||
case PAGE_READONLY:
|
||||
case PAGE_WRITECOPY:
|
||||
access = SECTION_MAP_READ;
|
||||
break;
|
||||
case PAGE_READWRITE:
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
access = SECTION_MAP_WRITE;
|
||||
break;
|
||||
case PAGE_READONLY:
|
||||
case PAGE_WRITECOPY:
|
||||
case PAGE_EXECUTE:
|
||||
case PAGE_EXECUTE_READ:
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
access = SECTION_MAP_READ;
|
||||
access = SECTION_MAP_READ | SECTION_MAP_EXECUTE;
|
||||
break;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
access = SECTION_MAP_WRITE | SECTION_MAP_EXECUTE;
|
||||
break;
|
||||
default:
|
||||
return STATUS_INVALID_PAGE_PROTECTION;
|
||||
|
|
Loading…
Reference in a new issue