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
March 2024
----- 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
775 discussions
Start a n
N
ew thread
Rémi Bernon : win32u: Get rid of the adapter display_device.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: d77d36b1f4b60cb958efc0c49e2e762f6ae3431e URL:
https://gitlab.winehq.org/wine/wine/-/commit/d77d36b1f4b60cb958efc0c49e2e76…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Mar 11 08:32:23 2024 +0100 win32u: Get rid of the adapter display_device. --- dlls/win32u/sysparams.c | 141 ++++++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 70 deletions(-)
1
0
0
0
Rémi Bernon : win32u: Get rid of the monitor state_flags.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: e6a8fc244896ae479d85f25c46f31515480e3af5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e6a8fc244896ae479d85f25c46f315…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Feb 27 12:38:12 2024 +0100 win32u: Get rid of the monitor state_flags. --- dlls/win32u/sysparams.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 588657e4de3..9b3d6b3e3ae 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -153,7 +153,6 @@ struct monitor RECT rc_monitor; RECT rc_work; BOOL is_clone; - UINT state_flags; struct edid_monitor_info edid_info; }; @@ -1552,6 +1551,15 @@ static void clear_display_devices(void) } } +static BOOL is_monitor_active( struct monitor *monitor ) +{ + struct adapter *adapter; + /* services do not have any adapters, only a virtual monitor */ + if (!(adapter = monitor->adapter)) return TRUE; + if (!(adapter->dev.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) return FALSE; + return !IsRectEmpty( &monitor->rc_monitor ); +} + static void enum_device_keys( const char *root, const WCHAR *classW, UINT class_size, void (*callback)(const char *) ) { char buffer[1024]; @@ -1682,14 +1690,11 @@ static BOOL update_display_cache_from_registry(void) monitor->id = monitor_id; monitor->adapter = adapter_acquire( adapter ); - monitor->state_flags |= DISPLAY_DEVICE_ATTACHED; if (adapter->dev.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) { - if (!IsRectEmpty(&monitor->rc_monitor)) monitor->state_flags |= DISPLAY_DEVICE_ACTIVE; - LIST_FOR_EACH_ENTRY( monitor2, &monitors, struct monitor, entry ) { - if (!(monitor2->state_flags & DISPLAY_DEVICE_ACTIVE)) continue; + if (!is_monitor_active( monitor2 )) continue; if (EqualRect( &monitor2->rc_monitor, &monitor->rc_monitor )) { monitor->is_clone = TRUE; @@ -2248,7 +2253,7 @@ RECT get_virtual_screen_rect( UINT dpi ) LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry ) { - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) continue; + if (!is_monitor_active( monitor )) continue; union_rect( &rect, &rect, &monitor->rc_monitor ); } @@ -2269,8 +2274,7 @@ static BOOL is_window_rect_full_screen( const RECT *rect ) { RECT monrect; - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) - continue; + if (!is_monitor_active( monitor )) continue; monrect = map_dpi_rect( monitor->rc_monitor, get_monitor_dpi( monitor->handle ), get_thread_dpi() ); @@ -2357,8 +2361,7 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in { LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry ) { - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) - continue; + if (!is_monitor_active( monitor )) continue; count++; } unlock_display_devices(); @@ -2541,8 +2544,7 @@ LONG WINAPI NtUserQueryDisplayConfig( UINT32 flags, UINT32 *paths_count, DISPLAY LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry ) { - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) - continue; + if (!is_monitor_active( monitor )) continue; if (!monitor->adapter) continue; @@ -2727,8 +2729,12 @@ NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, } if (info->cb >= offsetof(DISPLAY_DEVICEW, StateFlags) + sizeof(info->StateFlags)) { - if (monitor) info->StateFlags = monitor->state_flags; - else info->StateFlags = adapter->dev.state_flags; + if (!monitor) info->StateFlags = adapter->dev.state_flags; + else + { + info->StateFlags = DISPLAY_DEVICE_ATTACHED; + if (is_monitor_active( monitor )) info->StateFlags |= DISPLAY_DEVICE_ACTIVE; + } } if (info->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(info->DeviceID)) { @@ -3329,7 +3335,8 @@ static unsigned int active_monitor_count(void) LIST_FOR_EACH_ENTRY(monitor, &monitors, struct monitor, entry) { - if ((monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) count++; + if (!is_monitor_active( monitor )) continue; + count++; } return count; } @@ -3414,7 +3421,7 @@ BOOL WINAPI NtUserEnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc { RECT monrect; - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) continue; + if (!is_monitor_active( monitor )) continue; monrect = map_dpi_rect( monitor->rc_monitor, get_monitor_dpi( monitor->handle ), get_thread_dpi() ); @@ -3460,7 +3467,7 @@ BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info ) LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry ) { if (monitor->handle != handle) continue; - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) break; + if (!is_monitor_active( monitor )) continue; /* FIXME: map dpi */ info->rcMonitor = monitor->rc_monitor; @@ -3512,7 +3519,7 @@ HMONITOR monitor_from_rect( const RECT *rect, UINT flags, UINT dpi ) { RECT intersect, monitor_rect; - if (!(monitor->state_flags & DISPLAY_DEVICE_ACTIVE)) continue; + if (!is_monitor_active( monitor )) continue; monitor_rect = map_dpi_rect( monitor->rc_monitor, get_monitor_dpi( monitor->handle ), system_dpi ); if (intersect_rect( &intersect, &monitor_rect, &r ))
1
0
0
0
Rémi Bernon : win32u: Get rid of the monitor display_device.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: caf9585c3cb31c5ea59d279d1e61a9dc65d99f93 URL:
https://gitlab.winehq.org/wine/wine/-/commit/caf9585c3cb31c5ea59d279d1e61a9…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Feb 27 14:32:27 2024 +0100 win32u: Get rid of the monitor display_device. --- dlls/win32u/sysparams.c | 225 ++++++++++++++++++++++++++---------------------- 1 file changed, 122 insertions(+), 103 deletions(-)
1
0
0
0
Rémi Bernon : win32u: Split writing monitor to registry to a separate helper.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 3bcd6f1aabdf96132d529ef110efc500e13b692e URL:
https://gitlab.winehq.org/wine/wine/-/commit/3bcd6f1aabdf96132d529ef110efc5…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Feb 27 16:42:02 2024 +0100 win32u: Split writing monitor to registry to a separate helper. --- dlls/win32u/sysparams.c | 89 ++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index dee9632d527..2be223a8a46 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -148,6 +148,7 @@ struct edid_monitor_info struct monitor { struct list entry; + char path[MAX_PATH]; struct display_device dev; struct adapter *adapter; HANDLE handle; @@ -1372,45 +1373,24 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param ) sizeof(adapter->state_flags) ); } -static void add_monitor( const struct gdi_monitor *monitor, void *param ) +static BOOL write_monitor_to_registry( struct monitor *monitor, const BYTE *edid, UINT edid_len ) { - struct device_manager_ctx *ctx = param; - char buffer[MAX_PATH], instance[64]; - unsigned int monitor_index, output_index; - struct edid_monitor_info monitor_info; - char monitor_id_string[16]; - WCHAR bufferW[MAX_PATH]; + char buffer[1024], *tmp; + WCHAR bufferW[1024]; HKEY hkey, subkey; unsigned int len; - monitor_index = ctx->adapter.monitor_count++; - output_index = ctx->monitor_count++; - - TRACE( "%u %s %s\n", monitor_index, wine_dbgstr_rect(&monitor->rc_monitor), wine_dbgstr_rect(&monitor->rc_work) ); - - get_monitor_info_from_edid( &monitor_info, monitor->edid, monitor->edid_len ); - if (monitor_info.flags & MONITOR_INFO_HAS_MONITOR_ID) - strcpy( monitor_id_string, monitor_info.monitor_id_string ); - else - strcpy( monitor_id_string, "Default_Monitor" ); - - sprintf( buffer, "MonitorID%u", monitor_index ); - sprintf( instance, "DISPLAY\\%s\\%04X&%04X", monitor_id_string, ctx->adapter.id, monitor_index ); - set_reg_ascii_value( ctx->adapter_key, buffer, instance ); - - hkey = reg_create_ascii_key( enum_key, instance, 0, NULL ); - if (!hkey) return; - - link_device( instance, guid_devinterface_monitorA ); + if (!(hkey = reg_create_ascii_key( enum_key, monitor->path, 0, NULL ))) return FALSE; set_reg_ascii_value( hkey, "DeviceDesc", "Generic Non-PnP Monitor" ); set_reg_ascii_value( hkey, "Class", "Monitor" ); - sprintf( buffer, "%s\\%04X", guid_devclass_monitorA, output_index ); + sprintf( buffer, "%s\\%04X", guid_devclass_monitorA, monitor->output_id ); set_reg_ascii_value( hkey, "Driver", buffer ); set_reg_ascii_value( hkey, "ClassGUID", guid_devclass_monitorA ); - sprintf( buffer, "MONITOR\\%s", monitor_id_string ); + sprintf( buffer, "MONITOR\\%s", monitor->path + 8 ); + if ((tmp = strrchr( buffer, '\\' ))) *tmp = 0; len = asciiz_to_unicode( bufferW, buffer ); bufferW[len / sizeof(WCHAR)] = 0; set_reg_value( hkey, hardware_idW, REG_MULTI_SZ, bufferW, len + sizeof(WCHAR) ); @@ -1420,8 +1400,8 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) static const WCHAR bad_edidW[] = {'B','A','D','_','E','D','I','D',0}; static const WCHAR edidW[] = {'E','D','I','D',0}; - if (monitor->edid_len) - set_reg_value( subkey, edidW, REG_BINARY, monitor->edid, monitor->edid_len ); + if (edid_len) + set_reg_value( subkey, edidW, REG_BINARY, edid, edid_len ); else set_reg_value( subkey, bad_edidW, REG_BINARY, NULL, 0 ); NtClose( subkey ); @@ -1448,7 +1428,7 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) if ((subkey = reg_create_ascii_key( hkey, devpropkey_monitor_gpu_luidA, 0, NULL ))) { set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_INT64, - &ctx->gpu.luid, sizeof(ctx->gpu.luid) ); + &monitor->adapter->gpu->luid, sizeof(monitor->adapter->gpu->luid) ); NtClose( subkey ); } @@ -1456,15 +1436,54 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) if ((subkey = reg_create_ascii_key( hkey, devpropkey_monitor_output_idA, 0, NULL ))) { set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_UINT32, - &output_index, sizeof(output_index) ); + &monitor->output_id, sizeof(monitor->output_id) ); NtClose( subkey ); } NtClose( hkey ); - sprintf( buffer, "Class\\%s\\%04X", guid_devclass_monitorA, output_index ); - hkey = reg_create_ascii_key( control_key, buffer, 0, NULL ); - if (hkey) NtClose( hkey ); + + sprintf( buffer, "Class\\%s\\%04X", guid_devclass_monitorA, monitor->output_id ); + if (!(hkey = reg_create_ascii_key( control_key, buffer, 0, NULL ))) return FALSE; + NtClose( hkey ); + + link_device( monitor->path, guid_devinterface_monitorA ); + + return TRUE; +} + +static void add_monitor( const struct gdi_monitor *gdi_monitor, void *param ) +{ + struct device_manager_ctx *ctx = param; + struct monitor monitor = {0}; + char buffer[MAX_PATH]; + char monitor_id_string[16]; + + monitor.adapter = &ctx->adapter; + monitor.id = ctx->adapter.monitor_count; + monitor.output_id = ctx->monitor_count; + monitor.rc_monitor = gdi_monitor->rc_monitor; + monitor.rc_work = gdi_monitor->rc_work; + + TRACE( "%u %s %s\n", monitor.id, wine_dbgstr_rect(&gdi_monitor->rc_monitor), wine_dbgstr_rect(&gdi_monitor->rc_work) ); + + get_monitor_info_from_edid( &monitor.edid_info, gdi_monitor->edid, gdi_monitor->edid_len ); + if (monitor.edid_info.flags & MONITOR_INFO_HAS_MONITOR_ID) + strcpy( monitor_id_string, monitor.edid_info.monitor_id_string ); + else + strcpy( monitor_id_string, "Default_Monitor" ); + + sprintf( buffer, "MonitorID%u", monitor.id ); + sprintf( monitor.path, "DISPLAY\\%s\\%04X&%04X", monitor_id_string, ctx->adapter.id, monitor.id ); + set_reg_ascii_value( ctx->adapter_key, buffer, monitor.path ); + + if (!write_monitor_to_registry( &monitor, gdi_monitor->edid, gdi_monitor->edid_len )) + WARN( "Failed to write monitor to registry\n" ); + else + { + ctx->adapter.monitor_count++; + ctx->monitor_count++; + } } static void add_mode( const DEVMODEW *mode, BOOL current, void *param )
1
0
0
0
Rémi Bernon : win32u: Add an adapter struct to the device manager context.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 737e9d7ffc95dc476cab9f564fa2aa9e2c5a9520 URL:
https://gitlab.winehq.org/wine/wine/-/commit/737e9d7ffc95dc476cab9f564fa2aa…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Feb 27 10:19:36 2024 +0100 win32u: Add an adapter struct to the device manager context. --- dlls/win32u/sysparams.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6c4223f0cdb..dee9632d527 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -125,7 +125,8 @@ struct adapter unsigned int id; struct gpu *gpu; const WCHAR *config_key; - unsigned int mode_count; + UINT monitor_count; + UINT mode_count; DEVMODEW *modes; }; @@ -994,13 +995,12 @@ static unsigned int format_date( WCHAR *bufferW, LONGLONG time ) struct device_manager_ctx { - unsigned int gpu_count; - unsigned int video_count; - unsigned int monitor_count; - unsigned int output_count; - unsigned int mode_count; + UINT gpu_count; + UINT adapter_count; + UINT monitor_count; HANDLE mutex; struct gpu gpu; + struct adapter adapter; HKEY adapter_key; /* for the virtual desktop settings */ BOOL is_primary; @@ -1276,9 +1276,6 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) lstrcpyW( ctx->gpu.name, gpu->name ); ctx->gpu.vulkan_uuid = gpu->vulkan_uuid; - ctx->monitor_count = 0; - ctx->mode_count = 0; - sprintf( ctx->gpu.path, "PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\\%08X", gpu->vendor_id, gpu->device_id, gpu->subsys_id, gpu->revision_id, ctx->gpu.index ); if (!(hkey = reg_create_ascii_key( enum_key, ctx->gpu.path, 0, NULL ))) return; @@ -1329,7 +1326,7 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) static void add_adapter( const struct gdi_adapter *adapter, void *param ) { struct device_manager_ctx *ctx = param; - unsigned int adapter_index, video_index, len; + unsigned int adapter_index, len; char name[64], buffer[MAX_PATH]; WCHAR bufferW[MAX_PATH]; HKEY hkey; @@ -1343,24 +1340,23 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param ) } adapter_index = ctx->gpu.adapter_count++; - video_index = ctx->video_count++; - ctx->monitor_count = 0; - ctx->mode_count = 0; - snprintf( buffer, ARRAY_SIZE(buffer), "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\%s\\%04x", - ctx->gpu.guid, adapter_index ); + memset( &ctx->adapter, 0, sizeof(ctx->adapter) ); + ctx->adapter.gpu = &ctx->gpu; + ctx->adapter.id = ctx->adapter_count++; + + snprintf( buffer, ARRAY_SIZE(buffer), "%s\\Video\\%s\\%04x", control_keyA, ctx->gpu.guid, adapter_index ); len = asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR); hkey = reg_create_ascii_key( NULL, buffer, REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK, NULL ); if (!hkey) hkey = reg_create_ascii_key( NULL, buffer, REG_OPTION_VOLATILE | REG_OPTION_OPEN_LINK, NULL ); - sprintf( name, "\\Device\\Video%u", video_index ); + sprintf( name, "\\Device\\Video%u", ctx->adapter.id ); set_reg_ascii_value( video_key, name, buffer ); if (hkey) { - sprintf( buffer, "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\" - "%s\\%04X", guid_devclass_displayA, ctx->gpu_count - 1 ); + sprintf( buffer, "%s\\Class\\%s\\%04X", control_keyA, guid_devclass_displayA, ctx->gpu.index ); len = asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR); set_reg_value( hkey, symbolic_link_valueW, REG_LINK, bufferW, len ); NtClose( hkey ); @@ -1387,8 +1383,8 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) HKEY hkey, subkey; unsigned int len; - monitor_index = ctx->monitor_count++; - output_index = ctx->output_count++; + monitor_index = ctx->adapter.monitor_count++; + output_index = ctx->monitor_count++; TRACE( "%u %s %s\n", monitor_index, wine_dbgstr_rect(&monitor->rc_monitor), wine_dbgstr_rect(&monitor->rc_work) ); @@ -1399,7 +1395,7 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) strcpy( monitor_id_string, "Default_Monitor" ); sprintf( buffer, "MonitorID%u", monitor_index ); - sprintf( instance, "DISPLAY\\%s\\%04X&%04X", monitor_id_string, ctx->video_count - 1, monitor_index ); + sprintf( instance, "DISPLAY\\%s\\%04X&%04X", monitor_id_string, ctx->adapter.id, monitor_index ); set_reg_ascii_value( ctx->adapter_key, buffer, instance ); hkey = reg_create_ascii_key( enum_key, instance, 0, NULL ); @@ -1491,10 +1487,10 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) nopos_mode.dmPosition.y = 0; nopos_mode.dmFields &= ~DM_POSITION; - if (write_adapter_mode( ctx->adapter_key, ctx->mode_count, &nopos_mode )) + if (write_adapter_mode( ctx->adapter_key, ctx->adapter.mode_count, &nopos_mode )) { - ctx->mode_count++; - set_reg_value( ctx->adapter_key, mode_countW, REG_DWORD, &ctx->mode_count, sizeof(ctx->mode_count) ); + ctx->adapter.mode_count++; + set_reg_value( ctx->adapter_key, mode_countW, REG_DWORD, &ctx->adapter.mode_count, sizeof(ctx->adapter.mode_count) ); if (current) { if (!read_adapter_mode( ctx->adapter_key, ENUM_REGISTRY_SETTINGS, &nopos_mode ))
1
0
0
0
Alexandre Julliard : kernelbase: Remove no longer needed DllMainCRTStartup function.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 866907ee3dab7231cf0c87da66a35fbbac36e848 URL:
https://gitlab.winehq.org/wine/wine/-/commit/866907ee3dab7231cf0c87da66a35f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 14 17:22:39 2024 +0100 kernelbase: Remove no longer needed DllMainCRTStartup function. --- dlls/kernelbase/main.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dlls/kernelbase/main.c b/dlls/kernelbase/main.c index 0309ec91589..60173ba6513 100644 --- a/dlls/kernelbase/main.c +++ b/dlls/kernelbase/main.c @@ -55,15 +55,6 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) } -/************************************************************* - * DllMainCRTStartup - */ -BOOL WINAPI DllMainCRTStartup( HANDLE inst, DWORD reason, LPVOID reserved ) -{ - return DllMain( inst, reason, reserved ); -} - - /*********************************************************************** * MulDiv (kernelbase.@) */
1
0
0
0
Alexandre Julliard : ntdll: Implement RtlGetCallersAddress.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 180bd1044b9594659bd560048859c5d2beb159d9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/180bd1044b9594659bd560048859c5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 14 17:57:30 2024 +0100 ntdll: Implement RtlGetCallersAddress. --- dlls/ntdll/exception.c | 14 ++++++++++++++ dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/tests/exception.c | 14 ++++++++++++++ include/rtlsupportapi.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index ac5f403131f..bf4a53e1b6e 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -531,6 +531,20 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, void **buffer, } +/************************************************************************* + * RtlGetCallersAddress (NTDLL.@) + */ +void WINAPI RtlGetCallersAddress( void **caller, void **parent ) +{ + void *buffer[2]; + ULONG count = ARRAY_SIZE(buffer), skip = 2; /* skip our frame and the parent */ + + count = RtlWalkFrameChain( buffer, count + skip, skip << 8 ); + *caller = count > 0 ? buffer[0] : NULL; + *parent = count > 1 ? buffer[1] : NULL; +} + + /********************************************************************** * RtlGetEnabledExtendedFeatures (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 3d45b3d1e9a..d40bfd33a58 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -716,7 +716,7 @@ @ stub RtlGenerate8dot3Name @ stdcall RtlGetAce(ptr long ptr) @ stdcall RtlGetActiveActivationContext(ptr) -@ stub RtlGetCallersAddress +@ stdcall RtlGetCallersAddress(ptr ptr) @ stdcall RtlGetCompressionWorkSpaceSize(long ptr ptr) @ stdcall RtlGetControlSecurityDescriptor(ptr ptr ptr) @ stdcall RtlGetCurrentDirectory_U(long ptr) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 3fa0c1801b4..d3c279ecab8 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -66,6 +66,7 @@ static void * (WINAPI *pRtlLocateLegacyContext)(CONTEXT_EX *context_ex, ULONG static void (WINAPI *pRtlSetExtendedFeaturesMask)(CONTEXT_EX *context_ex, ULONG64 feature_mask); static ULONG64 (WINAPI *pRtlGetExtendedFeaturesMask)(CONTEXT_EX *context_ex); static void * (WINAPI *pRtlPcToFileHeader)(PVOID pc, PVOID *address); +static void (WINAPI *pRtlGetCallersAddress)(void**,void**); static NTSTATUS (WINAPI *pNtRaiseException)(EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance); static NTSTATUS (WINAPI *pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*); static NTSTATUS (WINAPI *pNtTerminateProcess)(HANDLE handle, LONG exit_code); @@ -10784,6 +10785,18 @@ static void test_backtrace(void) ok( module == GetModuleHandleA(0), "wrong module %p %s / %p for %p\n", module, debugstr_w(name), GetModuleHandleA(0), buffer[0]); + if (pRtlGetCallersAddress) + { + void *caller, *parent; + + caller = parent = (void *)0xdeadbeef; + pRtlGetCallersAddress( &caller, &parent ); + ok( caller == (count > 1 ? buffer[1] : NULL) || broken(is_arm64ec), /* caller is entry thunk */ + "wrong caller %p / %p\n", caller, buffer[1] ); + ok( parent == (count > 2 ? buffer[2] : NULL), "wrong parent %p / %p\n", parent, buffer[2] ); + } + else win_skip( "RtlGetCallersAddress not supported\n" ); + if (count && !buffer[count - 1]) count--; /* win11 32-bit */ if (count <= 1) return; RtlPcToFileHeader( buffer[count - 1], &module ); @@ -10844,6 +10857,7 @@ START_TEST(exception) X(RtlSetExtendedFeaturesMask); X(RtlGetExtendedFeaturesMask); X(RtlPcToFileHeader); + X(RtlGetCallersAddress); X(RtlCopyContext); X(RtlCopyExtendedContext); X(KiUserApcDispatcher); diff --git a/include/rtlsupportapi.h b/include/rtlsupportapi.h index becb6179a56..a9dd5515501 100644 --- a/include/rtlsupportapi.h +++ b/include/rtlsupportapi.h @@ -24,6 +24,7 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*); NTSYSAPI void WINAPI RtlCaptureContext2(CONTEXT*); NTSYSAPI USHORT WINAPI RtlCaptureStackBackTrace(ULONG,ULONG,void**,ULONG*); +NTSYSAPI void WINAPI RtlGetCallersAddress(void**,void**); NTSYSAPI void WINAPI RtlRaiseException(EXCEPTION_RECORD*); NTSYSAPI void CDECL RtlRestoreContext(CONTEXT*,EXCEPTION_RECORD*); NTSYSAPI void WINAPI RtlUnwind(void*,void*,EXCEPTION_RECORD*,void*);
1
0
0
0
Alexandre Julliard : ntdll/tests: Fix a few more test failures on ARM64EC.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 92d20c11204f2abe1de98246784bcc1587a0cfd3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/92d20c11204f2abe1de98246784bcc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 14 11:24:42 2024 +0100 ntdll/tests: Fix a few more test failures on ARM64EC. --- dlls/ntdll/tests/exception.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 2b6ddecf9e5..3fa0c1801b4 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -3853,7 +3853,7 @@ static void test_thread_context(void) { ok( context.ContextFlags == (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT), "wrong flags %08lx\n", context.ContextFlags ); - ok( (context.EFlags & ~0xc5) == (expect.EFlags & ~0xc5), "wrong EFlags %lx / %I64x\n", + ok( (context.EFlags & ~0xd5) == (expect.EFlags & ~0xd5), "wrong EFlags %lx / %I64x\n", context.EFlags, expect.EFlags ); ok( context.SegCs == 0xcccc, "wrong SegCs %x\n", context.SegCs); ok( context.SegDs == 0xcccc, "wrong SegDs %x\n", context.SegDs); @@ -4845,7 +4845,8 @@ static void test_KiUserApcDispatcher(void) pNtQueueApcThread( GetCurrentThread(), apc_func, 0x1234, 0x5678, 0xdeadbeef ); SleepEx( 0, TRUE ); ok( apc_called, "APC was not called\n" ); - ok( hook_called, "hook was not called\n" ); + /* hooking is bypassed on arm64ec */ + ok( is_arm64ec ? !hook_called : hook_called, "hook was not called\n" ); VirtualProtect( pKiUserApcDispatcher, sizeof(saved_KiUserApcDispatcher), old_protect, &old_protect ); } @@ -5144,6 +5145,8 @@ static void test_syscall_clobbered_regs(void) CONTEXT context; NTSTATUS status; + if (is_arm64ec) return; /* arm64ec register handling is different */ + pNtCancelTimer = (void *)GetProcAddress(hntdll, "NtCancelTimer"); ok(!!pNtCancelTimer, "NtCancelTimer not found.\n"); memcpy(code_mem, code, sizeof(code)); @@ -8339,10 +8342,13 @@ static void subtest_fastfail(unsigned int code) if (de.u.Exception.ExceptionRecord.ExceptionCode == STATUS_STACK_BUFFER_OVERRUN) { ok(!de.u.Exception.dwFirstChance, "must be a second chance exception\n"); - ok(de.u.Exception.ExceptionRecord.NumberParameters == 1, "expected exactly one parameter, got %lu\n", + ok(de.u.Exception.ExceptionRecord.NumberParameters == 1 || broken(is_arm64ec), + "expected exactly one parameter, got %lu\n", de.u.Exception.ExceptionRecord.NumberParameters); - ok(de.u.Exception.ExceptionRecord.ExceptionInformation[0] == code, "expected %u for code, got %Iu\n", - code, de.u.Exception.ExceptionRecord.ExceptionInformation[0]); + if (de.u.Exception.ExceptionRecord.NumberParameters >= 1) + ok(de.u.Exception.ExceptionRecord.ExceptionInformation[0] == code, + "expected %u for code, got %Iu\n", + code, de.u.Exception.ExceptionRecord.ExceptionInformation[0]); had_ff = TRUE; } @@ -10760,7 +10766,7 @@ static void test_set_live_context(void) static void test_backtrace(void) { void *buffer[1024]; - WCHAR *p, name[MAX_PATH]; + WCHAR name[MAX_PATH]; void *module; ULONG hash, hash_expect; int i, count = RtlCaptureStackBackTrace( 0, 1024, buffer, &hash ); @@ -10769,16 +10775,20 @@ static void test_backtrace(void) for (i = hash_expect = 0; i < count; i++) hash_expect += (ULONG_PTR)buffer[i]; ok( hash == hash_expect, "hash mismatch %lx / %lx\n", hash, hash_expect ); RtlPcToFileHeader( buffer[0], &module ); - ok( module == GetModuleHandleA(0), "wrong module %p/%p for %p\n", - module, GetModuleHandleA(0), buffer[0]); + if (is_arm64ec && module == hntdll) /* Windows arm64ec has an extra frame for the entry thunk */ + { + ok( count > 1, "wrong count %u\n", count ); + RtlPcToFileHeader( buffer[1], &module ); + } + GetModuleFileNameW( module, name, ARRAY_SIZE(name) ); + ok( module == GetModuleHandleA(0), "wrong module %p %s / %p for %p\n", + module, debugstr_w(name), GetModuleHandleA(0), buffer[0]); if (count && !buffer[count - 1]) count--; /* win11 32-bit */ if (count <= 1) return; RtlPcToFileHeader( buffer[count - 1], &module ); GetModuleFileNameW( module, name, ARRAY_SIZE(name) ); - if ((p = wcsrchr( name, '\\' ))) p++; - else p = name; - ok( !wcsicmp( p, L"ntdll.dll" ), "wrong module %p %s for frame %u %p\n", + ok( module == hntdll, "wrong module %p %s for frame %u %p\n", module, debugstr_w(name), count - 1, buffer[count - 1] ); }
1
0
0
0
Alexandre Julliard : ntdll/tests: Fix debug register tests on ARM64EC.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 3036dddca4b896a22fd19bfa8c93130d312c926c URL:
https://gitlab.winehq.org/wine/wine/-/commit/3036dddca4b896a22fd19bfa8c9313…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 14 10:55:02 2024 +0100 ntdll/tests: Fix debug register tests on ARM64EC. --- dlls/ntdll/tests/exception.c | 100 +++++++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 28 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index db25a3aa2e6..2b6ddecf9e5 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -38,6 +38,7 @@ static void *code_mem; static HMODULE hntdll; +static BOOL is_arm64ec; static NTSTATUS (WINAPI *pNtGetContextThread)(HANDLE,CONTEXT*); static NTSTATUS (WINAPI *pNtSetContextThread)(HANDLE,CONTEXT*); @@ -140,8 +141,6 @@ typedef struct _UNWIND_INFO */ } UNWIND_INFO; -static BOOL is_arm64ec; - static EXCEPTION_DISPOSITION (WINAPI *p__C_specific_handler)(EXCEPTION_RECORD*, ULONG64, CONTEXT*, DISPATCHER_CONTEXT*); static NTSTATUS (WINAPI *pRtlWow64GetThreadContext)(HANDLE, WOW64_CONTEXT *); static NTSTATUS (WINAPI *pRtlWow64SetThreadContext)(HANDLE, const WOW64_CONTEXT *); @@ -7746,17 +7745,29 @@ static void test_debug_registers(void) status = pNtSetContextThread(GetCurrentThread(), &ctx); ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %08lx\n", status); - memset(&ctx, 0, sizeof(ctx)); + memset(&ctx, 0xcc, sizeof(ctx)); ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS; status = pNtGetContextThread(GetCurrentThread(), &ctx); ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08lx\n", status); - ok(ctx.Dr0 == tests[i].dr0, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr0, (DWORD_PTR)ctx.Dr0); - ok(ctx.Dr1 == tests[i].dr1, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr1, (DWORD_PTR)ctx.Dr1); - ok(ctx.Dr2 == tests[i].dr2, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr2, (DWORD_PTR)ctx.Dr2); - ok(ctx.Dr3 == tests[i].dr3, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr3, (DWORD_PTR)ctx.Dr3); - ok((ctx.Dr6 & 0xf00f) == tests[i].dr6, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr6, (DWORD_PTR)ctx.Dr6); - ok((ctx.Dr7 & ~0xdc00) == tests[i].dr7, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr7, (DWORD_PTR)ctx.Dr7); + if (is_arm64ec) /* setting debug registers is silently ignored */ + { + ok(!ctx.Dr0, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr0); + ok(!ctx.Dr1, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr1); + ok(!ctx.Dr2, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr2); + ok(!ctx.Dr3, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr3); + ok(!ctx.Dr6, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr6); + ok(!ctx.Dr7, "test %d: expected 0, got %Ix\n", i, (DWORD_PTR)ctx.Dr7); + } + else + { + ok(ctx.Dr0 == tests[i].dr0, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr0, (DWORD_PTR)ctx.Dr0); + ok(ctx.Dr1 == tests[i].dr1, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr1, (DWORD_PTR)ctx.Dr1); + ok(ctx.Dr2 == tests[i].dr2, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr2, (DWORD_PTR)ctx.Dr2); + ok(ctx.Dr3 == tests[i].dr3, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr3, (DWORD_PTR)ctx.Dr3); + ok((ctx.Dr6 & 0xf00f) == tests[i].dr6, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr6, (DWORD_PTR)ctx.Dr6); + ok((ctx.Dr7 & ~0xdc00) == tests[i].dr7, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr7, (DWORD_PTR)ctx.Dr7); + } } memset(&ctx, 0, sizeof(ctx)); @@ -7824,30 +7835,52 @@ static void test_debug_registers_wow64(void) ok(bret, "SetThreadContext failed\n"); if (bret) { - ZeroMemory(&ctx, sizeof(ctx)); + memset(&ctx, 0xcc, sizeof(ctx)); ctx.ContextFlags = CONTEXT_ALL; bret = GetThreadContext(pi.hThread, &ctx); ok(bret, "GetThreadContext failed\n"); if (bret) { - ok(ctx.Dr0 == 0x12340000, "expected 0x12340000, got %Ix\n", ctx.Dr0); - ok(ctx.Dr1 == 0x12340001, "expected 0x12340001, got %Ix\n", ctx.Dr1); - ok(ctx.Dr2 == 0x12340002, "expected 0x12340002, got %Ix\n", ctx.Dr2); - ok(ctx.Dr3 == 0x12340003, "expected 0x12340003, got %Ix\n", ctx.Dr3); - ok(ctx.Dr7 == 0x155, "expected 0x155, got %Ix\n", ctx.Dr7); + if (is_arm64ec) + { + ok(!ctx.Dr0, "expected 0, got %Ix\n", ctx.Dr0); + ok(!ctx.Dr1, "expected 0, got %Ix\n", ctx.Dr1); + ok(!ctx.Dr2, "expected 0, got %Ix\n", ctx.Dr2); + ok(!ctx.Dr3, "expected 0, got %Ix\n", ctx.Dr3); + ok(!ctx.Dr7, "expected 0, got %Ix\n", ctx.Dr7); + } + else + { + ok(ctx.Dr0 == 0x12340000, "expected 0x12340000, got %Ix\n", ctx.Dr0); + ok(ctx.Dr1 == 0x12340001, "expected 0x12340001, got %Ix\n", ctx.Dr1); + ok(ctx.Dr2 == 0x12340002, "expected 0x12340002, got %Ix\n", ctx.Dr2); + ok(ctx.Dr3 == 0x12340003, "expected 0x12340003, got %Ix\n", ctx.Dr3); + ok(ctx.Dr7 == 0x155, "expected 0x155, got %Ix\n", ctx.Dr7); + } } - ZeroMemory(&wow64_ctx, sizeof(wow64_ctx)); + memset(&wow64_ctx, 0xcc, sizeof(wow64_ctx)); wow64_ctx.ContextFlags = WOW64_CONTEXT_ALL; ret = pRtlWow64GetThreadContext(pi.hThread, &wow64_ctx); ok(ret == STATUS_SUCCESS, "Wow64GetThreadContext failed with %lx\n", ret); if (ret == STATUS_SUCCESS) { - ok(wow64_ctx.Dr0 == 0x12340000, "expected 0x12340000, got %lx\n", wow64_ctx.Dr0); - ok(wow64_ctx.Dr1 == 0x12340001, "expected 0x12340001, got %lx\n", wow64_ctx.Dr1); - ok(wow64_ctx.Dr2 == 0x12340002, "expected 0x12340002, got %lx\n", wow64_ctx.Dr2); - ok(wow64_ctx.Dr3 == 0x12340003, "expected 0x12340003, got %lx\n", wow64_ctx.Dr3); - ok(wow64_ctx.Dr7 == 0x155, "expected 0x155, got %lx\n", wow64_ctx.Dr7); + if (is_arm64ec) + { + ok(!wow64_ctx.Dr0, "expected 0, got %lx\n", wow64_ctx.Dr0); + ok(!wow64_ctx.Dr1, "expected 0, got %lx\n", wow64_ctx.Dr1); + ok(!wow64_ctx.Dr2, "expected 0, got %lx\n", wow64_ctx.Dr2); + ok(!wow64_ctx.Dr3, "expected 0, got %lx\n", wow64_ctx.Dr3); + ok(!wow64_ctx.Dr7, "expected 0, got %lx\n", wow64_ctx.Dr7); + } + else + { + ok(wow64_ctx.Dr0 == 0x12340000, "expected 0x12340000, got %lx\n", wow64_ctx.Dr0); + ok(wow64_ctx.Dr1 == 0x12340001, "expected 0x12340001, got %lx\n", wow64_ctx.Dr1); + ok(wow64_ctx.Dr2 == 0x12340002, "expected 0x12340002, got %lx\n", wow64_ctx.Dr2); + ok(wow64_ctx.Dr3 == 0x12340003, "expected 0x12340003, got %lx\n", wow64_ctx.Dr3); + ok(wow64_ctx.Dr7 == 0x155, "expected 0x155, got %lx\n", wow64_ctx.Dr7); + } } } @@ -7859,7 +7892,7 @@ static void test_debug_registers_wow64(void) ret = pRtlWow64SetThreadContext(pi.hThread, &wow64_ctx); ok(ret == STATUS_SUCCESS, "Wow64SetThreadContext failed with %lx\n", ret); - ZeroMemory(&wow64_ctx, sizeof(wow64_ctx)); + memset(&wow64_ctx, 0xcc, sizeof(wow64_ctx)); wow64_ctx.ContextFlags = WOW64_CONTEXT_ALL; ret = pRtlWow64GetThreadContext(pi.hThread, &wow64_ctx); ok(ret == STATUS_SUCCESS, "Wow64GetThreadContext failed with %lx\n", ret); @@ -7872,17 +7905,28 @@ static void test_debug_registers_wow64(void) ok(wow64_ctx.Dr7 == 0x101, "expected 0x101, got %lx\n", wow64_ctx.Dr7); } - ZeroMemory(&ctx, sizeof(ctx)); + memset(&ctx, 0xcc, sizeof(ctx)); ctx.ContextFlags = CONTEXT_ALL; bret = GetThreadContext(pi.hThread, &ctx); ok(bret, "GetThreadContext failed\n"); if (bret) { - ok(ctx.Dr0 == 0x56780000, "expected 0x56780000, got %Ix\n", ctx.Dr0); - ok(ctx.Dr1 == 0x56780001, "expected 0x56780001, got %Ix\n", ctx.Dr1); - ok(ctx.Dr2 == 0x56780002, "expected 0x56780002, got %Ix\n", ctx.Dr2); - ok(ctx.Dr3 == 0x56780003, "expected 0x56780003, got %Ix\n", ctx.Dr3); - ok(ctx.Dr7 == 0x101, "expected 0x101, got %Ix\n", ctx.Dr7); + if (is_arm64ec) + { + ok(!ctx.Dr0, "expected 0, got %Ix\n", ctx.Dr0); + ok(!ctx.Dr1, "expected 0, got %Ix\n", ctx.Dr1); + ok(!ctx.Dr2, "expected 0, got %Ix\n", ctx.Dr2); + ok(!ctx.Dr3, "expected 0, got %Ix\n", ctx.Dr3); + ok(!ctx.Dr7, "expected 0, got %Ix\n", ctx.Dr7); + } + else + { + ok(ctx.Dr0 == 0x56780000, "expected 0x56780000, got %Ix\n", ctx.Dr0); + ok(ctx.Dr1 == 0x56780001, "expected 0x56780001, got %Ix\n", ctx.Dr1); + ok(ctx.Dr2 == 0x56780002, "expected 0x56780002, got %Ix\n", ctx.Dr2); + ok(ctx.Dr3 == 0x56780003, "expected 0x56780003, got %Ix\n", ctx.Dr3); + ok(ctx.Dr7 == 0x101, "expected 0x101, got %Ix\n", ctx.Dr7); + } } ResumeThread(pi.hThread);
1
0
0
0
Alexandre Julliard : ntdll/tests: Skip segment register tests on ARM64EC.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 97f07ae21171a470058d8e1af783541ef7a923fe URL:
https://gitlab.winehq.org/wine/wine/-/commit/97f07ae21171a470058d8e1af78354…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 14 10:50:03 2024 +0100 ntdll/tests: Skip segment register tests on ARM64EC. --- dlls/ntdll/tests/exception.c | 56 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 822f85d6a3f..db25a3aa2e6 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -656,8 +656,8 @@ static void test_unwind(void) NtCurrentTeb()->Tib.ExceptionList = frame1->Prev; } -static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame, - CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher ) +static DWORD prot_fault_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame, + CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher ) { const struct exception *except = *(const struct exception **)(frame + 1); unsigned int i, parameter_count, entry = except - exceptions; @@ -719,10 +719,7 @@ static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *fram } skip_params: - /* don't handle exception if it's not the address we expected */ - if (context->Eip != (DWORD_PTR)code_mem + except->offset) return ExceptionContinueSearch; - - context->Eip += except->length; + context->Eip = (DWORD_PTR)code_mem + except->offset + except->length; return ExceptionContinueExecution; } @@ -738,7 +735,7 @@ static void test_prot_fault(void) continue; } got_exception = 0; - run_exception_test(handler, &exceptions[i], &exceptions[i].code, + run_exception_test(prot_fault_handler, &exceptions[i], &exceptions[i].code, sizeof(exceptions[i].code), 0); if (!i && !got_exception) { @@ -2658,8 +2655,8 @@ static void run_exception_test(void *handler, const void* context, run_exception_test_flags(handler, context, code, code_size, access, UNW_FLAG_EHANDLER); } -static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame, - CONTEXT *context, DISPATCHER_CONTEXT *dispatcher ) +static DWORD WINAPI prot_fault_handler( EXCEPTION_RECORD *rec, ULONG64 frame, + CONTEXT *context, DISPATCHER_CONTEXT *dispatcher ) { const struct exception *except = *(const struct exception **)(dispatcher->HandlerData); unsigned int i, parameter_count, entry = except - exceptions; @@ -2677,6 +2674,7 @@ static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame, "Unexpected exception address %p/%p\n", rec->ExceptionAddress, (char*)context->Rip ); #ifndef __arm64ec__ + if (!is_arm64ec) { USHORT ds, es, fs, gs, ss; __asm__ volatile( "movw %%ds,%0" : "=g" (ds) ); @@ -2744,10 +2742,7 @@ static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame, skip_params: winetest_pop_context(); - /* don't handle exception if it's not the address we expected */ - if (context->Rip != (DWORD_PTR)code_mem + except->offset) return ExceptionContinueSearch; - - context->Rip += except->length; + context->Rip = (DWORD_PTR)code_mem + except->offset + except->length; return ExceptionContinueExecution; } @@ -3016,11 +3011,13 @@ static void test_exceptions(void) got_exception = 0; run_exception_test(direction_flag_handler, NULL, direction_flag_code, sizeof(direction_flag_code), 0); ok(got_exception == 1, "got %d exceptions, expected 1\n", got_exception); + if (is_arm64ec) __asm__ volatile( "cld" ); /* needed on Windows */ /* test int3 handling */ run_exception_test(int3_handler, NULL, int3_code, sizeof(int3_code), 0); #ifndef __arm64ec__ + if (!is_arm64ec) { USHORT ds, es, fs, gs, ss; /* test segment registers */ @@ -3177,7 +3174,7 @@ static void test_prot_fault(void) for (i = 0; i < ARRAY_SIZE(exceptions); i++) { got_exception = 0; - run_exception_test(handler, &exceptions[i], &exceptions[i].code, + run_exception_test(prot_fault_handler, &exceptions[i], &exceptions[i].code, sizeof(exceptions[i].code), 0); ok( got_exception == (exceptions[i].status != 0), "%u: bad exception count %d\n", i, got_exception ); @@ -4243,7 +4240,8 @@ static void test_wow64_context(void) context.ContextFlags = CONTEXT_ALL; ret = pNtGetContextThread( pi.hThread, &context ); ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); - ok( context.ContextFlags == CONTEXT_ALL, "got context flags %#lx\n", context.ContextFlags ); + ok( context.ContextFlags == is_arm64ec ? CONTEXT_FULL : CONTEXT_ALL, + "got context flags %#lx\n", context.ContextFlags ); ok( !context.Rsi, "rsi is not zero %Ix\n", context.Rsi ); ok( !context.Rdi, "rdi is not zero %Ix\n", context.Rdi ); ok( !context.Rbp, "rbp is not zero %Ix\n", context.Rbp ); @@ -4257,12 +4255,14 @@ static void test_wow64_context(void) ok( !context.R15, "r15 is not zero %Ix\n", context.R15 ); ok( context.MxCsr == 0x1f80, "wrong mxcsr %08lx\n", context.MxCsr ); ok( context.FltSave.ControlWord == 0x27f, "wrong control %08x\n", context.FltSave.ControlWord ); - ok( context.SegDs == ctx.SegDs, "wrong ds %04x / %04lx\n", context.SegDs, ctx.SegDs ); - ok( context.SegEs == ctx.SegEs, "wrong es %04x / %04lx\n", context.SegEs, ctx.SegEs ); - ok( context.SegFs == ctx.SegFs, "wrong fs %04x / %04lx\n", context.SegFs, ctx.SegFs ); - ok( context.SegGs == ctx.SegGs, "wrong gs %04x / %04lx\n", context.SegGs, ctx.SegGs ); - ok( context.SegSs == ctx.SegSs, "wrong ss %04x / %04lx\n", context.SegSs, ctx.SegSs ); - + if (LOWORD(context.ContextFlags) & CONTEXT_SEGMENTS) + { + ok( context.SegDs == ctx.SegDs, "wrong ds %04x / %04lx\n", context.SegDs, ctx.SegDs ); + ok( context.SegEs == ctx.SegEs, "wrong es %04x / %04lx\n", context.SegEs, ctx.SegEs ); + ok( context.SegFs == ctx.SegFs, "wrong fs %04x / %04lx\n", context.SegFs, ctx.SegFs ); + ok( context.SegGs == ctx.SegGs, "wrong gs %04x / %04lx\n", context.SegGs, ctx.SegGs ); + ok( context.SegSs == ctx.SegSs, "wrong ss %04x / %04lx\n", context.SegSs, ctx.SegSs ); + } cs32 = ctx.SegCs; cs64 = context.SegCs; if (cs32 == cs64) @@ -4381,11 +4381,14 @@ static void test_wow64_context(void) trace( "in 64-bit mode %04x\n", context.SegCs ); ok( ctx.Eip != context.Rip, "cs64: eip %08lx / %p\n", ctx.Eip, (void *)context.Rip); ok( ctx.SegCs == cs32, "cs64: wrong cs %04lx / %04x\n", ctx.SegCs, cs32 ); - ok( ctx.SegDs == context.SegDs, "cs64: wrong ds %04lx / %04x\n", ctx.SegDs, context.SegDs ); - ok( ctx.SegEs == context.SegEs, "cs64: wrong es %04lx / %04x\n", ctx.SegEs, context.SegEs ); - ok( ctx.SegFs == context.SegFs, "cs64: wrong fs %04lx / %04x\n", ctx.SegFs, context.SegFs ); - ok( ctx.SegGs == context.SegGs, "cs64: wrong gs %04lx / %04x\n", ctx.SegGs, context.SegGs ); - ok( ctx.SegSs == context.SegSs, "cs64: wrong ss %04lx / %04x\n", ctx.SegSs, context.SegSs ); + if (!is_arm64ec) + { + ok( ctx.SegDs == context.SegDs, "cs64: wrong ds %04lx / %04x\n", ctx.SegDs, context.SegDs ); + ok( ctx.SegEs == context.SegEs, "cs64: wrong es %04lx / %04x\n", ctx.SegEs, context.SegEs ); + ok( ctx.SegFs == context.SegFs, "cs64: wrong fs %04lx / %04x\n", ctx.SegFs, context.SegFs ); + ok( ctx.SegGs == context.SegGs, "cs64: wrong gs %04lx / %04x\n", ctx.SegGs, context.SegGs ); + ok( ctx.SegSs == context.SegSs, "cs64: wrong ss %04lx / %04x\n", ctx.SegSs, context.SegSs ); + } if (teb32.DeallocationStack) ok( ctx.Esp >= teb32.DeallocationStack && ctx.Esp <= teb32.Tib.StackBase, "cs64: esp not inside 32-bit stack %08lx / %08lx-%08lx\n", ctx.Esp, @@ -4445,6 +4448,7 @@ static void test_wow64_context(void) pRtlWow64SetThreadContext( pi.hThread, &ctx ); } got64 = TRUE; + if (is_arm64ec) break; /* no 32-bit %cs on arm64ec */ } } if (!got32) skip( "failed to test 32-bit context\n" );
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
78
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
Results per page:
10
25
50
100
200