diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index f4de3cf848b..fdb443b45cb 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -185,6 +185,8 @@ extern NTSTATUS virtual_uninterrupted_write_memory( void *addr, const void *buff extern void VIRTUAL_SetForceExec( BOOL enable ) DECLSPEC_HIDDEN; extern void virtual_release_address_space(void) DECLSPEC_HIDDEN; extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN; +extern void virtual_fill_image_information( const pe_image_info_t *pe_info, + SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN; extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN; /* completion */ diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 372e26e83ef..623bf653970 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -1314,6 +1314,7 @@ NTSTATUS WINAPI RtlCreateUserProcess( UNICODE_STRING *path, ULONG attributes, info->Thread = thread_handle; info->ClientId.UniqueProcess = ULongToHandle( process_id ); info->ClientId.UniqueThread = ULongToHandle( thread_id ); + virtual_fill_image_information( &pe_info, &info->ImageInformation ); process_handle = thread_handle = 0; status = STATUS_SUCCESS; } diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index af1509eae5d..5dfbe743f98 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -3175,6 +3175,39 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr ) } +/****************************************************************************** + * virtual_fill_image_information + * + * Helper for NtQuerySection. + */ +void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info ) +{ + info->TransferAddress = wine_server_get_ptr( pe_info->entry_point ); + info->ZeroBits = pe_info->zerobits; + info->MaximumStackSize = pe_info->stack_size; + info->CommittedStackSize = pe_info->stack_commit; + info->SubSystemType = pe_info->subsystem; + info->SubsystemVersionLow = pe_info->subsystem_low; + info->SubsystemVersionHigh = pe_info->subsystem_high; + info->GpValue = pe_info->gp; + info->ImageCharacteristics = pe_info->image_charact; + info->DllCharacteristics = pe_info->dll_charact; + info->Machine = pe_info->machine; + info->ImageContainsCode = pe_info->contains_code; + info->u.ImageFlags = pe_info->image_flags; + info->LoaderFlags = pe_info->loader_flags; + info->ImageFileSize = pe_info->file_size; + info->CheckSum = pe_info->checksum; +#ifndef _WIN64 /* don't return 64-bit values to 32-bit processes */ + if (pe_info->machine == IMAGE_FILE_MACHINE_AMD64 || pe_info->machine == IMAGE_FILE_MACHINE_ARM64) + { + info->TransferAddress = (void *)0x81231234; /* sic */ + info->MaximumStackSize = 0x100000; + info->CommittedStackSize = 0x10000; + } +#endif +} + /****************************************************************************** * NtQuerySection (NTDLL.@) * ZwQuerySection (NTDLL.@) @@ -3217,32 +3250,8 @@ NTSTATUS WINAPI NtQuerySection( HANDLE handle, SECTION_INFORMATION_CLASS class, else if (reply->flags & SEC_IMAGE) { SECTION_IMAGE_INFORMATION *info = ptr; - info->TransferAddress = wine_server_get_ptr( image_info.entry_point ); - info->ZeroBits = image_info.zerobits; - info->MaximumStackSize = image_info.stack_size; - info->CommittedStackSize = image_info.stack_commit; - info->SubSystemType = image_info.subsystem; - info->SubsystemVersionLow = image_info.subsystem_low; - info->SubsystemVersionHigh = image_info.subsystem_high; - info->GpValue = image_info.gp; - info->ImageCharacteristics = image_info.image_charact; - info->DllCharacteristics = image_info.dll_charact; - info->Machine = image_info.machine; - info->ImageContainsCode = image_info.contains_code; - info->u.ImageFlags = image_info.image_flags; - info->LoaderFlags = image_info.loader_flags; - info->ImageFileSize = image_info.file_size; - info->CheckSum = image_info.checksum; + virtual_fill_image_information( &image_info, info ); 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; }