Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 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
March 2018
- 90 participants
- 1704 messages
[PATCH] testbot: Fix Collection::IsEmpty() on perl 5.20.
by Francois Gouget
Although scalar(%hash) is 0 when the hash is empty, the rest of the time
it is not a number.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/Collection.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index a57a32942..032c7386d 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -420,8 +420,9 @@ sub IsEmpty($)
}
# Even though scalar(hash) does not return the number of items in Perl 5.20
- # it returns 0 for an empty hash.
- return !$self->{Items} || scalar(%{$self->{Items}}) == 0;
+ # (and cannot generally be compared to numbers), it evaluates to true for
+ # all hashes except empty ones.
+ return !$self->{Items} || !%{$self->{Items}};
}
sub CombineKey($@)
--
2.16.2
March 30, 2018
[PATCH 8/8] mstask: Implement setting and getting a task comment using IExecAction.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 ed0b984d84..5a4023694c 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 */
--
2.16.2
March 30, 2018
[PATCH 7/8] mstask: Implement setting and getting working directory using IExecAction.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 1aba435efd..ed0b984d84 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(
--
2.16.2
March 30, 2018
[PATCH 6/8] mstask: Implement setting and getting parameters using IExecAction.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 1a079cc8c5..1aba435efd 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;
--
2.16.2
March 30, 2018
[PATCH 5/8] mstask: Implement setting and getting an application name using IExecAction.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 97d778255f..1a079cc8c5 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;
}
--
2.16.2
March 30, 2018
[PATCH 4/8] mstask/tests: Add some tests for task file storage.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 31d284819c..e1e76e8c9c 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();
--
2.16.2
March 30, 2018
[PATCH 3/8] mstask: Improve stubs for ITask::GetTaskFlags and ITask::GetFlags.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 e77a959e0f..97d778255f 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 d139207039..956aa0bbd0 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();
}
--
2.16.2
March 30, 2018
[PATCH 2/8] mstask: Switch to using ITaskDefinition instead of IRegisteredTask.
by Dmitry Timoshkov
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>
---
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 511019ded6..038c6c84c1 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 095431cb04..e77a959e0f 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 e9b8727633..6e17a57908 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;
--
2.16.2
March 30, 2018
[PATCH 1/8] taskschd: Implement ExecAction::put_Id and ExecAction::get_Id.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
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 1b6a7015ee..19546c0d71 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 80bc1c9034..c0f691a53d 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);
--
2.16.2
March 30, 2018
[PATCH v2] dsound/tests: Call interface methods properly.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/dsound/tests/capture.c | 4 ++--
dlls/dsound/tests/ds3d.c | 30 +++++++++---------------------
dlls/dsound/tests/ds3d8.c | 11 -----------
dlls/dsound/tests/dsound.c | 5 +++--
dlls/dsound/tests/dsound8.c | 34 +++++++++++++++++-----------------
dlls/dsound/tests/duplex.c | 6 +++---
6 files changed, 34 insertions(+), 56 deletions(-)
diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index 4eae28b..a23d1eb 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -114,7 +114,7 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IUnknown) "
"failed: %08x\n", rc);
if (rc==DS_OK)
- IDirectSoundCapture_Release(unknown);
+ IUnknown_Release(unknown);
rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IDirectSoundCapture,
(LPVOID*)&dsc);
@@ -162,7 +162,7 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
ZeroMemory(&dsccaps, sizeof(dsccaps));
/* DSOUND: Error: Invalid caps buffer */
- rc=IDirectSound_GetCaps(dsco, &dsccaps);
+ rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps);
ok(rc==DSERR_INVALIDPARAM, "IDirectSound_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
index 6c12f71..d4356c2 100644
--- a/dlls/dsound/tests/ds3d.c
+++ b/dlls/dsound/tests/ds3d.c
@@ -535,18 +535,6 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
- temp_buffer=NULL;
- rc=IDirectSound3DBuffer_QueryInterface(*dsbo,
- &IID_IDirectSoundBuffer,
- (LPVOID *)&temp_buffer);
- ok(rc==DS_OK && temp_buffer!=NULL,
- "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
- ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
- temp_buffer,*dsbo);
- ref=IDirectSoundBuffer_Release(temp_buffer);
- ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
- "should have 1\n",ref);
-
ref=IDirectSoundBuffer_Release(*dsbo);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
@@ -1193,6 +1181,8 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
if (rc==DS_OK && primary!=NULL) {
LPDIRECTSOUND3DLISTENER listener=NULL;
LPDIRECTSOUNDBUFFER temp_buffer=NULL;
+ IKsPropertySet *propset;
+
rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener,(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
@@ -1231,11 +1221,10 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
temp_buffer = NULL;
rc = IDirectSound3DListener_QueryInterface(listener, &IID_IKsPropertySet,
- (void **)&temp_buffer);
- ok(rc==DS_OK && temp_buffer!=NULL,
+ (void **)&propset);
+ ok(rc == DS_OK && propset != NULL,
"IDirectSound3DListener_QueryInterface didn't handle IKsPropertySet: ret = %08x\n", rc);
- if(temp_buffer)
- IKsPropertySet_Release(temp_buffer);
+ IKsPropertySet_Release(propset);
}
/* Testing the reference counting */
@@ -1244,12 +1233,11 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
"references, should have 0\n",ref);
}
- temp_buffer = NULL;
- rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IKsPropertySet, (void **)&temp_buffer);
- ok(rc==DS_OK && temp_buffer!=NULL,
+ propset = NULL;
+ rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IKsPropertySet, (void **)&propset);
+ ok(rc == DS_OK && propset != NULL,
"IDirectSoundBuffer_QueryInterface didn't handle IKsPropertySet on primary buffer: ret = %08x\n", rc);
- if(temp_buffer)
- IKsPropertySet_Release(temp_buffer);
+ IKsPropertySet_Release(propset);
/* Testing the reference counting */
ref=IDirectSoundBuffer_Release(primary);
diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c
index 25eb010..00340af 100644
--- a/dlls/dsound/tests/ds3d8.c
+++ b/dlls/dsound/tests/ds3d8.c
@@ -371,17 +371,6 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
- temp_buffer=NULL;
- rc=IDirectSound3DBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
- (LPVOID *)&temp_buffer);
- ok(rc==DS_OK && temp_buffer!=NULL,
- "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
- ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
- temp_buffer,*dsbo);
- ref=IDirectSoundBuffer_Release(temp_buffer);
- ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
- "should have 1\n",ref);
-
ref=IDirectSoundBuffer_Release(*dsbo);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 1ccb8f9..07c8908 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -30,6 +30,7 @@
#include "wine/test.h"
#include "mmsystem.h"
+#define COBJMACROS
#include "dsound.h"
#include "dsconf.h"
#include "initguid.h"
@@ -61,7 +62,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK)
- IDirectSound_Release(unknown);
+ IUnknown_Release(unknown);
rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
@@ -337,7 +338,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
"buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
- rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
+ rc = IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() "
"failed: %08x\n",rc);
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index 53b3d47..a6e3f12 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -72,7 +72,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK)
- IDirectSound8_Release(unknown);
+ IUnknown_Release(unknown);
rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
@@ -353,7 +353,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
LPDIRECTSOUNDBUFFER8 buffer8;
- rc=IDirectSound8_QueryInterface(secondary,
+ rc=IDirectSoundBuffer_QueryInterface(secondary,
&IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,
@@ -363,7 +363,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
"should have 2\n",ref);
}
- rc=IDirectSound8_QueryInterface(secondary,
+ rc=IDirectSoundBuffer_QueryInterface(secondary,
&IID_IDirectSoundBuffer8,
(void **)&buffer8);
if (rc==DS_OK && buffer8!=NULL) {
@@ -645,7 +645,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,format_tags[tag],
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
}
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %08x\n",rc);
@@ -756,7 +756,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
wfx.nBlockAlign);
bufdesc.lpwfxFormat=&wfx;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16)
ok(((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary)
|| rc == DS_OK, /* driver dependent? */
@@ -779,7 +779,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Samples.wValidBitsPerSample = wfx.wBitsPerSample;
wfxe.dwChannelMask = (wfx.nChannels == 1 ? KSAUDIO_SPEAKER_MONO : KSAUDIO_SPEAKER_STEREO);
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -791,7 +791,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx) + 1;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL /* 2003 */ || rc==DSERR_INVALIDPARAM) && !secondary)
|| rc==DS_OK /* driver dependent? */,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
@@ -804,7 +804,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx);
wfxe.SubFormat = GUID_NULL;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok((rc==DSERR_INVALIDPARAM || rc==DSERR_INVALIDCALL) && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -815,7 +815,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Format.cbSize = sizeof(wfxe);
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL || rc==DSERR_INVALIDPARAM) && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -826,7 +826,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.SubFormat = (format_tags[tag] == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT);
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -837,7 +837,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Format.cbSize = sizeof(wfxe) + 1;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL /* 2003 */ || rc==DSERR_INVALIDPARAM) && !secondary)
|| rc==DS_OK /* driver dependent? */,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
@@ -850,7 +850,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx);
++wfxe.Samples.wValidBitsPerSample;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -862,7 +862,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
--wfxe.Samples.wValidBitsPerSample;
wfxe.Samples.wValidBitsPerSample = 0;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@@ -873,7 +873,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
- rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+ rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %08x\n",rc);
@@ -1162,7 +1162,7 @@ static void test_COM(void)
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
refcount = IUnknown_AddRef(unk);
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
- hr = IDirectSound_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
+ hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
refcount = IUnknown_AddRef(unk8);
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
@@ -1194,7 +1194,7 @@ static void test_effects(void)
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
if (rc!=DS_OK) {
- IDirectSound_Release(dso);
+ IDirectSound8_Release(dso);
return;
}
@@ -1372,7 +1372,7 @@ static void test_effects(void)
IDirectSoundBuffer_Release(primary);
}
- while (IDirectSound_Release(dso));
+ while (IDirectSound8_Release(dso));
}
START_TEST(dsound8)
diff --git a/dlls/dsound/tests/duplex.c b/dlls/dsound/tests/duplex.c
index ecdebdc..b770515 100644
--- a/dlls/dsound/tests/duplex.c
+++ b/dlls/dsound/tests/duplex.c
@@ -49,7 +49,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK) {
- ref=IDirectSoundFullDuplex_Release(unknown);
+ ref = IUnknown_Release(unknown);
ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, "
"should have 0\n", ref);
}
@@ -94,7 +94,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
"failed: %08x\n",rc);
if (rc==DS_OK) {
ok(dsfdo==dsfd, "different interfaces\n");
- ref=IDirectSound8_Release(dsfd);
+ ref=IDirectSoundFullDuplex_Release(dsfd);
ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, should have 1\n", ref);
}
@@ -319,7 +319,7 @@ static void test_COM(void)
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
refcount = IDirectSoundFullDuplex_AddRef(dsfd);
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
- hr = IDirectSoundCapture_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
+ hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
ok(unk == unk8,
"Got different IUnknown when QI'ing IDirectSoundFullDuplex and IDirectSoundCapture\n");
--
2.7.4
March 30, 2018