server: Fix loading of IMAGE_OPTIONAL_HEADER.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5e7c892811
commit
84b3218ed6
|
@ -264,7 +264,11 @@ static void query_image_section( int id, const char *dll_name, const IMAGE_NT_HE
|
|||
ok( image.CommittedStackSize == nt_header->OptionalHeader.SizeOfStackCommit || broken(truncated),
|
||||
"%u: CommittedStackSize wrong %lx / %lx\n", id,
|
||||
image.CommittedStackSize, (SIZE_T)nt_header->OptionalHeader.SizeOfStackCommit );
|
||||
ok( image.SubSystemType == nt_header->OptionalHeader.Subsystem || broken(truncated),
|
||||
if (truncated)
|
||||
ok( !image.SubSystemType || broken(truncated),
|
||||
"%u: SubSystemType wrong %08x / 00000000\n", id, image.SubSystemType );
|
||||
else
|
||||
ok( image.SubSystemType == nt_header->OptionalHeader.Subsystem,
|
||||
"%u: SubSystemType wrong %08x / %08x\n", id,
|
||||
image.SubSystemType, nt_header->OptionalHeader.Subsystem );
|
||||
ok( image.SubsystemVersionLow == nt_header->OptionalHeader.MinorSubsystemVersion,
|
||||
|
|
|
@ -399,7 +399,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
|
|||
size = pread( unix_fd, &nt, sizeof(nt), pos );
|
||||
if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_FORMAT;
|
||||
/* zero out Optional header in the case it's not present or partial */
|
||||
size = min( size, nt.FileHeader.SizeOfOptionalHeader );
|
||||
size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + nt.FileHeader.SizeOfOptionalHeader );
|
||||
if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size );
|
||||
if (nt.Signature != IMAGE_NT_SIGNATURE)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue