Rebase against 8ddff3f51faca2c0824e204a69f69e241fb93d15.

This commit is contained in:
Alistair Leslie-Hughes
2021-05-26 10:10:15 +10:00
parent 69765f438b
commit 34afd80e2e
7 changed files with 49 additions and 60 deletions

View File

@@ -1,39 +1,30 @@
From cd7883aaf87e8c15a6171d013e6b6c1ca518d158 Mon Sep 17 00:00:00 2001
From eac7d559f3a0dd0ab5b05a1ff461c619e6faa2d5 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 | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
dlls/ntdll/unix/env.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index 5d8c14625f9..69f2dda1c2b 100644
index 837725dd0d1..ed844e26593 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1921,6 +1921,7 @@ static inline DWORD append_string( void **ptr, const RTL_USER_PROCESS_PARAMETERS
@@ -2039,6 +2039,7 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
*/
static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
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;
@@ -1928,7 +1929,7 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
WCHAR *dst, *image, *cmdline, *path, *bootstrap;
WCHAR *env = get_initial_environment( &env_pos, &env_size );
WCHAR *curdir = get_initial_directory();
- void *module = NULL;
+ void *module;
NTSTATUS status;
/* store the initial PATH value */
@@ -1950,24 +1951,8 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
@@ -2067,24 +2068,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 );
- 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;
@@ -46,16 +37,16 @@ index 5d8c14625f9..69f2dda1c2b 100644
- {
- static const char *args[] = { "start.exe", "/exec" };
- free( image );
- if (module) NtUnmapViewOfSection( GetCurrentProcess(), module );
- load_start_exe( &image, &module );
- if (*module) NtUnmapViewOfSection( GetCurrentProcess(), *module );
- load_start_exe( &image, module );
- prepend_argv( args, 2 );
- }
- else rebuild_argv();
+ load_start_exe( &image, &module );
+ load_start_exe( &image, module );
+ prepend_argv( args, 2 );
NtCurrentTeb()->Peb->ImageBaseAddress = module;
main_wargv = build_wargv( get_dos_path( image ));
cmdline = build_command_line( main_wargv );
--
2.30.2