server: Add custom flag for fake dlls in PE image information.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-02-09 15:23:47 +01:00
parent f1bb3580e3
commit f244c3b5eb
4 changed files with 19 additions and 7 deletions

View File

@ -3200,7 +3200,7 @@ void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMA
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->u.ImageFlags = pe_info->image_flags & ~IMAGE_FLAGS_WineFakeDll;
info->LoaderFlags = pe_info->loader_flags;
info->ImageFileSize = pe_info->file_size;
info->CheckSum = pe_info->checksum;

View File

@ -714,6 +714,7 @@ typedef struct
#define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04
#define IMAGE_FLAGS_ImageMappedFlat 0x08
#define IMAGE_FLAGS_BaseBelow4gb 0x10
#define IMAGE_FLAGS_WineFakeDll 0x80
struct rawinput_device
{
@ -6553,6 +6554,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 571
#define SERVER_PROTOCOL_VERSION 572
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -555,10 +555,16 @@ static int load_clr_header( IMAGE_COR20_HEADER *hdr, size_t va, size_t size, int
/* retrieve the mapping parameters for an executable (PE) image */
static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_size, int unix_fd )
{
IMAGE_DOS_HEADER dos;
static const char fakedll_signature[] = "Wine placeholder DLL";
IMAGE_COR20_HEADER clr;
IMAGE_SECTION_HEADER sec[96];
struct
{
IMAGE_DOS_HEADER dos;
char buffer[sizeof(fakedll_signature)];
} mz;
struct
{
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
@ -570,15 +576,17 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
} nt;
off_t pos;
int size;
size_t clr_va, clr_size;
size_t mz_size, clr_va, clr_size;
unsigned int i, cpu_mask = get_supported_cpu_mask();
/* load the headers */
if (!file_size) return STATUS_INVALID_FILE_FOR_SECTION;
if (pread( unix_fd, &dos, sizeof(dos), 0 ) != sizeof(dos)) return STATUS_INVALID_IMAGE_NOT_MZ;
if (dos.e_magic != IMAGE_DOS_SIGNATURE) return STATUS_INVALID_IMAGE_NOT_MZ;
pos = dos.e_lfanew;
size = pread( unix_fd, &mz, sizeof(mz), 0 );
if (size < sizeof(mz.dos)) return STATUS_INVALID_IMAGE_NOT_MZ;
if (mz.dos.e_magic != IMAGE_DOS_SIGNATURE) return STATUS_INVALID_IMAGE_NOT_MZ;
mz_size = size;
pos = mz.dos.e_lfanew;
size = pread( unix_fd, &nt, sizeof(nt), pos );
if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_FORMAT;
@ -691,6 +699,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
mapping->image.gp = 0; /* FIXME */
mapping->image.file_size = file_size;
mapping->image.loader_flags = clr_va && clr_size;
if (mz_size == sizeof(mz) && !memcmp( mz.buffer, fakedll_signature, sizeof(fakedll_signature) ))
mapping->image.image_flags |= IMAGE_FLAGS_WineFakeDll;
/* load the section headers */

View File

@ -730,6 +730,7 @@ typedef struct
#define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04
#define IMAGE_FLAGS_ImageMappedFlat 0x08
#define IMAGE_FLAGS_BaseBelow4gb 0x10
#define IMAGE_FLAGS_WineFakeDll 0x80
struct rawinput_device
{