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
July 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
639 discussions
Start a n
N
ew thread
Jinoh Kang : shell32: Return stub bitmap in IShellItemImageFactory::GetImage.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 16d785d41608ba6ca6e73d4255154ceed0647ac2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/16d785d41608ba6ca6e73d4255154c…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Jul 15 01:59:58 2022 +0900 shell32: Return stub bitmap in IShellItemImageFactory::GetImage. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=52673
--- dlls/shell32/shellitem.c | 17 +++++++++++++++-- dlls/shell32/tests/shlfolder.c | 1 - 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index 3e8bd24a429..a6d4ee9ef07 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -569,13 +569,26 @@ static HRESULT WINAPI ShellItem_IShellItemImageFactory_GetImage(IShellItemImageF SIZE size, SIIGBF flags, HBITMAP *phbm) { ShellItem *This = impl_from_IShellItemImageFactory(iface); + static const BITMAPINFOHEADER dummy_bmi_header = { + .biSize = sizeof(dummy_bmi_header), + .biWidth = 1, + .biHeight = 1, + .biPlanes = 1, + .biBitCount = 32, + .biCompression = BI_RGB + }; static int once; if (!once++) FIXME("%p ({%lu, %lu} %d %p): stub\n", This, size.cx, size.cy, flags, phbm); - *phbm = NULL; - return E_NOTIMPL; + if (!(*phbm = CreateDIBSection(NULL, (const BITMAPINFO *)&dummy_bmi_header, + DIB_RGB_COLORS, NULL, NULL, 0))) + { + return E_OUTOFMEMORY; + } + + return S_OK; } static const IShellItemImageFactoryVtbl ShellItem_IShellItemImageFactory_Vtbl = { diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 267c81a0ec5..02a5c0dfb2d 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4487,7 +4487,6 @@ static void test_IShellItemImageFactory(void) ret = IShellItemImageFactory_GetImage(siif, size, SIIGBF_BIGGERSIZEOK, &hbm); IShellItemImageFactory_Release(siif); - todo_wine ok(ret == S_OK, "GetImage returned %lx\n", ret); ok(FAILED(ret) == !hbm, "result = %lx but bitmap = %p\n", ret, hbm);
1
0
0
0
Giovanni Mascellani : xactengine3_7: Forward wave bank notifications to the application.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 6e51e0839cedfb7034c638ac35ac221582fc959d URL:
https://gitlab.winehq.org/wine/wine/-/commit/6e51e0839cedfb7034c638ac35ac22…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Jul 8 12:45:54 2022 +0200 xactengine3_7: Forward wave bank notifications to the application. Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com> --- dlls/xactengine3_7/tests/xact3.c | 5 +- dlls/xactengine3_7/xact_dll.c | 201 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 192 insertions(+), 14 deletions(-)
1
0
0
0
Giovanni Mascellani : faudio: Import upstream commit e3c444e4f819d2364a6adb0ae73b1d01185b1e93.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 4be1dc1b7be951f79bbae4a1838f07b7512ddb8b URL:
https://gitlab.winehq.org/wine/wine/-/commit/4be1dc1b7be951f79bbae4a1838f07…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Mon Jul 18 12:58:18 2022 +0200 faudio: Import upstream commit e3c444e4f819d2364a6adb0ae73b1d01185b1e93. Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com> --- libs/faudio/include/FAudio.h | 2 +- libs/faudio/src/FACT.c | 36 ++++++++++-- libs/faudio/src/FACT_internal.h | 1 + libs/faudio/src/FAudioFX_reverb.c | 99 ++++++++++++++++++--------------- libs/faudio/src/FAudio_internal_simd.c | 8 +-- libs/faudio/src/FAudio_platform_win32.c | 4 ++ 6 files changed, 97 insertions(+), 53 deletions(-)
1
0
0
0
Giovanni Mascellani : xactengine3_7/tests: Test notifications when loading a wave bank.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 1ac80a99dd8ffa92e1822a71168030d2cd0bf802 URL:
https://gitlab.winehq.org/wine/wine/-/commit/1ac80a99dd8ffa92e1822a71168030…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Thu Jul 7 15:15:05 2022 +0200 xactengine3_7/tests: Test notifications when loading a wave bank. "The King of Fighters '98 Ultimate Match Final Edition" depends on this behavior. At least, the build I have is; it seems other builds are not. Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com> --- dlls/xactengine3_7/tests/xact3.c | 171 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/dlls/xactengine3_7/tests/xact3.c b/dlls/xactengine3_7/tests/xact3.c index 623a1c97db8..1b27eb9aa19 100644 --- a/dlls/xactengine3_7/tests/xact3.c +++ b/dlls/xactengine3_7/tests/xact3.c @@ -28,6 +28,7 @@ #include "initguid.h" #include "xact3.h" +#include "xact3wb.h" DEFINE_GUID(IID_IXACT3Engine30, 0x9e33f661, 0x2d07, 0x43ec, 0x97, 0x04, 0xbb, 0xcb, 0x71, 0xa5, 0x49, 0x72); DEFINE_GUID(IID_IXACT3Engine31, 0xe72c1b9a, 0xd717, 0x41c0, 0x81, 0xa6, 0x50, 0xeb, 0x56, 0xe8, 0x06, 0x49); @@ -90,11 +91,181 @@ static void test_interfaces(void) } } +static WCHAR *gen_xwb_file(void) +{ + static const WAVEBANKENTRY entry = + { + .Format = + { + .wFormatTag = WAVEBANKMINIFORMAT_TAG_ADPCM, + .nChannels = 2, + .nSamplesPerSec = 22051, + .wBlockAlign = 48, + }, + }; + static const WAVEBANKDATA bank_data = + { + .dwFlags = WAVEBANK_TYPE_STREAMING, + .dwEntryCount = 1, + .szBankName = "test", + .dwEntryMetaDataElementSize = sizeof(entry), + .dwEntryNameElementSize = WAVEBANK_ENTRYNAME_LENGTH, + .dwAlignment = 0x800, + }; + static const WAVEBANKHEADER header = + { + .dwSignature = WAVEBANK_HEADER_SIGNATURE, + .dwVersion = XACT_CONTENT_VERSION, + .dwHeaderVersion = WAVEBANK_HEADER_VERSION, + .Segments = + { + [WAVEBANK_SEGIDX_BANKDATA] = + { + .dwOffset = sizeof(header), + .dwLength = sizeof(bank_data), + }, + [WAVEBANK_SEGIDX_ENTRYMETADATA] = + { + .dwOffset = sizeof(header) + sizeof(bank_data), + .dwLength = sizeof(entry), + }, + }, + }; + static WCHAR path[MAX_PATH]; + DWORD written; + HANDLE file; + + GetTempPathW(ARRAY_SIZE(path), path); + lstrcatW(path, L"test.xwb"); + + file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "Cannot create file %s, error %ld\n", + wine_dbgstr_w(path), GetLastError()); + + WriteFile(file, &header, sizeof(header), &written, NULL); + ok(written == sizeof(header), "Cannot write header\n"); + + WriteFile(file, &bank_data, sizeof(bank_data), &written, NULL); + ok(written == sizeof(bank_data), "Cannot write bank data\n"); + + WriteFile(file, &entry, sizeof(entry), &written, NULL); + ok(written == sizeof(entry), "Cannot write entry\n"); + + CloseHandle(file); + + return path; +} + +struct notification_cb_data +{ + XACTNOTIFICATIONTYPE type; + IXACT3WaveBank *wave_bank; + BOOL received; + DWORD thread_id; +}; + +static void WINAPI notification_cb(const XACT_NOTIFICATION *notification) +{ + struct notification_cb_data *data = notification->pvContext; + DWORD thread_id = GetCurrentThreadId(); + + data->received = TRUE; + ok(notification->type == data->type, + "Unexpected notification type %u\n", notification->type); + ok(notification->waveBank.pWaveBank == data->wave_bank, "Unexpected wave bank %p instead of %p\n", + notification->waveBank.pWaveBank, data->wave_bank); + ok(thread_id == data->thread_id, "Unexpected thread id %#lx instead of %#lx\n", thread_id, data->thread_id); +} + +static void test_notifications(void) +{ + struct notification_cb_data prepared_data = { 0 }, destroyed_data = { 0 }; + XACT_NOTIFICATION_DESCRIPTION notification_desc = { 0 }; + XACT_STREAMING_PARAMETERS streaming_params = { 0 }; + XACT_RUNTIME_PARAMETERS params = { 0 }; + IXACT3Engine *engine; + WCHAR *filename; + unsigned int i; + HANDLE file; + DWORD state; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void **)&engine); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* Win 10 v1507 */, "Cannot create engine, hr %#lx\n", hr); + + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip("XACT not supported\n"); + return; + } + + params.lookAheadTime = XACT_ENGINE_LOOKAHEAD_DEFAULT; + params.fnNotificationCallback = notification_cb; + + hr = IXACT3Engine_Initialize(engine, ¶ms); + ok(hr == S_OK, "Cannot initialize engine, hr %#lx\n", hr); + + prepared_data.type = XACTNOTIFICATIONTYPE_WAVEBANKPREPARED; + prepared_data.thread_id = GetCurrentThreadId(); + notification_desc.type = XACTNOTIFICATIONTYPE_WAVEBANKPREPARED; + notification_desc.flags = XACT_FLAG_NOTIFICATION_PERSIST; + notification_desc.pvContext = &prepared_data; + hr = IXACT3Engine_RegisterNotification(engine, ¬ification_desc); + ok(hr == S_OK, "Cannot register notification, hr %#lx\n", hr); + + destroyed_data.type = XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED; + destroyed_data.thread_id = GetCurrentThreadId(); + notification_desc.type = XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED; + notification_desc.flags = XACT_FLAG_NOTIFICATION_PERSIST; + notification_desc.pvContext = NULL; + hr = IXACT3Engine_RegisterNotification(engine, ¬ification_desc); + ok(hr == S_OK, "Cannot register notification, hr %#lx\n", hr); + + /* Registering again overrides pvContext, but each notification + * class has its own pvContext. */ + notification_desc.pvContext = &destroyed_data; + hr = IXACT3Engine_RegisterNotification(engine, ¬ification_desc); + ok(hr == S_OK, "Cannot register notification, hr %#lx\n", hr); + + filename = gen_xwb_file(); + + file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); + ok(file != INVALID_HANDLE_VALUE, "Cannot open file\n"); + + streaming_params.file = file; + streaming_params.packetSize = 0x800; + hr = IXACT3Engine_CreateStreamingWaveBank(engine, &streaming_params, &prepared_data.wave_bank); + ok(hr == S_OK, "Cannot create a streaming wave bank, hr %#lx\n", hr); + destroyed_data.wave_bank = prepared_data.wave_bank; + + for (i = 0; i < 10 && !prepared_data.received; i++) + { + IXACT3Engine_DoWork(engine); + Sleep(1); + } + + hr = IXACT3WaveBank_GetState(prepared_data.wave_bank, &state); + ok(hr == S_OK, "Cannot query wave bank state, hr %#lx\n", hr); + ok(state == XACT_WAVEBANKSTATE_PREPARED, "Wave bank is not in prepared state, but in %#lx\n", state); + + todo_wine ok(prepared_data.received, "The 'wave bank prepared' notification was never received\n"); + ok(!destroyed_data.received, "The 'wave bank destroyed' notification was received too early\n"); + + IXACT3WaveBank_Destroy(prepared_data.wave_bank); + todo_wine ok(destroyed_data.received, "The 'wave bank destroyed' notification was never received\n"); + + CloseHandle(file); + IXACT3Engine_Release(engine); + + DeleteFileW(filename); +} + START_TEST(xact3) { CoInitialize(NULL); test_interfaces(); + test_notifications(); CoUninitialize(); }
1
0
0
0
Zhiyi Zhang : rpcrt4: Implement I_RpcBindingInqLocalClientPID().
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: a0301f7db6b58cb8aedd2bd0e862f89cbdb984c5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/a0301f7db6b58cb8aedd2bd0e862f8…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Mon May 23 23:09:59 2022 +0800 rpcrt4: Implement I_RpcBindingInqLocalClientPID(). Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/rpcrt4/rpc_binding.c | 16 ++++++++++++++-- dlls/rpcrt4/rpc_binding.h | 1 + dlls/rpcrt4/rpc_transport.c | 11 +++++++++++ dlls/rpcrt4/tests/server.c | 7 ------- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index ba7ef418419..8c2d34f8a21 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -1981,6 +1981,18 @@ RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Op RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID(RPC_BINDING_HANDLE ClientBinding, ULONG *ClientPID) { - FIXME("%p %p: stub\n", ClientBinding, ClientPID); - return RPC_S_INVALID_BINDING; + RpcConnection *connection = NULL; + RpcBinding *binding; + + TRACE("%p %p\n", ClientBinding, ClientPID); + + binding = ClientBinding ? ClientBinding : RPCRT4_GetThreadCurrentCallHandle(); + if (!binding) + return RPC_S_NO_CALL_ACTIVE; + + connection = binding->FromConn; + if (!connection->ops->inquire_client_pid) + return RPC_S_INVALID_BINDING; + + return connection->ops->inquire_client_pid(connection, ClientPID); } diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h index 8faacbd66e2..c79451f4894 100644 --- a/dlls/rpcrt4/rpc_binding.h +++ b/dlls/rpcrt4/rpc_binding.h @@ -118,6 +118,7 @@ struct connection_ops { RPC_STATUS (*impersonate_client)(RpcConnection *conn); RPC_STATUS (*revert_to_self)(RpcConnection *conn); RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG); + RPC_STATUS (*inquire_client_pid)(RpcConnection *conn, ULONG *pid); }; /* don't know what MS's structure looks like */ diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 82798a5a80d..8c615b71dd9 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -893,6 +893,13 @@ static RPC_STATUS rpcrt4_ncalrpc_inquire_auth_client( return RPC_S_OK; } +static RPC_STATUS rpcrt4_ncalrpc_inquire_client_pid(RpcConnection *conn, ULONG *pid) +{ + RpcConnection_np *connection = (RpcConnection_np *)conn; + + return GetNamedPipeClientProcessId(connection->pipe, pid) ? RPC_S_OK : RPC_S_INVALID_BINDING; +} + /**** ncacn_ip_tcp support ****/ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, @@ -3134,6 +3141,7 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_conn_np_impersonate_client, rpcrt4_conn_np_revert_to_self, RPCRT4_default_inquire_auth_client, + NULL }, { "ncalrpc", { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE }, @@ -3156,6 +3164,7 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_conn_np_impersonate_client, rpcrt4_conn_np_revert_to_self, rpcrt4_ncalrpc_inquire_auth_client, + rpcrt4_ncalrpc_inquire_client_pid }, { "ncacn_ip_tcp", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP }, @@ -3178,6 +3187,7 @@ static const struct connection_ops conn_protseq_list[] = { RPCRT4_default_impersonate_client, RPCRT4_default_revert_to_self, RPCRT4_default_inquire_auth_client, + NULL }, { "ncacn_http", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP }, @@ -3200,6 +3210,7 @@ static const struct connection_ops conn_protseq_list[] = { RPCRT4_default_impersonate_client, RPCRT4_default_revert_to_self, RPCRT4_default_inquire_auth_client, + NULL }, }; diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 7fdb076bc73..5fe803e5a1d 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -1140,16 +1140,13 @@ static DWORD CALLBACK test_I_RpcBindingInqLocalClientPID_thread_func(void *args) winetest_push_context("%s", client_test_name); status = I_RpcBindingInqLocalClientPID(NULL, &pid); - todo_wine ok(status == RPC_S_NO_CALL_ACTIVE, "Got unexpected %ld.\n", status); /* Other protocol sequences throw exceptions */ if (params->protseq == RPC_PROTSEQ_LRPC) { status = I_RpcBindingInqLocalClientPID(params->binding, &pid); - todo_wine ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); - todo_wine ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); } @@ -1179,9 +1176,7 @@ void __cdecl s_test_I_RpcBindingInqLocalClientPID(unsigned int protseq, RPC_BIND status = I_RpcBindingInqLocalClientPID(NULL, &pid); if (protseq == RPC_PROTSEQ_LRPC) { - todo_wine ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); - todo_wine ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); } else @@ -1192,9 +1187,7 @@ void __cdecl s_test_I_RpcBindingInqLocalClientPID(unsigned int protseq, RPC_BIND if (protseq == RPC_PROTSEQ_LRPC) /* Other protocol sequences throw exceptions */ { status = I_RpcBindingInqLocalClientPID(binding, &pid); - todo_wine ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); - todo_wine ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); }
1
0
0
0
Zhiyi Zhang : rpcrt4/tests: Add I_RpcBindingInqLocalClientPID() tests.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 056dbb04dea4d0b990e0177f63475165f56ba8da URL:
https://gitlab.winehq.org/wine/wine/-/commit/056dbb04dea4d0b990e0177f634751…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Mon May 23 17:46:03 2022 +0800 rpcrt4/tests: Add I_RpcBindingInqLocalClientPID() tests. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/rpcrt4/tests/server.c | 106 ++++++++++++++++++++++++++++++++++++++++--- dlls/rpcrt4/tests/server.idl | 2 + 2 files changed, 101 insertions(+), 7 deletions(-) diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 253fd817a48..7fdb076bc73 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -40,10 +40,11 @@ #define INT_CODE 4198 -static const char *progname; +static const char *progname, *client_test_name; static BOOL old_windows_version; static HANDLE stop_event, stop_wait_event; +static PROCESS_INFORMATION client_info; static void (WINAPI *pNDRSContextMarshall2)(RPC_BINDING_HANDLE, NDR_SCONTEXT, void*, NDR_RUNDOWN, void*, ULONG); static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG); @@ -147,6 +148,7 @@ static int (__cdecl *sum_array_ptr)(int (*a)[2]); static ctx_handle_t (__cdecl *get_handle)(void); static void (__cdecl *get_handle_by_ptr)(ctx_handle_t *r); static void (__cdecl *test_handle)(ctx_handle_t ctx_handle); +static void (__cdecl *test_I_RpcBindingInqLocalClientPID)(unsigned int protseq, RPC_BINDING_HANDLE binding); #define SERVER_FUNCTIONS \ X(int_return) \ @@ -240,7 +242,8 @@ static void (__cdecl *test_handle)(ctx_handle_t ctx_handle); X(sum_array_ptr) \ X(get_handle) \ X(get_handle_by_ptr) \ - X(test_handle) + X(test_handle) \ + X(test_I_RpcBindingInqLocalClientPID) /* type check statements generated in header file */ fnprintf *p_printf = printf; @@ -1122,6 +1125,88 @@ void __cdecl s_test_handle(ctx_handle_t ctx_handle) ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle); } +struct test_thread_params +{ + unsigned int protseq; + RPC_BINDING_HANDLE binding; +}; + +static DWORD CALLBACK test_I_RpcBindingInqLocalClientPID_thread_func(void *args) +{ + struct test_thread_params *params = (struct test_thread_params *)args; + RPC_STATUS status; + ULONG pid; + + winetest_push_context("%s", client_test_name); + + status = I_RpcBindingInqLocalClientPID(NULL, &pid); + todo_wine + ok(status == RPC_S_NO_CALL_ACTIVE, "Got unexpected %ld.\n", status); + + /* Other protocol sequences throw exceptions */ + if (params->protseq == RPC_PROTSEQ_LRPC) + { + status = I_RpcBindingInqLocalClientPID(params->binding, &pid); + todo_wine + ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); + todo_wine + ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); + } + + winetest_pop_context(); + return 0; +} + +void __cdecl s_test_I_RpcBindingInqLocalClientPID(unsigned int protseq, RPC_BINDING_HANDLE binding) +{ + struct test_thread_params params; + RPC_STATUS status; + HANDLE thread; + ULONG pid; + + winetest_push_context("%s", client_test_name); + + /* Crash on Windows */ + if (0) + { + status = I_RpcBindingInqLocalClientPID(NULL, NULL); + ok(status == RPC_S_INVALID_ARG, "Got unexpected %ld.\n", status); + + status = I_RpcBindingInqLocalClientPID(binding, NULL); + ok(status == RPC_S_INVALID_ARG, "Got unexpected %ld.\n", status); + } + + status = I_RpcBindingInqLocalClientPID(NULL, &pid); + if (protseq == RPC_PROTSEQ_LRPC) + { + todo_wine + ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); + todo_wine + ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); + } + else + { + ok(status == RPC_S_INVALID_BINDING, "Got unexpected %ld.\n", status); + } + + if (protseq == RPC_PROTSEQ_LRPC) /* Other protocol sequences throw exceptions */ + { + status = I_RpcBindingInqLocalClientPID(binding, &pid); + todo_wine + ok(status == RPC_S_OK, "Got unexpected %ld.\n", status); + todo_wine + ok(pid == client_info.dwProcessId, "Got unexpected pid.\n"); + } + + params.protseq = protseq; + params.binding = binding; + thread = CreateThread(NULL, 0, test_I_RpcBindingInqLocalClientPID_thread_func, ¶ms, 0, NULL); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + + winetest_pop_context(); +} + void __RPC_USER ctx_handle_t_rundown(ctx_handle_t ctx_handle) { ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle); @@ -1137,17 +1222,17 @@ static void run_client(const char *test) { char cmdline[MAX_PATH]; - PROCESS_INFORMATION info; STARTUPINFOA startup; memset(&startup, 0, sizeof startup); startup.cb = sizeof startup; + client_test_name = test; make_cmdline(cmdline, test); - ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - wait_child_process( info.hProcess ); - ok(CloseHandle(info.hProcess), "CloseHandle\n"); - ok(CloseHandle(info.hThread), "CloseHandle\n"); + ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &client_info), "CreateProcess\n"); + wait_child_process(client_info.hProcess); + ok(CloseHandle(client_info.hProcess), "CloseHandle\n"); + ok(CloseHandle(client_info.hThread), "CloseHandle\n"); } static void @@ -1964,6 +2049,7 @@ client(const char *test) run_tests(); authinfo_test(RPC_PROTSEQ_TCP, 0); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_TCP, IMixedServer_IfHandle); test_is_server_listening2(IMixedServer_IfHandle, RPC_S_OK, RPC_S_ACCESS_DENIED); ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n"); @@ -1976,6 +2062,7 @@ client(const char *test) set_auth_info(IMixedServer_IfHandle); authinfo_test(RPC_PROTSEQ_TCP, 1); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_TCP, IMixedServer_IfHandle); test_is_server_listening(IMixedServer_IfHandle, RPC_S_ACCESS_DENIED); ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n"); @@ -1988,6 +2075,7 @@ client(const char *test) run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */ authinfo_test(RPC_PROTSEQ_LRPC, 0); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle); test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK); ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n"); @@ -2000,6 +2088,7 @@ client(const char *test) run_tests(); authinfo_test(RPC_PROTSEQ_LRPC, 0); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle); todo_wine test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING); @@ -2016,6 +2105,7 @@ client(const char *test) set_auth_info(IMixedServer_IfHandle); authinfo_test(RPC_PROTSEQ_LRPC, 1); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle); test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK); ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n"); @@ -2029,6 +2119,7 @@ client(const char *test) test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK); run_tests(); authinfo_test(RPC_PROTSEQ_NMP, 0); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_NMP, IMixedServer_IfHandle); test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK); stop(); test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING); @@ -2046,6 +2137,7 @@ client(const char *test) test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK); run_tests(); authinfo_test(RPC_PROTSEQ_NMP, 0); + test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_NMP, IInterpServer_IfHandle); test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK); ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n"); diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index 4d945dcca3e..8de5dce5d4e 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -485,4 +485,6 @@ cpp_quote("#endif") ctx_handle_t get_handle(); void get_handle_by_ptr([out] ctx_handle_t *r); void test_handle(ctx_handle_t ctx_handle); + + void test_I_RpcBindingInqLocalClientPID([in] unsigned int protseq, [in] handle_t binding); }
1
0
0
0
Jinoh Kang : kernel32/tests: Test deletion of synchronization objects after handle close.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: e613992cee2310dc4485a00f00db8ace165d913b URL:
https://gitlab.winehq.org/wine/wine/-/commit/e613992cee2310dc4485a00f00db8a…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Tue Jul 19 00:00:18 2022 +0900 kernel32/tests: Test deletion of synchronization objects after handle close. --- dlls/kernel32/tests/sync.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 93cae1c84d5..60180194b7a 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -182,6 +182,51 @@ static void test_signalandwait(void) CloseHandle(file); } +static void test_temporary_objects(void) +{ + HANDLE handle; + + SetLastError(0xdeadbeef); + handle = CreateMutexA(NULL, FALSE, "WineTestMutex2"); + ok(handle != NULL, "CreateMutex failed with error %ld\n", GetLastError()); + CloseHandle(handle); + + SetLastError(0xdeadbeef); + handle = OpenMutexA(READ_CONTROL, FALSE, "WineTestMutex2"); + ok(!handle, "OpenMutex succeeded\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError()); + + SetLastError(0xdeadbeef); + handle = CreateSemaphoreA(NULL, 0, 1, "WineTestSemaphore2"); + ok(handle != NULL, "CreateSemaphore failed with error %ld\n", GetLastError()); + CloseHandle(handle); + + SetLastError(0xdeadbeef); + handle = OpenSemaphoreA(READ_CONTROL, FALSE, "WineTestSemaphore2"); + ok(!handle, "OpenSemaphore succeeded\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError()); + + SetLastError(0xdeadbeef); + handle = CreateEventA(NULL, FALSE, FALSE, "WineTestEvent2"); + ok(handle != NULL, "CreateEvent failed with error %ld\n", GetLastError()); + CloseHandle(handle); + + SetLastError(0xdeadbeef); + handle = OpenEventA(READ_CONTROL, FALSE, "WineTestEvent2"); + ok(!handle, "OpenEvent succeeded\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError()); + + SetLastError(0xdeadbeef); + handle = CreateWaitableTimerA(NULL, FALSE, "WineTestWaitableTimer2"); + ok(handle != NULL, "CreateWaitableTimer failed with error %ld\n", GetLastError()); + CloseHandle(handle); + + SetLastError(0xdeadbeef); + handle = OpenWaitableTimerA(READ_CONTROL, FALSE, "WineTestWaitableTimer2"); + ok(!handle, "OpenWaitableTimer succeeded\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError()); +} + static void test_mutex(void) { DWORD wait_ret; @@ -2825,6 +2870,7 @@ START_TEST(sync) test_QueueUserAPC(); test_signalandwait(); + test_temporary_objects(); test_mutex(); test_slist(); test_event();
1
0
0
0
Paul Gofman : taskschd: Return SCHED_S_TASK_HAS_NOT_RUN from regtask_get_LastRunTime() stub.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 60a84d0e664ead23448c3297421c2f6717e3b9cd URL:
https://gitlab.winehq.org/wine/wine/-/commit/60a84d0e664ead23448c3297421c2f…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Fri Jul 15 18:59:00 2022 -0500 taskschd: Return SCHED_S_TASK_HAS_NOT_RUN from regtask_get_LastRunTime() stub. --- dlls/taskschd/regtask.c | 2 +- dlls/taskschd/tests/scheduler.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/taskschd/regtask.c b/dlls/taskschd/regtask.c index 4c0c9130c5e..69bec19027c 100644 --- a/dlls/taskschd/regtask.c +++ b/dlls/taskschd/regtask.c @@ -205,7 +205,7 @@ static HRESULT WINAPI regtask_GetInstances(IRegisteredTask *iface, LONG flags, I static HRESULT WINAPI regtask_get_LastRunTime(IRegisteredTask *iface, DATE *date) { FIXME("%p,%p: stub\n", iface, date); - return E_NOTIMPL; + return SCHED_S_TASK_HAS_NOT_RUN; } static HRESULT WINAPI regtask_get_LastTaskResult(IRegisteredTask *iface, LONG *result) diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index e2f985650e0..e6efd3aa1af 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -744,6 +744,7 @@ static void test_GetTask(void) ITaskService *service; ITaskFolder *root, *folder; IRegisteredTask *task1, *task2; + DATE date; IID iid; int i; @@ -840,6 +841,9 @@ static void test_GetTask(void) ok(hr == S_OK, "get_Enabled error %#lx\n", hr); ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool); + hr = IRegisteredTask_get_LastRunTime(task1, &date); + ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr); + IRegisteredTask_Release(task1); hr = ITaskFolder_RegisterTask(folder, Task1, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task2); @@ -865,6 +869,9 @@ static void test_GetTask(void) ok(hr == S_OK, "get_Enabled error %#lx\n", hr); ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); + hr = IRegisteredTask_get_LastRunTime(task2, &date); + ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr); + IRegisteredTask_Release(task2); hr = ITaskFolder_GetTask(root, NULL, &task1); @@ -891,6 +898,9 @@ static void test_GetTask(void) ok(hr == S_OK, "get_Enabled error %#lx\n", hr); ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool); + hr = IRegisteredTask_get_LastRunTime(task1, &date); + ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr); + hr = IRegisteredTask_put_Enabled(task1, VARIANT_TRUE); ok(hr == S_OK, "put_Enabled error %#lx\n", hr); hr = IRegisteredTask_get_State(task1, &state); @@ -902,6 +912,9 @@ static void test_GetTask(void) todo_wine ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); + hr = IRegisteredTask_get_LastRunTime(task1, &date); + ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr); + IRegisteredTask_Release(task1); hr = ITaskFolder_GetTask(folder, Task2, &task2); @@ -922,6 +935,9 @@ static void test_GetTask(void) ok(hr == S_OK, "get_Enabled error %#lx\n", hr); ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); + hr = IRegisteredTask_get_LastRunTime(task2, &date); + ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr); + hr = IRegisteredTask_get_State(task2, NULL); ok(hr == E_POINTER, "expected E_POINTER, got %#lx\n", hr); hr = IRegisteredTask_get_Enabled(task2, NULL);
1
0
0
0
Paul Gofman : schedsvc: Read task enable state from XML in SchRpcGetTaskInfo().
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 6e7f5f8e5fceef78b11950598b58fd3b0816df7b URL:
https://gitlab.winehq.org/wine/wine/-/commit/6e7f5f8e5fceef78b11950598b58fd…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Fri Jul 15 17:31:26 2022 -0500 schedsvc: Read task enable state from XML in SchRpcGetTaskInfo(). --- dlls/schedsvc/Makefile.in | 2 +- dlls/schedsvc/schedsvc.c | 226 +++++++++++++++++++++++++++++++++++++++- dlls/taskschd/tests/scheduler.c | 4 - 3 files changed, 225 insertions(+), 7 deletions(-) diff --git a/dlls/schedsvc/Makefile.in b/dlls/schedsvc/Makefile.in index 021cae468a6..ccd483edae2 100644 --- a/dlls/schedsvc/Makefile.in +++ b/dlls/schedsvc/Makefile.in @@ -1,5 +1,5 @@ MODULE = schedsvc.dll -IMPORTS = rpcrt4 advapi32 ole32 +IMPORTS = rpcrt4 advapi32 ole32 xmllite C_SRCS = \ atsvc.c \ diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c index ee200d94a6c..ba6da110fe5 100644 --- a/dlls/schedsvc/schedsvc.c +++ b/dlls/schedsvc/schedsvc.c @@ -20,7 +20,12 @@ #include <stdarg.h> +#define COBJMACROS + #include "windef.h" +#include "initguid.h" +#include "objbase.h" +#include "xmllite.h" #include "schrpc.h" #include "taskschd.h" #include "wine/debug.h" @@ -31,6 +36,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); static const char bom_utf8[] = { 0xef,0xbb,0xbf }; +struct task_info +{ + BOOL enabled; +}; + HRESULT __cdecl SchRpcHighestVersion(DWORD *version) { TRACE("%p\n", version); @@ -310,6 +320,212 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml) return hr; } +static HRESULT read_text_value(IXmlReader *reader, WCHAR **value) +{ + HRESULT hr; + XmlNodeType type; + + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_Text: + if (FAILED(hr = IXmlReader_GetValue(reader, (const WCHAR **)value, NULL))) + return hr; + TRACE("%s\n", debugstr_w(*value)); + return S_OK; + + case XmlNodeType_Whitespace: + case XmlNodeType_Comment: + break; + + default: + FIXME("unexpected node type %d\n", type); + return E_FAIL; + } + } + + return E_FAIL; +} + +static HRESULT read_variantbool_value(IXmlReader *reader, VARIANT_BOOL *vbool) +{ + WCHAR *value; + HRESULT hr; + + *vbool = VARIANT_FALSE; + + if (FAILED(hr = read_text_value(reader, &value))) + return hr; + + if (!wcscmp(value, L"true")) + { + *vbool = VARIANT_TRUE; + } + else if (wcscmp(value, L"false")) + { + WARN("unexpected bool value %s\n", debugstr_w(value)); + return SCHED_E_INVALIDVALUE; + } + + return S_OK; +} + +static HRESULT read_task_settings(IXmlReader *reader, struct task_info *info) +{ + VARIANT_BOOL bool_val; + const WCHAR *name; + XmlNodeType type; + HRESULT hr; + + if (IXmlReader_IsEmptyElement(reader)) + { + TRACE("Settings is empty.\n"); + return S_OK; + } + + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_EndElement: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("/%s\n", debugstr_w(name)); + + if (!wcscmp(name, L"Settings")) + return S_OK; + + break; + + case XmlNodeType_Element: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("Element: %s\n", debugstr_w(name)); + + if (!wcscmp(name, L"Enabled")) + { + if (FAILED(hr = read_variantbool_value(reader, &bool_val))) + return hr; + info->enabled = !!bool_val; + } + break; + default: + break; + } + } + + WARN("Settings was not terminated\n"); + return SCHED_E_MALFORMEDXML; +} + +static HRESULT read_task_info(IXmlReader *reader, struct task_info *info) +{ + const WCHAR *name; + XmlNodeType type; + HRESULT hr; + + if (IXmlReader_IsEmptyElement(reader)) + { + TRACE("Task is empty\n"); + return S_OK; + } + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_EndElement: + if (FAILED(hr = IXmlReader_GetLocalName(reader, &name, NULL))) + return hr; + + if (!wcscmp(name, L"Task")) + return S_OK; + break; + + case XmlNodeType_Element: + if (FAILED(hr = IXmlReader_GetLocalName(reader, &name, NULL))) + return hr; + + TRACE("Element: %s\n", debugstr_w(name)); + + if (!wcscmp(name, L"Settings")) + { + if (FAILED(hr = read_task_settings(reader, info))) + return hr; + } + break; + + default: + break; + } + } + + WARN("Task was not terminated\n"); + return SCHED_E_MALFORMEDXML; + +} + +static HRESULT read_task_info_from_xml(const WCHAR *xml, struct task_info *info) +{ + IXmlReader *reader; + const WCHAR *name; + XmlNodeType type; + IStream *stream; + HGLOBAL hmem; + HRESULT hr; + void *buf; + + memset(info, 0, sizeof(*info)); + + if (!(hmem = GlobalAlloc(0, wcslen(xml) * sizeof(WCHAR)))) + return E_OUTOFMEMORY; + + buf = GlobalLock(hmem); + memcpy(buf, xml, lstrlenW(xml) * sizeof(WCHAR)); + GlobalUnlock(hmem); + + if (FAILED(hr = CreateStreamOnHGlobal(hmem, TRUE, &stream))) + { + GlobalFree(hmem); + return hr; + } + + if (FAILED(hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL))) + { + IStream_Release(stream); + return hr; + } + + if (FAILED(hr = IXmlReader_SetInput(reader, (IUnknown *)stream))) + goto done; + + while (IXmlReader_Read(reader, &type) == S_OK) + { + if (type != XmlNodeType_Element) continue; + if (FAILED(hr = IXmlReader_GetLocalName(reader, &name, NULL))) + goto done; + + TRACE("Element: %s\n", debugstr_w(name)); + if (wcscmp(name, L"Task")) + continue; + + hr = read_task_info(reader, info); + break; + } + +done: + IXmlReader_Release(reader); + IStream_Release(stream); + if (FAILED(hr)) + { + WARN("Failed parsing xml, hr %#lx.\n", hr); + return SCHED_E_MALFORMEDXML; + } + return S_OK; +} + HRESULT __cdecl SchRpcRetrieveTask(const WCHAR *path, const WCHAR *languages, ULONG *n_languages, WCHAR **xml) { WCHAR *full_name; @@ -685,6 +901,7 @@ HRESULT __cdecl SchRpcGetLastRunInfo(const WCHAR *path, SYSTEMTIME *last_runtime HRESULT __cdecl SchRpcGetTaskInfo(const WCHAR *path, DWORD flags, DWORD *enabled, DWORD *task_state) { WCHAR *full_name, *xml; + struct task_info info; HRESULT hr; FIXME("%s,%#lx,%p,%p: stub\n", debugstr_w(path), flags, enabled, task_state); @@ -695,10 +912,15 @@ HRESULT __cdecl SchRpcGetTaskInfo(const WCHAR *path, DWORD flags, DWORD *enabled hr = read_xml(full_name, &xml); heap_free(full_name); if (hr != S_OK) return hr; + hr = read_task_info_from_xml(xml, &info); heap_free(xml); + if (FAILED(hr)) return hr; - *enabled = 0; - *task_state = (flags & SCH_FLAG_STATE) ? TASK_STATE_DISABLED : TASK_STATE_UNKNOWN; + *enabled = info.enabled; + if (flags & SCH_FLAG_STATE) + *task_state = *enabled ? TASK_STATE_READY : TASK_STATE_DISABLED; + else + *task_state = TASK_STATE_UNKNOWN; return S_OK; } diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index 4a97d831795..e2f985650e0 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -860,11 +860,9 @@ static void test_GetTask(void) SysFreeString(bstr); hr = IRegisteredTask_get_State(task2, &state); ok(hr == S_OK, "get_State error %#lx\n", hr); - todo_wine ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); hr = IRegisteredTask_get_Enabled(task2, &vbool); ok(hr == S_OK, "get_Enabled error %#lx\n", hr); - todo_wine ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); IRegisteredTask_Release(task2); @@ -919,11 +917,9 @@ static void test_GetTask(void) SysFreeString(bstr); hr = IRegisteredTask_get_State(task2, &state); ok(hr == S_OK, "get_State error %#lx\n", hr); - todo_wine ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); hr = IRegisteredTask_get_Enabled(task2, &vbool); ok(hr == S_OK, "get_Enabled error %#lx\n", hr); - todo_wine ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); hr = IRegisteredTask_get_State(task2, NULL);
1
0
0
0
Paul Gofman : taskschd: Implement writing settings to XML.
by Alexandre Julliard
18 Jul '22
18 Jul '22
Module: wine Branch: master Commit: 7e4d4a7edb9c6e69f68491359cea0eb0c6af3de0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/7e4d4a7edb9c6e69f68491359cea0e…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Fri Jul 15 16:11:51 2022 -0500 taskschd: Implement writing settings to XML. --- dlls/taskschd/task.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/dlls/taskschd/task.c b/dlls/taskschd/task.c index 8c9fc9f2582..28c0ff89945 100644 --- a/dlls/taskschd/task.c +++ b/dlls/taskschd/task.c @@ -2457,6 +2457,19 @@ static inline HRESULT write_text_value(IStream *stream, const WCHAR *name, const return write_stringW(stream, L">\n"); } +static HRESULT write_bool_value(IStream *stream, const WCHAR *name, VARIANT_BOOL value) +{ + return write_text_value(stream, name, value ? L"true" : L"false"); +} + +static HRESULT write_int_value(IStream *stream, const WCHAR *name, int val) +{ + WCHAR s[32]; + + swprintf(s, ARRAY_SIZE(s), L"%d", val); + return write_text_value(stream, name, s); +} + static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef) { HRESULT hr; @@ -2684,12 +2697,104 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal) return write_element_end(stream, L"Principals"); } +const WCHAR *string_from_instances_policy(TASK_INSTANCES_POLICY policy) +{ + switch (policy) + { + case TASK_INSTANCES_PARALLEL: return L"Parallel"; + case TASK_INSTANCES_QUEUE: return L"Queue"; + case TASK_INSTANCES_IGNORE_NEW: return L"IgnoreNew"; + case TASK_INSTANCES_STOP_EXISTING : return L"StopExisting"; + } + return L"<error>"; +} + static HRESULT write_settings(IStream *stream, ITaskSettings *settings) { + INetworkSettings *network_settings; + TASK_INSTANCES_POLICY policy; + IIdleSettings *idle_settings; + VARIANT_BOOL bval; + HRESULT hr; + INT ival; + BSTR s; + if (!settings) return write_empty_element(stream, L"Settings"); - FIXME("stub\n"); + if (FAILED(hr = write_element(stream, L"Settings"))) + return hr; + + push_indent(); + +#define WRITE_BOOL_OPTION(name) \ + { \ + if (FAILED(hr = ITaskSettings_get_##name(settings, &bval))) \ + return hr; \ + if (FAILED(hr = write_bool_value(stream, L ## #name, bval))) \ + return hr; \ + } + + + if (FAILED(hr = ITaskSettings_get_AllowDemandStart(settings, &bval))) + return hr; + if (FAILED(hr = write_bool_value(stream, L"AllowStartOnDemand", bval))) + return hr; + + if (SUCCEEDED(hr = TaskSettings_get_RestartInterval(settings, &s)) && s) + { + FIXME("RestartInterval not handled.\n"); + SysFreeString(s); + } + if (FAILED(hr = ITaskSettings_get_MultipleInstances(settings, &policy))) + return hr; + if (FAILED(hr = write_text_value(stream, L"MultipleInstancesPolicy", string_from_instances_policy(policy)))) + return hr; + + WRITE_BOOL_OPTION(DisallowStartIfOnBatteries); + WRITE_BOOL_OPTION(StopIfGoingOnBatteries); + WRITE_BOOL_OPTION(AllowHardTerminate); + WRITE_BOOL_OPTION(StartWhenAvailable); + WRITE_BOOL_OPTION(RunOnlyIfNetworkAvailable); + WRITE_BOOL_OPTION(WakeToRun); + WRITE_BOOL_OPTION(Enabled); + WRITE_BOOL_OPTION(Hidden); + + if (SUCCEEDED(hr = TaskSettings_get_DeleteExpiredTaskAfter(settings, &s)) && s) + { + hr = write_text_value(stream, L"DeleteExpiredTaskAfter", s); + SysFreeString(s); + if (FAILED(hr)) + return hr; + } + if (SUCCEEDED(hr = TaskSettings_get_IdleSettings(settings, &idle_settings))) + { + FIXME("IdleSettings not handled.\n"); + IIdleSettings_Release(idle_settings); + } + if (SUCCEEDED(hr = TaskSettings_get_NetworkSettings(settings, &network_settings))) + { + FIXME("NetworkSettings not handled.\n"); + INetworkSettings_Release(network_settings); + } + if (SUCCEEDED(hr = TaskSettings_get_ExecutionTimeLimit(settings, &s)) && s) + { + hr = write_text_value(stream, L"ExecutionTimeLimit", s); + SysFreeString(s); + if (FAILED(hr)) + return hr; + } + if (FAILED(hr = ITaskSettings_get_Priority(settings, &ival))) + return hr; + if (FAILED(hr = write_int_value(stream, L"Priority", ival))) + return hr; + + WRITE_BOOL_OPTION(RunOnlyIfIdle); +#undef WRITE_BOOL_OPTION + + pop_indent(); + write_element_end(stream, L"Settings"); + return S_OK; }
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
64
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
Results per page:
10
25
50
100
200