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
August 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
1 participants
1051 discussions
Start a n
N
ew thread
Jacek Caban : gdi32: Use ntgdi names for D3DKMT functions.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: d127a14a7f1941539753f029fb52f407514b1106 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d127a14a7f1941539753f029…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 25 13:39:45 2021 +0100 gdi32: Use ntgdi names for D3DKMT functions. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dib.c | 8 ++++---- dlls/gdi32/driver.c | 38 +++++++++++++++++++------------------- dlls/gdi32/gdi32.spec | 22 +++++++++++----------- include/ntgdi.h | 12 ++++++++++++ 4 files changed, 46 insertions(+), 34 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index de1942894de..5a8d29ae5bf 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1579,9 +1579,9 @@ error: /*********************************************************************** - * D3DKMTCreateDCFromMemory (GDI32.@) + * NtGdiDdDDICreateDCFromMemory (win32u.@) */ -NTSTATUS WINAPI D3DKMTCreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ) +NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ) { const struct d3dddi_format_info { @@ -1693,9 +1693,9 @@ error: /*********************************************************************** - * D3DKMTDestroyDCFromMemory (GDI32.@) + * NtGdiDdDDIDestroyDCFromMemory (win32u.@) */ -NTSTATUS WINAPI D3DKMTDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *desc ) +NTSTATUS WINAPI NtGdiDdDDIDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *desc ) { if (!desc) return STATUS_INVALID_PARAMETER; diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 1df4660211e..fba1f1cffea 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -1203,27 +1203,27 @@ ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID) } /****************************************************************************** - * D3DKMTOpenAdapterFromHdc [GDI32.@] + * NtGdiDdDDIOpenAdapterFromHdc (win32u.@) */ -NTSTATUS WINAPI D3DKMTOpenAdapterFromHdc( void *pData ) +NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromHdc( void *pData ) { FIXME("(%p): stub\n", pData); return STATUS_NO_MEMORY; } /****************************************************************************** - * D3DKMTEscape [GDI32.@] + * NtGdiDdDDIEscape (win32u.@) */ -NTSTATUS WINAPI D3DKMTEscape( const void *pData ) +NTSTATUS WINAPI NtGdiDdDDIEscape( const void *pData ) { FIXME("(%p): stub\n", pData); return STATUS_NO_MEMORY; } /****************************************************************************** - * D3DKMTCloseAdapter [GDI32.@] + * NtGdiDdDDICloseAdapter (win32u.@) */ -NTSTATUS WINAPI D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc ) +NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc ) { NTSTATUS status = STATUS_INVALID_PARAMETER; struct d3dkmt_adapter *adapter; @@ -1332,9 +1332,9 @@ done: } /****************************************************************************** - * D3DKMTCreateDevice [GDI32.@] + * NtGdiDdDDICreateDevice (win32u.@) */ -NTSTATUS WINAPI D3DKMTCreateDevice( D3DKMT_CREATEDEVICE *desc ) +NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc ) { static D3DKMT_HANDLE handle_start = 0; struct d3dkmt_adapter *adapter; @@ -1377,9 +1377,9 @@ NTSTATUS WINAPI D3DKMTCreateDevice( D3DKMT_CREATEDEVICE *desc ) } /****************************************************************************** - * D3DKMTDestroyDevice [GDI32.@] + * NtGdiDdDDIDestroyDevice (win32u.@) */ -NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) +NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) { NTSTATUS status = STATUS_INVALID_PARAMETER; D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc; @@ -1397,7 +1397,7 @@ NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) { memset( &set_owner_desc, 0, sizeof(set_owner_desc) ); set_owner_desc.hDevice = desc->hDevice; - D3DKMTSetVidPnSourceOwner( &set_owner_desc ); + NtGdiDdDDISetVidPnSourceOwner( &set_owner_desc ); list_remove( &device->entry ); heap_free( device ); status = STATUS_SUCCESS; @@ -1410,27 +1410,27 @@ NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) } /****************************************************************************** - * D3DKMTQueryStatistics [GDI32.@] + * NtGdiDdDDIQueryStatistics (win32u.@) */ -NTSTATUS WINAPI D3DKMTQueryStatistics(D3DKMT_QUERYSTATISTICS *stats) +NTSTATUS WINAPI NtGdiDdDDIQueryStatistics( D3DKMT_QUERYSTATISTICS *stats ) { FIXME("(%p): stub\n", stats); return STATUS_SUCCESS; } /****************************************************************************** - * D3DKMTSetQueuedLimit [GDI32.@] + * NtGdiDdDDISetQueuedLimit (win32u.@) */ -NTSTATUS WINAPI D3DKMTSetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ) +NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ) { FIXME( "(%p): stub\n", desc ); return STATUS_NOT_IMPLEMENTED; } /****************************************************************************** - * D3DKMTSetVidPnSourceOwner [GDI32.@] + * NtGdiDdDDISetVidPnSourceOwner (win32u.@) */ -NTSTATUS WINAPI D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) +NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) { TRACE("(%p)\n", desc); @@ -1448,9 +1448,9 @@ NTSTATUS WINAPI D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *des } /****************************************************************************** - * D3DKMTCheckVidPnExclusiveOwnership [GDI32.@] + * NtGdiDdDDICheckVidPnExclusiveOwnership (win32u.@) */ -NTSTATUS WINAPI D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ) +NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ) { TRACE("(%p)\n", desc); diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 6aef8c2dbf6..48ce04e3819 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -80,18 +80,18 @@ @ stdcall CreateScalableFontResourceA(long str str str) @ stdcall CreateScalableFontResourceW(long wstr wstr wstr) @ stdcall CreateSolidBrush(long) -@ stdcall D3DKMTCheckVidPnExclusiveOwnership(ptr) -@ stdcall D3DKMTCloseAdapter(ptr) -@ stdcall D3DKMTCreateDCFromMemory(ptr) -@ stdcall D3DKMTCreateDevice(ptr) -@ stdcall D3DKMTDestroyDCFromMemory(ptr) -@ stdcall D3DKMTDestroyDevice(ptr) -@ stdcall D3DKMTEscape(ptr) +@ stdcall D3DKMTCheckVidPnExclusiveOwnership(ptr) NtGdiDdDDICheckVidPnExclusiveOwnership +@ stdcall D3DKMTCloseAdapter(ptr) NtGdiDdDDICloseAdapter +@ stdcall D3DKMTCreateDCFromMemory(ptr) NtGdiDdDDICreateDCFromMemory +@ stdcall D3DKMTCreateDevice(ptr) NtGdiDdDDICreateDevice +@ stdcall D3DKMTDestroyDCFromMemory(ptr) NtGdiDdDDIDestroyDCFromMemory +@ stdcall D3DKMTDestroyDevice(ptr) NtGdiDdDDIDestroyDevice +@ stdcall D3DKMTEscape(ptr) NtGdiDdDDIEscape @ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr) -@ stdcall D3DKMTOpenAdapterFromHdc(ptr) -@ stdcall D3DKMTQueryStatistics(ptr) -@ stdcall D3DKMTSetQueuedLimit(ptr) -@ stdcall D3DKMTSetVidPnSourceOwner(ptr) +@ stdcall D3DKMTOpenAdapterFromHdc(ptr) NtGdiDdDDIOpenAdapterFromHdc +@ stdcall D3DKMTQueryStatistics(ptr) NtGdiDdDDIQueryStatistics +@ stdcall D3DKMTSetQueuedLimit(ptr) NtGdiDdDDISetQueuedLimit +@ stdcall D3DKMTSetVidPnSourceOwner(ptr) NtGdiDdDDISetVidPnSourceOwner @ stdcall DPtoLP(long ptr long) @ stdcall DeleteColorSpace(long) @ stdcall DeleteDC(long) diff --git a/include/ntgdi.h b/include/ntgdi.h index e1bb6fb901d..7f3ecec8c64 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -20,7 +20,9 @@ #define _NTGDI_ #include <wingdi.h> +#include <winternl.h> #include <winspool.h> +#include <ddk/d3dkmthk.h> typedef struct _GDI_HANDLE_ENTRY { @@ -325,4 +327,14 @@ BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj ); BOOL WINAPI NtGdiUpdateColors( HDC hdc ); BOOL WINAPI NtGdiWidenPath( HDC hdc ); +NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ); +NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc ); +NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ); +NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc ); +NTSTATUS WINAPI NtGdiDdDDIDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *desc ); +NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ); +NTSTATUS WINAPI NtGdiDdDDIQueryStatistics( D3DKMT_QUERYSTATISTICS *stats ); +NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ); +NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ); + #endif /* _NTGDI_ */
1
0
0
0
Hugh McMaster : conhost: Use font face length as number of characters.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: a7fb08fba60f3f2cc3926021d9da182cc9c645ec URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a7fb08fba60f3f2cc3926021…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Aug 25 14:02:41 2021 +0200 conhost: Use font face length as number of characters. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/conhost/conhost.c | 13 +++++++++---- programs/conhost/window.c | 24 +++++++++++++----------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 9bfc5f84242..05447d52dd5 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -97,9 +97,14 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int screen_buffer->popup_attr = console->active->attr; screen_buffer->font = console->active->font; - if (!(screen_buffer->font.face_name = malloc( screen_buffer->font.face_len ))) return NULL; - memcpy( screen_buffer->font.face_name, console->active->font.face_name, - screen_buffer->font.face_len ); + if (screen_buffer->font.face_len) + { + screen_buffer->font.face_name = malloc( screen_buffer->font.face_len * sizeof(WCHAR) ); + if (!screen_buffer->font.face_name) return NULL; + + memcpy( screen_buffer->font.face_name, console->active->font.face_name, + screen_buffer->font.face_len * sizeof(WCHAR) ); + } } else { @@ -1728,7 +1733,7 @@ static NTSTATUS get_output_info( struct screen_buffer *screen_buffer, size_t *ou { struct condrv_output_info *info; - *out_size = min( *out_size, sizeof(*info) + screen_buffer->font.face_len ); + *out_size = min( *out_size, sizeof(*info) + screen_buffer->font.face_len * sizeof(WCHAR) ); if (!(info = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY; info->cursor_size = screen_buffer->cursor_size; diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 3ce36fe2c3d..48cd9ed6f6b 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -683,9 +683,9 @@ static BOOL set_console_font( struct console *console, const LOGFONTW *logfont ) if (console->window->font && logfont->lfHeight == console->active->font.height && logfont->lfWeight == console->active->font.weight && !logfont->lfItalic && !logfont->lfUnderline && !logfont->lfStrikeOut && - console->active->font.face_len == wcslen( logfont->lfFaceName ) * sizeof(WCHAR) && + console->active->font.face_len == wcslen( logfont->lfFaceName ) && !memcmp( logfont->lfFaceName, console->active->font.face_name, - console->active->font.face_len )) + console->active->font.face_len * sizeof(WCHAR) )) { TRACE( "equal to current\n" ); return TRUE; @@ -708,9 +708,9 @@ static BOOL set_console_font( struct console *console, const LOGFONTW *logfont ) font_info->weight = tm.tmWeight; free( font_info->face_name ); - font_info->face_len = wcslen( logfont->lfFaceName ) * sizeof(WCHAR); - font_info->face_name = malloc( font_info->face_len ); - memcpy( font_info->face_name, logfont->lfFaceName, font_info->face_len ); + font_info->face_len = wcslen( logfont->lfFaceName ); + font_info->face_name = malloc( font_info->face_len * sizeof(WCHAR) ); + memcpy( font_info->face_name, logfont->lfFaceName, font_info->face_len * sizeof(WCHAR) ); /* FIXME: use maximum width for DBCS codepages since some chars take two cells */ if (GetCPInfo( console->output_cp, &cpinfo ) && cpinfo.MaxCharSize > 1) @@ -819,9 +819,10 @@ static int WINAPI get_first_font_sub_enum( const LOGFONTW *lf, const TEXTMETRICW load_config( fc->console->window->config_key, &config ); config.cell_width = fc->console->active->font.width; config.cell_height = fc->console->active->font.height; - fc->console->active->font.face_len = wcslen( config.face_name ) * sizeof(WCHAR); - memcpy( fc->console->active->font.face_name, config.face_name, - fc->console->active->font.face_len ); + memcpy( config.face_name, fc->console->active->font.face_name, + fc->console->active->font.face_len * sizeof(WCHAR) ); + config.face_name[fc->console->active->font.face_len] = 0; + /* Force also its writing back to the registry so that we can get it * the next time. */ @@ -1895,8 +1896,9 @@ static void apply_config( struct console *console, const struct console_config * console->active->font.height != config->cell_height || console->active->font.weight != config->font_weight || console->active->font.pitch_family != config->font_pitch_family || - console->active->font.face_len != wcslen( config->face_name ) * sizeof(WCHAR) || - memcmp( console->active->font.face_name, config->face_name, console->active->font.face_len )) + console->active->font.face_len != wcslen( config->face_name ) || + memcmp( console->active->font.face_name, config->face_name, + console->active->font.face_len * sizeof(WCHAR) )) { update_console_font( console, config->face_name, config->cell_height, config->font_weight ); } @@ -1930,7 +1932,7 @@ static void current_config( struct console *console, struct console_config *conf config->cell_height = console->active->font.height; config->font_weight = console->active->font.weight; config->font_pitch_family = console->active->font.pitch_family; - len = min( ARRAY_SIZE(config->face_name) - 1, console->active->font.face_len / sizeof(WCHAR) ); + len = min( ARRAY_SIZE(config->face_name) - 1, console->active->font.face_len ); if (len) memcpy( config->face_name, console->active->font.face_name, len * sizeof(WCHAR) ); config->face_name[len] = 0;
1
0
0
0
Paul Gofman : winegstreamer: Create media source read thread after initializing wg_parser.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: f49b8602e357957744db95b11d0c187175551833 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f49b8602e357957744db95b1…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Aug 25 14:43:39 2021 +0300 winegstreamer: Create media source read thread after initializing wg_parser. Fixes race condition as wg_parser is used right away in the created thread. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/media_source.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 05544ef7abe..01ab626254a 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1315,8 +1315,6 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) goto fail; - object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); - if (!(parser = unix_funcs->wg_decodebin_parser_create())) { hr = E_OUTOFMEMORY; @@ -1324,6 +1322,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ } object->wg_parser = parser; + object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); + object->state = SOURCE_OPENING; if (FAILED(hr = unix_funcs->wg_parser_connect(parser, file_size)))
1
0
0
0
Alexandre Julliard : winebuild: Fix 64-bit argument alignment on ARM.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: 8ee30e6dcc6cc705c9e59893d631e79d887b0644 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8ee30e6dcc6cc705c9e59893…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 25 15:14:11 2021 +0200 winebuild: Fix 64-bit argument alignment on ARM. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/winebuild/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 56e76fc35cd..441e84aa092 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -1144,6 +1144,7 @@ unsigned int get_args_size( const ORDDEF *odp ) { case ARG_INT64: case ARG_DOUBLE: + if (target_cpu == CPU_ARM) size = (size + 7) & ~7; size += 8; break; case ARG_INT128:
1
0
0
0
Rémi Bernon : winebus.sys: Use the private data pointer as device unique id.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: 11c6b376c04b4e1b6095c85656bcb1decc908b0c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=11c6b376c04b4e1b6095c856…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:42 2021 +0200 winebus.sys: Use the private data pointer as device unique id. Instead of a separately allocated device list entry pointer. And link the device object into the device list directly. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 69 +++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index f0e94648d4e..41aef8ab018 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -105,12 +105,6 @@ static DEVICE_OBJECT *bus_fdo; HANDLE driver_key; -struct pnp_device -{ - struct list entry; - DEVICE_OBJECT *device; -}; - enum device_state { DEVICE_STATE_STOPPED, @@ -120,11 +114,12 @@ enum device_state struct device_extension { + struct list entry; + DEVICE_OBJECT *device; + CRITICAL_SECTION cs; enum device_state state; - struct pnp_device *pnp_device; - WORD vid, pid, input; DWORD uid, version, index; BOOL is_gamepad; @@ -151,7 +146,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug = }; static CRITICAL_SECTION device_list_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; -static struct list pnp_devset = LIST_INIT(pnp_devset); +static struct list device_list = LIST_INIT(device_list); static const WCHAR zero_serialW[]= {'0','0','0','0',0}; static const WCHAR miW[] = {'M','I',0}; @@ -179,12 +174,11 @@ struct unix_device *get_unix_device(DEVICE_OBJECT *device) static DWORD get_device_index(WORD vid, WORD pid, WORD input) { - struct pnp_device *ptr; + struct device_extension *ext; DWORD index = 0; - LIST_FOR_EACH_ENTRY(ptr, &pnp_devset, struct pnp_device, entry) + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) { - struct device_extension *ext = (struct device_extension *)ptr->device->DeviceExtension; if (ext->vid == vid && ext->pid == pid && ext->input == input) index = max(ext->index + 1, index); } @@ -266,7 +260,6 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WO { static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e','\\','%','s','#','%','p',0}; struct device_extension *ext; - struct pnp_device *pnp_dev; DEVICE_OBJECT *device; UNICODE_STRING nameW; WCHAR dev_name[256]; @@ -276,16 +269,12 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WO "is_gamepad %u, vtbl %p, unix_device %p\n", debugstr_w(busidW), vid, pid, input, version, uid, debugstr_w(serialW), is_gamepad, vtbl, unix_device); - if (!(pnp_dev = HeapAlloc(GetProcessHeap(), 0, sizeof(*pnp_dev)))) - return NULL; - - sprintfW(dev_name, device_name_fmtW, busidW, pnp_dev); + sprintfW(dev_name, device_name_fmtW, busidW, unix_device); RtlInitUnicodeString(&nameW, dev_name); status = IoCreateDevice(driver_obj, sizeof(struct device_extension), &nameW, 0, 0, FALSE, &device); if (status) { FIXME("failed to create device error %x\n", status); - HeapFree(GetProcessHeap(), 0, pnp_dev); return NULL; } @@ -293,7 +282,7 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WO /* fill out device_extension struct */ ext = (struct device_extension *)device->DeviceExtension; - ext->pnp_device = pnp_dev; + ext->device = device; ext->vid = vid; ext->pid = pid; ext->input = input; @@ -315,8 +304,7 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WO ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); /* add to list of pnp devices */ - pnp_dev->device = device; - list_add_tail(&pnp_devset, &pnp_dev->entry); + list_add_tail(&device_list, &ext->entry); LeaveCriticalSection(&device_list_cs); return device; @@ -324,19 +312,18 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WO DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) { - struct pnp_device *dev; + struct device_extension *ext; DEVICE_OBJECT *ret = NULL; TRACE("bus_id %s, platform_dev %p\n", debugstr_w(bus_id), platform_dev); EnterCriticalSection(&device_list_cs); - LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry) + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) { - struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension; if (strcmpW(ext->busid, bus_id)) continue; - if (ext->vtbl->compare_platform_device(dev->device, platform_dev) == 0) + if (ext->vtbl->compare_platform_device(ext->device, platform_dev) == 0) { - ret = dev->device; + ret = ext->device; break; } } @@ -348,23 +335,22 @@ DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) { - struct pnp_device *dev, *dev_next; + struct device_extension *ext, *next; DEVICE_OBJECT *ret = NULL; int cont; TRACE("bus_id %p\n", debugstr_w(bus_id)); EnterCriticalSection(&device_list_cs); - LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry) + LIST_FOR_EACH_ENTRY_SAFE(ext, next, &device_list, struct device_extension, entry) { - struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension; if (strcmpW(ext->busid, bus_id)) continue; LeaveCriticalSection(&device_list_cs); - cont = function(dev->device, context); + cont = function(ext->device, context); EnterCriticalSection(&device_list_cs); if (!cont) { - ret = dev->device; + ret = ext->device; break; } } @@ -375,20 +361,19 @@ DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function void bus_unlink_hid_device(DEVICE_OBJECT *device) { struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - struct pnp_device *pnp_device = ext->pnp_device; EnterCriticalSection(&device_list_cs); - list_remove(&pnp_device->entry); + list_remove(&ext->entry); LeaveCriticalSection(&device_list_cs); } static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices) { + struct device_extension *ext; int i; - struct pnp_device *ptr; EnterCriticalSection(&device_list_cs); - *devices = ExAllocatePool(PagedPool, offsetof(DEVICE_RELATIONS, Objects[list_count(&pnp_devset)])); + *devices = ExAllocatePool(PagedPool, offsetof(DEVICE_RELATIONS, Objects[list_count(&device_list)])); if (!*devices) { @@ -397,10 +382,10 @@ static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices) } i = 0; - LIST_FOR_EACH_ENTRY(ptr, &pnp_devset, struct pnp_device, entry) + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) { - (*devices)->Objects[i] = ptr->device; - call_fastcall_func1(ObfReferenceObject, ptr->device); + (*devices)->Objects[i] = ext->device; + call_fastcall_func1(ObfReferenceObject, ext->device); i++; } LeaveCriticalSection(&device_list_cs); @@ -835,9 +820,6 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) break; case IRP_MN_REMOVE_DEVICE: - { - struct pnp_device *pnp_device = ext->pnp_device; - remove_pending_irps(device); bus_unlink_hid_device(device); @@ -853,12 +835,7 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) IoCompleteRequest(irp, IO_NO_INCREMENT); IoDeleteDevice(device); - - /* pnp_device must be released after the device is gone */ - HeapFree(GetProcessHeap(), 0, pnp_device); - return STATUS_SUCCESS; - } default: FIXME("Unhandled function %08x\n", irpsp->MinorFunction);
1
0
0
0
Rémi Bernon : winebus.sys: Allocate private device data separately.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: 09c14c63211e21c4f590f1fb1e32038835037e1a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=09c14c63211e21c4f590f1fb…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:41 2021 +0200 winebus.sys: Allocate private device data separately. And use an opaque struct unix_device as private data. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 8 ++++---- dlls/winebus.sys/bus_iohid.c | 23 ++++++++++++++++------- dlls/winebus.sys/bus_sdl.c | 25 ++++++++++++++++--------- dlls/winebus.sys/bus_udev.c | 31 ++++++++++++++++++++++++------- dlls/winebus.sys/main.c | 25 +++++++++++-------------- dlls/winebus.sys/unix_private.h | 4 ++++ dlls/winebus.sys/unixlib.h | 2 ++ 7 files changed, 77 insertions(+), 41 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=09c14c63211e21c4f590…
1
0
0
0
Rémi Bernon : winebus.sys: Load bus options in main.c.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: 7e1d1fac7035dc68cc43e315b2b55d532415da7a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7e1d1fac7035dc68cc43e315…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:40 2021 +0200 winebus.sys: Load bus options in main.c. And pass them to bus_init function. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 1 - dlls/winebus.sys/bus_iohid.c | 5 +++++ dlls/winebus.sys/bus_sdl.c | 12 +++++----- dlls/winebus.sys/bus_udev.c | 28 +++++++----------------- dlls/winebus.sys/main.c | 52 ++++++++++++++++++++++++++++++-------------- dlls/winebus.sys/unixlib.h | 15 +++++++++++++ 6 files changed, 69 insertions(+), 44 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=7e1d1fac7035dc68cc43…
1
0
0
0
Rémi Bernon : winebus.sys: Introduce a new unixlib interface.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: edbb3fac25bae08535a741acdf3813fe1059b114 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=edbb3fac25bae08535a741ac…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:39 2021 +0200 winebus.sys: Introduce a new unixlib interface. And use it for bus entry points. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/Makefile.in | 3 ++- dlls/winebus.sys/bus.h | 13 ------------ dlls/winebus.sys/bus_iohid.c | 1 + dlls/winebus.sys/bus_sdl.c | 1 + dlls/winebus.sys/bus_udev.c | 1 + dlls/winebus.sys/main.c | 34 +++++++++++++++++------------ dlls/winebus.sys/unix_private.h | 42 ++++++++++++++++++++++++++++++++++++ dlls/winebus.sys/unixlib.c | 44 ++++++++++++++++++++++++++++++++++++++ dlls/winebus.sys/unixlib.h | 47 +++++++++++++++++++++++++++++++++++++++++ 9 files changed, 158 insertions(+), 28 deletions(-) diff --git a/dlls/winebus.sys/Makefile.in b/dlls/winebus.sys/Makefile.in index 8cde3c7b422..658d27b70fd 100644 --- a/dlls/winebus.sys/Makefile.in +++ b/dlls/winebus.sys/Makefile.in @@ -9,6 +9,7 @@ C_SRCS = \ bus_sdl.c \ bus_udev.c \ hid.c \ - main.c + main.c \ + unixlib.c RC_SRCS = winebus.rc diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index cecde2aa83c..a3e84bf8bd8 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -27,19 +27,6 @@ typedef int(*enum_func)(DEVICE_OBJECT *device, void *context); -/* Buses */ -extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; -extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; -extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; - -extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN; -extern NTSTATUS udev_bus_wait(void *) DECLSPEC_HIDDEN; -extern NTSTATUS udev_bus_stop(void *) DECLSPEC_HIDDEN; - -extern NTSTATUS iohid_bus_init(void *) DECLSPEC_HIDDEN; -extern NTSTATUS iohid_bus_wait(void *) DECLSPEC_HIDDEN; -extern NTSTATUS iohid_bus_stop(void *) DECLSPEC_HIDDEN; - /* Native device function table */ typedef struct { diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 49774dd0662..f1fe34e1780 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -90,6 +90,7 @@ #include "wine/debug.h" #include "bus.h" +#include "unix_private.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); #ifdef HAVE_IOHIDMANAGERCREATE diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 02509f1560c..cf81120c2f9 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -51,6 +51,7 @@ #endif #include "bus.h" +#include "unix_private.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 67d00670a26..a4b20f3efae 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -80,6 +80,7 @@ #endif #include "bus.h" +#include "unix_private.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 9d57a0c4db2..b678e86bc8b 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -32,8 +32,10 @@ #include "wine/debug.h" #include "wine/unicode.h" #include "wine/list.h" +#include "wine/unixlib.h" #include "bus.h" +#include "unixlib.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report); @@ -155,6 +157,11 @@ static const WCHAR zero_serialW[]= {'0','0','0','0',0}; static const WCHAR miW[] = {'M','I',0}; static const WCHAR igW[] = {'I','G',0}; +static NTSTATUS winebus_call(unsigned int code, void *args) +{ + return __wine_unix_call_funcs[code]( args ); +} + static inline WCHAR *strdupW(const WCHAR *src) { WCHAR *dst; @@ -626,9 +633,8 @@ struct bus_main_params const WCHAR *name; HANDLE init_done; - NTSTATUS (*init_func)(void *args); - - NTSTATUS (*wait_func)(void *args); + unsigned int init_code; + unsigned int wait_code; }; static DWORD CALLBACK bus_main_thread(void *args) @@ -637,12 +643,12 @@ static DWORD CALLBACK bus_main_thread(void *args) NTSTATUS status; TRACE("%s main loop starting\n", debugstr_w(bus.name)); - status = bus.init_func(NULL); + status = winebus_call(bus.init_code, NULL); SetEvent(bus.init_done); TRACE("%s main loop started\n", debugstr_w(bus.name)); if (status) WARN("%s bus init returned status %#x\n", debugstr_w(bus.name), status); - else status = bus.wait_func(NULL); + else status = winebus_call(bus.wait_code, NULL); if (status) WARN("%s bus wait returned status %#x\n", debugstr_w(bus.name), status); else TRACE("%s main loop exited\n", debugstr_w(bus.name)); @@ -679,8 +685,8 @@ static NTSTATUS sdl_driver_init(void) struct bus_main_params bus = { .name = bus_name, - .init_func = sdl_bus_init, - .wait_func = sdl_bus_wait, + .init_code = sdl_init, + .wait_code = sdl_wait, }; return bus_main_thread_start(&bus); @@ -692,8 +698,8 @@ static NTSTATUS udev_driver_init(void) struct bus_main_params bus = { .name = bus_name, - .init_func = udev_bus_init, - .wait_func = udev_bus_wait, + .init_code = udev_init, + .wait_code = udev_wait, }; return bus_main_thread_start(&bus); @@ -705,8 +711,8 @@ static NTSTATUS iohid_driver_init(void) struct bus_main_params bus = { .name = bus_name, - .init_func = iohid_bus_init, - .wait_func = iohid_bus_wait, + .init_code = iohid_init, + .wait_code = iohid_wait, }; return bus_main_thread_start(&bus); @@ -740,9 +746,9 @@ static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Status = STATUS_SUCCESS; break; case IRP_MN_REMOVE_DEVICE: - sdl_bus_stop(NULL); - udev_bus_stop(NULL); - iohid_bus_stop(NULL); + winebus_call(sdl_stop, NULL); + winebus_call(udev_stop, NULL); + winebus_call(iohid_stop, NULL); WaitForMultipleObjects(bus_count, bus_thread, TRUE, INFINITE); while (bus_count--) CloseHandle(bus_thread[bus_count]); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h new file mode 100644 index 00000000000..9468cac45e9 --- /dev/null +++ b/dlls/winebus.sys/unix_private.h @@ -0,0 +1,42 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINEBUS_UNIX_PRIVATE_H +#define __WINEBUS_UNIX_PRIVATE_H + +#include <stdarg.h> + +#include <windef.h> +#include <winbase.h> +#include <winternl.h> + +#include "unixlib.h" + +extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; +extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; +extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; + +extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN; +extern NTSTATUS udev_bus_wait(void *) DECLSPEC_HIDDEN; +extern NTSTATUS udev_bus_stop(void *) DECLSPEC_HIDDEN; + +extern NTSTATUS iohid_bus_init(void *) DECLSPEC_HIDDEN; +extern NTSTATUS iohid_bus_wait(void *) DECLSPEC_HIDDEN; +extern NTSTATUS iohid_bus_stop(void *) DECLSPEC_HIDDEN; + +#endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c new file mode 100644 index 00000000000..c4090861675 --- /dev/null +++ b/dlls/winebus.sys/unixlib.c @@ -0,0 +1,44 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include <stdarg.h> +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winternl.h" + +#include "wine/debug.h" +#include "wine/unixlib.h" + +#include "unix_private.h" + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + sdl_bus_init, + sdl_bus_wait, + sdl_bus_stop, + udev_bus_init, + udev_bus_wait, + udev_bus_stop, + iohid_bus_init, + iohid_bus_wait, + iohid_bus_stop, +}; diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h new file mode 100644 index 00000000000..51765f2f2d6 --- /dev/null +++ b/dlls/winebus.sys/unixlib.h @@ -0,0 +1,47 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINEBUS_UNIXLIB_H +#define __WINEBUS_UNIXLIB_H + +#include <stdarg.h> + +#include <windef.h> +#include <winbase.h> +#include <winternl.h> +#include <ddk/wdm.h> +#include <hidusage.h> + +#include "wine/unixlib.h" + +enum unix_funcs +{ + sdl_init, + sdl_wait, + sdl_stop, + udev_init, + udev_wait, + udev_stop, + iohid_init, + iohid_wait, + iohid_stop, +}; + +extern const unixlib_entry_t __wine_unix_call_funcs[] DECLSPEC_HIDDEN; + +#endif /* __WINEBUS_UNIXLIB_H */
1
0
0
0
Rémi Bernon : winebus.sys: Create the IOHID bus thread in main.c.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: b4d8cd38918c3ec74d70d9d229f3d88de91e405c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b4d8cd38918c3ec74d70d9d2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:38 2021 +0200 winebus.sys: Create the IOHID bus thread in main.c. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 7 +++--- dlls/winebus.sys/bus_iohid.c | 59 +++++++++++++++++++++----------------------- dlls/winebus.sys/main.c | 15 ++++++++++- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 6dc95a5b803..cecde2aa83c 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -28,9 +28,6 @@ typedef int(*enum_func)(DEVICE_OBJECT *device, void *context); /* Buses */ -NTSTATUS iohid_driver_init(void) DECLSPEC_HIDDEN; -void iohid_driver_unload( void ) DECLSPEC_HIDDEN; - extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; @@ -39,6 +36,10 @@ extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS udev_bus_wait(void *) DECLSPEC_HIDDEN; extern NTSTATUS udev_bus_stop(void *) DECLSPEC_HIDDEN; +extern NTSTATUS iohid_bus_init(void *) DECLSPEC_HIDDEN; +extern NTSTATUS iohid_bus_wait(void *) DECLSPEC_HIDDEN; +extern NTSTATUS iohid_bus_stop(void *) DECLSPEC_HIDDEN; + /* Native device function table */ typedef struct { diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 4eb0ea0e4b3..49774dd0662 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -96,7 +96,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); static IOHIDManagerRef hid_manager; static CFRunLoopRef run_loop; -static HANDLE run_loop_handle; static const WCHAR busidW[] = {'I','O','H','I','D',0}; @@ -385,63 +384,61 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender, } } -/* This puts the relevant run loop for event handling into a WINE thread */ -static DWORD CALLBACK runloop_thread(void *args) +NTSTATUS iohid_bus_init(void *args) { + if (!(hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, 0L))) + { + ERR("IOHID manager creation failed\n"); + return STATUS_UNSUCCESSFUL; + } + run_loop = CFRunLoopGetCurrent(); IOHIDManagerSetDeviceMatching(hid_manager, NULL); IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, handle_DeviceMatchingCallback, NULL); IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, handle_RemovalCallback, NULL); IOHIDManagerScheduleWithRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode); - - CFRunLoopRun(); - TRACE("Run Loop exiting\n"); - return 1; - + return STATUS_SUCCESS; } -NTSTATUS iohid_driver_init(void) +NTSTATUS iohid_bus_wait(void *args) { - hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, 0L); - if (!(run_loop_handle = CreateThread(NULL, 0, runloop_thread, NULL, 0, NULL))) - { - ERR("Failed to initialize IOHID Manager thread\n"); - CFRelease(hid_manager); - return STATUS_UNSUCCESSFUL; - } + CFRunLoopRun(); - TRACE("Initialization successful\n"); + TRACE("IOHID main loop exiting\n"); + IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, NULL, NULL); + IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, NULL, NULL); + CFRelease(hid_manager); return STATUS_SUCCESS; } -void iohid_driver_unload( void ) +NTSTATUS iohid_bus_stop(void *args) { - TRACE("Unloading Driver\n"); - - if (!run_loop_handle) - return; + if (!run_loop) return STATUS_SUCCESS; IOHIDManagerUnscheduleFromRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode); CFRunLoopStop(run_loop); - WaitForSingleObject(run_loop_handle, INFINITE); - CloseHandle(run_loop_handle); - IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, NULL, NULL); - IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, NULL, NULL); - CFRelease(hid_manager); - TRACE("Driver Unloaded\n"); + return STATUS_SUCCESS; } #else -NTSTATUS iohid_driver_init(void) +NTSTATUS iohid_bus_init(void *args) +{ + WARN("IOHID support not compiled in!\n"); + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS iohid_bus_wait(void *args) { + WARN("IOHID support not compiled in!\n"); return STATUS_NOT_IMPLEMENTED; } -void iohid_driver_unload( void ) +NTSTATUS iohid_bus_stop(void *args) { - TRACE("Stub: Unload Driver\n"); + WARN("IOHID support not compiled in!\n"); + return STATUS_NOT_IMPLEMENTED; } #endif /* HAVE_IOHIDMANAGERCREATE */ diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 505fc131be4..9d57a0c4db2 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -699,6 +699,19 @@ static NTSTATUS udev_driver_init(void) return bus_main_thread_start(&bus); } +static NTSTATUS iohid_driver_init(void) +{ + static const WCHAR bus_name[] = {'I','O','H','I','D'}; + struct bus_main_params bus = + { + .name = bus_name, + .init_func = iohid_bus_init, + .wait_func = iohid_bus_wait, + }; + + return bus_main_thread_start(&bus); +} + static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) { static const WCHAR SDL_enabledW[] = {'E','n','a','b','l','e',' ','S','D','L',0}; @@ -727,9 +740,9 @@ static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Status = STATUS_SUCCESS; break; case IRP_MN_REMOVE_DEVICE: - iohid_driver_unload(); sdl_bus_stop(NULL); udev_bus_stop(NULL); + iohid_bus_stop(NULL); WaitForMultipleObjects(bus_count, bus_thread, TRUE, INFINITE); while (bus_count--) CloseHandle(bus_thread[bus_count]);
1
0
0
0
Rémi Bernon : winebus.sys: Create the UDEV bus thread in main.c.
by Alexandre Julliard
25 Aug '21
25 Aug '21
Module: wine Branch: master Commit: 9d7f1eefa1a58b62aec5c1ab7df2b258dc91a31f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9d7f1eefa1a58b62aec5c1ab…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 23 10:49:37 2021 +0200 winebus.sys: Create the UDEV bus thread in main.c. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 6 +- dlls/winebus.sys/bus_udev.c | 130 +++++++++++++++++++------------------------- dlls/winebus.sys/main.c | 15 ++++- 3 files changed, 75 insertions(+), 76 deletions(-) diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index c5b93b769c9..6dc95a5b803 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -28,15 +28,17 @@ typedef int(*enum_func)(DEVICE_OBJECT *device, void *context); /* Buses */ -NTSTATUS udev_driver_init(void) DECLSPEC_HIDDEN; NTSTATUS iohid_driver_init(void) DECLSPEC_HIDDEN; -void udev_driver_unload( void ) DECLSPEC_HIDDEN; void iohid_driver_unload( void ) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; +extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN; +extern NTSTATUS udev_bus_wait(void *) DECLSPEC_HIDDEN; +extern NTSTATUS udev_bus_stop(void *) DECLSPEC_HIDDEN; + /* Native device function table */ typedef struct { diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 77a242a6087..67d00670a26 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -88,10 +88,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report); static struct udev *udev_context = NULL; +static struct udev_monitor *udev_monitor; static DWORD disable_hidraw = 0; static DWORD disable_input = 0; -static HANDLE deviceloop_handle; static int deviceloop_control[2]; +static int udev_monitor_fd; static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0}; static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',0}; @@ -1210,7 +1211,7 @@ static void build_initial_deviceset(void) udev_enumerate_unref(enumerate); } -static struct udev_monitor *create_monitor(struct pollfd *pfd) +static struct udev_monitor *create_monitor(int *fd) { struct udev_monitor *monitor; int systems = 0; @@ -1247,11 +1248,8 @@ static struct udev_monitor *create_monitor(struct pollfd *pfd) if (udev_monitor_enable_receiving(monitor) < 0) goto error; - if ((pfd->fd = udev_monitor_get_fd(monitor)) >= 0) - { - pfd->events = POLLIN; + if ((*fd = udev_monitor_get_fd(monitor)) >= 0) return monitor; - } error: WARN("Failed to start monitoring\n"); @@ -1287,51 +1285,8 @@ static void process_monitor_event(struct udev_monitor *monitor) udev_device_unref(dev); } -static DWORD CALLBACK deviceloop_thread(void *args) -{ - struct udev_monitor *monitor; - HANDLE init_done = args; - struct pollfd pfd[2]; - - pfd[1].fd = deviceloop_control[0]; - pfd[1].events = POLLIN; - pfd[1].revents = 0; - - monitor = create_monitor(&pfd[0]); - build_initial_deviceset(); - SetEvent(init_done); - - while (monitor) - { - if (poll(pfd, 2, -1) <= 0) continue; - if (pfd[1].revents) break; - process_monitor_event(monitor); - } - - TRACE("Monitor thread exiting\n"); - if (monitor) - udev_monitor_unref(monitor); - return 0; -} - -void udev_driver_unload( void ) -{ - TRACE("Unload Driver\n"); - - if (!deviceloop_handle) - return; - - write(deviceloop_control[1], "q", 1); - WaitForSingleObject(deviceloop_handle, INFINITE); - close(deviceloop_control[0]); - close(deviceloop_control[1]); - CloseHandle(deviceloop_handle); -} - -NTSTATUS udev_driver_init(void) +NTSTATUS udev_bus_init(void *args) { - HANDLE events[2]; - DWORD result; static const WCHAR hidraw_disabledW[] = {'D','i','s','a','b','l','e','H','i','d','r','a','w',0}; static const UNICODE_STRING hidraw_disabled = {sizeof(hidraw_disabledW) - sizeof(WCHAR), sizeof(hidraw_disabledW), (WCHAR*)hidraw_disabledW}; static const WCHAR input_disabledW[] = {'D','i','s','a','b','l','e','I','n','p','u','t',0}; @@ -1339,13 +1294,13 @@ NTSTATUS udev_driver_init(void) if (pipe(deviceloop_control) != 0) { - ERR("Control pipe creation failed\n"); + ERR("UDEV control pipe creation failed\n"); return STATUS_UNSUCCESSFUL; } if (!(udev_context = udev_new())) { - ERR("Can't create udev object\n"); + ERR("UDEV object creation failed\n"); goto error; } @@ -1359,46 +1314,75 @@ NTSTATUS udev_driver_init(void) TRACE("UDEV input devices disabled in registry\n"); #endif - if (!(events[0] = CreateEventW(NULL, TRUE, FALSE, NULL))) - goto error; - if (!(events[1] = CreateThread(NULL, 0, deviceloop_thread, events[0], 0, NULL))) + if (!(udev_monitor = create_monitor(&udev_monitor_fd))) { - CloseHandle(events[0]); + ERR("UDEV monitor creation failed\n"); goto error; } - result = WaitForMultipleObjects(2, events, FALSE, INFINITE); - CloseHandle(events[0]); - if (result == WAIT_OBJECT_0) - { - deviceloop_handle = events[1]; - TRACE("Initialization successful\n"); - return STATUS_SUCCESS; - } - CloseHandle(events[1]); + build_initial_deviceset(); + return STATUS_SUCCESS; error: - ERR("Failed to initialize udev device thread\n"); + if (udev_context) udev_unref(udev_context); + udev_context = NULL; close(deviceloop_control[0]); close(deviceloop_control[1]); - if (udev_context) + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS udev_bus_wait(void *args) +{ + struct pollfd pfd[2]; + + pfd[0].fd = udev_monitor_fd; + pfd[0].events = POLLIN; + pfd[0].revents = 0; + pfd[1].fd = deviceloop_control[0]; + pfd[1].events = POLLIN; + pfd[1].revents = 0; + + while (1) { - udev_unref(udev_context); - udev_context = NULL; + if (poll(pfd, 2, -1) <= 0) continue; + if (pfd[1].revents) break; + process_monitor_event(udev_monitor); } - return STATUS_UNSUCCESSFUL; + + TRACE("UDEV main loop exiting\n"); + udev_monitor_unref(udev_monitor); + udev_unref(udev_context); + udev_context = NULL; + close(deviceloop_control[0]); + close(deviceloop_control[1]); + return STATUS_SUCCESS; +} + +NTSTATUS udev_bus_stop(void *args) +{ + if (!udev_context) return STATUS_SUCCESS; + write(deviceloop_control[1], "q", 1); + return STATUS_SUCCESS; } #else -NTSTATUS udev_driver_init(void) +NTSTATUS udev_bus_init(void *args) +{ + WARN("UDEV support not compiled in!\n"); + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS udev_bus_wait(void *args) { + WARN("UDEV support not compiled in!\n"); return STATUS_NOT_IMPLEMENTED; } -void udev_driver_unload( void ) +NTSTATUS udev_bus_stop(void *args) { - TRACE("Stub: Unload Driver\n"); + WARN("UDEV support not compiled in!\n"); + return STATUS_NOT_IMPLEMENTED; } #endif /* HAVE_UDEV */ diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 6be5e677bba..505fc131be4 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -686,6 +686,19 @@ static NTSTATUS sdl_driver_init(void) return bus_main_thread_start(&bus); } +static NTSTATUS udev_driver_init(void) +{ + static const WCHAR bus_name[] = {'U','D','E','V',0}; + struct bus_main_params bus = + { + .name = bus_name, + .init_func = udev_bus_init, + .wait_func = udev_bus_wait, + }; + + return bus_main_thread_start(&bus); +} + static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) { static const WCHAR SDL_enabledW[] = {'E','n','a','b','l','e',' ','S','D','L',0}; @@ -714,9 +727,9 @@ static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Status = STATUS_SUCCESS; break; case IRP_MN_REMOVE_DEVICE: - udev_driver_unload(); iohid_driver_unload(); sdl_bus_stop(NULL); + udev_bus_stop(NULL); WaitForMultipleObjects(bus_count, bus_thread, TRUE, INFINITE); while (bus_count--) CloseHandle(bus_thread[bus_count]);
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
31
...
106
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
Results per page:
10
25
50
100
200