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
November 2022
----- 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
1 participants
1171 discussions
Start a n
N
ew thread
Alexandre Julliard : winebuild: Use RVAs instead of absolute addresses in the delay import descriptors.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 0c39285077eb75783daa3c78226dc91e14266ed6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0c39285077eb75783daa3c78226dc9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 29 14:00:00 2022 +0100 winebuild: Use RVAs instead of absolute addresses in the delay import descriptors. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecrt0/delay_load.c | 46 ++++++++++++++----------------------- tools/winebuild/build.h | 1 + tools/winebuild/import.c | 56 ++++++++++++++++++++++------------------------ tools/winebuild/spec32.c | 2 ++ 4 files changed, 47 insertions(+), 58 deletions(-) diff --git a/dlls/winecrt0/delay_load.c b/dlls/winecrt0/delay_load.c index 4ba840479d8..af14fce3668 100644 --- a/dlls/winecrt0/delay_load.c +++ b/dlls/winecrt0/delay_load.c @@ -24,49 +24,37 @@ #include "delayloadhandler.h" WINBASEAPI void *WINAPI DelayLoadFailureHook( LPCSTR name, LPCSTR function ); - -#ifdef __WINE_PE_BUILD - -extern IMAGE_DOS_HEADER __ImageBase; - WINBASEAPI void *WINAPI ResolveDelayLoadedAPI( void* base, const IMAGE_DELAYLOAD_DESCRIPTOR* desc, PDELAYLOAD_FAILURE_DLL_CALLBACK dllhook, PDELAYLOAD_FAILURE_SYSTEM_ROUTINE syshook, IMAGE_THUNK_DATA* addr, ULONG flags ); -FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAGE_THUNK_DATA *addr ) +static inline void *image_base(void) { - return ResolveDelayLoadedAPI( &__ImageBase, descr, NULL, DelayLoadFailureHook, addr, 0 ); +#ifdef __WINE_PE_BUILD + extern IMAGE_DOS_HEADER __ImageBase; + return (void *)&__ImageBase; +#else + extern IMAGE_NT_HEADERS __wine_spec_nt_header; + return (void *)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff); +#endif } -#else /* __WINE_PE_BUILD */ - -struct ImgDelayDescr +FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAGE_THUNK_DATA *addr ) { - DWORD_PTR grAttrs; - LPCSTR szName; - HMODULE *phmod; - IMAGE_THUNK_DATA *pIAT; - const IMAGE_THUNK_DATA *pINT; - const IMAGE_THUNK_DATA *pBoundIAT; - const IMAGE_THUNK_DATA *pUnloadIAT; - DWORD_PTR dwTimeStamp; -}; + return ResolveDelayLoadedAPI( image_base(), descr, NULL, DelayLoadFailureHook, addr, 0 ); +} + +#ifndef __WINE_PE_BUILD -extern struct ImgDelayDescr __wine_spec_delay_imports[]; +extern IMAGE_DELAYLOAD_DESCRIPTOR __wine_spec_delay_imports[]; FARPROC WINAPI DECLSPEC_HIDDEN __wine_spec_delay_load( unsigned int id ) { - struct ImgDelayDescr *descr = __wine_spec_delay_imports + HIWORD(id); - WORD func = LOWORD(id); - FARPROC proc; + const IMAGE_DELAYLOAD_DESCRIPTOR *descr = __wine_spec_delay_imports + HIWORD(id); + IMAGE_THUNK_DATA *thunk = (IMAGE_THUNK_DATA *)((char *)image_base() + descr->ImportAddressTableRVA); - if (!*descr->phmod) *descr->phmod = LoadLibraryA( descr->szName ); - if (!*descr->phmod || - !(proc = GetProcAddress( *descr->phmod, (LPCSTR)descr->pINT[func].u1.Function ))) - proc = DelayLoadFailureHook( descr->szName, (LPCSTR)descr->pINT[func].u1.Function ); - descr->pIAT[func].u1.Function = (ULONG_PTR)proc; - return proc; + return __delayLoadHelper2( descr, thunk + LOWORD(id) ); } #endif /* __WINE_PE_BUILD */ diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index f501cca8f84..3b5ba0fff2a 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -303,6 +303,7 @@ extern void read_undef_symbols( DLLSPEC *spec, struct strarray files ); extern void resolve_imports( DLLSPEC *spec ); extern int is_undefined( const char *name ); extern int has_imports(void); +extern int has_delay_imports(void); extern void output_get_pc_thunk(void); extern void output_module( DLLSPEC *spec ); extern void output_stubs( DLLSPEC *spec ); diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 57adbef0d23..4c77c6cc60e 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -821,6 +821,12 @@ int has_imports(void) return !list_empty( &dll_imports ); } +/* check if we need a delayed import directory */ +int has_delay_imports(void) +{ + return !list_empty( &dll_delayed ); +} + /* output the import table of a Win32 module */ static void output_immediate_imports(void) { @@ -928,7 +934,7 @@ static void output_immediate_import_thunks(void) /* output the delayed import table of a Win32 module */ static void output_delayed_imports( const DLLSPEC *spec ) { - int j, mod; + int j, iat_pos, int_pos, mod_pos; struct import *import; if (list_empty( &dll_delayed )) return; @@ -936,36 +942,28 @@ static void output_delayed_imports( const DLLSPEC *spec ) output( "\n/* delayed imports */\n\n" ); output( "\t.data\n" ); output( "\t.align %d\n", get_alignment(get_ptr_size()) ); + output( ".L__wine_spec_delay_imports:\n" ); output( "%s\n", asm_globl("__wine_spec_delay_imports") ); /* list of dlls */ - j = mod = 0; + iat_pos = int_pos = mod_pos = 0; LIST_FOR_EACH_ENTRY( import, &dll_delayed, struct import, entry ) { - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* grAttrs */ - output( "\t%s .L__wine_delay_name_%s\n", /* szName */ - get_asm_ptr_keyword(), import->c_name ); - output( "\t%s .L__wine_delay_modules+%d\n", /* phmod */ - get_asm_ptr_keyword(), mod * get_ptr_size() ); - output( "\t%s .L__wine_delay_IAT+%d\n", /* pIAT */ - get_asm_ptr_keyword(), j * get_ptr_size() ); - output( "\t%s .L__wine_delay_INT+%d\n", /* pINT */ - get_asm_ptr_keyword(), j * get_ptr_size() ); - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pBoundIAT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pUnloadIAT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* dwTimeStamp */ - j += import->nb_imports; - mod++; + output( "\t.long 1\n" ); /* Attributes */ + output_rva( ".L__wine_delay_name_%s", import->c_name ); /* DllNameRVA */ + output_rva( ".L__wine_delay_modules+%d", mod_pos ); /* ModuleHandleRVA */ + output_rva( ".L__wine_delay_IAT+%d", iat_pos ); /* ImportAddressTableRVA */ + output_rva( ".L__wine_delay_INT+%d", int_pos ); /* ImportNameTableRVA */ + output( "\t.long 0\n" ); /* BoundImportAddressTableRVA */ + output( "\t.long 0\n" ); /* UnloadInformationTableRVA */ + output( "\t.long 0\n" ); /* TimeDateStamp */ + iat_pos += import->nb_imports * get_ptr_size(); + int_pos += (import->nb_imports + 1) * get_ptr_size(); + mod_pos += get_ptr_size(); } - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* grAttrs */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* szName */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* phmod */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pIAT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pINT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pBoundIAT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* pUnloadIAT */ - output( "\t%s 0\n", get_asm_ptr_keyword() ); /* dwTimeStamp */ + output( "\t.long 0,0,0,0,0,0,0,0\n" ); + output( ".L__wine_spec_delay_imports_end:\n" ); output( "\n.L__wine_delay_IAT:\n" ); LIST_FOR_EACH_ENTRY( import, &dll_delayed, struct import, entry ) @@ -986,12 +984,10 @@ static void output_delayed_imports( const DLLSPEC *spec ) for (j = 0; j < import->nb_imports; j++) { struct import_func *func = &import->imports[j]; - if (!func->name) - output( "\t%s %d\n", get_asm_ptr_keyword(), func->ordinal ); - else - output( "\t%s .L__wine_delay_data_%s_%s\n", - get_asm_ptr_keyword(), import->c_name, func->name ); + output_thunk_rva( func->name ? -1 : func->ordinal, + ".L__wine_delay_data_%s_%s", import->c_name, func->name ); } + output( "\t%s 0\n", get_asm_ptr_keyword() ); } output( "\n.L__wine_delay_modules:\n" ); @@ -1012,7 +1008,9 @@ static void output_delayed_imports( const DLLSPEC *spec ) { struct import_func *func = &import->imports[j]; if (!func->name) continue; + output( "\t.align %d\n", get_alignment(2) ); output( ".L__wine_delay_data_%s_%s:\n", import->c_name, func->name ); + output( "\t.short %d\n", func->hint ); output( "\t%s \"%s\"\n", get_asm_string_keyword(), func->name ); } } diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index a4a95f09c43..296d15c5d3b 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -735,6 +735,8 @@ void output_module( DLLSPEC *spec ) data_dirs[1] = ".L__wine_spec_imports"; /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */ if (spec->nb_resources) data_dirs[2] = ".L__wine_spec_resources"; /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */ + if (has_delay_imports()) + data_dirs[13] = ".L__wine_spec_delay_imports"; /* DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT] */ output_data_directories( data_dirs );
1
0
0
0
Alexandre Julliard : winebuild: Add a helper function to output a thunk data pointer.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 29060f3d7812d511cb11cb2f8d87c6c43b075881 URL:
https://gitlab.winehq.org/wine/wine/-/commit/29060f3d7812d511cb11cb2f8d87c6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 29 13:55:01 2022 +0100 winebuild: Add a helper function to output a thunk data pointer. --- tools/winebuild/build.h | 2 ++ tools/winebuild/import.c | 33 ++++----------------------------- tools/winebuild/utils.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 576304cd2b8..f501cca8f84 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -252,6 +252,8 @@ extern void output_cfi( const char *format, ... ) __attribute__ ((__format__ (__printf__, 1, 2))); extern void output_rva( const char *format, ... ) __attribute__ ((__format__ (__printf__, 1, 2))); +extern void output_thunk_rva( int ordinal, const char *format, ... ) + __attribute__ ((__format__ (__printf__, 2, 3))); extern void spawn( struct strarray array ); extern struct strarray find_tool( const char *name, const char * const *names ); extern struct strarray find_link_tool(void); diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 9f87adcf593..57adbef0d23 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -869,16 +869,8 @@ static void output_immediate_imports(void) if (func->name) output( "__imp_%s:\n", asm_name( func->name )); else if (func->export_name) output( "__imp_%s:\n", asm_name( func->export_name )); } - if (func->name) - output( "\t%s .L__wine_spec_import_data_%s_%s-.L__wine_spec_rva_base\n", - get_asm_ptr_keyword(), import->c_name, func->name ); - else - { - if (get_ptr_size() == 8) - output( "\t.quad 0x800000000000%04x\n", func->ordinal ); - else - output( "\t.long 0x8000%04x\n", func->ordinal ); - } + output_thunk_rva( func->name ? -1 : func->ordinal, + ".L__wine_spec_import_data_%s_%s", import->c_name, func->name ); } output( "\t%s 0\n", get_asm_ptr_keyword() ); } @@ -1861,31 +1853,14 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struc } output( "\n\t.section \".idata$4\"\n" ); - if (by_name) - { - output_rva( ".L__wine_import_name" ); - if (get_ptr_size() == 8) output( "\t.long 0\n" ); - } - else - { - if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", odp->ordinal ); - else output( "\t.quad 0x800000000000%04x\n", odp->ordinal ); - } + output_thunk_rva( by_name ? -1 : odp->ordinal, ".L__wine_import_name" ); output( "\n\t.section \".idata$5\"\n" ); output( "%s\n", asm_globl( imp_name ) ); if (is_delay) output( "\t%s .L__wine_delay_import\n", get_asm_ptr_keyword() ); - else if (by_name) - { - output_rva( ".L__wine_import_name" ); - if (get_ptr_size() == 8) output( "\t.long 0\n" ); - } else - { - if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", odp->ordinal ); - else output( "\t.quad 0x800000000000%04x\n", odp->ordinal ); - } + output_thunk_rva( by_name ? -1 : odp->ordinal, ".L__wine_import_name" ); if (by_name) { diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 7f10939da36..21de209f65c 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -984,6 +984,38 @@ void output_rva( const char *format, ... ) va_end( valist ); } +/* output an RVA pointer or ordinal for a function thunk */ +void output_thunk_rva( int ordinal, const char *format, ... ) +{ + if (ordinal == -1) + { + va_list valist; + + va_start( valist, format ); + switch (target.platform) + { + case PLATFORM_MINGW: + case PLATFORM_WINDOWS: + output( "\t.rva " ); + vfprintf( output_file, format, valist ); + fputc( '\n', output_file ); + if (get_ptr_size() == 8) output( "\t.long 0\n" ); + break; + default: + output( "\t%s ", get_asm_ptr_keyword() ); + vfprintf( output_file, format, valist ); + output( " - .L__wine_spec_rva_base\n" ); + break; + } + va_end( valist ); + } + else + { + if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", ordinal ); + else output( "\t.quad 0x800000000000%04x\n", ordinal ); + } +} + /* output the GNU note for non-exec stack */ void output_gnu_stack_note(void) {
1
0
0
0
Alexandre Julliard : ntdll: Also fixup the delay import directory when mapping a .so dll.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: d406de182808fa58f9c1e30f46080ff80cb03a75 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d406de182808fa58f9c1e30f46080f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 29 13:15:52 2022 +0100 ntdll: Also fixup the delay import directory when mapping a .so dll. --- dlls/ntdll/unix/loader.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index deb25a8e35e..8e7bb155c86 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -962,6 +962,27 @@ static NTSTATUS map_so_dll( const IMAGE_NT_HEADERS *nt_descr, HMODULE module ) fixup_rva_dwords( (DWORD *)(addr + exports->AddressOfNames), delta, exports->NumberOfNames ); fixup_rva_ptrs( addr + exports->AddressOfFunctions, addr, exports->NumberOfFunctions ); } + + /* build the delay import directory */ + + dir = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT]; + if (dir->Size) + { + IMAGE_DELAYLOAD_DESCRIPTOR *imports = (IMAGE_DELAYLOAD_DESCRIPTOR *)(addr + dir->VirtualAddress); + + while (imports->DllNameRVA) + { + fixup_rva_dwords( &imports->DllNameRVA, delta, 1 ); + fixup_rva_dwords( &imports->ModuleHandleRVA, delta, 1 ); + fixup_rva_dwords( &imports->ImportAddressTableRVA, delta, 1 ); + fixup_rva_dwords( &imports->ImportNameTableRVA, delta, 1 ); + fixup_rva_dwords( &imports->BoundImportAddressTableRVA, delta, 1 ); + fixup_rva_dwords( &imports->UnloadInformationTableRVA, delta, 1 ); + fixup_rva_names( (UINT_PTR *)(addr + imports->ImportNameTableRVA), delta ); + imports++; + } + } + return STATUS_SUCCESS; }
1
0
0
0
Alex Henrie : vbscript: Fix memory leak on realloc failure in Global_Split (cppcheck).
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 06395e5cd95fb5cbbc6724d9eddc0ca7bdc46842 URL:
https://gitlab.winehq.org/wine/wine/-/commit/06395e5cd95fb5cbbc6724d9eddc0c…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Mon Nov 28 22:30:40 2022 -0700 vbscript: Fix memory leak on realloc failure in Global_Split (cppcheck). --- dlls/vbscript/global.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 98c705f4712..9eac80218fd 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -2574,7 +2574,7 @@ static HRESULT Global_Split(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, { BSTR str, string, delimiter = NULL; int count, max, mode, len, start, end, ret, delimiterlen = 1; - int i,*indices = NULL, indices_max = 8; + int i, *indices = NULL, *new_indices, indices_max = 8; SAFEARRAYBOUND bounds; SAFEARRAY *sa = NULL; VARIANT *data, var; @@ -2656,12 +2656,13 @@ static HRESULT Global_Split(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, } if (count == indices_max) { - indices_max *= 2; - indices = realloc( indices, indices_max * sizeof(int)); - if(!indices) { + new_indices = realloc(indices, indices_max * 2 * sizeof(int)); + if(!new_indices) { hres = E_OUTOFMEMORY; goto error; } + indices = new_indices; + indices_max *= 2; } indices[count++] = end;
1
0
0
0
Alex Henrie : atl: Fix memory leak on error path in do_process_root_key (scan-build).
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: cb4d61efa185f495d4a9a371f8ea857bbe1e785e URL:
https://gitlab.winehq.org/wine/wine/-/commit/cb4d61efa185f495d4a9a371f8ea85…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Mon Nov 28 21:50:39 2022 -0700 atl: Fix memory leak on error path in do_process_root_key (scan-build). --- dlls/atl/registrar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/atl/registrar.c b/dlls/atl/registrar.c index 5e03b42132c..9009cd1c7cf 100644 --- a/dlls/atl/registrar.c +++ b/dlls/atl/registrar.c @@ -383,7 +383,7 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register) strbuf_init(&buf); hres = get_word(&iter, &buf); if(FAILED(hres)) - return hres; + goto done; while(*iter) { if(!buf.len) { @@ -417,6 +417,8 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register) if(FAILED(hres)) break; } + +done: free(buf.str); return hres; }
1
0
0
0
Alex Henrie : comctl32: Use standard C functions for memory allocation in edit.c.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 5fe082172d71abdca6f1bbad0be96478247db9dd URL:
https://gitlab.winehq.org/wine/wine/-/commit/5fe082172d71abdca6f1bbad0be964…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sun Nov 27 17:10:16 2022 -0700 comctl32: Use standard C functions for memory allocation in edit.c. --- dlls/comctl32/edit.c | 78 +++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 96ed2b0ae1b..eb74af29aa5 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -44,7 +44,6 @@ #include "uxtheme.h" #include "vsstyle.h" #include "wine/debug.h" -#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(edit); @@ -239,7 +238,7 @@ static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT memset(&psa,0,sizeof(SCRIPT_ANALYSIS)); psa.eScript = SCRIPT_UNDEFINED; - es->logAttr = heap_alloc(sizeof(SCRIPT_LOGATTR) * get_text_length(es)); + es->logAttr = malloc(sizeof(SCRIPT_LOGATTR) * get_text_length(es)); ScriptBreak(es->text, get_text_length(es), &psa, es->logAttr); } @@ -477,7 +476,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta { /* The buffer has been expanded, create a new line and insert it into the link list */ - LINEDEF *new_line = heap_alloc_zero(sizeof(*new_line)); + LINEDEF *new_line = calloc(1, sizeof(*new_line)); new_line->next = previous_line->next; previous_line->next = new_line; current_line = new_line; @@ -487,7 +486,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta { /* The previous line merged with this line so we delete this extra entry */ previous_line->next = current_line->next; - heap_free(current_line); + free(current_line); current_line = previous_line->next; es->line_count--; continue; @@ -587,7 +586,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta if (current_line->ssa) { count = ScriptString_pcOutChars(current_line->ssa); - piDx = heap_alloc(sizeof(INT) * (*count)); + piDx = malloc(sizeof(INT) * (*count)); ScriptStringGetLogicalWidths(current_line->ssa,piDx); prev = current_line->net_length-1; @@ -597,7 +596,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta } while ( prev > 0 && current_line->width > fw); if (prev<=0) prev = 1; - heap_free(piDx); + free(piDx); } else prev = (fw / es->char_width); @@ -686,7 +685,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta { pnext = current_line->next; EDIT_InvalidateUniscribeData_linedef(current_line); - heap_free(current_line); + free(current_line); current_line = pnext; es->line_count--; } @@ -1174,7 +1173,7 @@ static inline void text_buffer_changed(EDITSTATE *es) { es->text_length = (UINT)-1; - heap_free( es->logAttr ); + free(es->logAttr); es->logAttr = NULL; EDIT_InvalidateUniscribeData(es); } @@ -1300,7 +1299,8 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size) TRACE("trying to ReAlloc to %d+1\n", size); alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR)); - if ((new_undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) { + if ((new_undo_text = realloc(es->undo_text, alloc_size))) { + memset(new_undo_text + es->undo_buffer_size, 0, alloc_size - es->undo_buffer_size * sizeof(WCHAR)); es->undo_text = new_undo_text; es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1; return TRUE; @@ -2473,7 +2473,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r /* there is something to be deleted */ TRACE("deleting stuff.\n"); bufl = e - s; - buf = heap_alloc((bufl + 1) * sizeof(WCHAR)); + buf = malloc((bufl + 1) * sizeof(WCHAR)); if (!buf) return; memcpy(buf, es->text + s, bufl * sizeof(WCHAR)); buf[bufl] = 0; /* ensure 0 termination */ @@ -2586,7 +2586,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r EDIT_EM_EmptyUndoBuffer(es); } - heap_free(buf); + free(buf); s += strl; @@ -2831,12 +2831,12 @@ static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, const INT *tabs) { if (!(es->style & ES_MULTILINE)) return FALSE; - heap_free(es->tabs); + free(es->tabs); es->tabs_count = count; if (!count) es->tabs = NULL; else { - es->tabs = heap_alloc(count * sizeof(INT)); + es->tabs = malloc(count * sizeof(INT)); memcpy(es->tabs, tabs, count * sizeof(INT)); } EDIT_InvalidateUniscribeData(es); @@ -2880,7 +2880,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es) ulength = lstrlenW(es->undo_text); - utext = heap_alloc((ulength + 1) * sizeof(WCHAR)); + utext = malloc((ulength + 1) * sizeof(WCHAR)); lstrcpyW(utext, es->undo_text); @@ -2894,7 +2894,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es) /* send the notification after the selection start and end are set */ if (!notify_parent(es, EN_CHANGE)) return TRUE; EDIT_EM_ScrollCaret(es); - heap_free(utext); + free(utext); TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n", es->undo_insert_count, debugstr_w(es->undo_text)); @@ -4203,14 +4203,6 @@ static LRESULT EDIT_EM_GetThumb(EDITSTATE *es) EDIT_WM_HScroll(es, EM_GETTHUMB, 0)); } -static inline WCHAR *heap_strdupW(const WCHAR *str) -{ - int len = lstrlenW(str) + 1; - WCHAR *ret = heap_alloc(len * sizeof(WCHAR)); - lstrcpyW(ret, str); - return ret; -} - /********************************************************************* * * EM_SETCUEBANNER @@ -4221,8 +4213,8 @@ static BOOL EDIT_EM_SetCueBanner(EDITSTATE *es, BOOL draw_focused, const WCHAR * if (es->style & ES_MULTILINE || !cue_text) return FALSE; - heap_free(es->cue_banner_text); - es->cue_banner_text = heap_strdupW(cue_text); + free(es->cue_banner_text); + es->cue_banner_text = wcsdup(cue_text); es->cue_banner_draw_focused = draw_focused; return TRUE; @@ -4272,7 +4264,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) return; } - lpCompStr = heap_alloc(buflen); + lpCompStr = malloc(buflen); if (!lpCompStr) { ERR("Unable to allocate IME CompositionString\n"); @@ -4292,11 +4284,11 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) if (dwBufLenAttr) { dwBufLenAttr ++; - lpCompStrAttr = heap_alloc(dwBufLenAttr + 1); + lpCompStrAttr = malloc(dwBufLenAttr + 1); if (!lpCompStrAttr) { ERR("Unable to allocate IME Attribute String\n"); - heap_free(lpCompStr); + free(lpCompStr); return; } ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr, @@ -4323,8 +4315,8 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) es->selection_start = es->composition_start; es->selection_end = es->selection_start + es->composition_len; - heap_free(lpCompStrAttr); - heap_free(lpCompStr); + free(lpCompStrAttr); + free(lpCompStr); } static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) @@ -4338,7 +4330,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) return; } - lpResultStr = heap_alloc(buflen); + lpResultStr = malloc(buflen); if (!lpResultStr) { ERR("Unable to alloc buffer for IME string\n"); @@ -4357,7 +4349,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) es->composition_start = es->selection_end; es->composition_len = 0; - heap_free(lpResultStr); + free(lpResultStr); } static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) @@ -4404,7 +4396,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) TRACE("Creating edit control, style = %#lx\n", lpcs->style); - if (!(es = heap_alloc_zero(sizeof(*es)))) + if (!(es = calloc(1, sizeof(*es)))) return FALSE; SetWindowLongPtrW( hwnd, 0, (LONG_PTR)es ); @@ -4466,12 +4458,12 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) goto cleanup; es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1; - if (!(es->undo_text = heap_alloc_zero((es->buffer_size + 1) * sizeof(WCHAR)))) + if (!(es->undo_text = calloc(es->buffer_size + 1, sizeof(WCHAR)))) goto cleanup; es->undo_buffer_size = es->buffer_size; if (es->style & ES_MULTILINE) - if (!(es->first_line_def = heap_alloc_zero(sizeof(LINEDEF)))) + if (!(es->first_line_def = calloc(1, sizeof(LINEDEF)))) goto cleanup; es->line_count = 1; @@ -4496,11 +4488,11 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) cleanup: SetWindowLongPtrW(es->hwndSelf, 0, 0); EDIT_InvalidateUniscribeData(es); - heap_free(es->first_line_def); - heap_free(es->undo_text); + free(es->first_line_def); + free(es->undo_text); if (es->hloc32W) LocalFree(es->hloc32W); - heap_free(es->logAttr); - heap_free(es); + free(es->logAttr); + free(es); return FALSE; } @@ -4583,14 +4575,14 @@ static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es) while (pc) { pp = pc->next; - heap_free(pc); + free(pc); pc = pp; } SetWindowLongPtrW( es->hwndSelf, 0, 0 ); - heap_free(es->undo_text); - heap_free(es->cue_banner_text); - heap_free(es); + free(es->undo_text); + free(es->cue_banner_text); + free(es); return 0; }
1
0
0
0
Rémi Bernon : joy.cpl: Merge the dinput test and force feedback tabs.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 77572690f577c02f336576103b10631da594514c URL:
https://gitlab.winehq.org/wine/wine/-/commit/77572690f577c02f336576103b1063…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Nov 27 01:30:02 2022 +0100 joy.cpl: Merge the dinput test and force feedback tabs. --- dlls/joy.cpl/joy.rc | 17 +-- dlls/joy.cpl/main.c | 398 +++++++++++++++--------------------------------- dlls/joy.cpl/resource.h | 5 +- po/ar.po | 14 +- po/ast.po | 12 +- po/bg.po | 13 +- po/ca.po | 14 +- po/cs.po | 14 +- po/da.po | 14 +- po/de.po | 14 +- po/el.po | 14 +- po/en.po | 14 +- po/en_US.po | 14 +- po/eo.po | 14 +- po/es.po | 14 +- po/fa.po | 12 +- po/fi.po | 14 +- po/fr.po | 14 +- po/he.po | 14 +- po/hi.po | 12 +- po/hr.po | 14 +- po/hu.po | 14 +- po/it.po | 14 +- po/ja.po | 14 +- po/ko.po | 14 +- po/lt.po | 14 +- po/ml.po | 12 +- po/nb_NO.po | 14 +- po/nl.po | 14 +- po/or.po | 12 +- po/pa.po | 12 +- po/pl.po | 14 +- po/pt_BR.po | 14 +- po/pt_PT.po | 14 +- po/rm.po | 12 +- po/ro.po | 12 +- po/ru.po | 14 +- po/si.po | 12 +- po/sk.po | 14 +- po/sl.po | 14 +- po/sr_RS(a)cyrillic.po | 13 +- po/sr_RS(a)latin.po | 13 +- po/sv.po | 14 +- po/ta.po | 12 +- po/te.po | 12 +- po/th.po | 14 +- po/tr.po | 14 +- po/uk.po | 14 +- po/wa.po | 12 +- po/wine.pot | 12 +- po/zh_CN.po | 14 +- po/zh_TW.po | 14 +- 52 files changed, 366 insertions(+), 711 deletions(-)
1
0
0
0
Rémi Bernon : joy.cpl: Reduce the button size on the device test tab.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: 8f618096902ef1502c9e439b41962810dd3cc0e0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/8f618096902ef1502c9e439b419628…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Nov 27 01:05:26 2022 +0100 joy.cpl: Reduce the button size on the device test tab. --- dlls/joy.cpl/joy.rc | 4 ++-- dlls/joy.cpl/main.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/joy.cpl/joy.rc b/dlls/joy.cpl/joy.rc index 8086ecec6e1..d1c179d2ef3 100644 --- a/dlls/joy.cpl/joy.rc +++ b/dlls/joy.cpl/joy.rc @@ -55,8 +55,8 @@ CAPTION "Test Joystick" FONT 8, "Ms Shell Dlg" { COMBOBOX IDC_TESTSELECTCOMBO, 5, 5, 200, 60, CBS_DROPDOWNLIST | CBS_HASSTRINGS - GROUPBOX "Buttons", IDC_STATIC, 0, 110, 250, 110 - GROUPBOX "", IDC_TESTGROUPXY, 15, 30, 60, 60 + GROUPBOX "Buttons", IDC_STATIC, 15, 100, 291, 70 + GROUPBOX "", IDC_TESTGROUPXY, 15, 30, 60, 60 GROUPBOX "", IDC_TESTGROUPRXRY, 92, 30, 60, 60 GROUPBOX "", IDC_TESTGROUPZRZ, 169, 30, 60, 60 GROUPBOX "", IDC_TESTGROUPPOV, 246, 30, 60, 60 diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c index cc1ce800445..e48762d18f1 100644 --- a/dlls/joy.cpl/main.c +++ b/dlls/joy.cpl/main.c @@ -43,13 +43,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(joycpl); #define TEST_MAX_AXES 4 #define TEST_POLL_TIME 100 -#define TEST_BUTTON_COL_MAX 8 -#define TEST_BUTTON_X 8 -#define TEST_BUTTON_Y 122 -#define TEST_NEXT_BUTTON_X 30 -#define TEST_NEXT_BUTTON_Y 25 -#define TEST_BUTTON_SIZE_X 20 -#define TEST_BUTTON_SIZE_Y 18 +#define TEST_BUTTON_COL_MAX 16 +#define TEST_BUTTON_X 24 +#define TEST_BUTTON_Y 112 +#define TEST_NEXT_BUTTON_X 17 +#define TEST_NEXT_BUTTON_Y 15 +#define TEST_BUTTON_SIZE_X 16 +#define TEST_BUTTON_SIZE_Y 14 #define TEST_AXIS_X 43 #define TEST_AXIS_Y 60
1
0
0
0
Rémi Bernon : joy.cpl: Use a notification event rather than polling state.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: a2a80136875f4c0f504d5b84c3ecf04e06ef28ca URL:
https://gitlab.winehq.org/wine/wine/-/commit/a2a80136875f4c0f504d5b84c3ecf0…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Nov 26 23:16:15 2022 +0100 joy.cpl: Use a notification event rather than polling state. --- dlls/joy.cpl/main.c | 55 +++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c index ab2314bad5f..cc1ce800445 100644 --- a/dlls/joy.cpl/main.c +++ b/dlls/joy.cpl/main.c @@ -113,6 +113,8 @@ static IDirectInputEffect *effect_selected; static struct list devices = LIST_INIT( devices ); static IDirectInputDevice8W *device_selected; +static HANDLE device_state_event; + /********************************************************************* * DllMain */ @@ -292,10 +294,17 @@ static void set_selected_device( IDirectInputDevice8W *device ) set_selected_effect( NULL ); - if (device) IDirectInputDevice8_AddRef( device ); - previous = device_selected; - device_selected = device; - if (previous) IDirectInputEffect_Release( previous ); + if ((previous = device_selected)) + { + IDirectInputDevice8_SetEventNotification( previous, NULL ); + IDirectInputDevice8_Release( previous ); + } + if ((device_selected = device)) + { + IDirectInputDevice8_AddRef( device ); + IDirectInputDevice8_SetEventNotification( device, device_state_event ); + IDirectInputDevice8_Acquire( device ); + } LeaveCriticalSection( &joy_cs ); } @@ -601,24 +610,6 @@ static void dump_joy_state(DIJOYSTATE* st) TRACE("\n"); } -static void poll_input( IDirectInputDevice8W *device, DIJOYSTATE *state ) -{ - HRESULT hr; - - hr = IDirectInputDevice8_Poll( device ); - - /* If it failed, try to acquire the joystick */ - if (FAILED(hr)) - { - hr = IDirectInputDevice8_Acquire( device ); - while (hr == DIERR_INPUTLOST) hr = IDirectInputDevice8_Acquire( device ); - } - - if (hr == DIERR_OTHERAPPHASPRIO) return; - - IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE), state ); -} - static DWORD WINAPI input_thread(void *param) { int axes_pos[TEST_MAX_AXES][2]; @@ -647,9 +638,11 @@ static DWORD WINAPI input_thread(void *param) memset( &state, 0, sizeof(state) ); + if (WaitForSingleObject( device_state_event, TEST_POLL_TIME ) == WAIT_TIMEOUT) continue; + if ((device = get_selected_device())) { - poll_input( device, &state ); + IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); IDirectInputDevice8_Release( device ); } @@ -688,8 +681,6 @@ static DWORD WINAPI input_thread(void *param) SetWindowPos(data->graphics.axes[i], 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } - - Sleep(TEST_POLL_TIME); } return 0; @@ -981,11 +972,13 @@ static DWORD WINAPI ff_input_thread(void *param) }; RECT r; - Sleep(TEST_POLL_TIME); + if (WaitForSingleObject( device_state_event, TEST_POLL_TIME ) == WAIT_TIMEOUT) continue; - if (!(device = get_selected_device())) continue; - poll_input( device, &state ); - IDirectInputDevice8_Release( device ); + if ((device = get_selected_device())) + { + IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + IDirectInputDevice8_Release( device ); + } if (!(effect = get_selected_effect())) continue; @@ -1214,6 +1207,8 @@ LONG CALLBACK CPlApplet(HWND hwnd, UINT command, LPARAM lParam1, LPARAM lParam2) { HRESULT hr; + device_state_event = CreateEventW( NULL, FALSE, FALSE, NULL ); + /* Initialize dinput */ hr = DirectInput8Create(GetModuleHandleW(NULL), DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void**)&data.di, NULL); @@ -1251,6 +1246,8 @@ LONG CALLBACK CPlApplet(HWND hwnd, UINT command, LPARAM lParam1, LPARAM lParam2) /* And destroy dinput too */ IDirectInput8_Release(data.di); + + CloseHandle( device_state_event ); break; }
1
0
0
0
Rémi Bernon : joy.cpl: Always start input threads and remove num_ff member.
by Alexandre Julliard
29 Nov '22
29 Nov '22
Module: wine Branch: master Commit: eb00dd0db1cb196a48ec113892b5a165314c9cf4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/eb00dd0db1cb196a48ec113892b5a1…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Nov 26 21:47:52 2022 +0100 joy.cpl: Always start input threads and remove num_ff member. --- dlls/joy.cpl/main.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c index f2d4212b0aa..ab2314bad5f 100644 --- a/dlls/joy.cpl/main.c +++ b/dlls/joy.cpl/main.c @@ -92,7 +92,6 @@ struct Graphics struct JoystickData { IDirectInput8W *di; - int num_ff; struct Graphics graphics; BOOL stop; }; @@ -270,7 +269,6 @@ static BOOL CALLBACK enum_devices( const DIDEVICEINSTANCEW *instance, void *cont IDirectInputDevice8_SetDataFormat( entry->device, &c_dfDIJoystick ); IDirectInputDevice8_GetCapabilities( entry->device, &caps ); - if (caps.dwFlags & DIDC_FORCEFEEDBACK) data->num_ff++; /* Set axis range to ease the GUI visualization */ proprange.diph.dwSize = sizeof(DIPROPRANGE); @@ -846,17 +844,13 @@ static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM refresh_test_joystick_list(hwnd, data); - /* Initialize input thread */ - if (!list_empty( &devices )) - { - data->stop = FALSE; + data->stop = FALSE; - /* Set the first joystick as default */ - SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_SETCURSEL, 0, 0); - test_handle_joychange(hwnd, data); + /* Set the first joystick as default */ + SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_SETCURSEL, 0, 0); + test_handle_joychange(hwnd, data); - thread = CreateThread(NULL, 0, input_thread, (void*) data, 0, &tid); - } + thread = CreateThread(NULL, 0, input_thread, (void*) data, 0, &tid); } break; @@ -1079,20 +1073,15 @@ static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp case PSN_SETACTIVE: refresh_ff_joystick_list(hwnd, data); - if (data->num_ff > 0) - { - DWORD tid; - - data->stop = FALSE; - /* Set the first joystick as default */ - SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_SETCURSEL, 0, 0); - ff_handle_joychange( hwnd ); + data->stop = FALSE; + /* Set the first joystick as default */ + SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_SETCURSEL, 0, 0); + ff_handle_joychange( hwnd ); - SendDlgItemMessageW(hwnd, IDC_FFEFFECTLIST, LB_SETCURSEL, 0, 0); - ff_handle_effectchange( hwnd ); + SendDlgItemMessageW(hwnd, IDC_FFEFFECTLIST, LB_SETCURSEL, 0, 0); + ff_handle_effectchange( hwnd ); - thread = CreateThread(NULL, 0, ff_input_thread, (void*) data, 0, &tid); - } + thread = CreateThread(NULL, 0, ff_input_thread, (void*) data, 0, NULL); break; case PSN_RESET: /* intentional fall-through */
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
118
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Results per page:
10
25
50
100
200