From 891bd073d8162dbb38b8e6fc86530d9b06f0838f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 2 Mar 2016 17:16:13 +0100 Subject: [PATCH] Added patch to set ERROR_DLL_NOT_FOUND as error code for Win 9X instead of ERROR_MOD_NOT_FOUND in load_library. --- ...OR_DLL_NOT_FOUND-as-error-code-for-W.patch | 29 +++++++++++++++++++ .../kernel32-ERROR_DLL_NOT_FOUND/definition | 1 + patches/patchinstall.sh | 16 ++++++++++ 3 files changed, 46 insertions(+) create mode 100644 patches/kernel32-ERROR_DLL_NOT_FOUND/0001-kernel32-Set-ERROR_DLL_NOT_FOUND-as-error-code-for-W.patch create mode 100644 patches/kernel32-ERROR_DLL_NOT_FOUND/definition diff --git a/patches/kernel32-ERROR_DLL_NOT_FOUND/0001-kernel32-Set-ERROR_DLL_NOT_FOUND-as-error-code-for-W.patch b/patches/kernel32-ERROR_DLL_NOT_FOUND/0001-kernel32-Set-ERROR_DLL_NOT_FOUND-as-error-code-for-W.patch new file mode 100644 index 00000000..04533d68 --- /dev/null +++ b/patches/kernel32-ERROR_DLL_NOT_FOUND/0001-kernel32-Set-ERROR_DLL_NOT_FOUND-as-error-code-for-W.patch @@ -0,0 +1,29 @@ +From 9d075c0f5c958becf8fe661b8c2877115501f044 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Tue, 1 Mar 2016 20:11:57 +0100 +Subject: kernel32: Set ERROR_DLL_NOT_FOUND as error code for Win 9X instead of + ERROR_MOD_NOT_FOUND. + +--- + dlls/kernel32/module.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c +index dac66c1..badfe1d 100644 +--- a/dlls/kernel32/module.c ++++ b/dlls/kernel32/module.c +@@ -948,7 +948,10 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags ) + if (nts != STATUS_SUCCESS) + { + hModule = 0; +- SetLastError( RtlNtStatusToDosError( nts ) ); ++ if (nts == STATUS_DLL_NOT_FOUND && (GetVersion() & 0x80000000)) ++ SetLastError( ERROR_DLL_NOT_FOUND ); ++ else ++ SetLastError( RtlNtStatusToDosError( nts ) ); + } + done: + HeapFree( GetProcessHeap(), 0, load_path ); +-- +2.7.1 + diff --git a/patches/kernel32-ERROR_DLL_NOT_FOUND/definition b/patches/kernel32-ERROR_DLL_NOT_FOUND/definition new file mode 100644 index 00000000..1fb2736f --- /dev/null +++ b/patches/kernel32-ERROR_DLL_NOT_FOUND/definition @@ -0,0 +1 @@ +Fixes: Set ERROR_DLL_NOT_FOUND as error code for Win 9X instead of ERROR_MOD_NOT_FOUND in load_library diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index d8051f89..e8251ec2 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -165,6 +165,7 @@ patch_enable_all () enable_kernel32_COMSPEC="$1" enable_kernel32_CopyFileEx="$1" enable_kernel32_Cwd_Startup_Info="$1" + enable_kernel32_ERROR_DLL_NOT_FOUND="$1" enable_kernel32_FindFirstFile="$1" enable_kernel32_FreeUserPhysicalPages="$1" enable_kernel32_GetCurrentPackageFamilyName="$1" @@ -650,6 +651,9 @@ patch_enable () kernel32-Cwd_Startup_Info) enable_kernel32_Cwd_Startup_Info="$2" ;; + kernel32-ERROR_DLL_NOT_FOUND) + enable_kernel32_ERROR_DLL_NOT_FOUND="$2" + ;; kernel32-FindFirstFile) enable_kernel32_FindFirstFile="$2" ;; @@ -4017,6 +4021,18 @@ if test "$enable_kernel32_Cwd_Startup_Info" -eq 1; then ) >> "$patchlist" fi +# Patchset kernel32-ERROR_DLL_NOT_FOUND +# | +# | Modified files: +# | * dlls/kernel32/module.c +# | +if test "$enable_kernel32_ERROR_DLL_NOT_FOUND" -eq 1; then + patch_apply kernel32-ERROR_DLL_NOT_FOUND/0001-kernel32-Set-ERROR_DLL_NOT_FOUND-as-error-code-for-W.patch + ( + echo '+ { "Michael Müller", "kernel32: Set ERROR_DLL_NOT_FOUND as error code for Win 9X instead of ERROR_MOD_NOT_FOUND.", 1 },'; + ) >> "$patchlist" +fi + # Patchset kernel32-FindFirstFile # | # | This patchset fixes the following Wine bugs: