From f15b462860ed052e451819f1905ac348b9bd826b Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 23 Oct 2018 09:11:41 +1100 Subject: [PATCH] Rebase against e52a20f5bf86d156e1130e8268c65e04032e8caa --- ...-support-for-creating-processes-usin.patch | 134 ++++++++---------- ...dd-some-tests-for-GetLongPathName-Ge.patch | 69 --------- ...tPathName-should-fail-when-called-wi.patch | 64 --------- ...PathName-should-fail-when-called-wit.patch | 62 -------- patches/kernel32-GetShortPathName/definition | 1 - ...rchPath-test-demonstrating-the-prior.patch | 20 +-- patches/patchinstall.sh | 25 +--- 7 files changed, 70 insertions(+), 305 deletions(-) delete mode 100644 patches/kernel32-GetShortPathName/0001-kernel32-tests-Add-some-tests-for-GetLongPathName-Ge.patch delete mode 100644 patches/kernel32-GetShortPathName/0002-kernel32-GetShortPathName-should-fail-when-called-wi.patch delete mode 100644 patches/kernel32-GetShortPathName/0003-kernel32-GetLongPathName-should-fail-when-called-wit.patch delete mode 100644 patches/kernel32-GetShortPathName/definition diff --git a/patches/advapi32-Token_Integrity_Level/0010-server-Implement-support-for-creating-processes-usin.patch b/patches/advapi32-Token_Integrity_Level/0010-server-Implement-support-for-creating-processes-usin.patch index dcb49992..6f1ded22 100644 --- a/patches/advapi32-Token_Integrity_Level/0010-server-Implement-support-for-creating-processes-usin.patch +++ b/patches/advapi32-Token_Integrity_Level/0010-server-Implement-support-for-creating-processes-usin.patch @@ -1,33 +1,33 @@ -From 9db924ab804c76bd6b1dada8e46ba59aef2987e0 Mon Sep 17 00:00:00 2001 +From e571cdf9236e083f196c09d0fc96ed7c98fae440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 6 Aug 2017 02:08:05 +0200 Subject: [PATCH] server: Implement support for creating processes using a token. --- - dlls/kernel32/process.c | 33 ++++++++++++++++++--------------- - server/process.c | 29 +++++++++++++++++++++++++---- + dlls/kernel32/process.c | 27 +++++++++++++++------------ + server/process.c | 39 +++++++++++++++++++++++++++++++++++---- server/process.h | 2 +- server/protocol.def | 1 + server/request.c | 2 +- server/security.h | 2 ++ server/token.c | 11 +++++++++++ - 7 files changed, 59 insertions(+), 21 deletions(-) + 7 files changed, 66 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c -index 396d12a..c06bcb2 100644 +index bb6cc3e..7b202db 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c -@@ -2201,7 +2201,7 @@ static NTSTATUS alloc_object_attributes( const SECURITY_ATTRIBUTES *attr, struct +@@ -2289,7 +2289,7 @@ static BOOL replace_process( HANDLE handle, const RTL_USER_PROCESS_PARAMETERS *p * Create a new process. If hFile is a valid handle we have an exe * file, otherwise it is a Winelib app. */ -static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, +static BOOL create_process( HANDLE token, HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params, - LPPROCESS_INFORMATION info, LPCSTR unixdir, - const pe_image_info_t *pe_info, int exec_only ) -@@ -2302,6 +2302,7 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ + LPPROCESS_INFORMATION info, LPCSTR unixdir, const pe_image_info_t *pe_info ) + { +@@ -2356,6 +2356,7 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ req->access = PROCESS_ALL_ACCESS; req->cpu = pe_info->cpu; req->info_size = startup_info_size; @@ -35,25 +35,25 @@ index 396d12a..c06bcb2 100644 wine_server_add_data( req, objattr, attr_len ); wine_server_add_data( req, startup_info, startup_info_size ); wine_server_add_data( req, params->Environment, (env_end - params->Environment) * sizeof(WCHAR) ); -@@ -2418,7 +2419,7 @@ error: +@@ -2526,7 +2527,7 @@ static RTL_USER_PROCESS_PARAMETERS *get_vdm_params( const RTL_USER_PROCESS_PARAM * * Create a new VDM process for a 16-bit or DOS application. */ -static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, +static BOOL create_vdm_process( HANDLE token, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params, - LPPROCESS_INFORMATION info, LPCSTR unixdir, int exec_only ) + LPPROCESS_INFORMATION info, LPCSTR unixdir ) { -@@ -2467,7 +2468,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES +@@ -2536,7 +2537,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES - memset( &pe_info, 0, sizeof(pe_info) ); - pe_info.cpu = CPU_x86; -- ret = create_process( 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info, exec_only ); -+ ret = create_process( token, 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info, exec_only ); + if (!(new_params = get_vdm_params( params, &pe_info ))) return FALSE; + +- ret = create_process( 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info ); ++ ret = create_process( token, 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info ); RtlDestroyProcessParameters( new_params ); - HeapFree( GetProcessHeap(), 0, new_cmd_line ); return ret; -@@ -2479,7 +2480,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES + } +@@ -2547,7 +2548,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES * * Create a new cmd shell process for a .BAT file. */ @@ -62,7 +62,7 @@ index 396d12a..c06bcb2 100644 BOOL inherit, DWORD flags, LPSTARTUPINFOW startup, const RTL_USER_PROCESS_PARAMETERS *params, LPPROCESS_INFORMATION info ) -@@ -2509,9 +2510,9 @@ static BOOL create_cmd_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES +@@ -2577,9 +2578,9 @@ static BOOL create_cmd_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES strcatW( newcmdline, params->CommandLine.Buffer ); strcatW( newcmdline, quotW ); if (params->CurrentDirectory.DosPath.Length) cur_dir = params->CurrentDirectory.DosPath.Buffer; @@ -74,7 +74,7 @@ index 396d12a..c06bcb2 100644 HeapFree( GetProcessHeap(), 0, newcmdline ); return ret; } -@@ -2624,7 +2625,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l +@@ -2692,7 +2693,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) ); @@ -85,35 +85,34 @@ index 396d12a..c06bcb2 100644 if (new_token) FIXME("No support for returning created process token\n"); if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ), &hFile, &is_64bit ))) -@@ -2692,18 +2695,18 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l +@@ -2760,17 +2763,17 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32, wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size), cpu_names[pe_info.cpu] ); - retv = create_process( hFile, process_attr, thread_attr, + retv = create_process( token, hFile, process_attr, thread_attr, - inherit, flags, params, info, unixdir, &pe_info, FALSE ); + inherit, flags, params, info, unixdir, &pe_info ); break; case BINARY_WIN16: TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) ); -- retv = create_vdm_process( process_attr, thread_attr, -+ retv = create_vdm_process( token, process_attr, thread_attr, - inherit, flags, params, info, unixdir, FALSE ); +- retv = create_vdm_process( process_attr, thread_attr, inherit, flags, params, info, unixdir ); ++ retv = create_vdm_process( token, process_attr, thread_attr, inherit, flags, params, info, unixdir ); break; case BINARY_UNIX_LIB: TRACE( "starting %s as %d-bit Winelib app\n", debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32 ); - retv = create_process( hFile, process_attr, thread_attr, + retv = create_process( token, hFile, process_attr, thread_attr, - inherit, flags, params, info, unixdir, &pe_info, FALSE ); + inherit, flags, params, info, unixdir, &pe_info ); break; case BINARY_UNKNOWN: -@@ -2713,14 +2716,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l +@@ -2780,14 +2783,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l if (!strcmpiW( p, comW ) || !strcmpiW( p, pifW )) { TRACE( "starting %s as DOS binary\n", debugstr_w(name) ); - retv = create_vdm_process( process_attr, thread_attr, + retv = create_vdm_process( token, process_attr, thread_attr, - inherit, flags, params, info, unixdir, FALSE ); + inherit, flags, params, info, unixdir ); break; } if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) ) @@ -124,43 +123,20 @@ index 396d12a..c06bcb2 100644 inherit, flags, startup_info, params, info ); break; } -@@ -2828,11 +2831,11 @@ static void exec_process( LPCWSTR name ) - debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32, - wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size), - cpu_names[pe_info.cpu] ); -- create_process( hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE ); -+ create_process( NULL, hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE ); - break; - case BINARY_UNIX_LIB: - TRACE( "%s is a Unix library, starting as Winelib app\n", debugstr_w(name) ); -- create_process( hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE ); -+ create_process( NULL, hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE ); - break; - case BINARY_UNKNOWN: - /* check for .com or .pif extension */ -@@ -2841,7 +2844,7 @@ static void exec_process( LPCWSTR name ) - /* fall through */ - case BINARY_WIN16: - TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) ); -- create_vdm_process( NULL, NULL, FALSE, 0, params, &info, NULL, TRUE ); -+ create_vdm_process( NULL, NULL, NULL, FALSE, 0, params, &info, NULL, TRUE ); - break; - default: - break; diff --git a/server/process.c b/server/process.c -index 653e513..2bb49e2 100644 +index af2ba3d..57bf0ec 100644 --- a/server/process.c +++ b/server/process.c @@ -486,7 +486,7 @@ static void start_sigkill_timer( struct process *process ) /* create a new process */ /* if the function fails the fd is closed */ - struct process *create_process( int fd, struct thread *parent_thread, int inherit_all, + struct process *create_process( int fd, struct process *parent, int inherit_all, - const struct security_descriptor *sd ) + const struct security_descriptor *sd, struct token *token ) { struct process *process; -@@ -562,7 +562,7 @@ struct process *create_process( int fd, struct thread *parent_thread, int inheri +@@ -561,7 +561,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all, : alloc_handle_table( process, 0 ); /* Note: for security reasons, starting a new process does not attempt * to use the current impersonation token for the new process */ @@ -169,7 +145,7 @@ index 653e513..2bb49e2 100644 process->affinity = parent->affinity; } if (!process->handles || !process->token) goto error; -@@ -1128,6 +1128,7 @@ DECL_HANDLER(new_process) +@@ -1127,6 +1127,7 @@ DECL_HANDLER(new_process) const struct security_descriptor *sd; const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, NULL ); struct process *process = NULL; @@ -177,7 +153,7 @@ index 653e513..2bb49e2 100644 struct process *parent = current->process; int socket_fd = thread_get_inflight_fd( current, req->socket_fd ); -@@ -1168,13 +1169,31 @@ DECL_HANDLER(new_process) +@@ -1167,10 +1168,39 @@ DECL_HANDLER(new_process) return; } @@ -198,19 +174,18 @@ index 653e513..2bb49e2 100644 + } + } + - if (!req->info_size) /* create an orphaned process */ - { -- if ((process = create_process( socket_fd, NULL, 0, sd ))) ++ if (!req->info_size) /* create an orphaned process */ ++ { + if ((process = create_process( socket_fd, NULL, 0, sd, token ))) - { - create_thread( -1, process, NULL ); - release_object( process ); - } ++ { ++ create_thread( -1, process, NULL ); ++ release_object( process ); ++ } + if (token) release_object( token ); - return; - } - -@@ -1182,6 +1201,7 @@ DECL_HANDLER(new_process) ++ return; ++ } ++ + /* build the startup info for a new process */ if (!(info = alloc_object( &startup_info_ops ))) { close( socket_fd ); @@ -218,16 +193,16 @@ index 653e513..2bb49e2 100644 return; } info->process = NULL; -@@ -1228,7 +1248,7 @@ DECL_HANDLER(new_process) +@@ -1217,7 +1247,7 @@ DECL_HANDLER(new_process) #undef FIXUP_LEN } -- if (!(process = create_process( socket_fd, current, req->inherit_all, sd ))) goto done; +- if (!(process = create_process( socket_fd, parent, req->inherit_all, sd ))) goto done; + if (!(process = create_process( socket_fd, current, req->inherit_all, sd, token ))) goto done; process->startup_info = (struct startup_info *)grab_object( info ); -@@ -1290,6 +1310,7 @@ DECL_HANDLER(new_process) +@@ -1279,6 +1309,7 @@ DECL_HANDLER(new_process) reply->handle = alloc_handle_no_access_check( parent, process, req->access, objattr->attributes ); done: @@ -235,21 +210,30 @@ index 653e513..2bb49e2 100644 if (process) release_object( process ); release_object( info ); } +@@ -1311,7 +1342,7 @@ DECL_HANDLER(exec_process) + close( socket_fd ); + return; + } +- if (!(process = create_process( socket_fd, NULL, 0, NULL ))) return; ++ if (!(process = create_process( socket_fd, NULL, 0, NULL, NULL ))) return; + create_thread( -1, process, NULL ); + release_object( process ); + } diff --git a/server/process.h b/server/process.h -index 1128dba..ec44e02 100644 +index 029b328..ea28091 100644 --- a/server/process.h +++ b/server/process.h @@ -116,7 +116,7 @@ extern unsigned int alloc_ptid( void *ptr ); extern void free_ptid( unsigned int id ); extern void *get_ptid_entry( unsigned int id ); - extern struct process *create_process( int fd, struct thread *parent_thread, int inherit_all, + extern struct process *create_process( int fd, struct process *parent, int inherit_all, - const struct security_descriptor *sd ); + const struct security_descriptor *sd, struct token *token ); extern data_size_t init_process( struct thread *thread ); extern struct thread *get_process_first_thread( struct process *process ); extern struct process *get_process_from_id( process_id_t id ); diff --git a/server/protocol.def b/server/protocol.def -index aebac70..3dc82b3 100644 +index 607644e..1b5e6de 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -744,6 +744,7 @@ struct rawinput_device @@ -287,7 +271,7 @@ index 21e90cc..32dfe5f 100644 static inline const ACE_HEADER *ace_next( const ACE_HEADER *ace ) { diff --git a/server/token.c b/server/token.c -index de1d624..2804247 100644 +index 1184241..5db97b4 100644 --- a/server/token.c +++ b/server/token.c @@ -836,6 +836,12 @@ int token_assign_label( struct token *token, PSID label ) @@ -303,7 +287,7 @@ index de1d624..2804247 100644 struct token *token_create_admin( void ) { struct token *token = NULL; -@@ -1263,6 +1269,11 @@ const SID *token_get_primary_group( struct token *token ) +@@ -1262,6 +1268,11 @@ const SID *token_get_primary_group( struct token *token ) return token->primary_group; } diff --git a/patches/kernel32-GetShortPathName/0001-kernel32-tests-Add-some-tests-for-GetLongPathName-Ge.patch b/patches/kernel32-GetShortPathName/0001-kernel32-tests-Add-some-tests-for-GetLongPathName-Ge.patch deleted file mode 100644 index 430bd63b..00000000 --- a/patches/kernel32-GetShortPathName/0001-kernel32-tests-Add-some-tests-for-GetLongPathName-Ge.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a539993bd7c60424fb6d592be8cb5040959e1b48 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Sun, 17 Apr 2016 19:58:15 +0800 -Subject: [PATCH] kernel32/tests: Add some tests for - GetLongPathName/GetShortPathName called with a wildcard. - ---- - dlls/kernel32/tests/path.c | 24 ++++++++++++++++++++++-- - 1 file changed, 22 insertions(+), 2 deletions(-) - -diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c -index ca1cbf3..1e698bf 100644 ---- a/dlls/kernel32/tests/path.c -+++ b/dlls/kernel32/tests/path.c -@@ -1186,7 +1186,7 @@ static void test_GetTempPath(void) - static void test_GetLongPathNameA(void) - { - DWORD length, explength, hostsize; -- char tempfile[MAX_PATH]; -+ char tempfile[MAX_PATH], *name; - char longpath[MAX_PATH]; - char unc_prefix[MAX_PATH]; - char unc_short[MAX_PATH], unc_long[MAX_PATH]; -@@ -1197,7 +1197,17 @@ static void test_GetLongPathNameA(void) - return; - - GetTempPathA(MAX_PATH, tempfile); -- lstrcatA(tempfile, "longfilename.longext"); -+ name = tempfile + strlen(tempfile); -+ -+ strcpy(name, "*"); -+ SetLastError(0xdeadbeef); -+ length = pGetLongPathNameA(tempfile, temppath, MAX_PATH); -+todo_wine -+ ok(!length, "GetLongPathNameA should fail\n"); -+todo_wine -+ ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError()); -+ -+ strcpy(name, "longfilename.longext"); - - file = CreateFileA(tempfile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - CloseHandle(file); -@@ -1401,6 +1411,7 @@ static void test_GetShortPathNameW(void) - static const WCHAR name[] = { 't', 'e', 's', 't', 0 }; - static const WCHAR backSlash[] = { '\\', 0 }; - static const WCHAR a_bcdeW[] = {'a','.','b','c','d','e',0}; -+ static const WCHAR wildW[] = { '*',0 }; - WCHAR path[MAX_PATH], tmppath[MAX_PATH], *ptr; - WCHAR short_path[MAX_PATH]; - DWORD length; -@@ -1463,6 +1474,15 @@ static void test_GetShortPathNameW(void) - length = GetShortPathNameW( path, short_path, ARRAY_SIZE( short_path )); - ok( length, "GetShortPathNameW failed: %u.\n", GetLastError() ); - -+ lstrcpyW(ptr, wildW); -+ SetLastError(0xdeadbeef); -+ length = GetShortPathNameW( path, short_path, sizeof(short_path)/sizeof(*short_path) ); -+todo_wine -+ ok(!length, "GetShortPathNameW should fail\n"); -+todo_wine -+ ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError()); -+ -+ lstrcpyW(ptr, a_bcdeW); - ret = DeleteFileW( path ); - ok( ret, "Cannot delete file.\n" ); - *ptr = 0; --- -1.9.1 - diff --git a/patches/kernel32-GetShortPathName/0002-kernel32-GetShortPathName-should-fail-when-called-wi.patch b/patches/kernel32-GetShortPathName/0002-kernel32-GetShortPathName-should-fail-when-called-wi.patch deleted file mode 100644 index f5409dc1..00000000 --- a/patches/kernel32-GetShortPathName/0002-kernel32-GetShortPathName-should-fail-when-called-wi.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0546ec6c4084213cb3ffa4c635d5392305d86726 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Sun, 17 Apr 2016 20:06:46 +0800 -Subject: kernel32: GetShortPathName should fail when called with a wildcard. - -This patch fixes heap corruption reported in the bug 39355. ---- - dlls/kernel32/path.c | 11 ++++++++++- - dlls/kernel32/tests/path.c | 2 -- - 2 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c -index a3897431717..9cd0b57a65b 100644 ---- a/dlls/kernel32/path.c -+++ b/dlls/kernel32/path.c -@@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(file); - - static int path_safe_mode = -1; /* path mode set by SetSearchPathMode */ - -+static const WCHAR wildcardsW[] = {'*','?',0}; -+ - /* check if a file name is for an executable file (.exe or .com) */ - static inline BOOL is_executable( const WCHAR *name ) - { -@@ -445,7 +447,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl - WIN32_FIND_DATAW wfd; - HANDLE goit; - -- TRACE("%s\n", debugstr_w(longpath)); -+ TRACE("%s,%p,%u\n", debugstr_w(longpath), shortpath, shortlen); - - if (!longpath) - { -@@ -474,6 +476,13 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl - sp = lp = 4; - } - -+ if (strpbrkW(longpath + lp, wildcardsW)) -+ { -+ HeapFree(GetProcessHeap(), 0, tmpshortpath); -+ SetLastError(ERROR_INVALID_NAME); -+ return 0; -+ } -+ - /* check for drive letter */ - if (longpath[lp] != '/' && longpath[lp + 1] == ':' ) - { -diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c -index 31a90b4f532..707fb88bab9 100644 ---- a/dlls/kernel32/tests/path.c -+++ b/dlls/kernel32/tests/path.c -@@ -1477,9 +1477,7 @@ static void test_GetShortPathNameW(void) - lstrcpyW(ptr, wildW); - SetLastError(0xdeadbeef); - length = GetShortPathNameW( path, short_path, sizeof(short_path)/sizeof(*short_path) ); --todo_wine - ok(!length, "GetShortPathNameW should fail\n"); --todo_wine - ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError()); - - lstrcpyW(ptr, a_bcdeW); --- -2.14.1 - diff --git a/patches/kernel32-GetShortPathName/0003-kernel32-GetLongPathName-should-fail-when-called-wit.patch b/patches/kernel32-GetShortPathName/0003-kernel32-GetLongPathName-should-fail-when-called-wit.patch deleted file mode 100644 index 8565e1d1..00000000 --- a/patches/kernel32-GetShortPathName/0003-kernel32-GetLongPathName-should-fail-when-called-wit.patch +++ /dev/null @@ -1,62 +0,0 @@ -From b1ab2f65a23534e70e084f777f2ed75c615e1696 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Sun, 17 Apr 2016 20:15:35 +0800 -Subject: kernel32: GetLongPathName should fail when called with a wildcard. - ---- - dlls/kernel32/path.c | 10 ++++++++-- - dlls/kernel32/tests/path.c | 2 -- - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c -index ecebab2..17b9851 100644 ---- a/dlls/kernel32/path.c -+++ b/dlls/kernel32/path.c -@@ -295,6 +295,8 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen - HANDLE goit; - BOOL is_legal_8dot3; - -+ TRACE("%s,%p,%u\n", debugstr_w(shortpath), longpath, longlen); -+ - if (!shortpath) - { - SetLastError(ERROR_INVALID_PARAMETER); -@@ -306,8 +308,6 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen - return 0; - } - -- TRACE("%s,%p,%d\n", debugstr_w(shortpath), longpath, longlen); -- - if (shortpath[0] == '\\' && shortpath[1] == '\\') - { - FIXME("UNC pathname %s\n", debugstr_w(shortpath)); -@@ -331,6 +331,12 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen - lp = sp = 2; - } - -+ if (strpbrkW(shortpath + sp, wildcardsW)) -+ { -+ SetLastError(ERROR_INVALID_NAME); -+ return 0; -+ } -+ - while (shortpath[sp]) - { - /* check for path delimiters and reproduce them */ -diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c -index 3934046..4d23fbc 100644 ---- a/dlls/kernel32/tests/path.c -+++ b/dlls/kernel32/tests/path.c -@@ -1186,9 +1186,7 @@ static void test_GetLongPathNameA(void) - strcpy(name, "*"); - SetLastError(0xdeadbeef); - length = pGetLongPathNameA(tempfile, temppath, MAX_PATH); --todo_wine - ok(!length, "GetLongPathNameA should fail\n"); --todo_wine - ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError()); - - strcpy(name, "longfilename.longext"); --- -2.7.1 - diff --git a/patches/kernel32-GetShortPathName/definition b/patches/kernel32-GetShortPathName/definition deleted file mode 100644 index 8138cc2d..00000000 --- a/patches/kernel32-GetShortPathName/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [39355] Fix handling of wildcard paths in GetShortPathName and GetLongPathName diff --git a/patches/kernel32-NeedCurrentDirectoryForExePath/0001-kernel32-Add-SearchPath-test-demonstrating-the-prior.patch b/patches/kernel32-NeedCurrentDirectoryForExePath/0001-kernel32-Add-SearchPath-test-demonstrating-the-prior.patch index 66644b53..189e9cbc 100644 --- a/patches/kernel32-NeedCurrentDirectoryForExePath/0001-kernel32-Add-SearchPath-test-demonstrating-the-prior.patch +++ b/patches/kernel32-NeedCurrentDirectoryForExePath/0001-kernel32-Add-SearchPath-test-demonstrating-the-prior.patch @@ -1,18 +1,18 @@ -From 88bdfac0f88e250975181edc251b7f527217224a Mon Sep 17 00:00:00 2001 +From 35606d9b1a51b094f4abac7a880e66c71ecd8cf3 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 3 Jan 2015 20:24:07 -0700 -Subject: kernel32: Add SearchPath test demonstrating the priority of the - working directory. +Subject: [PATCH] kernel32: Add SearchPath test demonstrating the priority of + the working directory. --- dlls/kernel32/tests/path.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c -index 836d7ec..079820f 100644 +index 0a03225..ff78a39 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c -@@ -1790,10 +1790,11 @@ static void test_SearchPathA(void) +@@ -1820,10 +1820,11 @@ static void test_SearchPathA(void) static const CHAR testdeprelA[] = "./testdep.dll"; static const CHAR kernel32A[] = "kernel32.dll"; static const CHAR fileA[] = ""; @@ -25,8 +25,8 @@ index 836d7ec..079820f 100644 + BOOL bret; DWORD ret; - if (!pSearchPathA) -@@ -1867,6 +1868,28 @@ static void test_SearchPathA(void) + GetWindowsDirectoryA(pathA, ARRAY_SIZE(pathA)); +@@ -1915,6 +1916,28 @@ static void test_SearchPathA(void) ret = pDeactivateActCtx(0, cookie); ok(ret, "failed to deactivate context, %u\n", GetLastError()); pReleaseActCtx(handle); @@ -36,7 +36,7 @@ index 836d7ec..079820f 100644 + ret = GetCurrentDirectoryA(MAX_PATH, curdirA); + ok(ret, "failed to obtain working directory.\n"); + sprintf(pathA, "%s\\%s", tmpdirA, kernel32A); -+ ret = pSearchPathA(NULL, kernel32A, NULL, sizeof(path2A)/sizeof(CHAR), path2A, NULL); ++ ret = SearchPathA(NULL, kernel32A, NULL, sizeof(path2A)/sizeof(CHAR), path2A, NULL); + ok(ret && ret == strlen(path2A), "got %d\n", ret); + bret = CopyFileA(path2A, pathA, FALSE); + ok(bret != 0, "failed to copy test executable to temp directory, %u\n", GetLastError()); @@ -45,7 +45,7 @@ index 836d7ec..079820f 100644 + ok(bret != 0, "failed to copy test executable to launch directory, %u\n", GetLastError()); + bret = SetCurrentDirectoryA(tmpdirA); + ok(bret, "failed to change working directory\n"); -+ ret = pSearchPathA(NULL, kernel32A, ".exe", sizeof(buffA), buffA, NULL); ++ ret = SearchPathA(NULL, kernel32A, ".exe", sizeof(buffA), buffA, NULL); + ok(ret && ret == strlen(buffA), "got %d\n", ret); + ok(strcmp(buffA, path3A) == 0, "expected %s, got %s\n", path3A, buffA); + bret = SetCurrentDirectoryA(curdirA); @@ -56,5 +56,5 @@ index 836d7ec..079820f 100644 static void test_SearchPathW(void) -- -2.7.1 +1.9.1 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index f21ab4e2..a62825ad 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "417e94f19936c738a274a2ae879fc6c17db113e1" + echo "e52a20f5bf86d156e1130e8268c65e04032e8caa" } # Show version information @@ -161,7 +161,6 @@ patch_enable_all () enable_kernel32_Debugger="$1" enable_kernel32_Disable_GetQueuedCompletionStatusEx="$1" enable_kernel32_FindFirstFile="$1" - enable_kernel32_GetShortPathName="$1" enable_kernel32_Job_Tests="$1" enable_kernel32_K32GetPerformanceInfo="$1" enable_kernel32_MoveFile="$1" @@ -650,9 +649,6 @@ patch_enable () kernel32-FindFirstFile) enable_kernel32_FindFirstFile="$2" ;; - kernel32-GetShortPathName) - enable_kernel32_GetShortPathName="$2" - ;; kernel32-Job_Tests) enable_kernel32_Job_Tests="$2" ;; @@ -3936,25 +3932,6 @@ if test "$enable_kernel32_FindFirstFile" -eq 1; then ) >> "$patchlist" fi -# Patchset kernel32-GetShortPathName -# | -# | This patchset fixes the following Wine bugs: -# | * [#39355] Fix handling of wildcard paths in GetShortPathName and GetLongPathName -# | -# | Modified files: -# | * dlls/kernel32/path.c, dlls/kernel32/tests/path.c -# | -if test "$enable_kernel32_GetShortPathName" -eq 1; then - patch_apply kernel32-GetShortPathName/0001-kernel32-tests-Add-some-tests-for-GetLongPathName-Ge.patch - patch_apply kernel32-GetShortPathName/0002-kernel32-GetShortPathName-should-fail-when-called-wi.patch - patch_apply kernel32-GetShortPathName/0003-kernel32-GetLongPathName-should-fail-when-called-wit.patch - ( - printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Add some tests for GetLongPathName/GetShortPathName called with a wildcard.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: GetShortPathName should fail when called with a wildcard.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: GetLongPathName should fail when called with a wildcard.", 1 },'; - ) >> "$patchlist" -fi - # Patchset kernel32-Job_Tests # | # | Modified files: