Builtin modules must be aligned on 64K boundary.

This commit is contained in:
Alexandre Julliard 2002-08-14 21:09:55 +00:00
parent 94fa372b8f
commit 124eaf809c
2 changed files with 4 additions and 13 deletions

View File

@ -220,18 +220,9 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
assert( size <= page_size );
if (nt_descr->OptionalHeader.ImageBase)
{
addr = wine_anon_mmap( (void *)nt_descr->OptionalHeader.ImageBase,
page_size, PROT_READ|PROT_WRITE, MAP_FIXED );
if (addr != (BYTE *)nt_descr->OptionalHeader.ImageBase) return NULL;
}
else
{
/* this will leak memory; but it should never happen */
addr = wine_anon_mmap( NULL, page_size, PROT_READ|PROT_WRITE, 0 );
if (addr == (BYTE *)-1) return NULL;
}
/* module address must be aligned on 64K boundary */
addr = (BYTE *)((nt_descr->OptionalHeader.ImageBase + 0xffff) & ~0xffff);
if (wine_anon_mmap( addr, page_size, PROT_READ|PROT_WRITE, MAP_FIXED ) != addr) return NULL;
dos = (IMAGE_DOS_HEADER *)addr;
nt = (IMAGE_NT_HEADERS *)(dos + 1);

View File

@ -550,7 +550,7 @@ void BuildSpec32File( FILE *outfile )
fprintf( outfile, "#endif\n" );
fprintf( outfile, "asm(\".section \\\".text\\\"\\n\\t\"\n" );
fprintf( outfile, " \".align %d\\n\"\n", get_alignment(page_size) );
fprintf( outfile, " \"" __ASM_NAME("pe_header") ":\\t.skip %ld\\n\\t\");\n", page_size );
fprintf( outfile, " \"" __ASM_NAME("pe_header") ":\\t.skip 65536\\n\\t\");\n" );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif\n" );