winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
865 discussions
Start a n
N
ew thread
Zebediah Figura : wined3d: Check for a valid index buffer in d3d[89]_device_DrawIndexedPrimitive().
by Alexandre Julliard
01 Apr '21
01 Apr '21
Module: wine Branch: master Commit: 1c810a64b74816116ddc387cc0c52aaf0a16036e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1c810a64b74816116ddc387c…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Wed Mar 31 11:38:00 2021 -0500 wined3d: Check for a valid index buffer in d3d[89]_device_DrawIndexedPrimitive(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/device.c | 13 +++++++++---- dlls/d3d8/tests/device.c | 2 +- dlls/d3d9/device.c | 19 +++++++++++-------- dlls/ddraw/device.c | 6 +++--- dlls/wined3d/device.c | 14 +------------- include/wine/wined3d.h | 2 +- 6 files changed, 26 insertions(+), 30 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=1c810a64b74816116ddc…
1
0
0
0
Alexandre Julliard : start: Import the correct command-line building algorithm from ntdll.
by Alexandre Julliard
01 Apr '21
01 Apr '21
Module: wine Branch: master Commit: 997ae6ddc99897af436830273053dae95ea1e2a4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=997ae6ddc99897af43683027…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Apr 1 13:00:27 2021 +0200 start: Import the correct command-line building algorithm from ntdll. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50873
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/start/start.c | 104 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 26 deletions(-) diff --git a/programs/start/start.c b/programs/start/start.c index 3efad69b090..e78968e2052 100644 --- a/programs/start/start.c +++ b/programs/start/start.c @@ -119,28 +119,83 @@ static void usage(void) fatal_string(STRING_USAGE); } -static WCHAR *build_args( int argc, WCHAR **argvW ) +/*********************************************************************** + * build_command_line + * + * Build the command line of a process from the argv array. + * + * We must quote and escape characters so that the argv array can be rebuilt + * from the command line: + * - spaces and tabs must be quoted + * 'a b' -> '"a b"' + * - quotes must be escaped + * '"' -> '\"' + * - if '\'s are followed by a '"', they must be doubled and followed by '\"', + * resulting in an odd number of '\' followed by a '"' + * '\"' -> '\\\"' + * '\\"' -> '\\\\\"' + * - '\'s are followed by the closing '"' must be doubled, + * resulting in an even number of '\' followed by a '"' + * ' \' -> '" \\"' + * ' \\' -> '" \\\\"' + * - '\'s that are not followed by a '"' can be left as is + * 'a\b' == 'a\b' + * 'a\\b' == 'a\\b' + */ +static WCHAR *build_command_line( WCHAR **wargv ) { - int i, wlen = 1; - WCHAR *ret, *p; + int len; + WCHAR **arg, *ret; + LPWSTR p; - for (i = 0; i < argc; i++ ) - { - wlen += lstrlenW(argvW[i]) + 1; - if (wcschr(argvW[i], ' ')) - wlen += 2; - } - ret = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); - ret[0] = 0; + len = 1; + for (arg = wargv; *arg; arg++) len += 3 + 2 * wcslen( *arg ); + if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL; - for (i = 0, p = ret; i < argc; i++ ) - { - if (wcschr(argvW[i], ' ')) - p += swprintf(p, wlen - (p - ret), L" \"%s\"", argvW[i]); - else - p += swprintf(p, wlen - (p - ret), L" %s", argvW[i]); - } - return ret; + p = ret; + for (arg = wargv; *arg; arg++) + { + BOOL has_space, has_quote; + int i, bcount; + WCHAR *a; + + /* check for quotes and spaces in this argument */ + has_space = !**arg || wcschr( *arg, ' ' ) || wcschr( *arg, '\t' ); + has_quote = wcschr( *arg, '"' ) != NULL; + + /* now transfer it to the command line */ + if (has_space) *p++ = '"'; + if (has_quote || has_space) + { + bcount = 0; + for (a = *arg; *a; a++) + { + if (*a == '\\') bcount++; + else + { + if (*a == '"') /* double all the '\\' preceding this '"', plus one */ + for (i = 0; i <= bcount; i++) *p++ = '\\'; + bcount = 0; + } + *p++ = *a; + } + } + else + { + wcscpy( p, *arg ); + p += wcslen( p ); + } + if (has_space) + { + /* Double all the '\' preceding the closing quote */ + for (i = 0; i < bcount; i++) *p++ = '\\'; + *p++ = '"'; + } + *p++ = ' '; + } + if (p > ret) p--; /* remove last space */ + *p = 0; + return ret; } static WCHAR *get_parent_dir(WCHAR* path) @@ -339,7 +394,6 @@ int __cdecl wmain (int argc, WCHAR *argv[]) { SHELLEXECUTEINFOW sei; DWORD creation_flags; - WCHAR *args = NULL; int i; BOOL unix_mode = FALSE; BOOL progid_open = FALSE; @@ -489,8 +543,7 @@ int __cdecl wmain (int argc, WCHAR *argv[]) else file = argv[i++]; - args = build_args( argc - i, &argv[i] ); - sei.lpParameters = args; + sei.lpParameters = build_command_line( &argv[i] ); if (unix_mode || progid_open) { LPWSTR (*CDECL wine_get_dos_file_name_ptr)(LPCSTR); @@ -537,9 +590,9 @@ int __cdecl wmain (int argc, WCHAR *argv[]) /* explorer on windows always quotes the filename when running a binary on windows (see bug 5224) so we have to use CreateProcessW in this case */ - commandline = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(sei.lpFile)+3+lstrlenW(sei.lpParameters))*sizeof(WCHAR)); - swprintf(commandline, lstrlenW(sei.lpFile) + 3 + lstrlenW(sei.lpParameters), - L"\"%s\"%s", sei.lpFile, sei.lpParameters); + commandline = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(sei.lpFile)+4+lstrlenW(sei.lpParameters))*sizeof(WCHAR)); + swprintf(commandline, lstrlenW(sei.lpFile) + 4 + lstrlenW(sei.lpParameters), + L"\"%s\" %s", sei.lpFile, sei.lpParameters); ZeroMemory(&startup_info, sizeof(startup_info)); startup_info.cb = sizeof(startup_info); @@ -616,7 +669,6 @@ int __cdecl wmain (int argc, WCHAR *argv[]) } done: - HeapFree( GetProcessHeap(), 0, args ); HeapFree( GetProcessHeap(), 0, dos_filename ); HeapFree( GetProcessHeap(), 0, fullpath ); HeapFree( GetProcessHeap(), 0, parent_directory );
1
0
0
0
Alexandre Julliard : ntdll: Define NtCurrentTeb64() on 64-bit to avoid some #ifdefs.
by Alexandre Julliard
01 Apr '21
01 Apr '21
Module: wine Branch: master Commit: 7929b21ede210634e989ad32d479085053ca0059 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7929b21ede210634e989ad32…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Apr 1 12:25:21 2021 +0200 ntdll: Define NtCurrentTeb64() on 64-bit to avoid some #ifdefs. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/directory.c | 8 -------- dlls/ntdll/env.c | 11 ++++------- dlls/ntdll/loader.c | 7 +------ dlls/ntdll/ntdll_misc.h | 7 +++---- dlls/ntdll/unix/env.c | 8 +++----- dlls/ntdll/unix/file.c | 4 ---- dlls/ntdll/unix/loader.c | 2 -- dlls/ntdll/unix/unix_private.h | 4 +++- 8 files changed, 14 insertions(+), 37 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 4125170b509..3c601fe016a 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -46,13 +46,9 @@ */ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable ) { -#ifdef _WIN64 - return STATUS_NOT_IMPLEMENTED; -#else if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = !enable; return STATUS_SUCCESS; -#endif } @@ -61,9 +57,6 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable ) */ NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value ) { -#ifdef _WIN64 - return STATUS_NOT_IMPLEMENTED; -#else if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; __TRY @@ -78,7 +71,6 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value ) NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = disable; return STATUS_SUCCESS; -#endif } diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 62f93603d55..1ed52b9728f 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -73,14 +73,11 @@ static void set_wow64_environment( WCHAR **env ) RtlSetEnvironmentVariable( env, &arch6432_strW, NULL ); } } - else if (!RtlQueryEnvironmentVariable_U( *env, &arch_strW, &valW )) + else if (NtCurrentTeb64() && !RtlQueryEnvironmentVariable_U( *env, &arch_strW, &valW )) { - if (is_wow64) - { - RtlSetEnvironmentVariable( env, &arch6432_strW, &valW ); - RtlInitUnicodeString( &nameW, L"x86" ); - RtlSetEnvironmentVariable( env, &arch_strW, &nameW ); - } + RtlSetEnvironmentVariable( env, &arch6432_strW, &valW ); + RtlInitUnicodeString( &nameW, L"x86" ); + RtlSetEnvironmentVariable( env, &arch_strW, &nameW ); } /* set the ProgramFiles variables */ diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 39e87e5d752..daee7675196 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -69,7 +69,6 @@ const WCHAR system_dir[] = L"C:\\windows\\system32\\"; const WCHAR syswow64_dir[] = L"C:\\windows\\syswow64\\"; HMODULE kernel32_handle = 0; -BOOL is_wow64 = FALSE; /* system search path */ static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows"; @@ -2704,7 +2703,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con } /* Win 7/2008R2 and up seem to re-enable WoW64 FS redirection when loading libraries */ - if (is_wow64) RtlWow64EnableFsRedirectionEx( 0, &wow64_old_value ); + RtlWow64EnableFsRedirectionEx( 0, &wow64_old_value ); nt_name->Buffer = NULL; @@ -4048,10 +4047,6 @@ static NTSTATUS process_init(void) InitializeListHead( &ldr.InMemoryOrderModuleList ); InitializeListHead( &ldr.InInitializationOrderModuleList ); -#ifndef _WIN64 - is_wow64 = !!NtCurrentTeb64(); -#endif - init_user_process_params(); load_global_options(); version_init(); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 400ac9398a5..e50d48dc3cc 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -64,9 +64,6 @@ extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN; extern void init_user_process_params(void) DECLSPEC_HIDDEN; extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN; -/* server support */ -extern BOOL is_wow64 DECLSPEC_HIDDEN; - /* module handling */ extern LIST_ENTRY tls_links DECLSPEC_HIDDEN; extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports, @@ -90,7 +87,9 @@ extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, /* load order */ -#ifndef _WIN64 +#ifdef _WIN64 +static inline TEB64 *NtCurrentTeb64(void) { return NULL; } +#else static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; } #endif diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 2101f463287..ab2e828dacd 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1827,7 +1827,6 @@ static void run_wineboot( WCHAR *env, SIZE_T size ) wine_server_fd_to_handle( 2, GENERIC_WRITE | SYNCHRONIZE, OBJ_INHERIT, ¶ms.hStdError ); -#ifndef _WIN64 if (NtCurrentTeb64() && !NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]) { NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = TRUE; @@ -1837,10 +1836,9 @@ static void run_wineboot( WCHAR *env, SIZE_T size ) NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = FALSE; } else -#endif - status = NtCreateUserProcess( &process, &thread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS, - NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, ¶ms, - &create_info, &ps_attr ); + status = NtCreateUserProcess( &process, &thread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS, + NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, ¶ms, + &create_info, &ps_attr ); NtClose( params.hStdError ); if (status) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 35ff3c7dea7..9ee5e84ee43 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3118,11 +3118,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer int ret, len; struct stat st; char *unix_name = *buffer; -#ifdef _WIN64 - const BOOL redirect = FALSE; -#else const BOOL redirect = NtCurrentTeb64() && !NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]; -#endif /* try a shortcut first */ diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 1d3a940aab8..9c6d58d94ee 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1439,10 +1439,8 @@ BOOL is_builtin_path( const UNICODE_STRING *path, WORD *machine ) if (path->Length > wcslen(system_dir) * sizeof(WCHAR) && !wcsnicmp( path->Buffer, system_dir, wcslen(system_dir) )) { -#ifndef _WIN64 if (NtCurrentTeb64() && NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]) *machine = IMAGE_FILE_MACHINE_AMD64; -#endif goto found; } if ((is_win64 || is_wow64) && path->Length > sizeof(wow64W) && diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index b49789b641e..c02a8f50b24 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -315,7 +315,9 @@ static inline void mutex_unlock( pthread_mutex_t *mutex ) if (!process_exiting) pthread_mutex_unlock( mutex ); } -#ifndef _WIN64 +#ifdef _WIN64 +static inline TEB64 *NtCurrentTeb64(void) { return NULL; } +#else static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; } #endif
1
0
0
0
Alexandre Julliard : ntdll: Move creation of the initial modules to LdrInitializeThunk().
by Alexandre Julliard
01 Apr '21
01 Apr '21
Module: wine Branch: master Commit: e6ed943028d8d5d63ae0d40c898fbf0fbfc38c54 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e6ed943028d8d5d63ae0d40c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Apr 1 12:01:43 2021 +0200 ntdll: Move creation of the initial modules to LdrInitializeThunk(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index e418eef6acb..39e87e5d752 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2389,7 +2389,7 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name, * * Build the module data for the main image. */ -static void build_main_module(void) +static WINE_MODREF *build_main_module(void) { SECTION_IMAGE_INFORMATION info; UNICODE_STRING nt_name; @@ -2419,11 +2419,12 @@ static void build_main_module(void) if (status) goto failed; status = build_module( NULL, &nt_name, &module, &info, NULL, DONT_RESOLVE_DLL_REFERENCES, &wm ); RtlFreeUnicodeString( &nt_name ); - if (!status) return; + if (!status) return wm; failed: MESSAGE( "wine: failed to create main module for %s, status %x\n", debugstr_us(¶ms->ImagePathName), status ); NtTerminateProcess( GetCurrentProcess(), status ); + return NULL; /* unreached */ } @@ -3513,14 +3514,16 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR RtlEnterCriticalSection( &loader_section ); - wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress ); - assert( wm ); - if (!imports_fixup_done) { ANSI_STRING func_name; WINE_MODREF *kernel32; + wm = build_main_module(); + wm->ldr.LoadCount = -1; + + build_ntdll_module(); + if ((status = load_dll( NULL, L"kernel32.dll", NULL, 0, &kernel32 )) != STATUS_SUCCESS) { MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); @@ -3549,6 +3552,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR } imports_fixup_done = TRUE; } + else wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress ); RtlAcquirePebLock(); InsertHeadList( &tls_links, &NtCurrentTeb()->TlsLinks ); @@ -3565,7 +3569,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status ); NtTerminateProcess( GetCurrentProcess(), status ); } - wm->ldr.LoadCount = -1; wm->ldr.Flags |= LDR_PROCESS_ATTACHED; /* don't try to attach again */ if (wm->ldr.ActivationContext) RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); @@ -4052,8 +4055,6 @@ static NTSTATUS process_init(void) init_user_process_params(); load_global_options(); version_init(); - build_main_module(); - build_ntdll_module(); #ifndef _WIN64 if (NtCurrentTeb64())
1
0
0
0
Alexandre Julliard : ntdll: Create the initial stack on the Unix side.
by Alexandre Julliard
01 Apr '21
01 Apr '21
Module: wine Branch: master Commit: c00c62bbfdb85eb2e2ecc545b6eee838e5a481f7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c00c62bbfdb85eb2e2ecc545…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Apr 1 11:25:48 2021 +0200 ntdll: Create the initial stack on the Unix side. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 6 ------ dlls/ntdll/unix/loader.c | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 336b11c6344..e418eef6acb 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4020,7 +4020,6 @@ static void map_wow64cpu(void) */ static NTSTATUS process_init(void) { - INITIAL_TEB stack; TEB *teb = NtCurrentTeb(); PEB *peb = teb->Peb; @@ -4069,11 +4068,6 @@ static NTSTATUS process_init(void) map_wow64cpu(); } #endif - - RtlCreateUserStack( 0, 0, 0, 0x10000, 0x10000, &stack ); - teb->Tib.StackBase = stack.StackBase; - teb->Tib.StackLimit = stack.StackLimit; - teb->DeallocationStack = stack.DeallocationStack; return STATUS_SUCCESS; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 5b0004b6d01..1d3a940aab8 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1797,6 +1797,7 @@ static struct unix_funcs unix_funcs = static void start_main_thread(void) { NTSTATUS status; + INITIAL_TEB stack; TEB *teb = virtual_alloc_first_teb(); signal_init_threading(); @@ -1809,6 +1810,10 @@ static void start_main_thread(void) syscall_dispatcher = signal_init_syscalls(); init_files(); init_startup_info(); + virtual_alloc_thread_stack( &stack, 0, 0, NULL ); + teb->Tib.StackBase = stack.StackBase; + teb->Tib.StackLimit = stack.StackLimit; + teb->DeallocationStack = stack.DeallocationStack; NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 ); load_ntdll(); load_libwine();
1
0
0
0
← Newer
1
...
84
85
86
87
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Results per page:
10
25
50
100
200