Alexandre Julliard : ntdll: Use the SECTION_IMAGE_INFORMATION bitfields where possible.
Alexandre Julliard
julliard at winehq.org
Tue Feb 16 16:03:18 CST 2021
Module: wine
Branch: master
Commit: c2c57e8dba92f54aba4e1e52d2f0a5ea4831dff4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c2c57e8dba92f54aba4e1e52d2f0a5ea4831dff4
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Feb 16 11:37:08 2021 +0100
ntdll: Use the SECTION_IMAGE_INFORMATION bitfields where possible.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 16 ++++++++--------
dlls/ntdll/unix/loader.c | 2 +-
include/winternl.h | 5 +++++
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 4eb6bb1144f..9403cdb89fd 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1877,12 +1877,12 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
/* create the MODREF */
- if (!(wm = alloc_module( *module, nt_name, (image_info->u.ImageFlags & IMAGE_FLAGS_WineBuiltin) )))
+ if (!(wm = alloc_module( *module, nt_name, (image_info->u.s.WineBuiltin) )))
return STATUS_NO_MEMORY;
if (id) wm->id = *id;
if (image_info->LoaderFlags) wm->ldr.Flags |= LDR_COR_IMAGE;
- if (image_info->u.ImageFlags & IMAGE_FLAGS_ComPlusILOnly) wm->ldr.Flags |= LDR_COR_ILONLY;
+ if (image_info->u.s.ComPlusILOnly) wm->ldr.Flags |= LDR_COR_ILONLY;
set_security_cookie( *module, map_size );
@@ -1916,7 +1916,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
TRACE( "loaded %s %p %p\n", debugstr_us(nt_name), wm, *module );
- if (image_info->u.ImageFlags & IMAGE_FLAGS_WineBuiltin)
+ if (image_info->u.s.WineBuiltin)
{
if (TRACE_ON(relay)) RELAY_SetupDLL( *module );
}
@@ -1926,7 +1926,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
}
TRACE_(loaddll)( "Loaded %s at %p: %s\n", debugstr_w(wm->ldr.FullDllName.Buffer), *module,
- (image_info->u.ImageFlags & IMAGE_FLAGS_WineBuiltin) ? "builtin" : "native" );
+ (image_info->u.s.WineBuiltin) ? "builtin" : "native" );
wm->ldr.LoadCount = 1;
*pwm = wm;
@@ -1946,7 +1946,7 @@ static NTSTATUS build_builtin_module( const WCHAR *load_path, const UNICODE_STRI
NTSTATUS status;
SECTION_IMAGE_INFORMATION image_info = { 0 };
- image_info.u.ImageFlags = IMAGE_FLAGS_WineBuiltin;
+ image_info.u.s.WineBuiltin = 1;
status = build_module( load_path, nt_name, &module, &image_info, NULL, flags, pwm );
if (status && module) unix_funcs->unload_builtin_dll( module );
return status;
@@ -2062,7 +2062,7 @@ static BOOL is_valid_binary( HANDLE file, const SECTION_IMAGE_INFORMATION *info
if (info->Machine == IMAGE_FILE_MACHINE_ARM64) return TRUE;
#endif
if (!info->ImageContainsCode) return TRUE;
- if (!(info->u.ImageFlags & IMAGE_FLAGS_ComPlusNativeReady))
+ if (!(info->u.s.ComPlusNativeReady))
{
IMAGE_COR20_HEADER cor_header;
if (!get_cor_header( file, info, &cor_header )) return FALSE;
@@ -2673,7 +2673,7 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
break;
case STATUS_SUCCESS: /* valid PE file */
- if (image_info.u.ImageFlags & IMAGE_FLAGS_WineBuiltin)
+ if (image_info.u.s.WineBuiltin)
{
switch (loadorder)
{
@@ -2691,7 +2691,7 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
}
break;
}
- if (!(image_info.u.ImageFlags & IMAGE_FLAGS_WineFakeDll))
+ if (!(image_info.u.s.WineFakeDll))
{
switch (loadorder)
{
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 92bf3b08620..9aa1eeda88b 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1225,7 +1225,7 @@ static NTSTATUS open_dll_file( const char *name, OBJECT_ATTRIBUTES *attr, HANDLE
NtQuerySection( *mapping, SectionImageInformation, image_info, sizeof(*image_info), NULL );
/* ignore non-builtins */
- if (!(image_info->u.ImageFlags & IMAGE_FLAGS_WineBuiltin))
+ if (!(image_info->u.s.WineBuiltin))
{
WARN( "%s found in WINEDLLPATH but not a builtin, ignoring\n", debugstr_a(name) );
status = STATUS_DLL_NOT_FOUND;
diff --git a/include/winternl.h b/include/winternl.h
index a65d21b9e3e..61bcd0f1d92 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2490,7 +2490,12 @@ typedef struct _SECTION_IMAGE_INFORMATION {
UCHAR ImageMappedFlat : 1;
UCHAR BaseBelow4gb : 1;
UCHAR ComPlusPrefer32bit : 1;
+#ifdef __WINESRC__ /* Wine extensions */
+ UCHAR WineBuiltin : 1;
+ UCHAR WineFakeDll : 1;
+#else
UCHAR Reserved : 2;
+#endif
} DUMMYSTRUCTNAME;
} DUMMYUNIONNAME;
ULONG LoaderFlags;
More information about the wine-cvs
mailing list