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
Alexandre Julliard : ntdll: Retrieve Wine version strings through NtQuerySystemInformation().
by Alexandre Julliard
05 Apr '21
05 Apr '21
Module: wine Branch: master Commit: 985bd97c2bb0a161f9cae370ae1893f2b0554ffd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=985bd97c2bb0a161f9cae370…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 5 13:05:44 2021 +0200 ntdll: Retrieve Wine version strings through NtQuerySystemInformation(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/ntdll.spec | 6 +++--- dlls/ntdll/unix/loader.c | 48 ++---------------------------------------------- dlls/ntdll/unix/system.c | 18 ++++++++++++++++++ dlls/ntdll/version.c | 37 +++++++++++++++++++++++++++++++++++++ include/winternl.h | 4 +++- 5 files changed, 63 insertions(+), 50 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index c8622ba21f4..cbb45f50dff 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1623,9 +1623,9 @@ @ cdecl -syscall __wine_locked_recvmsg(long ptr long) # Version -@ cdecl -syscall wine_get_version() -@ cdecl -syscall wine_get_build_id() -@ cdecl -syscall wine_get_host_version(ptr ptr) +@ cdecl wine_get_version() +@ cdecl wine_get_build_id() +@ cdecl wine_get_host_version(ptr ptr) # Filesystem @ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9c6d58d94ee..c13055a5549 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -51,9 +51,6 @@ #ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> #endif -#ifdef HAVE_SYS_UTSNAME_H -#include <sys/utsname.h> -#endif #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> #endif @@ -335,48 +332,6 @@ static void init_paths( char *argv[] ) } -/********************************************************************* - * wine_get_version - */ -const char * CDECL wine_get_version(void) -{ - return PACKAGE_VERSION; -} - - -/********************************************************************* - * wine_get_build_id - */ -const char * CDECL wine_get_build_id(void) -{ - extern const char wine_build[]; - return wine_build; -} - - -/********************************************************************* - * wine_get_host_version - */ -void CDECL wine_get_host_version( const char **sysname, const char **release ) -{ -#ifdef HAVE_SYS_UTSNAME_H - static struct utsname buf; - static BOOL init_done; - - if (!init_done) - { - uname( &buf ); - init_done = TRUE; - } - if (sysname) *sysname = buf.sysname; - if (release) *release = buf.release; -#else - if (sysname) *sysname = ""; - if (release) *release = ""; -#endif -} - - static void preloader_exec( char **argv ) { if (use_preloader) @@ -2107,7 +2062,8 @@ static void check_command_line( int argc, char *argv[] ) } if (!strcmp( argv[1], "--version" )) { - printf( "%s\n", wine_get_build_id() ); + extern const char wine_build[]; + printf( "%s\n", wine_build ); exit(0); } } diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 56f31e4147f..2b316095f4a 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -40,6 +40,9 @@ #ifdef HAVE_SYS_SYSCTL_H # include <sys/sysctl.h> #endif +#ifdef HAVE_SYS_UTSNAME_H +# include <sys/utsname.h> +#endif #ifdef HAVE_MACHINE_CPU_H # include <machine/cpu.h> #endif @@ -2809,6 +2812,21 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, ret = STATUS_SUCCESS; break; + /* Wine extensions */ + + case SystemWineVersionInformation: + { + static const char version[] = PACKAGE_VERSION; + extern const char wine_build[]; + struct utsname buf; + + uname( &buf ); + len = strlen(version) + strlen(wine_build) + strlen(buf.sysname) + strlen(buf.release) + 4; + snprintf( info, size, "%s%c%s%c%s%c%s", version, 0, wine_build, 0, buf.sysname, 0, buf.release ); + if (size < len) ret = STATUS_INFO_LENGTH_MISMATCH; + break; + } + default: FIXME( "(0x%08x,%p,0x%08x,%p) stub\n", class, info, size, ret_size ); diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c index 740d8403f5e..cde340cca1d 100644 --- a/dlls/ntdll/version.c +++ b/dlls/ntdll/version.c @@ -207,6 +207,41 @@ static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] = /* initialized to null so that we crash if we try to retrieve the version too early at startup */ static const RTL_OSVERSIONINFOEXW *current_version; +static char wine_version[256]; + +/********************************************************************* + * wine_get_version + */ +const char * CDECL wine_get_version(void) +{ + return wine_version; +} + + +/********************************************************************* + * wine_get_build_id + */ +const char * CDECL wine_get_build_id(void) +{ + const char *p = wine_version; + p += strlen(p) + 1; /* skip version */ + return p; +} + + +/********************************************************************* + * wine_get_host_version + */ +void CDECL wine_get_host_version( const char **sysname, const char **release ) +{ + const char *p = wine_version; + p += strlen(p) + 1; /* skip version */ + p += strlen(p) + 1; /* skip build id */ + if (sysname) *sysname = p; + p += strlen(p) + 1; + if (release) *release = p; +} + /********************************************************************** * get_nt_registry_version @@ -430,6 +465,8 @@ void version_init(void) const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; WCHAR appversion[MAX_PATH+20]; + NtQuerySystemInformation( SystemWineVersionInformation, wine_version, sizeof(wine_version), NULL ); + current_version = &VersionData[WIN7]; RtlOpenCurrentUser( KEY_ALL_ACCESS, &root ); diff --git a/include/winternl.h b/include/winternl.h index 9e6bde25569..298ebbc2d36 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1693,7 +1693,9 @@ typedef enum _SYSTEM_INFORMATION_CLASS { SystemDifRemovePluginVerificationOnDriver = 220, SystemShadowStackInformation = 221, SystemBuildVersionInformation = 222, - SystemInformationClassMax +#ifdef __WINESRC__ + SystemWineVersionInformation = 1000, +#endif } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS; typedef enum _THREADINFOCLASS {
1
0
0
0
Alexandre Julliard : ntdll: Move the PEB initialization to LdrInitializeThunk().
by Alexandre Julliard
05 Apr '21
05 Apr '21
Module: wine Branch: master Commit: beff5c56cdb02d614a5159de0e5ce1914c8ebc77 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=beff5c56cdb02d614a5159de…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 5 12:05:38 2021 +0200 ntdll: Move the PEB initialization to LdrInitializeThunk(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 62 +++++++++++++++++++++---------------------------- dlls/ntdll/ntdll_misc.h | 1 - dlls/ntdll/thread.c | 7 +----- 3 files changed, 28 insertions(+), 42 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 8863a20d67e..7a714a5aa6d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -154,7 +154,14 @@ static RTL_CRITICAL_SECTION_DEBUG peb_critsect_debug = }; static RTL_CRITICAL_SECTION peb_lock = { &peb_critsect_debug, -1, 0, 0, 0, 0 }; -static PEB_LDR_DATA ldr = { sizeof(ldr), TRUE }; +static PEB_LDR_DATA ldr = +{ + sizeof(ldr), TRUE, NULL, + { &ldr.InLoadOrderModuleList, &ldr.InLoadOrderModuleList }, + { &ldr.InMemoryOrderModuleList, &ldr.InMemoryOrderModuleList }, + { &ldr.InInitializationOrderModuleList, &ldr.InInitializationOrderModuleList } +}; + static RTL_BITMAP tls_bitmap; static RTL_BITMAP tls_expansion_bitmap; @@ -3615,6 +3622,24 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR { ANSI_STRING func_name; WINE_MODREF *kernel32; + PEB *peb = NtCurrentTeb()->Peb; + + peb->LdrData = &ldr; + peb->FastPebLock = &peb_lock; + peb->TlsBitmap = &tls_bitmap; + peb->TlsExpansionBitmap = &tls_expansion_bitmap; + peb->LoaderLock = &loader_section; + peb->OSMajorVersion = 5; + peb->OSMinorVersion = 1; + peb->OSBuildNumber = 0xA28; + peb->OSPlatformId = VER_PLATFORM_WIN32_NT; + peb->SessionId = 1; + peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL ); + + RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); + RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits, + sizeof(peb->TlsExpansionBitmapBits) * 8 ); + RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */ init_user_process_params(); load_global_options(); @@ -4040,39 +4065,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) } -/*********************************************************************** - * process_init - */ -static NTSTATUS process_init(void) -{ - TEB *teb = NtCurrentTeb(); - PEB *peb = teb->Peb; - - peb->LdrData = &ldr; - peb->FastPebLock = &peb_lock; - peb->TlsBitmap = &tls_bitmap; - peb->TlsExpansionBitmap = &tls_expansion_bitmap; - peb->LoaderLock = &loader_section; - peb->OSMajorVersion = 5; - peb->OSMinorVersion = 1; - peb->OSBuildNumber = 0xA28; - peb->OSPlatformId = VER_PLATFORM_WIN32_NT; - peb->SessionId = 1; - peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL ); - - RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); - RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits, - sizeof(peb->TlsExpansionBitmapBits) * 8 ); - RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */ - init_global_fls_data(); - - InitializeListHead( &ldr.InLoadOrderModuleList ); - InitializeListHead( &ldr.InMemoryOrderModuleList ); - InitializeListHead( &ldr.InInitializationOrderModuleList ); - - return STATUS_SUCCESS; -} - /*********************************************************************** * __wine_set_unix_funcs */ @@ -4080,5 +4072,5 @@ NTSTATUS CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *func { if (version != NTDLL_UNIXLIB_VERSION) return STATUS_REVISION_MISMATCH; unix_funcs = funcs; - return process_init(); + return STATUS_SUCCESS; } diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index e50d48dc3cc..a4a178a462e 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -106,7 +106,6 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) } /* FLS data */ -extern void init_global_fls_data(void) DECLSPEC_HIDDEN; extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN; #endif diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 25496609f08..3cb3bd469ba 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -241,7 +241,7 @@ TEB_ACTIVE_FRAME * WINAPI RtlGetFrame(void) ***********************************************************************/ -static GLOBAL_FLS_DATA fls_data; +static GLOBAL_FLS_DATA fls_data = { { NULL }, { &fls_data.fls_list_head, &fls_data.fls_list_head } }; static RTL_CRITICAL_SECTION fls_section; static RTL_CRITICAL_SECTION_DEBUG fls_critsect_debug = @@ -254,11 +254,6 @@ static RTL_CRITICAL_SECTION fls_section = { &fls_critsect_debug, -1, 0, 0, 0, 0 #define MAX_FLS_DATA_COUNT 0xff0 -void init_global_fls_data(void) -{ - InitializeListHead( &fls_data.fls_list_head ); -} - static void lock_fls_data(void) { RtlEnterCriticalSection( &fls_section );
1
0
0
0
Alexandre Julliard : ntdll: Move the global options initialization to LdrInitializeThunk().
by Alexandre Julliard
05 Apr '21
05 Apr '21
Module: wine Branch: master Commit: 04762b357635d3adb85ccd5e3456e81c23033394 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=04762b357635d3adb85ccd5e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 5 12:04:41 2021 +0200 ntdll: Move the global options initialization to LdrInitializeThunk(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 102 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 35cef275e9a..8863a20d67e 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3484,6 +3484,54 @@ static void process_breakpoint(void) } +/*********************************************************************** + * load_global_options + */ +static void load_global_options(void) +{ + OBJECT_ATTRIBUTES attr; + UNICODE_STRING name_str; + HANDLE hkey; + ULONG value; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &name_str; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &name_str, L"Machine\\System\\CurrentControlSet\\Control\\Session Manager" ); + + if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr )) + { + query_dword_option( hkey, L"GlobalFlag", &NtCurrentTeb()->Peb->NtGlobalFlag ); + query_dword_option( hkey, L"SafeProcessSearchMode", &path_safe_mode ); + query_dword_option( hkey, L"SafeDllSearchMode", &dll_safe_mode ); + + if (!query_dword_option( hkey, L"CriticalSectionTimeout", &value )) + NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000; + + if (!query_dword_option( hkey, L"HeapSegmentReserve", &value )) + NtCurrentTeb()->Peb->HeapSegmentReserve = value; + + if (!query_dword_option( hkey, L"HeapSegmentCommit", &value )) + NtCurrentTeb()->Peb->HeapSegmentCommit = value; + + if (!query_dword_option( hkey, L"HeapDeCommitTotalFreeThreshold", &value )) + NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value; + + if (!query_dword_option( hkey, L"HeapDeCommitFreeBlockThreshold", &value )) + NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value; + + NtClose( hkey ); + } + LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName, + L"GlobalFlag", REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag, + sizeof(DWORD), NULL ); + heap_set_debug_flags( GetProcessHeap() ); +} + + #ifndef _WIN64 void *Wow64Transition = NULL; @@ -3568,6 +3616,9 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ANSI_STRING func_name; WINE_MODREF *kernel32; + init_user_process_params(); + load_global_options(); + version_init(); #ifndef _WIN64 init_wow64(); #endif @@ -3657,54 +3708,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR } -/*********************************************************************** - * load_global_options - */ -static void load_global_options(void) -{ - OBJECT_ATTRIBUTES attr; - UNICODE_STRING name_str; - HANDLE hkey; - ULONG value; - - attr.Length = sizeof(attr); - attr.RootDirectory = 0; - attr.ObjectName = &name_str; - attr.Attributes = OBJ_CASE_INSENSITIVE; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &name_str, L"Machine\\System\\CurrentControlSet\\Control\\Session Manager" ); - - if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr )) - { - query_dword_option( hkey, L"GlobalFlag", &NtCurrentTeb()->Peb->NtGlobalFlag ); - query_dword_option( hkey, L"SafeProcessSearchMode", &path_safe_mode ); - query_dword_option( hkey, L"SafeDllSearchMode", &dll_safe_mode ); - - if (!query_dword_option( hkey, L"CriticalSectionTimeout", &value )) - NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000; - - if (!query_dword_option( hkey, L"HeapSegmentReserve", &value )) - NtCurrentTeb()->Peb->HeapSegmentReserve = value; - - if (!query_dword_option( hkey, L"HeapSegmentCommit", &value )) - NtCurrentTeb()->Peb->HeapSegmentCommit = value; - - if (!query_dword_option( hkey, L"HeapDeCommitTotalFreeThreshold", &value )) - NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value; - - if (!query_dword_option( hkey, L"HeapDeCommitFreeBlockThreshold", &value )) - NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value; - - NtClose( hkey ); - } - LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName, - L"GlobalFlag", REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag, - sizeof(DWORD), NULL ); - heap_set_debug_flags( GetProcessHeap() ); -} - - /*********************************************************************** * RtlImageDirectoryEntryToData (NTDLL.@) */ @@ -4067,9 +4070,6 @@ static NTSTATUS process_init(void) InitializeListHead( &ldr.InMemoryOrderModuleList ); InitializeListHead( &ldr.InInitializationOrderModuleList ); - init_user_process_params(); - load_global_options(); - version_init(); return STATUS_SUCCESS; }
1
0
0
0
Alexandre Julliard : ntdll: Move Wow64 initialization to LdrInitializeThunk().
by Alexandre Julliard
05 Apr '21
05 Apr '21
Module: wine Branch: master Commit: 4f594e155254cdd236bf1b44299c9cd4cccdcb73 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4f594e155254cdd236bf1b44…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 5 12:04:25 2021 +0200 ntdll: Move Wow64 initialization to LdrInitializeThunk(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 100 ++++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index daee7675196..35cef275e9a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3484,6 +3484,56 @@ static void process_breakpoint(void) } +#ifndef _WIN64 +void *Wow64Transition = NULL; + +static void map_wow64cpu(void) +{ + SIZE_T size = 0; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING string; + HANDLE file, section; + IO_STATUS_BLOCK io; + NTSTATUS status; + + RtlInitUnicodeString( &string, L"\\??\\C:\\windows\\sysnative\\wow64cpu.dll" ); + InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); + if ((status = NtOpenFile( &file, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) + { + WARN("failed to open wow64cpu, status %#x\n", status); + return; + } + if (!NtCreateSection( §ion, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | + SECTION_MAP_READ | SECTION_MAP_EXECUTE, + NULL, NULL, PAGE_EXECUTE_READ, SEC_COMMIT, file )) + { + NtMapViewOfSection( section, NtCurrentProcess(), &Wow64Transition, 0, + 0, NULL, &size, ViewShare, 0, PAGE_EXECUTE_READ ); + NtClose( section ); + } + NtClose( file ); +} + +static void init_wow64(void) +{ + PEB *peb = NtCurrentTeb()->Peb; + PEB64 *peb64; + + if (!NtCurrentTeb64()) return; + peb64 = UlongToPtr( NtCurrentTeb64()->Peb ); + peb64->ImageBaseAddress = PtrToUlong( peb->ImageBaseAddress ); + peb64->OSMajorVersion = peb->OSMajorVersion; + peb64->OSMinorVersion = peb->OSMinorVersion; + peb64->OSBuildNumber = peb->OSBuildNumber; + peb64->OSPlatformId = peb->OSPlatformId; + peb64->SessionId = peb->SessionId; + + map_wow64cpu(); +} +#endif + + /****************************************************************** * LdrInitializeThunk (NTDLL.@) * @@ -3518,6 +3568,9 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ANSI_STRING func_name; WINE_MODREF *kernel32; +#ifndef _WIN64 + init_wow64(); +#endif wm = build_main_module(); wm->ldr.LoadCount = -1; @@ -3984,39 +4037,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) } -#ifndef _WIN64 -void *Wow64Transition = NULL; - -static void map_wow64cpu(void) -{ - SIZE_T size = 0; - OBJECT_ATTRIBUTES attr; - UNICODE_STRING string; - HANDLE file, section; - IO_STATUS_BLOCK io; - NTSTATUS status; - - RtlInitUnicodeString( &string, L"\\??\\C:\\windows\\sysnative\\wow64cpu.dll" ); - InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); - if ((status = NtOpenFile( &file, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) - { - WARN("failed to open wow64cpu, status %#x\n", status); - return; - } - if (!NtCreateSection( §ion, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | - SECTION_MAP_READ | SECTION_MAP_EXECUTE, - NULL, NULL, PAGE_EXECUTE_READ, SEC_COMMIT, file )) - { - NtMapViewOfSection( section, NtCurrentProcess(), &Wow64Transition, 0, - 0, NULL, &size, ViewShare, 0, PAGE_EXECUTE_READ ); - NtClose( section ); - } - NtClose( file ); -} -#endif - - /*********************************************************************** * process_init */ @@ -4050,20 +4070,6 @@ static NTSTATUS process_init(void) init_user_process_params(); load_global_options(); version_init(); - -#ifndef _WIN64 - if (NtCurrentTeb64()) - { - PEB64 *peb64 = UlongToPtr( NtCurrentTeb64()->Peb ); - peb64->ImageBaseAddress = PtrToUlong( peb->ImageBaseAddress ); - peb64->OSMajorVersion = peb->OSMajorVersion; - peb64->OSMinorVersion = peb->OSMinorVersion; - peb64->OSBuildNumber = peb->OSBuildNumber; - peb64->OSPlatformId = peb->OSPlatformId; - peb64->SessionId = peb->SessionId; - map_wow64cpu(); - } -#endif return STATUS_SUCCESS; }
1
0
0
0
Alexandre Julliard : ntdll: Remove path from application name to open loadorder key.
by Alexandre Julliard
05 Apr '21
05 Apr '21
Module: wine Branch: master Commit: 7a1ed2e1219a5048653cf163018d317d6c99bf75 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7a1ed2e1219a5048653cf163…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 3 13:00:46 2021 +0200 ntdll: Remove path from application name to open loadorder key. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50914
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loadorder.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/loadorder.c b/dlls/ntdll/unix/loadorder.c index 49af8eb6adb..5285bb58007 100644 --- a/dlls/ntdll/unix/loadorder.c +++ b/dlls/ntdll/unix/loadorder.c @@ -384,16 +384,20 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) enum loadorder ret = LO_INVALID; HANDLE std_key, app_key = 0; const WCHAR *path = nt_name->Buffer; - const WCHAR *app_name = NULL; + const WCHAR *p, *app_name = NULL; WCHAR *module, *basename; int len; + if (!init_done) init_load_order(); + std_key = get_standard_key(); + if (NtCurrentTeb()->Peb->ImageBaseAddress) + { app_name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; + if ((p = wcsrchr( app_name, '\\' ))) app_name = p + 1; + app_key = get_app_key( app_name ); + } - if (!init_done) init_load_order(); - std_key = get_standard_key(); - if (app_name) app_key = get_app_key( app_name ); if (!wcsncmp( path, prefixW, 4 )) path += 4; TRACE("looking for %s\n", debugstr_w(path)); @@ -402,7 +406,7 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) */ if (!wcsnicmp( system_dir + 4, path, wcslen(system_dir) - 4 )) { - const WCHAR *p = path + wcslen( system_dir ) - 4; + p = path + wcslen( system_dir ) - 4; while (*p == '\\' || *p == '/') p++; if (!wcschr( p, '\\' ) && !wcschr( p, '/' )) path = p; }
1
0
0
0
Rémi Bernon : server: Split the fallback to desktop async keystate.
by Alexandre Julliard
02 Apr '21
02 Apr '21
Module: wine Branch: master Commit: 2fcc1d0ecdebc55a5f515b1390ce715303f6a6ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2fcc1d0ecdebc55a5f515b13…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 2 10:08:01 2021 +0200 server: Split the fallback to desktop async keystate. When current thread doesn't have a message queue. It's going to be removed later anyway. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/queue.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server/queue.c b/server/queue.c index e1f4f208fc8..b026c03e13d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2981,16 +2981,9 @@ DECL_HANDLER(get_key_state) set_reply_data( desktop->keystate, size ); release_object( desktop ); } - else + else if (!current->queue) { unsigned char *keystate; - if (current->queue) - { - if (req->key >= 0) reply->state = current->queue->input->keystate[req->key & 0xff]; - set_reply_data( current->queue->input->keystate, size ); - return; - } - /* fallback to desktop keystate */ if (!(desktop = get_thread_desktop( current, 0 ))) return; if (req->key >= 0) reply->state = desktop->keystate[req->key & 0xff] & ~0x40; @@ -3001,6 +2994,12 @@ DECL_HANDLER(get_key_state) } release_object( desktop ); } + else + { + unsigned char *keystate = current->queue->input->keystate; + if (req->key >= 0) reply->state = keystate[req->key & 0xff]; + set_reply_data( keystate, size ); + } }
1
0
0
0
Rémi Bernon : server: Remove tid from set_key_state request.
by Alexandre Julliard
02 Apr '21
02 Apr '21
Module: wine Branch: master Commit: 6444e4fadefb90bea8075b2e883c06cdb03454b9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6444e4fadefb90bea8075b2e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 2 10:08:00 2021 +0200 server: Remove tid from set_key_state request. As it is always set to GetCurrentThreadId(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/input.c | 1 - dlls/winex11.drv/keyboard.c | 1 - include/wine/server_protocol.h | 4 +--- server/protocol.def | 3 +-- server/queue.c | 18 +++--------------- server/request.h | 5 ++--- server/trace.c | 3 +-- 7 files changed, 8 insertions(+), 27 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 46dff3a89d4..8992c463c48 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -591,7 +591,6 @@ BOOL WINAPI SetKeyboardState( LPBYTE state ) SERVER_START_REQ( set_key_state ) { - req->tid = GetCurrentThreadId(); wine_server_add_data( req, state, 256 ); ret = !wine_server_call_err( req ); } diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 517522727fe..35a801fc895 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1177,7 +1177,6 @@ static void set_async_key_state( const BYTE state[256] ) { SERVER_START_REQ( set_key_state ) { - req->tid = GetCurrentThreadId(); req->async = 1; wine_server_add_data( req, state, 256 ); wine_server_call( req ); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 642841fceeb..9756e9cb8b7 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3846,10 +3846,8 @@ struct get_key_state_reply struct set_key_state_request { struct request_header __header; - thread_id_t tid; int async; /* VARARG(keystate,bytes); */ - char __pad_20[4]; }; struct set_key_state_reply { @@ -6226,7 +6224,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 689 +#define SERVER_PROTOCOL_VERSION 690 /* ### protocol_version end ### */ diff --git a/server/protocol.def b/server/protocol.def index c468c5b7151..617818f622d 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2758,9 +2758,8 @@ enum coords_relative VARARG(keystate,bytes); /* state array for all the keys */ @END -/* Set queue keyboard state for a given thread */ +/* Set queue keyboard state for current thread */ @REQ(set_key_state) - thread_id_t tid; /* id of thread */ int async; /* whether to change the async state too */ VARARG(keystate,bytes); /* state array for all the keys */ @END diff --git a/server/queue.c b/server/queue.c index 13a3641cfb8..e1f4f208fc8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3004,30 +3004,18 @@ DECL_HANDLER(get_key_state) } -/* set queue keyboard state for a given thread */ +/* set queue keyboard state for current thread */ DECL_HANDLER(set_key_state) { - struct thread *thread; struct desktop *desktop; data_size_t size = min( 256, get_req_data_size() ); - if (!req->tid) /* set global async key state */ + if (current->queue) memcpy( current->queue->input->keystate, get_req_data(), size ); + if (req->async && (desktop = get_thread_desktop( current, 0 ))) { - if (!(desktop = get_thread_desktop( current, 0 ))) return; memcpy( desktop->keystate, get_req_data(), size ); release_object( desktop ); } - else - { - if (!(thread = get_thread_from_id( req->tid ))) return; - if (thread->queue) memcpy( thread->queue->input->keystate, get_req_data(), size ); - if (req->async && (desktop = get_thread_desktop( thread, 0 ))) - { - memcpy( desktop->keystate, get_req_data(), size ); - release_object( desktop ); - } - release_object( thread ); - } } diff --git a/server/request.h b/server/request.h index a389a4eb6f7..6777f90b067 100644 --- a/server/request.h +++ b/server/request.h @@ -1724,9 +1724,8 @@ C_ASSERT( FIELD_OFFSET(struct get_key_state_request, key) == 16 ); C_ASSERT( sizeof(struct get_key_state_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_key_state_reply, state) == 8 ); C_ASSERT( sizeof(struct get_key_state_reply) == 16 ); -C_ASSERT( FIELD_OFFSET(struct set_key_state_request, tid) == 12 ); -C_ASSERT( FIELD_OFFSET(struct set_key_state_request, async) == 16 ); -C_ASSERT( sizeof(struct set_key_state_request) == 24 ); +C_ASSERT( FIELD_OFFSET(struct set_key_state_request, async) == 12 ); +C_ASSERT( sizeof(struct set_key_state_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct set_foreground_window_request, handle) == 12 ); C_ASSERT( sizeof(struct set_foreground_window_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct set_foreground_window_reply, previous) == 8 ); diff --git a/server/trace.c b/server/trace.c index ee11cfc9c3c..44bc8d8ee6f 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3413,8 +3413,7 @@ static void dump_get_key_state_reply( const struct get_key_state_reply *req ) static void dump_set_key_state_request( const struct set_key_state_request *req ) { - fprintf( stderr, " tid=%04x", req->tid ); - fprintf( stderr, ", async=%d", req->async ); + fprintf( stderr, " async=%d", req->async ); dump_varargs_bytes( ", keystate=", cur_size ); }
1
0
0
0
Rémi Bernon : server: Remove tid from get_key_state request.
by Alexandre Julliard
02 Apr '21
02 Apr '21
Module: wine Branch: master Commit: 626870abe2e800cc9407d05d5c00500a4ad97b3a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=626870abe2e800cc9407d05d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 2 10:07:59 2021 +0200 server: Remove tid from get_key_state request. And replace it with an async param if we want the global async keystate. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/input.c | 4 +--- dlls/wineandroid.drv/keyboard.c | 2 +- dlls/winemac.drv/keyboard.c | 2 +- dlls/winex11.drv/keyboard.c | 2 +- include/wine/server_protocol.h | 4 ++-- server/protocol.def | 4 ++-- server/queue.c | 14 +++++--------- server/request.h | 2 +- server/trace.c | 2 +- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index e06f8b4413e..46dff3a89d4 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -413,7 +413,7 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key ) ret = 0; SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = key; if (key_state_info) { @@ -550,7 +550,6 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey) SERVER_START_REQ( get_key_state ) { - req->tid = GetCurrentThreadId(); req->key = vkey; if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81); } @@ -573,7 +572,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state ) memset( state, 0, 256 ); SERVER_START_REQ( get_key_state ) { - req->tid = GetCurrentThreadId(); req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call_err( req ); diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index a0f3257f74b..1c8a1e4f68f 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -660,7 +660,7 @@ static BOOL get_async_key_state( BYTE state[256] ) SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call( req ); diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 45770b3125b..1b74300e93a 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -942,7 +942,7 @@ static BOOL get_async_key_state(BYTE state[256]) SERVER_START_REQ(get_key_state) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply(req, state, 256); ret = !wine_server_call(req); diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 48da12c0292..517522727fe 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1161,7 +1161,7 @@ static BOOL get_async_key_state( BYTE state[256] ) SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call( req ); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 36506bd258d..642841fceeb 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3830,7 +3830,7 @@ struct get_last_input_time_reply struct get_key_state_request { struct request_header __header; - thread_id_t tid; + int async; int key; char __pad_20[4]; }; @@ -6226,7 +6226,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 688 +#define SERVER_PROTOCOL_VERSION 689 /* ### protocol_version end ### */ diff --git a/server/protocol.def b/server/protocol.def index be524f92868..c468c5b7151 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2749,9 +2749,9 @@ enum coords_relative @END -/* Retrieve queue keyboard state for a given thread */ +/* Retrieve queue keyboard state for current thread or global async state */ @REQ(get_key_state) - thread_id_t tid; /* id of thread */ + int async; /* whether to query the async state */ int key; /* optional key code or -1 */ @REPLY unsigned char state; /* state of specified key */ diff --git a/server/queue.c b/server/queue.c index e47980a4aa8..13a3641cfb8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2964,14 +2964,13 @@ DECL_HANDLER(get_thread_input) } -/* retrieve queue keyboard state for a given thread */ +/* retrieve queue keyboard state for current thread or global async state */ DECL_HANDLER(get_key_state) { - struct thread *thread; struct desktop *desktop; data_size_t size = min( 256, get_reply_max_size() ); - if (!req->tid) /* get global async key state */ + if (req->async) /* get global async key state */ { if (!(desktop = get_thread_desktop( current, 0 ))) return; if (req->key >= 0) @@ -2985,15 +2984,12 @@ DECL_HANDLER(get_key_state) else { unsigned char *keystate; - if (!(thread = get_thread_from_id( req->tid ))) return; - if (thread->queue) + if (current->queue) { - if (req->key >= 0) reply->state = thread->queue->input->keystate[req->key & 0xff]; - set_reply_data( thread->queue->input->keystate, size ); - release_object( thread ); + if (req->key >= 0) reply->state = current->queue->input->keystate[req->key & 0xff]; + set_reply_data( current->queue->input->keystate, size ); return; } - release_object( thread ); /* fallback to desktop keystate */ if (!(desktop = get_thread_desktop( current, 0 ))) return; diff --git a/server/request.h b/server/request.h index d0baa089b4e..a389a4eb6f7 100644 --- a/server/request.h +++ b/server/request.h @@ -1719,7 +1719,7 @@ C_ASSERT( sizeof(struct get_thread_input_reply) == 64 ); C_ASSERT( sizeof(struct get_last_input_time_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_last_input_time_reply, time) == 8 ); C_ASSERT( sizeof(struct get_last_input_time_reply) == 16 ); -C_ASSERT( FIELD_OFFSET(struct get_key_state_request, tid) == 12 ); +C_ASSERT( FIELD_OFFSET(struct get_key_state_request, async) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_key_state_request, key) == 16 ); C_ASSERT( sizeof(struct get_key_state_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_key_state_reply, state) == 8 ); diff --git a/server/trace.c b/server/trace.c index b45dfc286b7..ee11cfc9c3c 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3401,7 +3401,7 @@ static void dump_get_last_input_time_reply( const struct get_last_input_time_rep static void dump_get_key_state_request( const struct get_key_state_request *req ) { - fprintf( stderr, " tid=%04x", req->tid ); + fprintf( stderr, " async=%d", req->async ); fprintf( stderr, ", key=%d", req->key ); }
1
0
0
0
Rémi Bernon : user32/tests: Add GetKeyState tests vs SetKeyboardState calls.
by Alexandre Julliard
02 Apr '21
02 Apr '21
Module: wine Branch: master Commit: ee7c17c16d8ff23f32d384bf87e266b92515cde2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ee7c17c16d8ff23f32d384bf…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 2 10:07:58 2021 +0200 user32/tests: Add GetKeyState tests vs SetKeyboardState calls. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/input.c | 120 +++++++++++++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 39 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=ee7c17c16d8ff23f32d3…
1
0
0
0
Rémi Bernon : user32/tests: Repeat each GetKeyState test a few times.
by Alexandre Julliard
02 Apr '21
02 Apr '21
Module: wine Branch: master Commit: 53a6b55ff64a49c2409872571ee9d626c5071cda URL:
https://source.winehq.org/git/wine.git/?a=commit;h=53a6b55ff64a49c240987257…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 2 10:07:57 2021 +0200 user32/tests: Repeat each GetKeyState test a few times. As it changes the results on the second and later iterations. This shows for instance that without a thread message queue, the first key press is always missed but then the thread input will follow desktop async keystate updates. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/input.c | 148 ++++++++++++++++++++++++---------------------- 1 file changed, 77 insertions(+), 71 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=53a6b55ff64a49c24098…
1
0
0
0
← Newer
1
...
79
80
81
82
83
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