ntdll: Don't return 64-bit image info to 32-bit processes.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-01-30 10:58:31 +01:00
parent f9bd73c4d6
commit 41275cbabf
2 changed files with 9 additions and 3 deletions

View File

@ -290,15 +290,12 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE
entry_point = (char *)(ULONG_PTR)nt32->OptionalHeader.ImageBase + nt32->OptionalHeader.AddressOfEntryPoint;
truncated = nt_header->FileHeader.SizeOfOptionalHeader < sizeof(IMAGE_OPTIONAL_HEADER32);
}
todo_wine_if (entry_point == (void *)0x81231234 )
ok( (char *)image.TransferAddress == (char *)entry_point,
"%u: TransferAddress wrong %p / %p (%08x)\n", id,
image.TransferAddress, entry_point, nt_header->OptionalHeader.AddressOfEntryPoint );
ok( image.ZeroBits == 0, "%u: ZeroBits wrong %08x\n", id, image.ZeroBits );
todo_wine_if (entry_point == (void *)0x81231234 )
ok( image.MaximumStackSize == max_stack || broken(truncated),
"%u: MaximumStackSize wrong %lx / %lx\n", id, image.MaximumStackSize, max_stack );
todo_wine_if (entry_point == (void *)0x81231234 )
ok( image.CommittedStackSize == commit_stack || broken(truncated),
"%u: CommittedStackSize wrong %lx / %lx\n", id, image.CommittedStackSize, commit_stack );
if (truncated)

View File

@ -3215,6 +3215,15 @@ NTSTATUS WINAPI NtQuerySection( HANDLE handle, SECTION_INFORMATION_CLASS class,
info->ImageFileSize = image_info.file_size;
info->CheckSum = image_info.checksum;
if (ret_size) *ret_size = sizeof(*info);
#ifndef _WIN64 /* don't return 64-bit values to 32-bit processes */
if (image_info.machine == IMAGE_FILE_MACHINE_AMD64 ||
image_info.machine == IMAGE_FILE_MACHINE_ARM64)
{
info->TransferAddress = (void *)0x81231234; /* sic */
info->MaximumStackSize = 0x100000;
info->CommittedStackSize = 0x10000;
}
#endif
}
else status = STATUS_SECTION_NOT_IMAGE;
}