winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2018
----- 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
2 participants
785 discussions
Start a n
N
ew thread
Nikolay Sivov : comctl32/button: Improve button data layout compatibility.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: 733a3ec1b9d5a62ba47b289bd23e166ce55dcdf0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=733a3ec1b9d5a62ba47b289b…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 30 13:20:46 2018 +0300 comctl32/button: Improve button data layout compatibility. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comctl32/button.c | 2 ++ dlls/comctl32/tests/button.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index 8b5a654..7d48fe7 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -90,6 +90,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(button); typedef struct _BUTTON_INFO { HWND hwnd; + HWND parent; LONG state; HFONT font; WCHAR *note; @@ -342,6 +343,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L infoPtr = heap_alloc_zero( sizeof(*infoPtr) ); SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr ); infoPtr->hwnd = hWnd; + infoPtr->parent = GetParent(hWnd); return DefWindowProcW(hWnd, uMsg, wParam, lParam); case WM_NCDESTROY: diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index 4c07f0a..0aacfa5 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -979,6 +979,62 @@ static void register_parent_class(void) RegisterClassA(&cls); } +static void test_button_data(void) +{ + static const DWORD styles[] = + { + BS_PUSHBUTTON, + BS_DEFPUSHBUTTON, + BS_CHECKBOX, + BS_AUTOCHECKBOX, + BS_RADIOBUTTON, + BS_3STATE, + BS_AUTO3STATE, + BS_GROUPBOX, + BS_USERBUTTON, + BS_AUTORADIOBUTTON, + BS_OWNERDRAW, + BS_SPLITBUTTON, + BS_DEFSPLITBUTTON, + BS_COMMANDLINK, + BS_DEFCOMMANDLINK, + }; + + struct button_desc + { + HWND self; + HWND parent; + }; + unsigned int i; + HWND parent; + + parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok(parent != 0, "Failed to create parent window\n"); + + for (i = 0; i < ARRAY_SIZE(styles); i++) + { + struct button_desc *desc; + HWND hwnd; + + hwnd = create_button(styles[i], parent); + ok(hwnd != NULL, "Failed to create a button.\n"); + + desc = (void *)GetWindowLongPtrA(hwnd, 0); + ok(desc != NULL, "Expected window data.\n"); + + if (desc) + { + ok(desc->self == hwnd, "Unexpected 'self' field.\n"); + ok(desc->parent == parent, "Unexpected 'parent' field.\n"); + } + + DestroyWindow(hwnd); + } + + DestroyWindow(parent); +} + START_TEST(button) { ULONG_PTR ctx_cookie; @@ -995,6 +1051,7 @@ START_TEST(button) test_button_class(); test_button_messages(); test_note(); + test_button_data(); unload_v6_module(ctx_cookie, hCtx); }
1
0
0
0
Dmitry Timoshkov : mstask: Implement setting and getting a task comment using IExecAction.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: 52df130d29132578c8a5c2e2db6a77e50113c1fd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=52df130d29132578c8a5c2e2…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 17:00:05 2018 +0800 mstask: Implement setting and getting a task comment using IExecAction. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 64 +++++++++++++++++++++--------------------------------- 1 file changed, 25 insertions(+), 39 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index ed0b984..5a40236 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -39,7 +39,6 @@ typedef struct ITaskDefinition *task; IExecAction *action; LPWSTR task_name; - LPWSTR comment; DWORD maxRunTime; LPWSTR accountName; } TaskImpl; @@ -62,7 +61,6 @@ static void TaskDestructor(TaskImpl *This) ITaskDefinition_Release(This->task); HeapFree(GetProcessHeap(), 0, This->task_name); HeapFree(GetProcessHeap(), 0, This->accountName); - HeapFree(GetProcessHeap(), 0, This->comment); HeapFree(GetProcessHeap(), 0, This); InterlockedDecrement(&dll_ref); } @@ -247,56 +245,45 @@ static HRESULT WINAPI MSTASK_ITask_GetExitCode( return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_ITask_SetComment( - ITask* iface, - LPCWSTR pwszComment) +static HRESULT WINAPI MSTASK_ITask_SetComment(ITask *iface, LPCWSTR comment) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); - LPWSTR tmp_comment; - TRACE("(%p, %s)\n", iface, debugstr_w(pwszComment)); + TRACE("(%p, %s)\n", iface, debugstr_w(comment)); - /* Empty comment */ - if (pwszComment[0] == 0) - { - HeapFree(GetProcessHeap(), 0, This->comment); - This->comment = NULL; - return S_OK; - } + if (!comment || !comment[0]) + comment = NULL; - /* Set to pwszComment */ - n = (lstrlenW(pwszComment) + 1); - tmp_comment = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); - if (!tmp_comment) - return E_OUTOFMEMORY; - lstrcpyW(tmp_comment, pwszComment); - HeapFree(GetProcessHeap(), 0, This->comment); - This->comment = tmp_comment; - - return S_OK; + return IExecAction_put_Id(This->action, (BSTR)comment); } -static HRESULT WINAPI MSTASK_ITask_GetComment( - ITask* iface, - LPWSTR *ppwszComment) +static HRESULT WINAPI MSTASK_ITask_GetComment(ITask *iface, LPWSTR *comment) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); + HRESULT hr; + BSTR id; + DWORD len; - TRACE("(%p, %p)\n", iface, ppwszComment); + TRACE("(%p, %p)\n", iface, comment); - n = This->comment ? lstrlenW(This->comment) + 1 : 1; - *ppwszComment = CoTaskMemAlloc(n * sizeof(WCHAR)); - if (!*ppwszComment) - return E_OUTOFMEMORY; + hr = IExecAction_get_Id(This->action, &id); + if (hr != S_OK) return hr; - if (!This->comment) - *ppwszComment[0] = 0; + len = id ? lstrlenW(id) + 1 : 1; + *comment = CoTaskMemAlloc(len * sizeof(WCHAR)); + if (*comment) + { + if (!id) + *comment[0] = 0; + else + lstrcpyW(*comment, id); + hr = S_OK; + } else - lstrcpyW(*ppwszComment, This->comment); + hr = E_OUTOFMEMORY; - return S_OK; + SysFreeString(id); + return hr; } static HRESULT WINAPI MSTASK_ITask_SetCreator( @@ -798,7 +785,6 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t This->ref = 1; This->task = taskdef; This->task_name = heap_strdupW(task_name); - This->comment = NULL; This->accountName = NULL; /* Default time is 3 days = 259200000 ms */
1
0
0
0
Dmitry Timoshkov : mstask: Implement setting and getting working directory using IExecAction.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: 04e240b3a7ca4705f60fde64e8db6078b36fba81 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=04e240b3a7ca4705f60fde64…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 17:00:02 2018 +0800 mstask: Implement setting and getting working directory using IExecAction. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 1aba435..ed0b984 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -533,20 +533,45 @@ static HRESULT WINAPI MSTASK_ITask_GetParameters(ITask *iface, LPWSTR *params) return hr; } -static HRESULT WINAPI MSTASK_ITask_SetWorkingDirectory( - ITask* iface, - LPCWSTR pwszWorkingDirectory) +static HRESULT WINAPI MSTASK_ITask_SetWorkingDirectory(ITask * iface, LPCWSTR workdir) { - FIXME("(%p, %s): stub\n", iface, debugstr_w(pwszWorkingDirectory)); - return E_NOTIMPL; + TaskImpl *This = impl_from_ITask(iface); + + TRACE("(%p, %s)\n", iface, debugstr_w(workdir)); + + if (!workdir || !workdir[0]) + workdir = NULL; + + return IExecAction_put_WorkingDirectory(This->action, (BSTR)workdir); } -static HRESULT WINAPI MSTASK_ITask_GetWorkingDirectory( - ITask* iface, - LPWSTR *ppwszWorkingDirectory) +static HRESULT WINAPI MSTASK_ITask_GetWorkingDirectory(ITask *iface, LPWSTR *workdir) { - FIXME("(%p, %p): stub\n", iface, ppwszWorkingDirectory); - return E_NOTIMPL; + TaskImpl *This = impl_from_ITask(iface); + HRESULT hr; + BSTR dir; + DWORD len; + + TRACE("(%p, %p)\n", iface, workdir); + + hr = IExecAction_get_WorkingDirectory(This->action, &dir); + if (hr != S_OK) return hr; + + len = dir ? lstrlenW(dir) + 1 : 1; + *workdir = CoTaskMemAlloc(len * sizeof(WCHAR)); + if (*workdir) + { + if (!dir) + *workdir[0] = 0; + else + lstrcpyW(*workdir, dir); + hr = S_OK; + } + else + hr = E_OUTOFMEMORY; + + SysFreeString(dir); + return hr; } static HRESULT WINAPI MSTASK_ITask_SetPriority(
1
0
0
0
Dmitry Timoshkov : mstask: Implement setting and getting parameters using IExecAction.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: cad2e5e8e2de39346a895bed39b62b49e45d3525 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cad2e5e8e2de39346a895bed…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:59:57 2018 +0800 mstask: Implement setting and getting parameters using IExecAction. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 62 ++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 1a079cc..1aba435 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -39,7 +39,6 @@ typedef struct ITaskDefinition *task; IExecAction *action; LPWSTR task_name; - LPWSTR parameters; LPWSTR comment; DWORD maxRunTime; LPWSTR accountName; @@ -64,7 +63,6 @@ static void TaskDestructor(TaskImpl *This) HeapFree(GetProcessHeap(), 0, This->task_name); HeapFree(GetProcessHeap(), 0, This->accountName); HeapFree(GetProcessHeap(), 0, This->comment); - HeapFree(GetProcessHeap(), 0, This->parameters); HeapFree(GetProcessHeap(), 0, This); InterlockedDecrement(&dll_ref); } @@ -493,55 +491,46 @@ static HRESULT WINAPI MSTASK_ITask_GetApplicationName(ITask *iface, LPWSTR *appn return hr; } -static HRESULT WINAPI MSTASK_ITask_SetParameters( - ITask* iface, - LPCWSTR pwszParameters) +static HRESULT WINAPI MSTASK_ITask_SetParameters(ITask *iface, LPCWSTR params) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); - LPWSTR tmp_parameters; - TRACE("(%p, %s)\n", iface, debugstr_w(pwszParameters)); + TRACE("(%p, %s)\n", iface, debugstr_w(params)); /* Empty parameter list */ - if (pwszParameters[0] == 0) - { - HeapFree(GetProcessHeap(), 0, This->parameters); - This->parameters = NULL; - return S_OK; - } + if (!params || !params[0]) + params = NULL; - /* Set to pwszParameters */ - n = (lstrlenW(pwszParameters) + 1); - tmp_parameters = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); - if (!tmp_parameters) - return E_OUTOFMEMORY; - lstrcpyW(tmp_parameters, pwszParameters); - HeapFree(GetProcessHeap(), 0, This->parameters); - This->parameters = tmp_parameters; - return S_OK; + return IExecAction_put_Arguments(This->action, (BSTR)params); } -static HRESULT WINAPI MSTASK_ITask_GetParameters( - ITask* iface, - LPWSTR *ppwszParameters) +static HRESULT WINAPI MSTASK_ITask_GetParameters(ITask *iface, LPWSTR *params) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); + HRESULT hr; + BSTR args; + DWORD len; - TRACE("(%p, %p)\n", iface, ppwszParameters); + TRACE("(%p, %p)\n", iface, params); - n = This->parameters ? lstrlenW(This->parameters) + 1 : 1; - *ppwszParameters = CoTaskMemAlloc(n * sizeof(WCHAR)); - if (!*ppwszParameters) - return E_OUTOFMEMORY; + hr = IExecAction_get_Arguments(This->action, &args); + if (hr != S_OK) return hr; - if (!This->parameters) - *ppwszParameters[0] = 0; + len = args ? lstrlenW(args) + 1 : 1; + *params = CoTaskMemAlloc(len * sizeof(WCHAR)); + if (*params) + { + if (!args) + *params[0] = 0; + else + lstrcpyW(*params, args); + hr = S_OK; + } else - lstrcpyW(*ppwszParameters, This->parameters); + hr = E_OUTOFMEMORY; - return S_OK; + SysFreeString(args); + return hr; } static HRESULT WINAPI MSTASK_ITask_SetWorkingDirectory( @@ -784,7 +773,6 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t This->ref = 1; This->task = taskdef; This->task_name = heap_strdupW(task_name); - This->parameters = NULL; This->comment = NULL; This->accountName = NULL;
1
0
0
0
Dmitry Timoshkov : mstask: Implement setting and getting an application name using IExecAction.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: b9ebac70a87fb92b3499d22bbcfea6fdb5d6c49d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b9ebac70a87fb92b3499d22b…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:59:47 2018 +0800 mstask: Implement setting and getting an application name using IExecAction. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 110 +++++++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 97d7782..1a079cc 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -37,8 +37,8 @@ typedef struct IPersistFile IPersistFile_iface; LONG ref; ITaskDefinition *task; + IExecAction *action; LPWSTR task_name; - LPWSTR applicationName; LPWSTR parameters; LPWSTR comment; DWORD maxRunTime; @@ -58,6 +58,8 @@ static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface ) static void TaskDestructor(TaskImpl *This) { TRACE("%p\n", This); + if (This->action) + IExecAction_Release(This->action); ITaskDefinition_Release(This->task); HeapFree(GetProcessHeap(), 0, This->task_name); HeapFree(GetProcessHeap(), 0, This->accountName); @@ -427,73 +429,68 @@ static HRESULT WINAPI MSTASK_ITask_GetAccountInformation( return S_OK; } -static HRESULT WINAPI MSTASK_ITask_SetApplicationName( - ITask* iface, - LPCWSTR pwszApplicationName) +static HRESULT WINAPI MSTASK_ITask_SetApplicationName(ITask *iface, LPCWSTR appname) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); - LPWSTR tmp_name; + DWORD len; - TRACE("(%p, %s)\n", iface, debugstr_w(pwszApplicationName)); + TRACE("(%p, %s)\n", iface, debugstr_w(appname)); /* Empty application name */ - if (pwszApplicationName[0] == 0) - { - HeapFree(GetProcessHeap(), 0, This->applicationName); - This->applicationName = NULL; - return S_OK; - } + if (!appname || !appname[0]) + return IExecAction_put_Path(This->action, NULL); /* Attempt to set pwszApplicationName to a path resolved application name */ - n = SearchPathW(NULL, pwszApplicationName, NULL, 0, NULL, NULL); - if (n) + len = SearchPathW(NULL, appname, NULL, 0, NULL, NULL); + if (len) { - tmp_name = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + LPWSTR tmp_name; + HRESULT hr; + + tmp_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (!tmp_name) return E_OUTOFMEMORY; - n = SearchPathW(NULL, pwszApplicationName, NULL, n, tmp_name, NULL); - if (n) - { - HeapFree(GetProcessHeap(), 0, This->applicationName); - This->applicationName = tmp_name; - return S_OK; - } + len = SearchPathW(NULL, appname, NULL, len, tmp_name, NULL); + if (len) + hr = IExecAction_put_Path(This->action, tmp_name); else - HeapFree(GetProcessHeap(), 0, tmp_name); + hr = HRESULT_FROM_WIN32(GetLastError()); + + HeapFree(GetProcessHeap(), 0, tmp_name); + return hr; } - /* If unable to path resolve name, simply set to pwszApplicationName */ - n = (lstrlenW(pwszApplicationName) + 1); - tmp_name = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); - if (!tmp_name) - return E_OUTOFMEMORY; - lstrcpyW(tmp_name, pwszApplicationName); - HeapFree(GetProcessHeap(), 0, This->applicationName); - This->applicationName = tmp_name; - return S_OK; + /* If unable to path resolve name, simply set to appname */ + return IExecAction_put_Path(This->action, (BSTR)appname); } -static HRESULT WINAPI MSTASK_ITask_GetApplicationName( - ITask* iface, - LPWSTR *ppwszApplicationName) +static HRESULT WINAPI MSTASK_ITask_GetApplicationName(ITask *iface, LPWSTR *appname) { - DWORD n; TaskImpl *This = impl_from_ITask(iface); + HRESULT hr; + BSTR path; + DWORD len; - TRACE("(%p, %p)\n", iface, ppwszApplicationName); + TRACE("(%p, %p)\n", iface, appname); - n = This->applicationName ? lstrlenW(This->applicationName) + 1 : 1; - *ppwszApplicationName = CoTaskMemAlloc(n * sizeof(WCHAR)); - if (!*ppwszApplicationName) - return E_OUTOFMEMORY; + hr = IExecAction_get_Path(This->action, &path); + if (hr != S_OK) return hr; - if (!This->applicationName) - *ppwszApplicationName[0] = 0; + len = path ? lstrlenW(path) + 1 : 1; + *appname = CoTaskMemAlloc(len * sizeof(WCHAR)); + if (*appname) + { + if (!path) + *appname[0] = 0; + else + lstrcpyW(*appname, path); + hr = S_OK; + } else - lstrcpyW(*ppwszApplicationName, This->applicationName); + hr = E_OUTOFMEMORY; - return S_OK; + SysFreeString(path); + return hr; } static HRESULT WINAPI MSTASK_ITask_SetParameters( @@ -767,6 +764,7 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t { TaskImpl *This; ITaskDefinition *taskdef; + IActionCollection *actions; HRESULT hr; TRACE("(%s, %p)\n", debugstr_w(task_name), task); @@ -786,7 +784,6 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t This->ref = 1; This->task = taskdef; This->task_name = heap_strdupW(task_name); - This->applicationName = NULL; This->parameters = NULL; This->comment = NULL; This->accountName = NULL; @@ -794,7 +791,20 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t /* Default time is 3 days = 259200000 ms */ This->maxRunTime = 259200000; - *task = &This->ITask_iface; - InterlockedIncrement(&dll_ref); - return S_OK; + hr = ITaskDefinition_get_Actions(This->task, &actions); + if (hr == S_OK) + { + hr = IActionCollection_Create(actions, TASK_ACTION_EXEC, (IAction **)&This->action); + IActionCollection_Release(actions); + if (hr == S_OK) + { + *task = &This->ITask_iface; + InterlockedIncrement(&dll_ref); + return S_OK; + } + } + + ITaskDefinition_Release(This->task); + ITask_Release(&This->ITask_iface); + return hr; }
1
0
0
0
Dmitry Timoshkov : mstask/tests: Add some tests for task file storage.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: d42e42e3f182bec7b5d69c884ed24d4af2f639f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d42e42e3f182bec7b5d69c88…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:58:54 2018 +0800 mstask/tests: Add some tests for task file storage. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/tests/task_scheduler.c | 151 +++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/dlls/mstask/tests/task_scheduler.c b/dlls/mstask/tests/task_scheduler.c index 31d2848..e1e76e8 100644 --- a/dlls/mstask/tests/task_scheduler.c +++ b/dlls/mstask/tests/task_scheduler.c @@ -2,6 +2,7 @@ * Test suite for TaskScheduler interface * * Copyright (C) 2008 Google (Roy Shea) + * Copyright (C) 2018 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -231,9 +232,159 @@ if (0) { /* crashes on win2k */ ITaskScheduler_Release(scheduler); } +static BOOL file_exists(const WCHAR *name) +{ + return GetFileAttributesW(name) != INVALID_FILE_ATTRIBUTES; +} + +static void test_save_task_curfile(ITask *task) +{ + HRESULT hr; + IPersistFile *pfile; + WCHAR *curfile; + + hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + curfile = NULL; + hr = IPersistFile_GetCurFile(pfile, &curfile); + ok(hr == S_OK, "GetCurFile error %#x\n", hr); + ok(curfile && curfile[0] , "curfile should not be NULL\n"); + + ok(file_exists(curfile), "curfile should exist\n"); + + hr = IPersistFile_Save(pfile, curfile, FALSE); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr); + + hr = IPersistFile_Save(pfile, curfile, TRUE); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr); + + hr = IPersistFile_Save(pfile, NULL, FALSE); + ok(hr == S_OK, "Save error %#x\n", hr); + + hr = IPersistFile_Save(pfile, NULL, TRUE); + ok(hr == S_OK, "Save error %#x\n", hr); + + curfile = NULL; + hr = IPersistFile_GetCurFile(pfile, &curfile); + ok(hr == S_OK, "GetCurFile error %#x\n", hr); + ok(curfile && curfile[0] , "curfile should not be NULL\n"); + + IPersistFile_Release(pfile); +} + +static WCHAR *get_task_curfile(ITask *task) +{ + HRESULT hr; + IPersistFile *pfile; + WCHAR *curfile; + + hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + curfile = NULL; + hr = IPersistFile_GetCurFile(pfile, &curfile); +todo_wine + ok(hr == S_OK, "GetCurFile error %#x\n", hr); +todo_wine + ok(curfile && curfile[0] , "curfile should not be NULL\n"); + + IPersistFile_Release(pfile); + + return curfile; +} + +static void test_task_storage(void) +{ + static const WCHAR Task1[] = { 'w','i','n','e','t','a','s','k',0 }; + static const WCHAR Task1_job[] = { '\\','T','a','s','k','s','\\','w','i','n','e','t','a','s','k','.','j','o','b',0 }; + WCHAR task_full_name[MAX_PATH]; + HRESULT hr; + ITaskScheduler *scheduler; + ITask *task, *task2; + WCHAR *curfile, *curfile2; + + GetWindowsDirectoryW(task_full_name, MAX_PATH); + lstrcatW(task_full_name, Task1_job); + + hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskScheduler, (void **)&scheduler); + if (hr != S_OK) + { + win_skip("CoCreateInstance(CLSID_CTaskScheduler) error %#x\n", hr); + return; + } + + hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task); + ok(hr == S_OK, "NewWorkItem error %#x\n", hr); + + curfile = get_task_curfile(task); + ok(!file_exists(curfile), "curfile should not exist\n"); +todo_wine + ok(!lstrcmpW(curfile, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); + + hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task2); + ok(hr == S_OK, "NewWorkItem error %#x\n", hr); + ok(task2 != task, "tasks should not be equal\n"); + + curfile2 = get_task_curfile(task); + ok(!file_exists(curfile2), "curfile2 should not exist\n"); +todo_wine + ok(!lstrcmpW(curfile2, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); + + CoTaskMemFree(curfile); + CoTaskMemFree(curfile2); + + task2 = (ITask *)0xdeadbeef; + hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task2); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr); + ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n"); + + hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); +todo_wine + ok(hr == S_OK, "AddWorkItem error %#x\n", hr); + + curfile = get_task_curfile(task); +todo_wine + ok(file_exists(curfile), "curfile should exist\n"); + + hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr); + + curfile = get_task_curfile(task); +todo_wine + ok(file_exists(curfile), "curfile should exist\n"); + + ITask_Release(task); + + task = NULL; + hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task); +todo_wine + ok(hr == S_OK, "Activate error %#x\n", hr); +todo_wine + ok(task != NULL, "task should not be set to NULL\n"); + if (task == NULL) goto fail; + + curfile2 = get_task_curfile(task); + ok(file_exists(curfile2), "curfile2 should exist\n"); + ok(!lstrcmpW(curfile2, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); + + CoTaskMemFree(curfile2); + + test_save_task_curfile(task); + + DeleteFileW(curfile); + CoTaskMemFree(curfile); + + ITask_Release(task); +fail: + ITaskScheduler_Release(scheduler); +} + START_TEST(task_scheduler) { CoInitialize(NULL); + + test_task_storage(); test_NewWorkItem(); test_Activate(); test_GetTargetComputer();
1
0
0
0
Dmitry Timoshkov : mstask: Improve stubs for ITask::GetTaskFlags and ITask ::GetFlags.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: a6866be9049f5e86418f3c2a12ef890ceebba549 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a6866be9049f5e86418f3c2a…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:58:39 2018 +0800 mstask: Improve stubs for ITask::GetTaskFlags and ITask::GetFlags. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 18 ++++++++---------- dlls/mstask/tests/task.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index e77a959..97d7782 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -373,12 +373,11 @@ static HRESULT WINAPI MSTASK_ITask_SetFlags( return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_ITask_GetFlags( - ITask* iface, - DWORD *pdwFlags) +static HRESULT WINAPI MSTASK_ITask_GetFlags(ITask *iface, DWORD *flags) { - FIXME("(%p, %p): stub\n", iface, pdwFlags); - return E_NOTIMPL; + FIXME("(%p, %p): stub\n", iface, flags); + *flags = 0; + return S_OK; } static HRESULT WINAPI MSTASK_ITask_SetAccountInformation( @@ -588,12 +587,11 @@ static HRESULT WINAPI MSTASK_ITask_SetTaskFlags( return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_ITask_GetTaskFlags( - ITask* iface, - DWORD *pdwFlags) +static HRESULT WINAPI MSTASK_ITask_GetTaskFlags(ITask *iface, DWORD *flags) { - FIXME("(%p, %p): stub\n", iface, pdwFlags); - return E_NOTIMPL; + FIXME("(%p, %p): stub\n", iface, flags); + *flags = 0; + return S_OK; } static HRESULT WINAPI MSTASK_ITask_SetMaxRunTime( diff --git a/dlls/mstask/tests/task.c b/dlls/mstask/tests/task.c index d139207..956aa0b 100644 --- a/dlls/mstask/tests/task.c +++ b/dlls/mstask/tests/task.c @@ -496,6 +496,39 @@ static void test_SetAccountInformation_GetAccountInformation(void) return; } +static void test_GetFlags(void) +{ + BOOL setup; + HRESULT hr; + DWORD flags; + + setup = setup_task(); + ok(setup, "Failed to setup test_task\n"); + if (!setup) + { + skip("Failed to create task. Skipping tests.\n"); + return; + } + + if (0) /* crashes under Windows */ + hr = ITask_GetFlags(test_task, NULL); + + flags = 0xdeadbeef; + hr = ITask_GetFlags(test_task, &flags); + ok(hr == S_OK, "GetFlags error %#x\n", hr); + ok(flags == 0, "got %#x\n", flags); + + if (0) /* crashes under Windows */ + hr = ITask_GetTaskFlags(test_task, NULL); + + flags = 0xdeadbeef; + hr = ITask_GetTaskFlags(test_task, &flags); + ok(hr == S_OK, "GetTaskFlags error %#x\n", hr); + ok(flags == 0, "got %#x\n", flags); + + cleanup_task(); +} + START_TEST(task) { CoInitialize(NULL); @@ -505,5 +538,6 @@ START_TEST(task) test_SetComment_GetComment(); test_SetMaxRunTime_GetMaxRunTime(); test_SetAccountInformation_GetAccountInformation(); + test_GetFlags(); CoUninitialize(); }
1
0
0
0
Dmitry Timoshkov : mstask: Switch to using ITaskDefinition instead of IRegisteredTask.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: 7ef83b279798ee361ca091ead5fa532fa1ff49c8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7ef83b279798ee361ca091ea…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:58:18 2018 +0800 mstask: Switch to using ITaskDefinition instead of IRegisteredTask. Testing under Windows revealed that task definition on disk should be created only when IPersistFile::Save() is called, and until that ITask should stay as a task description in memory. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/mstask_private.h | 15 ++++++++++++++- dlls/mstask/task.c | 37 ++++++++++--------------------------- dlls/mstask/task_scheduler.c | 14 +------------- 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/dlls/mstask/mstask_private.h b/dlls/mstask/mstask_private.h index 511019d..038c6c8 100644 --- a/dlls/mstask/mstask_private.h +++ b/dlls/mstask/mstask_private.h @@ -19,6 +19,9 @@ #ifndef __MSTASK_PRIVATE_H__ #define __MSTASK_PRIVATE_H__ +#include "wine/heap.h" +#include "wine/unicode.h" + extern LONG dll_ref DECLSPEC_HIDDEN; typedef struct ClassFactoryImpl ClassFactoryImpl; @@ -26,6 +29,16 @@ extern ClassFactoryImpl MSTASK_ClassFactory DECLSPEC_HIDDEN; extern HRESULT TaskTriggerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN; extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN; -extern HRESULT TaskConstructor(ITaskFolder *folder, const WCHAR *task_name, ITask **task, BOOL create) DECLSPEC_HIDDEN; +extern HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **task) DECLSPEC_HIDDEN; + +static inline WCHAR *heap_strdupW(const WCHAR *src) +{ + WCHAR *dst; + unsigned len; + if (!src) return NULL; + len = (strlenW(src) + 1) * sizeof(WCHAR); + if ((dst = heap_alloc(len))) memcpy(dst, src, len); + return dst; +} #endif /* __MSTASK_PRIVATE_H__ */ diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 095431c..e77a959 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -36,7 +36,8 @@ typedef struct ITask ITask_iface; IPersistFile IPersistFile_iface; LONG ref; - IRegisteredTask *regtask; + ITaskDefinition *task; + LPWSTR task_name; LPWSTR applicationName; LPWSTR parameters; LPWSTR comment; @@ -57,6 +58,8 @@ static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface ) static void TaskDestructor(TaskImpl *This) { TRACE("%p\n", This); + ITaskDefinition_Release(This->task); + HeapFree(GetProcessHeap(), 0, This->task_name); HeapFree(GetProcessHeap(), 0, This->accountName); HeapFree(GetProcessHeap(), 0, This->comment); HeapFree(GetProcessHeap(), 0, This->parameters); @@ -762,49 +765,29 @@ static const IPersistFileVtbl MSTASK_IPersistFileVtbl = MSTASK_IPersistFile_GetCurFile }; -HRESULT TaskConstructor(ITaskFolder *folder, const WCHAR *task_name, ITask **task, BOOL create) +HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **task) { TaskImpl *This; - IRegisteredTask *regtask; - BSTR bstr; + ITaskDefinition *taskdef; HRESULT hr; TRACE("(%s, %p)\n", debugstr_w(task_name), task); - bstr = SysAllocString(task_name); - if (!bstr) return E_OUTOFMEMORY; - - if (create) - { - static const char xml_tmplate[] = - "<?xml version=\"1.0\"?>\n" - "<Task xmlns=\"
http://schemas.microsoft.com/windows/2004/02/mit/task\
">\n" - "</Task>\n"; - WCHAR xmlW[sizeof(xml_tmplate)]; - VARIANT v_null; - - MultiByteToWideChar(CP_ACP, 0, xml_tmplate, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); - - V_VT(&v_null) = VT_NULL; - hr = ITaskFolder_RegisterTask(folder, bstr, xmlW, TASK_CREATE | TASK_UPDATE, - v_null, v_null, TASK_LOGON_NONE, v_null, ®task); - } - else - hr = ITaskFolder_GetTask(folder, bstr, ®task); - SysFreeString(bstr); + hr = ITaskService_NewTask(service, 0, &taskdef); if (hr != S_OK) return hr; This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) { - IRegisteredTask_Release(regtask); + ITaskDefinition_Release(taskdef); return E_OUTOFMEMORY; } This->ITask_iface.lpVtbl = &MSTASK_ITaskVtbl; This->IPersistFile_iface.lpVtbl = &MSTASK_IPersistFileVtbl; This->ref = 1; - This->regtask = regtask; + This->task = taskdef; + This->task_name = heap_strdupW(task_name); This->applicationName = NULL; This->parameters = NULL; This->comment = NULL; diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index e9b8727..6e17a57 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -37,7 +37,6 @@ typedef struct ITaskScheduler ITaskScheduler_iface; LONG ref; ITaskService *service; - ITaskFolder *root; } TaskSchedulerImpl; typedef struct @@ -59,7 +58,6 @@ static inline EnumWorkItemsImpl *impl_from_IEnumWorkItems(IEnumWorkItems *iface) static void TaskSchedulerDestructor(TaskSchedulerImpl *This) { TRACE("%p\n", This); - ITaskFolder_Release(This->root); ITaskService_Release(This->service); HeapFree(GetProcessHeap(), 0, This); InterlockedDecrement(&dll_ref); @@ -308,7 +306,7 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem( if (!IsEqualGUID(riid, &IID_ITask)) return E_NOINTERFACE; - return TaskConstructor(This->root, task_name, (ITask **)task, TRUE); + return TaskConstructor(This->service, task_name, (ITask **)task); } static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem( @@ -349,7 +347,6 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj) { TaskSchedulerImpl *This; ITaskService *service; - ITaskFolder *root; VARIANT v_null; HRESULT hr; @@ -366,24 +363,15 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj) return hr; } - hr = ITaskService_GetFolder(service, NULL, &root); - if (hr != S_OK) - { - ITaskService_Release(service); - return hr; - } - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) { - ITaskFolder_Release(root); ITaskService_Release(service); return E_OUTOFMEMORY; } This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl; This->service = service; - This->root = root; This->ref = 1; *ppObj = &This->ITaskScheduler_iface;
1
0
0
0
Dmitry Timoshkov : taskschd: Implement ExecAction::put_Id and ExecAction:: get_Id.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: f9d1aa586e4071aef361f3095c82990a970e82e0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f9d1aa586e4071aef361f309…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Mar 30 16:57:55 2018 +0800 taskschd: Implement ExecAction::put_Id and ExecAction::get_Id. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/taskschd/task.c | 27 +++++++++++++++++++++++---- dlls/taskschd/tests/scheduler.c | 24 ++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/dlls/taskschd/task.c b/dlls/taskschd/task.c index 1b6a701..19546c0 100644 --- a/dlls/taskschd/task.c +++ b/dlls/taskschd/task.c @@ -1679,6 +1679,7 @@ typedef struct WCHAR *path; WCHAR *directory; WCHAR *args; + WCHAR *id; } ExecAction; static inline ExecAction *impl_from_IExecAction(IExecAction *iface) @@ -1703,6 +1704,7 @@ static ULONG WINAPI ExecAction_Release(IExecAction *iface) heap_free(action->path); heap_free(action->directory); heap_free(action->args); + heap_free(action->id); heap_free(action); } @@ -1759,14 +1761,30 @@ static HRESULT WINAPI ExecAction_Invoke(IExecAction *iface, DISPID dispid, REFII static HRESULT WINAPI ExecAction_get_Id(IExecAction *iface, BSTR *id) { - FIXME("%p,%p: stub\n", iface, id); - return E_NOTIMPL; + ExecAction *action = impl_from_IExecAction(iface); + + TRACE("%p,%p\n", iface, id); + + if (!id) return E_POINTER; + + if (!action->id) *id = NULL; + else if (!(*id = SysAllocString(action->id))) return E_OUTOFMEMORY; + + return S_OK; } static HRESULT WINAPI ExecAction_put_Id(IExecAction *iface, BSTR id) { - FIXME("%p,%s: stub\n", iface, debugstr_w(id)); - return E_NOTIMPL; + ExecAction *action = impl_from_IExecAction(iface); + WCHAR *str = NULL; + + TRACE("%p,%s\n", iface, debugstr_w(id)); + + if (id && !(str = heap_strdupW((id)))) return E_OUTOFMEMORY; + heap_free(action->id); + action->id = str; + + return S_OK; } static HRESULT WINAPI ExecAction_get_Type(IExecAction *iface, TASK_ACTION_TYPE *type) @@ -1896,6 +1914,7 @@ static HRESULT ExecAction_create(IExecAction **obj) action->path = NULL; action->directory = NULL; action->args = NULL; + action->id = NULL; *obj = &action->IExecAction_iface; diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index 80bc1c9..c0f691a 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -1306,12 +1306,13 @@ static void create_action(ITaskDefinition *taskdef) static WCHAR task1_exe[] = { 't','a','s','k','1','.','e','x','e',0 }; static WCHAR workdir[] = { 'w','o','r','k','d','i','r',0 }; static WCHAR args[] = { 'a','r','g','u','m','e','n','s',0 }; + static WCHAR comment[] = { 'c','o','m','m','e','n','t',0 }; HRESULT hr; IActionCollection *actions; IAction *action; IExecAction *exec_action; TASK_ACTION_TYPE type; - BSTR path; + BSTR path, str; hr = ITaskDefinition_get_Actions(taskdef, NULL); ok(hr == E_POINTER, "got %#x\n", hr); @@ -1384,7 +1385,7 @@ static void create_action(ITaskDefinition *taskdef) ok(hr == S_OK, "put_Arguments error %#x\n", hr); hr = IExecAction_put_Arguments(exec_action, args); - ok(hr == S_OK, "put_WorkingDirectory error %#x\n", hr); + ok(hr == S_OK, "put_Arguments error %#x\n", hr); path = NULL; hr = IExecAction_get_Arguments(exec_action, &path); @@ -1393,6 +1394,25 @@ static void create_action(ITaskDefinition *taskdef) ok(!lstrcmpW(path, args), "got %s\n", wine_dbgstr_w(path)); SysFreeString(path); + + str = (BSTR)0xdeadbeef; + hr = IExecAction_get_Id(exec_action, &str); + ok(hr == S_OK, "get_Id error %#x\n", hr); + ok(str == NULL, "id should be NULL\n"); + + hr = IExecAction_put_Id(exec_action, NULL); + ok(hr == S_OK, "put_Id error %#x\n", hr); + + hr = IExecAction_put_Id(exec_action, comment); + ok(hr == S_OK, "put_Id error %#x\n", hr); + + str = NULL; + hr = IExecAction_get_Id(exec_action, &str); + ok(hr == S_OK, "get_Id error %#x\n", hr); + ok(str != NULL, "should not be NULL\n"); + ok(!lstrcmpW(str, comment), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + IExecAction_Release(exec_action); IAction_Release(action); IActionCollection_Release(actions);
1
0
0
0
Alexandre Julliard : user32: Set the process DPI awareness from the manifest.
by Alexandre Julliard
30 Mar '18
30 Mar '18
Module: wine Branch: master Commit: 4c71db15ca72f099d5237857a3e9eb03764c7f1b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4c71db15ca72f099d5237857…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Mar 30 16:45:22 2018 +0200 user32: Set the process DPI awareness from the manifest. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/user_main.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/user32/user_private.h | 2 ++ 2 files changed, 59 insertions(+) diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 74a7617..057c7aa 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -212,6 +212,62 @@ static const WCHAR *get_default_desktop(void) /*********************************************************************** + * dpiaware_init + * + * Initialize the DPI awareness style. + */ +static void dpiaware_init(void) +{ + WCHAR buffer[256]; + static const WCHAR dpiAwareW[] = {'d','p','i','A','w','a','r','e',0}; + static const WCHAR dpiAwarenessW[] = {'d','p','i','A','w','a','r','e','n','e','s','s',0}; + static const WCHAR namespace2005W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}; + static const WCHAR namespace2016W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','6','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}; + + if (QueryActCtxSettingsW( 0, NULL, namespace2016W, dpiAwarenessW, buffer, ARRAY_SIZE(buffer), NULL )) + { + static const WCHAR unawareW[] = {'u','n','a','w','a','r','e',0}; + static const WCHAR systemW[] = {'s','y','s','t','e','m',0}; + static const WCHAR permonW[] = {'p','e','r','m','o','n','i','t','o','r',0}; + static const WCHAR permonv2W[] = {'p','e','r','m','o','n','i','t','o','r','v','2',0}; + static const WCHAR spacesW[] = {' ','\t','\r','\n',0}; + static const WCHAR * const types[] = { unawareW, systemW, permonW, permonv2W }; + WCHAR *p, *start = buffer, *end; + ULONG_PTR i; + + TRACE( "got dpiAwareness=%s\n", debugstr_w(buffer) ); + for (start = buffer; *start; start = end) + { + start += strspnW( start, spacesW ); + if (!(end = strchrW( start, ',' ))) end = start + strlenW(start); + else *end++ = 0; + if ((p = strpbrkW( start, spacesW ))) *p = 0; + for (i = 0; i < ARRAY_SIZE(types); i++) + { + if (strcmpiW( start, types[i] )) continue; + SetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ); + return; + } + } + } + else if (QueryActCtxSettingsW( 0, NULL, namespace2005W, dpiAwareW, buffer, ARRAY_SIZE(buffer), NULL )) + { + static const WCHAR trueW[] = {'t','r','u','e',0}; + static const WCHAR truepmW[] = {'t','r','u','e','/','p','m',0}; + static const WCHAR permonW[] = {'p','e','r',' ','m','o','n','i','t','o','r',0}; + + TRACE( "got dpiAware=%s\n", debugstr_w(buffer) ); + if (!strcmpiW( buffer, trueW )) + SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ); + else if (!strcmpiW( buffer, truepmW ) || !strcmpiW( buffer, permonW )) + SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); + else + SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE ); + } +} + + +/*********************************************************************** * winstation_init * * Connect to the process window station and desktop. @@ -272,6 +328,7 @@ static void winstation_init(void) */ static BOOL process_attach(void) { + dpiaware_init(); winstation_init(); /* Initialize system colors and metrics */ diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 7e4f699..5d54cb1 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -32,6 +32,8 @@ #define GET_WORD(ptr) (*(const WORD *)(ptr)) #define GET_DWORD(ptr) (*(const DWORD *)(ptr)) +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) + #define WM_SYSTIMER 0x0118 #define WM_POPUPSYSTEMMENU 0x0313
1
0
0
0
← Newer
1
2
3
4
5
...
79
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Results per page:
10
25
50
100
200