diff --git a/patches/ntdll-Unused_Import_Descr/0001-ntdll-Skip-unused-import-descriptors-when-loading-li.patch b/patches/ntdll-Unused_Import_Descr/0001-ntdll-Skip-unused-import-descriptors-when-loading-li.patch new file mode 100644 index 00000000..28c57603 --- /dev/null +++ b/patches/ntdll-Unused_Import_Descr/0001-ntdll-Skip-unused-import-descriptors-when-loading-li.patch @@ -0,0 +1,36 @@ +From 62e17ad9aac4093654a2347aca9fd62f9e0499a8 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/ntdll-Unused_Import_Descr/definition b/patches/ntdll-Unused_Import_Descr/definition new file mode 100644 index 00000000..96e93722 --- /dev/null +++ b/patches/ntdll-Unused_Import_Descr/definition @@ -0,0 +1 @@ +Fixes: [39792] Ignore import descriptors with empty thunk list diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 095a53c7..fa432fca 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -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: