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
October 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
537 discussions
Start a n
N
ew thread
Nikolay Sivov : ntdll: Partially implement MemoryRegionInformation query.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: fc5cb9b577a66eab38ea61290bdac60ec36f80ec URL:
https://gitlab.winehq.org/wine/wine/-/commit/fc5cb9b577a66eab38ea61290bdac6…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Jun 28 17:13:47 2022 +0300 ntdll: Partially implement MemoryRegionInformation query. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/ntdll/tests/virtual.c | 97 ++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/virtual.c | 115 ++++++++++++++++++++++++++++++--------------- dlls/wow64/struct32.h | 11 +++++ dlls/wow64/virtual.c | 23 +++++++++ include/winternl.h | 24 ++++++++++ 5 files changed, 233 insertions(+), 37 deletions(-)
1
0
0
0
Brendan Shanks : server: Only require THREAD_SET_LIMITED_INFORMATION access to set thread description.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 0d21e1cbcf705bb2cba3d59571bb8b730ba2feac URL:
https://gitlab.winehq.org/wine/wine/-/commit/0d21e1cbcf705bb2cba3d59571bb8b…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Tue Feb 15 12:09:25 2022 -0800 server: Only require THREAD_SET_LIMITED_INFORMATION access to set thread description. --- dlls/kernel32/tests/thread.c | 2 -- server/thread.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index 0274cb6e266..25e5a0dc1da 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -2538,13 +2538,11 @@ static void test_thread_description(void) thread = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, GetCurrentThreadId()); hr = pSetThreadDescription(thread, desc); - todo_wine ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#lx.\n", hr); ptr = NULL; hr = pGetThreadDescription(GetCurrentThread(), &ptr); ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#lx.\n", hr); - todo_wine ok(!lstrcmpW(ptr, desc), "Unexpected description %s.\n", wine_dbgstr_w(ptr)); LocalFree(ptr); diff --git a/server/thread.c b/server/thread.c index f49fbf40b78..c0fb0eef637 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1534,8 +1534,10 @@ DECL_HANDLER(get_thread_times) DECL_HANDLER(set_thread_info) { struct thread *thread; + unsigned int access = (req->mask == SET_THREAD_INFO_DESCRIPTION) ? THREAD_SET_LIMITED_INFORMATION + : THREAD_SET_INFORMATION; - if ((thread = get_thread_from_handle( req->handle, THREAD_SET_INFORMATION ))) + if ((thread = get_thread_from_handle( req->handle, access ))) { set_thread_info( thread, req ); release_object( thread );
1
0
0
0
Paul Gofman : win32u: Implement NtUserDisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME).
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 21c373560fa8a8095fc0635844102fe73efc3b51 URL:
https://gitlab.winehq.org/wine/wine/-/commit/21c373560fa8a8095fc0635844102f…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Oct 24 17:43:28 2022 -0500 win32u: Implement NtUserDisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME). --- dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/monitor.c | 63 ++++++++++++++++++++++++++++++++++++++++--- dlls/win32u/sysparams.c | 27 +++++++++++++++++-- 3 files changed, 86 insertions(+), 6 deletions(-) diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index 344a3b66d2b..33c7f13f12d 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 hid imm32 +IMPORTS = user32 gdi32 advapi32 hid imm32 setupapi C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 4b774037508..1dff85b9621 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -23,6 +23,8 @@ #include "ntstatus.h" #define WIN32_NO_STATUS +#include "initguid.h" + #include "wine/test.h" #include "winbase.h" #include "wingdi.h" @@ -30,9 +32,14 @@ #include "winreg.h" #include "winternl.h" #include "ddk/d3dkmthk.h" +#include "setupapi.h" +#include "ntddvdeo.h" #include "wine/heap.h" #include <stdio.h> +DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1); +DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 2); + static LONG (WINAPI *pGetDisplayConfigBufferSizes)(UINT32,UINT32*,UINT32*); static BOOL (WINAPI *pGetDpiForMonitorInternal)(HMONITOR,UINT,UINT*,UINT*); static LONG (WINAPI *pQueryDisplayConfig)(UINT32,UINT32*,DISPLAYCONFIG_PATH_INFO*,UINT32*, @@ -1624,6 +1631,58 @@ static void test_EnumDisplayMonitors(void) ok(ret, "CloseWindowStation failed, error %#lx.\n", GetLastError()); } +static void check_device_path(const WCHAR *device_path, const LUID *adapter_id, DWORD id) +{ + BYTE iface_detail_buffer[sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + 256 * sizeof(WCHAR)]; + SP_DEVINFO_DATA device_data = {sizeof(device_data)}; + SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; + SP_DEVICE_INTERFACE_DETAIL_DATA_W *iface_data; + BOOL ret, found = FALSE; + DEVPROPTYPE type; + DWORD output_id; + unsigned int i; + HDEVINFO set; + LUID luid; + + iface_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_W *)iface_detail_buffer; + iface_data->cbSize = sizeof(*iface_data); + + set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MONITOR, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + ok(set != INVALID_HANDLE_VALUE, "Got error %lu.\n", GetLastError()); + + i = 0; + while (SetupDiEnumDeviceInterfaces(set, NULL, &GUID_DEVINTERFACE_MONITOR, i, &iface)) + { + ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, iface_data, + sizeof(iface_detail_buffer), NULL, &device_data); + ok(ret, "Got unexpected ret %d, GetLastError() %lu.\n", ret, GetLastError()); + + ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPROPKEY_MONITOR_GPU_LUID, &type, + (BYTE *)&luid, sizeof(luid), NULL, 0); + ok(ret || broken(GetLastError() == ERROR_NOT_FOUND) /* before Win10 1809 */, + "Got error %lu.\n", GetLastError()); + if (!ret) + { + win_skip("DEVPROPKEY_MONITOR_GPU_LUID is not found, skipping device path check.\n"); + SetupDiDestroyDeviceInfoList(set); + return; + } + ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPROPKEY_MONITOR_OUTPUT_ID, + &type, (BYTE *)&output_id, sizeof(output_id), NULL, 0); + ok(ret, "Got error %lu.\n", GetLastError()); + + if (output_id == id && RtlEqualLuid(&luid, adapter_id) && !wcsicmp(device_path, iface_data->DevicePath)) + { + found = TRUE; + break; + } + ++i; + } + ok(found, "device_path %s not found, luid %04lx:%04lx.\n", debugstr_w(device_path), adapter_id->HighPart, + adapter_id->LowPart); + SetupDiDestroyDeviceInfoList(set); +} + static void test_QueryDisplayConfig_result(UINT32 flags, UINT32 paths, const DISPLAYCONFIG_PATH_INFO *pi, UINT32 modes, const DISPLAYCONFIG_MODE_INFO *mi) { @@ -1654,7 +1713,6 @@ static void test_QueryDisplayConfig_result(UINT32 flags, ret = pDisplayConfigGetDeviceInfo(&source_name.header); ok(ret == ERROR_GEN_FAILURE, "Expected GEN_FAILURE, got %ld\n", ret); - todo_wine { target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; target_name.header.size = sizeof(target_name); target_name.header.adapterId = pi[i].targetInfo.adapterId; @@ -1662,8 +1720,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags, target_name.monitorDevicePath[0] = '\0'; ret = pDisplayConfigGetDeviceInfo(&target_name.header); ok(!ret, "Expected 0, got %ld\n", ret); - ok(target_name.monitorDevicePath[0] != '\0', "Expected monitor device path, got empty string\n"); - } + check_device_path(target_name.monitorDevicePath, &target_name.header.adapterId, target_name.header.id); todo_wine { preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index d490b54a3f4..da1b3bbcd2e 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -5546,13 +5546,36 @@ NTSTATUS WINAPI NtUserDisplayConfigGetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEAD case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME: { DISPLAYCONFIG_TARGET_DEVICE_NAME *target_name = (DISPLAYCONFIG_TARGET_DEVICE_NAME *)packet; + char buffer[ARRAY_SIZE(target_name->monitorFriendlyDeviceName)]; + struct monitor *monitor; - FIXME( "DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME stub.\n" ); + TRACE( "DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME.\n" ); if (packet->size < sizeof(*target_name)) return STATUS_INVALID_PARAMETER; - return STATUS_NOT_SUPPORTED; + if (!lock_display_devices()) return STATUS_UNSUCCESSFUL; + + memset( &target_name->flags, 0, sizeof(*target_name) - offsetof(DISPLAYCONFIG_TARGET_DEVICE_NAME, flags) ); + + LIST_FOR_EACH_ENTRY(monitor, &monitors, struct monitor, entry) + { + if (target_name->header.id != monitor->output_id) continue; + if (memcmp( &target_name->header.adapterId, &monitor->adapter->gpu_luid, + sizeof(monitor->adapter->gpu_luid) )) + continue; + + target_name->outputTechnology = DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL; + /* FIXME: get real monitor name. */ + snprintf( buffer, ARRAY_SIZE(buffer), "Display%u", monitor->output_id + 1 ); + asciiz_to_unicode( target_name->monitorFriendlyDeviceName, buffer ); + lstrcpyW( target_name->monitorDevicePath, monitor->dev.interface_name ); + ret = STATUS_SUCCESS; + break; + } + + unlock_display_devices(); + return ret; } case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE: {
1
0
0
0
Paul Gofman : win32u: Store output id in monitors cache.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: b2787fb15c7f8428c034c27ce38337c6013f0e7e URL:
https://gitlab.winehq.org/wine/wine/-/commit/b2787fb15c7f8428c034c27ce38337…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Oct 24 18:58:44 2022 -0500 win32u: Store output id in monitors cache. --- dlls/win32u/sysparams.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6555e3ef653..d490b54a3f4 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -226,6 +226,7 @@ struct monitor HANDLE handle; unsigned int id; unsigned int flags; + unsigned int output_id; RECT rc_monitor; RECT rc_work; BOOL is_clone; @@ -714,6 +715,17 @@ static BOOL read_monitor_settings( struct adapter *adapter, DWORD index, struct } monitor->dev.state_flags = *(const DWORD *)value->Data; + /* Output ID */ + size = query_reg_subkey_value( hkey, devpropkey_monitor_output_idW, + sizeof(devpropkey_monitor_output_idW), + value, sizeof(buffer) ); + if (size != sizeof(monitor->output_id)) + { + NtClose( hkey ); + return FALSE; + } + monitor->output_id = *(const unsigned int *)value->Data; + /* rc_monitor, WINE_DEVPROPKEY_MONITOR_RCMONITOR */ size = query_reg_subkey_value( hkey, wine_devpropkey_monitor_rcmonitorW, sizeof(wine_devpropkey_monitor_rcmonitorW),
1
0
0
0
Paul Gofman : win32u: Move NtUserDisplayConfigGetDeviceInfo implementation from user32.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 162101bcb34f22ade7b2851d40b503ead7943e3b URL:
https://gitlab.winehq.org/wine/wine/-/commit/162101bcb34f22ade7b2851d40b503…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Oct 24 17:27:16 2022 -0500 win32u: Move NtUserDisplayConfigGetDeviceInfo implementation from user32. --- dlls/user32/sysparams.c | 107 +-------------------------------------------- dlls/win32u/syscall.c | 1 + dlls/win32u/sysparams.c | 85 +++++++++++++++++++++++++++++++++++ dlls/win32u/tests/win32u.c | 20 +++++++++ dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 7 +++ include/ntuser.h | 1 + 8 files changed, 117 insertions(+), 107 deletions(-)
1
0
0
0
Paul Gofman : win32u: Store GPU luid in adapters cache.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 62f66c3da51492478049f259d452a49f909b72e3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/62f66c3da51492478049f259d452a4…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Oct 24 17:04:05 2022 -0500 win32u: Store GPU luid in adapters cache. --- dlls/win32u/sysparams.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index b09c55b3d66..59f8ed0411e 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -211,6 +211,7 @@ struct adapter LONG refcount; struct list entry; struct display_device dev; + LUID gpu_luid; unsigned int id; const WCHAR *config_key; unsigned int mode_count; @@ -565,6 +566,17 @@ static int mode_compare(const void *p1, const void *p2) return 0; } +static unsigned int query_reg_subkey_value( HKEY hkey, const WCHAR *name, unsigned int name_size, + KEY_VALUE_PARTIAL_INFORMATION *value, unsigned int size ) +{ + HKEY subkey; + + if (!(subkey = reg_open_key( hkey, name, name_size ))) return 0; + size = query_reg_value( subkey, NULL, value, size ); + NtClose( subkey ); + return size; +} + static BOOL read_display_adapter_settings( unsigned int index, struct adapter *info ) { char buffer[4096]; @@ -637,6 +649,14 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i if (!(hkey = reg_open_key( enum_key, value_str, value->DataLength - sizeof(WCHAR) ))) return FALSE; + size = query_reg_subkey_value( hkey, devpropkey_gpu_luidW, sizeof(devpropkey_gpu_luidW), value, sizeof(buffer) ); + if (size != sizeof(info->gpu_luid)) + { + NtClose( hkey ); + return FALSE; + } + memcpy( &info->gpu_luid, value->Data, sizeof(info->gpu_luid) ); + size = query_reg_value( hkey, hardware_idW, value, sizeof(buffer) ); NtClose( hkey ); if (!size || (value->Type != REG_SZ && value->Type != REG_MULTI_SZ)) @@ -646,17 +666,6 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i return TRUE; } -static unsigned int query_reg_subkey_value( HKEY hkey, const WCHAR *name, unsigned int name_size, - KEY_VALUE_PARTIAL_INFORMATION *value, unsigned int size ) -{ - HKEY subkey; - - if (!(subkey = reg_open_key( hkey, name, name_size ))) return 0; - size = query_reg_value( subkey, NULL, value, size ); - NtClose( subkey ); - return size; -} - static BOOL read_monitor_settings( struct adapter *adapter, DWORD index, struct monitor *monitor ) { char buffer[4096];
1
0
0
0
Piotr Caban : maintainers: Update Microsoft C Runtime files list.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 93ba92def7f987f931f356ab891a60dc07ef9e85 URL:
https://gitlab.winehq.org/wine/wine/-/commit/93ba92def7f987f931f356ab891a60…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Oct 27 12:42:35 2022 +0200 maintainers: Update Microsoft C Runtime files list. --- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f7669c09b97..721341266a9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -219,7 +219,11 @@ F: dlls/winegstreamer/wmv_decoder.c Microsoft C Runtime M: Piotr Caban <piotr(a)codeweavers.com> +F: dlls/concrt140/ F: dlls/msvc*/ +F: dlls/ucrtbase/ +F: dlls/vcruntime140/ +F: dlls/vcruntime140_1/ MSI installers M: Hans Leidekker <hans(a)codeweavers.com>
1
0
0
0
Piotr Caban : compstui: Test that callbacks are executed.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: d115861031e44a98ff61be0f751c9ad69f9960dc URL:
https://gitlab.winehq.org/wine/wine/-/commit/d115861031e44a98ff61be0f751c9a…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Sep 28 13:34:37 2022 +0200 compstui: Test that callbacks are executed. --- dlls/compstui/tests/compstui.c | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/dlls/compstui/tests/compstui.c b/dlls/compstui/tests/compstui.c index 72ac9b93f28..2634875db63 100644 --- a/dlls/compstui/tests/compstui.c +++ b/dlls/compstui/tests/compstui.c @@ -22,6 +22,42 @@ #include "wine/test.h" +#define DEFINE_EXPECT(func) \ + static BOOL expect_ ## func = FALSE, called_ ## func = FALSE + +#define SET_EXPECT(func) \ + do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0) + +#define CHECK_EXPECT2(func) \ + do { \ + ok(expect_ ##func, "unexpected call " #func "\n"); \ + called_ ## func = TRUE; \ + }while(0) + +#define CHECK_EXPECT(func) \ + do { \ + CHECK_EXPECT2(func); \ + expect_ ## func = FALSE; \ + }while(0) + +#define CHECK_CALLED(func) \ + do { \ + ok(called_ ## func, "expected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + +#define CLEAR_CALLED(func) \ + expect_ ## func = called_ ## func = FALSE + +DEFINE_EXPECT(page_proc_WM_INITDIALOG); +DEFINE_EXPECT(page_proc2_WM_INITDIALOG); +DEFINE_EXPECT(device_PROPSHEETUI_REASON_INIT); +DEFINE_EXPECT(device_PROPSHEETUI_REASON_DESTROY); +DEFINE_EXPECT(callback_PROPSHEETUI_REASON_BEFORE_INIT); +DEFINE_EXPECT(callback_PROPSHEETUI_REASON_INIT); +DEFINE_EXPECT(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); +DEFINE_EXPECT(callback_PROPSHEETUI_REASON_DESTROY); + typedef struct { WORD cbSize; WORD Flags; @@ -40,6 +76,8 @@ static INT_PTR CALLBACK prop_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA { HWND dlg = GetParent(hwnd); + CHECK_EXPECT(page_proc_WM_INITDIALOG); + PostMessageW(dlg, PSM_PRESSBUTTON, PSBTN_OK, 0); } return FALSE; @@ -53,6 +91,8 @@ static INT_PTR CALLBACK prop_page_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPAR PSPINFO *info = (PSPINFO*)((BYTE*)lparam + psp->dwSize); HWND dlg = GetParent(hwnd); + CHECK_EXPECT(page_proc2_WM_INITDIALOG); + ok(psp->dwSize == sizeof(PROPSHEETPAGEW), "psp->dwSize = %ld\n", psp->dwSize); ok(psp->pfnDlgProc == prop_page_proc2, "psp->pfnDlgProc != prop_page_proc2\n"); ok(!psp->lParam, "psp->lParam = %Ix\n", psp->lParam); @@ -70,6 +110,11 @@ static INT_PTR CALLBACK prop_page_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPAR static LONG WINAPI device_property_sheets(PROPSHEETUI_INFO *info, LPARAM lparam) { + if (info->Reason == PROPSHEETUI_REASON_INIT) + CHECK_EXPECT(device_PROPSHEETUI_REASON_INIT); + else + CHECK_EXPECT(device_PROPSHEETUI_REASON_DESTROY); + ok(info->cbSize == sizeof(*info), "info->cbSize = %hd\n", info->cbSize); ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); ok(info->Flags == info->lParamInit ? PSUIINFO_UNICODE : 0, "info->Flags = %hd\n", info->Flags); @@ -98,6 +143,7 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) switch(info->Reason) { case PROPSHEETUI_REASON_BEFORE_INIT: + CHECK_EXPECT(callback_PROPSHEETUI_REASON_BEFORE_INIT); ok(!info->Version, "info->Version = %hd\n", info->Version); ok(!info->Flags, "info->Flags = %hd\n", info->Flags); ok(!info->hComPropSheet, "info->hComPropSheet = %p\n", info->hComPropSheet); @@ -105,6 +151,7 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) ok(!info->Result, "info->Result = %Ix\n", info->Result); break; case PROPSHEETUI_REASON_INIT: + CHECK_EXPECT(callback_PROPSHEETUI_REASON_INIT); ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); ok(info->Flags == PSUIINFO_UNICODE, "info->Flags = %hd\n", info->Flags); ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); @@ -113,6 +160,7 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) ok(!info->Result, "info->Result = %Ix\n", info->Result); break; case PROPSHEETUI_REASON_GET_INFO_HEADER: + CHECK_EXPECT(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); ok(info->Flags == PSUIINFO_UNICODE, "info->Flags = %hd\n", info->Flags); ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); @@ -135,11 +183,18 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) PROPSHEETPAGEW psp; LONG_PTR ret; + SET_EXPECT(device_PROPSHEETUI_REASON_INIT); + SET_EXPECT(device_PROPSHEETUI_REASON_DESTROY); ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_PFNPROPSHEETUIA, (LPARAM)device_property_sheets, 0); ok(!ret, "ret = %Ix\n", ret); + CHECK_CALLED(device_PROPSHEETUI_REASON_INIT); + CHECK_CALLED(device_PROPSHEETUI_REASON_DESTROY); + SET_EXPECT(device_PROPSHEETUI_REASON_INIT); ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_PFNPROPSHEETUIW, (LPARAM)device_property_sheets, 1); ok(ret, "ret = 0\n"); + CHECK_CALLED(device_PROPSHEETUI_REASON_INIT); + SET_EXPECT(device_PROPSHEETUI_REASON_DESTROY); memset(&psp, 0, sizeof(psp)); psp.dwSize = sizeof(psp); @@ -156,8 +211,12 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) } break; case PROPSHEETUI_REASON_DESTROY: + CHECK_EXPECT(callback_PROPSHEETUI_REASON_DESTROY); if (info->lParamInit & ADD_PAGES) + { + CHECK_CALLED(device_PROPSHEETUI_REASON_DESTROY); ok(lparam, "lparam = 0\n"); + } else ok(!lparam, "lparam = %Ix\n", lparam); @@ -188,15 +247,35 @@ static void test_CommonPropertySheetUI(void) ok(res == 0xdeadbeef, "res = %lx\n", res); ok(!GetLastError(), "CommonPropertySheetUIW error %ld\n", GetLastError()); + SET_EXPECT(callback_PROPSHEETUI_REASON_BEFORE_INIT); + SET_EXPECT(callback_PROPSHEETUI_REASON_INIT); + SET_EXPECT(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); + SET_EXPECT(callback_PROPSHEETUI_REASON_DESTROY); res = 0xdeadbeef; ret = CommonPropertySheetUIW((HWND)0x4321, propsheetui_callback, 0, &res); ok(ret == ERR_CPSUI_NO_PROPSHEETPAGE, "CommonPropertySheetUIW returned %ld\n", ret); ok(!res, "res = %lx\n", res); + CLEAR_CALLED(callback_PROPSHEETUI_REASON_BEFORE_INIT); + CHECK_CALLED(callback_PROPSHEETUI_REASON_INIT); + CHECK_CALLED(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); + CHECK_CALLED(callback_PROPSHEETUI_REASON_DESTROY); + SET_EXPECT(callback_PROPSHEETUI_REASON_BEFORE_INIT); + SET_EXPECT(callback_PROPSHEETUI_REASON_INIT); + SET_EXPECT(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); + SET_EXPECT(page_proc2_WM_INITDIALOG); + SET_EXPECT(page_proc_WM_INITDIALOG); + SET_EXPECT(callback_PROPSHEETUI_REASON_DESTROY); res = 0xdeadbeef; ret = CommonPropertySheetUIW((HWND)0x4321, propsheetui_callback, ADD_PAGES, &res); ok(ret == CPSUI_OK, "CommonPropertySheetUIW returned %ld\n", ret); ok(!res, "res = %lx\n", res); + CLEAR_CALLED(callback_PROPSHEETUI_REASON_BEFORE_INIT); + CHECK_CALLED(callback_PROPSHEETUI_REASON_INIT); + CHECK_CALLED(callback_PROPSHEETUI_REASON_GET_INFO_HEADER); + CHECK_CALLED(page_proc2_WM_INITDIALOG); + CHECK_CALLED(page_proc_WM_INITDIALOG); + CHECK_CALLED(callback_PROPSHEETUI_REASON_DESTROY); } START_TEST(compstui)
1
0
0
0
Piotr Caban : compstui: Add CPSFUNC_ADD_PROPSHEETPAGE support.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: f590f72eedf97ce542521d8c79dda099d0308930 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f590f72eedf97ce542521d8c79dda0…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Tue Aug 30 20:24:56 2022 +0200 compstui: Add CPSFUNC_ADD_PROPSHEETPAGE support. --- dlls/compstui/compstui_main.c | 131 ++++++++++++++++++++++++++++++++++++++++- dlls/compstui/tests/compstui.c | 27 +++++++++ include/ddk/compstui.h | 9 +++ 3 files changed, 165 insertions(+), 2 deletions(-) diff --git a/dlls/compstui/compstui_main.c b/dlls/compstui/compstui_main.c index c44942c60a3..60d5f9891b0 100644 --- a/dlls/compstui/compstui_main.c +++ b/dlls/compstui/compstui_main.c @@ -28,7 +28,7 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" -#include "prsht.h" +#include "commctrl.h" #include "ddk/compstui.h" #include "wine/debug.h" @@ -66,6 +66,7 @@ struct propsheet struct propsheetpage { HPROPSHEETPAGE hpsp; + DLGPROC dlg_proc; }; struct propsheetfunc @@ -260,6 +261,130 @@ static HANDLE add_propsheetfunc(HANDLE hcps, PFNPROPSHEETUI func, LPARAM lparam, return ret; } +static HANDLE add_propsheetpage(HANDLE hcps, void *psp, PSPINFO *info, + DLGPROC dlg_proc, BOOL unicode) +{ + struct cps_data *cps_data = get_handle_data(hcps); + struct cps_data *cpsp_data; + HPROPSHEETPAGE hpsp; + HANDLE ret; + + if (!cps_data) + return 0; + + if (cps_data->type != HANDLE_PROPSHEET) + { + FIXME("unsupported handle type %d\n", cps_data->type); + return 0; + } + + if (cps_data->ps->pages_cnt == ARRAY_SIZE(cps_data->ps->pages)) + return 0; + + ret = alloc_handle(&cpsp_data, HANDLE_PROPSHEETPAGE); + if (!ret) + return 0; + + info->cbSize = sizeof(*info); + info->wReserved = 0; + info->hComPropSheet = hcps; + info->hCPSUIPage = ret; + info->pfnComPropSheet = cps_callback; + + if (unicode) + hpsp = CreatePropertySheetPageW((PROPSHEETPAGEW*)psp); + else + hpsp = CreatePropertySheetPageA((PROPSHEETPAGEA*)psp); + if (!hpsp) + { + free_handle(ret); + return 0; + } + + cpsp_data->psp->hpsp = hpsp; + cpsp_data->psp->dlg_proc = dlg_proc; + cps_data->ps->pages[cps_data->ps->pages_cnt++] = ret; + return ret; +} + +static INT_PTR CALLBACK propsheetpage_dlg_procW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + { + PROPSHEETPAGEW *psp = (PROPSHEETPAGEW*)lparam; + PSPINFO *info = (PSPINFO*)((BYTE*)lparam + psp->dwSize - sizeof(*info)); + struct cps_data *cpsp_data = get_handle_data(info->hCPSUIPage); + + psp->dwSize -= sizeof(*info); + psp->pfnDlgProc = cpsp_data->psp->dlg_proc; + SetWindowLongPtrW(hwnd, DWLP_DLGPROC, (LONG_PTR)psp->pfnDlgProc); + return psp->pfnDlgProc(hwnd, msg, wparam, lparam); + } + + return FALSE; +} + +static HANDLE add_propsheetpageW(HANDLE hcps, PROPSHEETPAGEW *psp) +{ + PROPSHEETPAGEW *psp_copy; + PSPINFO *info; + HANDLE ret; + + if (!psp || psp->dwSize < PROPSHEETPAGEW_V1_SIZE) + return 0; + + psp_copy = (PROPSHEETPAGEW*)malloc(psp->dwSize + sizeof(*info)); + if (!psp_copy) + return 0; + memcpy(psp_copy, psp, psp->dwSize); + psp_copy->dwSize += sizeof(*info); + psp_copy->pfnDlgProc = propsheetpage_dlg_procW; + + info = (PSPINFO*)((BYTE*)psp_copy + psp->dwSize); + ret = add_propsheetpage(hcps, psp_copy, info, psp->pfnDlgProc, TRUE); + free(psp_copy); + return ret; +} + +static INT_PTR CALLBACK propsheetpage_dlg_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + { + PROPSHEETPAGEA *psp = (PROPSHEETPAGEA*)lparam; + PSPINFO *info = (PSPINFO*)((BYTE*)lparam + psp->dwSize - sizeof(*info)); + struct cps_data *cpsp_data = get_handle_data(info->hCPSUIPage); + + psp->dwSize -= sizeof(*info); + psp->pfnDlgProc = cpsp_data->psp->dlg_proc; + SetWindowLongPtrA(hwnd, DWLP_DLGPROC, (LONG_PTR)psp->pfnDlgProc); + return psp->pfnDlgProc(hwnd, msg, wparam, lparam); + } + + return FALSE; +} + +static HANDLE add_propsheetpageA(HANDLE hcps, PROPSHEETPAGEA *psp) +{ + PROPSHEETPAGEA *psp_copy; + PSPINFO *info; + HANDLE ret; + + if (!psp || psp->dwSize < PROPSHEETPAGEW_V1_SIZE) + return 0; + + psp_copy = (PROPSHEETPAGEA*)malloc(psp->dwSize + sizeof(*info)); + if (!psp_copy) + return 0; + memcpy(psp_copy, psp, psp->dwSize); + psp_copy->dwSize += sizeof(*info); + psp_copy->pfnDlgProc = propsheetpage_dlg_procA; + + info = (PSPINFO*)((BYTE*)psp_copy + psp->dwSize); + ret = add_propsheetpage(hcps, psp_copy, info, psp->pfnDlgProc, FALSE); + free(psp_copy); + return ret; +} + static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPARAM lparam2) { TRACE("(%p, %u, %Ix, %Ix\n", hcps, func, lparam1, lparam2); @@ -272,7 +397,10 @@ static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPAR case CPSFUNC_ADD_PFNPROPSHEETUIW: return (LONG_PTR)add_propsheetfunc(hcps, (PFNPROPSHEETUI)lparam1, lparam2, func == CPSFUNC_ADD_PFNPROPSHEETUIW); + case CPSFUNC_ADD_PROPSHEETPAGEA: + return (LONG_PTR)add_propsheetpageA(hcps, (PROPSHEETPAGEA*)lparam1); case CPSFUNC_ADD_PROPSHEETPAGEW: + return (LONG_PTR)add_propsheetpageW(hcps, (PROPSHEETPAGEW*)lparam1); case CPSFUNC_ADD_PCOMPROPSHEETUIA: case CPSFUNC_ADD_PCOMPROPSHEETUIW: case CPSFUNC_DELETE_HCOMPROPSHEET: @@ -284,7 +412,6 @@ static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPAR case CPSFUNC_LOAD_CPSUI_STRINGW: case CPSFUNC_LOAD_CPSUI_ICON: case CPSFUNC_GET_PFNPROPSHEETUI_ICON: - case CPSFUNC_ADD_PROPSHEETPAGEA: case CPSFUNC_INSERT_PSUIPAGEA: case CPSFUNC_INSERT_PSUIPAGEW: case CPSFUNC_SET_PSUIPAGE_TITLEA: diff --git a/dlls/compstui/tests/compstui.c b/dlls/compstui/tests/compstui.c index be63c7645ec..72ac9b93f28 100644 --- a/dlls/compstui/tests/compstui.c +++ b/dlls/compstui/tests/compstui.c @@ -45,6 +45,29 @@ static INT_PTR CALLBACK prop_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA return FALSE; } +static INT_PTR CALLBACK prop_page_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + { + PROPSHEETPAGEW *psp = (PROPSHEETPAGEW*)lparam; + PSPINFO *info = (PSPINFO*)((BYTE*)lparam + psp->dwSize); + HWND dlg = GetParent(hwnd); + + ok(psp->dwSize == sizeof(PROPSHEETPAGEW), "psp->dwSize = %ld\n", psp->dwSize); + ok(psp->pfnDlgProc == prop_page_proc2, "psp->pfnDlgProc != prop_page_proc2\n"); + ok(!psp->lParam, "psp->lParam = %Ix\n", psp->lParam); + + ok(info->cbSize == sizeof(*info), "info->cbSize = %hd\n", info->cbSize); + ok(!info->wReserved, "info->wReserved = %hd\n", info->wReserved); + ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); + ok(info->hCPSUIPage != NULL, "info->hCPSUIPage = NULL\n"); + ok(info->pfnComPropSheet != NULL, "info->pfnComPropSheet = NULL\n"); + + PostMessageW(dlg, PSM_SETCURSEL, 1, 0); + } + return FALSE; +} + static LONG WINAPI device_property_sheets(PROPSHEETUI_INFO *info, LPARAM lparam) { ok(info->cbSize == sizeof(*info), "info->cbSize = %hd\n", info->cbSize); @@ -121,6 +144,10 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) memset(&psp, 0, sizeof(psp)); psp.dwSize = sizeof(psp); U(psp).pszTemplate = L"prop_page1"; + psp.pfnDlgProc = prop_page_proc2; + ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGEW, (LPARAM)&psp, 0); + ok(ret, "ret = 0\n"); + psp.pfnDlgProc = prop_page_proc; hpsp = CreatePropertySheetPageW(&psp); ok(hpsp != NULL, "hpsp = %p\n", hpsp); diff --git a/include/ddk/compstui.h b/include/ddk/compstui.h index aa167830207..1563450e26b 100644 --- a/include/ddk/compstui.h +++ b/include/ddk/compstui.h @@ -440,6 +440,15 @@ extern "C" { /* TYPES */ typedef LONG_PTR (CALLBACK *PFNCOMPROPSHEET)(HANDLE, UINT, LPARAM, LPARAM); + +typedef struct _PSPINFO { + WORD cbSize; + WORD wReserved; + HANDLE hComPropSheet; + HANDLE hCPSUIPage; + PFNCOMPROPSHEET pfnComPropSheet; +} PSPINFO, *PPSPINFO; + typedef struct _PROPSHEETUI_INFO { WORD cbSize; WORD Version;
1
0
0
0
Piotr Caban : compstui: Add CPSFUNC_ADD_PFNPROPSHEETUI support.
by Alexandre Julliard
31 Oct '22
31 Oct '22
Module: wine Branch: master Commit: 70bf3d521d2b5faf0507e2ca3322e7171b62db55 URL:
https://gitlab.winehq.org/wine/wine/-/commit/70bf3d521d2b5faf0507e2ca3322e7…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Aug 25 18:28:03 2022 +0200 compstui: Add CPSFUNC_ADD_PFNPROPSHEETUI support. --- dlls/compstui/compstui_main.c | 102 +++++++++++++++++++++++++++++++++++++++-- dlls/compstui/tests/compstui.c | 25 ++++++++++ 2 files changed, 122 insertions(+), 5 deletions(-) diff --git a/dlls/compstui/compstui_main.c b/dlls/compstui/compstui_main.c index b7a08e1c52b..c44942c60a3 100644 --- a/dlls/compstui/compstui_main.c +++ b/dlls/compstui/compstui_main.c @@ -32,6 +32,7 @@ #include "ddk/compstui.h" #include "wine/debug.h" +#include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(compstui); @@ -59,6 +60,7 @@ struct propsheet { int pages_cnt; HANDLE pages[100]; + struct list funcs; }; struct propsheetpage @@ -66,6 +68,17 @@ struct propsheetpage HPROPSHEETPAGE hpsp; }; +struct propsheetfunc +{ + struct list entry; + HANDLE handle; + PFNPROPSHEETUI func; + LPARAM lparam; + BOOL unicode; + ULONG_PTR user_data; + ULONG_PTR result; +}; + #define HANDLE_FIRST 0x43440001 static struct cps_data { @@ -73,7 +86,8 @@ static struct cps_data { HANDLE_FREE = 0, HANDLE_PROPSHEET, - HANDLE_PROPSHEETPAGE + HANDLE_PROPSHEETPAGE, + HANDLE_PROPSHEETFUNC, } type; union { @@ -81,6 +95,7 @@ static struct cps_data struct cps_data *next_free; struct propsheet *ps; struct propsheetpage *psp; + struct propsheetfunc *psf; }; } handles[0x1000]; static struct cps_data *first_free_handle = handles; @@ -94,6 +109,8 @@ static CRITICAL_SECTION_DEBUG handles_cs_debug = }; static CRITICAL_SECTION handles_cs = { &handles_cs_debug, -1, 0, 0, 0, 0 }; +static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPARAM lparam2); + static struct cps_data* get_handle_data(HANDLE handle) { struct cps_data *ret; @@ -117,6 +134,9 @@ static HANDLE alloc_handle(struct cps_data **cps_data, int type) case HANDLE_PROPSHEETPAGE: data = calloc(1, sizeof(struct propsheetpage)); break; + case HANDLE_PROPSHEETFUNC: + data = calloc(1, sizeof(struct propsheetfunc)); + break; } if (!data) @@ -187,6 +207,59 @@ static HANDLE add_hpropsheetpage(HANDLE hcps, HPROPSHEETPAGE hpsp) return ret; } +static HANDLE add_propsheetfunc(HANDLE hcps, PFNPROPSHEETUI func, LPARAM lparam, BOOL unicode) +{ + struct cps_data *cps_data = get_handle_data(hcps); + struct cps_data *cpsf_data; + PROPSHEETUI_INFO info, callback_info; + HANDLE ret; + LONG lret; + + if (!cps_data || !func) + return 0; + + if (cps_data->type != HANDLE_PROPSHEET) + { + FIXME("unsupported handle type %d\n", cps_data->type); + return 0; + } + + ret = alloc_handle(&cpsf_data, HANDLE_PROPSHEETFUNC); + if (!ret) + return 0; + cpsf_data->psf->handle = ret; + cpsf_data->psf->func = func; + cpsf_data->psf->unicode = unicode; + cpsf_data->psf->lparam = lparam; + + memset(&info, 0, sizeof(info)); + info.cbSize = sizeof(info); + info.Version = PROPSHEETUI_INFO_VERSION; + info.Flags = unicode ? PSUIINFO_UNICODE : 0; + info.Reason = PROPSHEETUI_REASON_INIT; + info.hComPropSheet = hcps; + info.pfnComPropSheet = cps_callback; + info.lParamInit = lparam; + + callback_info = info; + lret = func(&callback_info, lparam); + cpsf_data->psf->user_data = callback_info.UserData; + cpsf_data->psf->result = callback_info.Result; + if (lret <= 0) + { + callback_info = info; + callback_info.Reason = PROPSHEETUI_REASON_DESTROY; + callback_info.UserData = cpsf_data->psf->user_data; + callback_info.Result = cpsf_data->psf->result; + free_handle(ret); + func(&callback_info, 0); + return 0; + } + + list_add_tail(&cps_data->ps->funcs, &cpsf_data->psf->entry); + return ret; +} + static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPARAM lparam2) { TRACE("(%p, %u, %Ix, %Ix\n", hcps, func, lparam1, lparam2); @@ -195,11 +268,13 @@ static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPAR { case CPSFUNC_ADD_HPROPSHEETPAGE: return (LONG_PTR)add_hpropsheetpage(hcps, (HPROPSHEETPAGE)lparam1); + case CPSFUNC_ADD_PFNPROPSHEETUIA: + case CPSFUNC_ADD_PFNPROPSHEETUIW: + return (LONG_PTR)add_propsheetfunc(hcps, (PFNPROPSHEETUI)lparam1, + lparam2, func == CPSFUNC_ADD_PFNPROPSHEETUIW); case CPSFUNC_ADD_PROPSHEETPAGEW: case CPSFUNC_ADD_PCOMPROPSHEETUIA: case CPSFUNC_ADD_PCOMPROPSHEETUIW: - case CPSFUNC_ADD_PFNPROPSHEETUIA: - case CPSFUNC_ADD_PFNPROPSHEETUIW: case CPSFUNC_DELETE_HCOMPROPSHEET: case CPSFUNC_SET_HSTARTPAGE: case CPSFUNC_GET_PAGECOUNT: @@ -324,6 +399,7 @@ static LONG create_prop_dlg(HWND hwnd, PFNPROPSHEETUI callback, LPARAM lparam, D SetLastError(0); return ERR_CPSUI_GETLASTERROR; } + list_init(&cps_data->ps->funcs); memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); @@ -364,9 +440,25 @@ static LONG create_prop_dlg(HWND hwnd, PFNPROPSHEETUI callback, LPARAM lparam, D ret = create_property_sheetW(cps_data->ps, &header); destroy: + info.Reason = PROPSHEETUI_REASON_DESTROY; + while (!list_empty(&cps_data->ps->funcs)) + { + struct propsheetfunc *func = LIST_ENTRY(list_head(&cps_data->ps->funcs), + struct propsheetfunc, entry); + + list_remove(&func->entry); + + callback_info = info; + callback_info.Flags = func->unicode ? PSUIINFO_UNICODE : 0; + callback_info.lParamInit = func->lparam; + callback_info.UserData = func->user_data; + callback_info.Result = func->result; + func->func(&callback_info, ret <= 0 ? 0 : 0x100); + free_handle(func->handle); + } + callback_info = info; - callback_info.Reason = PROPSHEETUI_REASON_DESTROY; - callback(&callback_info, ret < 0 ? 0 : 0x100); + callback(&callback_info, ret <= 0 ? 0 : 0x100); for (i = 0; i < cps_data->ps->pages_cnt; i++) free_handle(cps_data->ps->pages[i]); diff --git a/dlls/compstui/tests/compstui.c b/dlls/compstui/tests/compstui.c index f4e3af459a9..be63c7645ec 100644 --- a/dlls/compstui/tests/compstui.c +++ b/dlls/compstui/tests/compstui.c @@ -45,6 +45,25 @@ static INT_PTR CALLBACK prop_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA return FALSE; } +static LONG WINAPI device_property_sheets(PROPSHEETUI_INFO *info, LPARAM lparam) +{ + ok(info->cbSize == sizeof(*info), "info->cbSize = %hd\n", info->cbSize); + ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); + ok(info->Flags == info->lParamInit ? PSUIINFO_UNICODE : 0, "info->Flags = %hd\n", info->Flags); + ok(info->Reason == PROPSHEETUI_REASON_INIT || info->Reason == PROPSHEETUI_REASON_DESTROY, + "info->Reason = %hx\n", info->Reason); + ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); + ok(info->pfnComPropSheet != NULL, "info->pfnComPropSheet = NULL\n"); + if (info->Reason == PROPSHEETUI_REASON_INIT) + { + ok(info->lParamInit == lparam, "info->lParamInit = %Ix, lparam = %Ix\n", + info->lParamInit, lparam); + } + ok(!info->UserData, "info->UserData = %Ix\n", info->UserData); + ok(!info->Result, "info->Result = %Ix\n", info->Result); + return lparam; +} + #define ADD_PAGES 0x1 static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) @@ -93,6 +112,12 @@ static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) PROPSHEETPAGEW psp; LONG_PTR ret; + ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_PFNPROPSHEETUIA, (LPARAM)device_property_sheets, 0); + ok(!ret, "ret = %Ix\n", ret); + + ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_PFNPROPSHEETUIW, (LPARAM)device_property_sheets, 1); + ok(ret, "ret = 0\n"); + memset(&psp, 0, sizeof(psp)); psp.dwSize = sizeof(psp); U(psp).pszTemplate = L"prop_page1";
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
54
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
Results per page:
10
25
50
100
200