From 546fa12755dd0d1d9618214fb02ef9fa5fa6c943 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 22 Apr 2019 11:34:25 +0200 Subject: [PATCH] server: Add flag for builtin dlls in the image information. Signed-off-by: Alexandre Julliard --- dlls/ntdll/virtual.c | 2 +- include/wine/server_protocol.h | 1 + server/mapping.c | 7 +++++-- server/protocol.def | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index fb6ede656ee..78973a8cda4 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -3203,7 +3203,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 & ~IMAGE_FLAGS_WineFakeDll; + info->u.ImageFlags = pe_info->image_flags & ~(IMAGE_FLAGS_WineBuiltin|IMAGE_FLAGS_WineFakeDll); info->LoaderFlags = pe_info->loader_flags; info->ImageFileSize = pe_info->file_size; info->CheckSum = pe_info->checksum; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index c3d1bb6a593..9e26aa4fb76 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -720,6 +720,7 @@ typedef struct #define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04 #define IMAGE_FLAGS_ImageMappedFlat 0x08 #define IMAGE_FLAGS_BaseBelow4gb 0x10 +#define IMAGE_FLAGS_WineBuiltin 0x40 #define IMAGE_FLAGS_WineFakeDll 0x80 struct rawinput_device diff --git a/server/mapping.c b/server/mapping.c index ddc8be890f3..348072456ab 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -558,6 +558,7 @@ 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 ) { + static const char builtin_signature[] = "Wine builtin DLL"; static const char fakedll_signature[] = "Wine placeholder DLL"; IMAGE_COR20_HEADER clr; @@ -565,7 +566,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s struct { IMAGE_DOS_HEADER dos; - char buffer[sizeof(fakedll_signature)]; + char buffer[32]; } mz; struct { @@ -702,7 +703,9 @@ 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) )) + if (mz_size == sizeof(mz) && !memcmp( mz.buffer, builtin_signature, sizeof(builtin_signature) )) + mapping->image.image_flags |= IMAGE_FLAGS_WineBuiltin; + else if (mz_size == sizeof(mz) && !memcmp( mz.buffer, fakedll_signature, sizeof(fakedll_signature) )) mapping->image.image_flags |= IMAGE_FLAGS_WineFakeDll; /* load the section headers */ diff --git a/server/protocol.def b/server/protocol.def index 888e22faf7e..79e9802aa6b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -736,6 +736,7 @@ typedef struct #define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04 #define IMAGE_FLAGS_ImageMappedFlat 0x08 #define IMAGE_FLAGS_BaseBelow4gb 0x10 +#define IMAGE_FLAGS_WineBuiltin 0x40 #define IMAGE_FLAGS_WineFakeDll 0x80 struct rawinput_device