From 042a633c8af88749c76a22eff7d9c4a2765630b5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Oct 2019 01:52:07 +0300 Subject: [PATCH] Rebase against 15bf3eee2cf05ce98011458fc5e715f4524c4ebd --- ...r-the-working-directory-first-when-l.patch | 39 ++++++++++--------- ...t-for-hiding-wine-version-informatio.patch | 34 +++++++++------- ...nt-CreateSymbolicLink-A-W-with-ntdll.patch | 26 +++++++------ patches/patchinstall.sh | 2 +- 4 files changed, 54 insertions(+), 47 deletions(-) diff --git a/patches/kernel32-NeedCurrentDirectoryForExePath/0003-kernel32-Consider-the-working-directory-first-when-l.patch b/patches/kernel32-NeedCurrentDirectoryForExePath/0003-kernel32-Consider-the-working-directory-first-when-l.patch index 8f39408f..0063cbf2 100644 --- a/patches/kernel32-NeedCurrentDirectoryForExePath/0003-kernel32-Consider-the-working-directory-first-when-l.patch +++ b/patches/kernel32-NeedCurrentDirectoryForExePath/0003-kernel32-Consider-the-working-directory-first-when-l.patch @@ -1,36 +1,37 @@ -From 04ccb4bc45d41ab247076f3d83329236a1c30125 Mon Sep 17 00:00:00 2001 +From 495a42ea564348e860c036803c89ce3650dd0a27 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 3 Jan 2015 20:55:43 -0700 -Subject: kernel32: Consider the working directory first when launching +Subject: [PATCH] kernel32: Consider the working directory first when launching executables with CreateProcess. --- - dlls/kernel32/process.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) + dlls/kernel32/process.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c -index 98ea09b..a5433d7 100644 +index 0a2192b246..ed78c0a01b 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c -@@ -441,9 +441,17 @@ static HANDLE open_exe_file( const WCHAR *name, BOOL *is_64bit ) +@@ -439,6 +439,7 @@ static HANDLE open_exe_file( const WCHAR *name, BOOL *is_64bit ) */ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE *handle ) { + WCHAR cur_dir[MAX_PATH]; -+ - TRACE("looking for %s\n", debugstr_w(name) ); + WCHAR *load_path; + BOOL ret; -- if (!SearchPathW( NULL, name, exeW, buflen, buffer, NULL ) && -+ /* The working directory takes precedence over other locations for CreateProcess unless the -+ * 'NoDefaultCurrentDirectoryInExePath' environment variable is set (and the executable name -+ * does not contain a backslash). */ -+ if ((NeedCurrentDirectoryForExePathW( name ) && GetCurrentDirectoryW( MAX_PATH, cur_dir) && -+ !SearchPathW( cur_dir, name, exeW, buflen, buffer, NULL )) && -+ /* not found in the working directory, try the system search path */ -+ !SearchPathW( NULL, name, exeW, buflen, buffer, NULL ) && - /* no builtin found, try native without extension in case it is a Unix app */ - !SearchPathW( NULL, name, NULL, buflen, buffer, NULL )) return FALSE; +@@ -446,7 +447,10 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE + TRACE("looking for %s in %s\n", debugstr_w(name), debugstr_w(load_path) ); + +- ret = (SearchPathW( load_path, name, exeW, buflen, buffer, NULL ) || ++ ret = (NeedCurrentDirectoryForExePathW( name ) && GetCurrentDirectoryW( MAX_PATH, cur_dir) && ++ SearchPathW( cur_dir, name, exeW, buflen, buffer, NULL )) || ++ /* not found in the working directory, try the system search path */ ++ (SearchPathW( load_path, name, exeW, buflen, buffer, NULL ) || + /* no builtin found, try native without extension in case it is a Unix app */ + SearchPathW( load_path, name, NULL, buflen, buffer, NULL )); + RtlReleasePath( load_path ); -- -2.7.4 +2.21.0 diff --git a/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch b/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch index a0ba199a..14d9d5a9 100644 --- a/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch +++ b/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch @@ -1,19 +1,19 @@ -From c887ee94a053fbec2f9e97d749539be97f614b08 Mon Sep 17 00:00:00 2001 +From e319578c8c47d7a2f7303f39de7f20e0d10e6675 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 30 May 2015 02:23:15 +0200 Subject: [PATCH] ntdll: Add support for hiding wine version information from applications. --- - dlls/ntdll/loader.c | 98 ++++++++++++++++++++++++++++++++++++++++- + dlls/ntdll/loader.c | 99 ++++++++++++++++++++++++++++++++++++++++- dlls/ntdll/ntdll_misc.h | 5 +++ - 2 files changed, 102 insertions(+), 1 deletion(-) + 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 9c82d31447b..2e57e2115d3 100644 +index 174569d3cf..2dc0202b36 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -68,17 +68,22 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *); +@@ -68,6 +68,7 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *); const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2','\\',0}; @@ -21,8 +21,9 @@ index 9c82d31447b..2e57e2115d3 100644 /* system search path */ static const WCHAR system_path[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',';', - 'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m',';', - 'C',':','\\','w','i','n','d','o','w','s',';',0}; +@@ -76,6 +77,9 @@ static const WCHAR system_path[] = + + static const WCHAR dotW[] = {'.',0}; +#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1') + @@ -30,13 +31,16 @@ index 9c82d31447b..2e57e2115d3 100644 static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */ static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */ static int free_lib_count; /* recursion depth of LdrUnloadDll calls */ - static ULONG path_safe_mode; /* path mode set by RtlSetSearchPathMode */ - static UNICODE_STRING dll_directory; /* extra path for LdrSetDllDirectory */ -+static BOOL hide_wine_exports = FALSE; /* try to hide ntdll wine exports from applications */ +@@ -92,6 +96,8 @@ struct dll_dir_entry + static struct list dll_dir_list = LIST_INIT( dll_dir_list ); /* extra dirs from LdrAddDllDirectory */ + ++static BOOL hide_wine_exports = FALSE; /* try to hide ntdll wine exports from applications */ ++ struct ldr_notification { -@@ -1695,6 +1700,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) + struct list entry; +@@ -1707,6 +1713,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) } @@ -133,7 +137,7 @@ index 9c82d31447b..2e57e2115d3 100644 /****************************************************************** * LdrGetProcedureAddress (NTDLL.@) */ -@@ -1715,7 +1810,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, +@@ -1727,7 +1823,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path ) : find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path ); @@ -142,7 +146,7 @@ index 9c82d31447b..2e57e2115d3 100644 { *address = proc; ret = STATUS_SUCCESS; -@@ -4040,6 +4135,7 @@ void __wine_process_init(void) +@@ -4289,6 +4385,7 @@ void __wine_process_init(void) NtCurrentTeb()->Peb->LoaderLock = &loader_section; update_user_process_params( &wm->ldr.FullDllName ); version_init( wm->ldr.FullDllName.Buffer ); @@ -151,7 +155,7 @@ index 9c82d31447b..2e57e2115d3 100644 LdrQueryImageFileExecutionOptions( &wm->ldr.FullDllName, globalflagW, REG_DWORD, diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index a1115305343..e7bf510c28e 100644 +index a111530534..e7bf510c28 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -269,6 +269,11 @@ extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN; @@ -167,5 +171,5 @@ index a1115305343..e7bf510c28e 100644 extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck, LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN; -- -2.23.0 +2.21.0 diff --git a/patches/ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch b/patches/ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch index 3d1b8599..1824c6f7 100644 --- a/patches/ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch +++ b/patches/ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch @@ -1,4 +1,4 @@ -From 9761db5bf17b98a9ae7f47fc5cf3e4eb98911af1 Mon Sep 17 00:00:00 2001 +From 647e8f79cc877f9baaf9cf29f7d6d9999c3960c9 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 16:02:05 -0600 Subject: [PATCH] kernel32: Implement CreateSymbolicLink[A|W] with ntdll @@ -13,7 +13,7 @@ Signed-off-by: Erich E. Hoover 4 files changed, 277 insertions(+), 81 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c -index 31da8fed4f5..2e57a3b38c9 100644 +index 31da8fed4f..2e57a3b38c 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -34,6 +34,8 @@ @@ -162,10 +162,10 @@ index 31da8fed4f5..2e57a3b38c9 100644 /************************************************************************* diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c -index 876ca743bc1..976993c9221 100644 +index 71577793b0..11b5ea35f0 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c -@@ -87,6 +87,9 @@ static void (WINAPI *pReleaseActCtx)(HANDLE); +@@ -92,6 +92,9 @@ static void (WINAPI *pReleaseActCtx)(HANDLE); static BOOL (WINAPI *pCheckNameLegalDOS8Dot3W)(const WCHAR *, char *, DWORD, BOOL *, BOOL *); static BOOL (WINAPI *pCheckNameLegalDOS8Dot3A)(const char *, char *, DWORD, BOOL *, BOOL *); @@ -175,20 +175,22 @@ index 876ca743bc1..976993c9221 100644 /* a structure to deal with wine todos somewhat cleanly */ typedef struct { DWORD shortlen; -@@ -2209,9 +2212,12 @@ static void init_pointers(void) +@@ -2217,11 +2220,14 @@ static void init_pointers(void) MAKEFUNC(ReleaseActCtx); MAKEFUNC(CheckNameLegalDOS8Dot3W); MAKEFUNC(CheckNameLegalDOS8Dot3A); + MAKEFUNC(CreateSymbolicLinkW); + mod = GetModuleHandleA("ntdll.dll"); + MAKEFUNC(LdrGetDllPath); + MAKEFUNC(RtlGetExePath); MAKEFUNC(RtlGetSearchPath); MAKEFUNC(RtlReleasePath); + #undef MAKEFUNC } -@@ -2549,6 +2555,95 @@ static void test_RtlGetSearchPath(void) +@@ -2744,6 +2750,95 @@ static void test_LdrGetDllPath(void) SetEnvironmentVariableW( pathW, old_path ); } @@ -284,14 +286,14 @@ index 876ca743bc1..976993c9221 100644 START_TEST(path) { CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive; -@@ -2584,4 +2679,5 @@ START_TEST(path) - test_CheckNameLegalDOS8Dot3(); - test_SetSearchPathMode(); +@@ -2781,4 +2876,5 @@ START_TEST(path) test_RtlGetSearchPath(); + test_RtlGetExePath(); + test_LdrGetDllPath(); + test_CreateSymbolicLink(); } diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c -index 8f7b75aab4b..77d8c377549 100644 +index 8f7b75aab4..77d8c37754 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -1622,15 +1622,14 @@ static void test_tr2_sys__Stat(void) @@ -433,7 +435,7 @@ index 8f7b75aab4b..77d8c377549 100644 } diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c -index 04406240e0f..46b2b8595dd 100644 +index 04406240e0..46b2b8595d 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -802,16 +802,15 @@ static void test_Stat(void) @@ -543,5 +545,5 @@ index 04406240e0f..46b2b8595dd 100644 } -- -2.23.0 +2.21.0 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 7a0cfd14..4fc7196f 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "5e8eb5f4c54c3a6d3c92fd414372da2fbd5bd91a" + echo "15bf3eee2cf05ce98011458fc5e715f4524c4ebd" } # Show version information