nixos-config/config/games/wine/server-default_integrity/0005-ntdll-Always-start-the-initial-process-through-start.patch

50 lines
1.9 KiB
Diff

From b08427ea0575faf213100269bf5bc931ec05930b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 21 May 2021 21:52:06 -0500
Subject: [PATCH] ntdll: Always start the initial process through start.exe.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntdll/unix/env.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index ae1afb2797b..02af2c5ca5a 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -2116,6 +2116,7 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
*/
static RTL_USER_PROCESS_PARAMETERS *build_initial_params( void **module )
{
+ static const char *args[] = { "start.exe", "/exec" };
static const WCHAR valueW[] = {'1',0};
static const WCHAR pathW[] = {'P','A','T','H'};
RTL_USER_PROCESS_PARAMETERS *params = NULL;
@@ -2144,22 +2145,8 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params( void **module )
add_registry_environment( &env, &env_pos, &env_size );
env[env_pos++] = 0;
- status = load_main_exe( NULL, main_argv[1], curdir, &image, module );
- if (!status)
- {
- if (main_image_info.ImageCharacteristics & IMAGE_FILE_DLL) status = STATUS_INVALID_IMAGE_FORMAT;
- if (main_image_info.Machine != current_machine) status = STATUS_INVALID_IMAGE_FORMAT;
- }
-
- if (status) /* try launching it through start.exe */
- {
- static const char *args[] = { "start.exe", "/exec" };
- free( image );
- if (*module) NtUnmapViewOfSection( GetCurrentProcess(), *module );
- load_start_exe( &image, module );
- prepend_argv( args, 2 );
- }
- else rebuild_argv();
+ load_start_exe( &image, module );
+ prepend_argv( args, 2 );
main_wargv = build_wargv( get_dos_path( image ));
cmdline = build_command_line( main_wargv );
--
2.32.0