[PATCH] ntdll: set correct protection flags on sections in builtin DLLs
Alexandre Julliard
julliard at winehq.org
Mon Aug 23 08:43:35 CDT 2010
Marcus Meissner <marcus at jet.franken.de> writes:
> @@ -1406,7 +1409,18 @@ static void load_builtin_callback( void *module, const char *filename )
> }
> virtual_create_system_view( module, nt->OptionalHeader.SizeOfImage,
> VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED |
> - VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC );
> + VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC, &view );
> +
> + sec = (IMAGE_SECTION_HEADER*)((char*)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
> + for (i=0;i<nt->FileHeader.NumberOfSections;i++) {
> + DWORD flags = VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED;
> +
> + if (sec[i].Characteristics & IMAGE_SCN_MEM_EXECUTE) flags |= VPROT_EXEC;
> + if (sec[i].Characteristics & IMAGE_SCN_MEM_READ) flags |= VPROT_READ;
> + if (sec[i].Characteristics & IMAGE_SCN_MEM_WRITE) flags |= VPROT_WRITE;
> + if (sec[i].Characteristics & IMAGE_SCN_MEM_SHARED) flags |= VPROT_WRITECOPY;
> + VIRTUAL_SetProt( view, (char*)module + sec[i].VirtualAddress, sec[i].Misc.VirtualSize, flags );
I don't think you want to actually change the permissions, our headers
don't necessarily match the real ELF sections.
(BTW, could you please convince your mailer to set a valid Message-Id?)
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list