Added patch to ignore import descriptors with empty thunk list.

This commit is contained in:
Sebastian Lackner 2016-01-07 04:09:43 +01:00
parent 98e45e14d9
commit 502fa5f06f
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 62e17ad9aac4093654a2347aca9fd62f9e0499a8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 7 Jan 2016 04:07:25 +0100
Subject: ntdll: Skip unused import descriptors when loading libraries.
---
dlls/ntdll/loader.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 74feb97..d552a32 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -901,7 +901,18 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
status = STATUS_SUCCESS;
for (i = 0; i < nb_imports; i++)
{
- if (!(wm->deps[i] = import_dll( wm->ldr.BaseAddress, &imports[i], load_path )))
+ const IMAGE_IMPORT_DESCRIPTOR *descr = &imports[i];
+ const IMAGE_THUNK_DATA *import_list = get_rva( wm->ldr.BaseAddress, descr->u.OriginalFirstThunk ?
+ (DWORD)descr->u.OriginalFirstThunk : (DWORD)descr->FirstThunk );
+ if (!import_list->u1.Ordinal)
+ {
+ const char *name = get_rva( wm->ldr.BaseAddress, descr->Name );
+ WARN( "Skipping unused import %s\n", debugstr_a(name) );
+ wm->deps[i] = NULL;
+ continue;
+ }
+
+ if (!(wm->deps[i] = import_dll( wm->ldr.BaseAddress, descr, load_path )))
status = STATUS_DLL_NOT_FOUND;
}
current_modref = prev;
--
2.6.4

View File

@ -0,0 +1 @@
Fixes: [39792] Ignore import descriptors with empty thunk list

View File

@ -213,6 +213,7 @@ patch_enable_all ()
enable_ntdll_SystemRoot_Symlink="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_Threading="$1"
enable_ntdll_Unused_Import_Descr="$1"
enable_ntdll_User_Shared_Data="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Wait_User_APC="$1"
@ -753,6 +754,9 @@ patch_enable ()
ntdll-Threading)
enable_ntdll_Threading="$2"
;;
ntdll-Unused_Import_Descr)
enable_ntdll_Unused_Import_Descr="$2"
;;
ntdll-User_Shared_Data)
enable_ntdll_User_Shared_Data="$2"
;;
@ -4466,6 +4470,21 @@ if test "$enable_ntdll_Threading" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Unused_Import_Descr
# |
# | This patchset fixes the following Wine bugs:
# | * [#39792] Ignore import descriptors with empty thunk list
# |
# | Modified files:
# | * dlls/ntdll/loader.c
# |
if test "$enable_ntdll_Unused_Import_Descr" -eq 1; then
patch_apply ntdll-Unused_Import_Descr/0001-ntdll-Skip-unused-import-descriptors-when-loading-li.patch
(
echo '+ { "Sebastian Lackner", "ntdll: Skip unused import descriptors when loading libraries.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-User_Shared_Data
# |
# | Modified files: