Commit 73b6d21a authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mstask: COM cleanup for the ITaskTrigger iface.

parent 30e90c9a
...@@ -34,12 +34,6 @@ extern LONG dll_ref; ...@@ -34,12 +34,6 @@ extern LONG dll_ref;
typedef struct ClassFactoryImpl ClassFactoryImpl; typedef struct ClassFactoryImpl ClassFactoryImpl;
extern ClassFactoryImpl MSTASK_ClassFactory; extern ClassFactoryImpl MSTASK_ClassFactory;
typedef struct
{
const ITaskTriggerVtbl *lpVtbl;
LONG ref;
TASK_TRIGGER triggerCond;
} TaskTriggerImpl;
extern HRESULT TaskTriggerConstructor(LPVOID *ppObj); extern HRESULT TaskTriggerConstructor(LPVOID *ppObj);
typedef struct typedef struct
......
...@@ -23,12 +23,24 @@ ...@@ -23,12 +23,24 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); WINE_DEFAULT_DEBUG_CHANNEL(mstask);
typedef struct
{
ITaskTrigger ITaskTrigger_iface;
LONG ref;
TASK_TRIGGER triggerCond;
} TaskTriggerImpl;
static inline TaskTriggerImpl *impl_from_ITaskTrigger(ITaskTrigger *iface)
{
return CONTAINING_RECORD(iface, TaskTriggerImpl, ITaskTrigger_iface);
}
static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface( static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface(
ITaskTrigger* iface, ITaskTrigger* iface,
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
TaskTriggerImpl *This = (TaskTriggerImpl *)iface; TaskTriggerImpl *This = impl_from_ITaskTrigger(iface);
TRACE("IID: %s\n", debugstr_guid(riid)); TRACE("IID: %s\n", debugstr_guid(riid));
if (ppvObject == NULL) if (ppvObject == NULL)
...@@ -37,7 +49,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface( ...@@ -37,7 +49,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface(
if (IsEqualGUID(riid, &IID_IUnknown) || if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ITaskTrigger)) IsEqualGUID(riid, &IID_ITaskTrigger))
{ {
*ppvObject = &This->lpVtbl; *ppvObject = &This->ITaskTrigger_iface;
ITaskTrigger_AddRef(iface); ITaskTrigger_AddRef(iface);
return S_OK; return S_OK;
} }
...@@ -50,7 +62,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface( ...@@ -50,7 +62,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface(
static ULONG WINAPI MSTASK_ITaskTrigger_AddRef( static ULONG WINAPI MSTASK_ITaskTrigger_AddRef(
ITaskTrigger* iface) ITaskTrigger* iface)
{ {
TaskTriggerImpl *This = (TaskTriggerImpl *)iface; TaskTriggerImpl *This = impl_from_ITaskTrigger(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedIncrement(&This->ref); ref = InterlockedIncrement(&This->ref);
...@@ -60,7 +72,7 @@ static ULONG WINAPI MSTASK_ITaskTrigger_AddRef( ...@@ -60,7 +72,7 @@ static ULONG WINAPI MSTASK_ITaskTrigger_AddRef(
static ULONG WINAPI MSTASK_ITaskTrigger_Release( static ULONG WINAPI MSTASK_ITaskTrigger_Release(
ITaskTrigger* iface) ITaskTrigger* iface)
{ {
TaskTriggerImpl *This = (TaskTriggerImpl *)iface; TaskTriggerImpl *This = impl_from_ITaskTrigger(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
...@@ -76,7 +88,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_SetTrigger( ...@@ -76,7 +88,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_SetTrigger(
ITaskTrigger* iface, ITaskTrigger* iface,
const PTASK_TRIGGER pTrigger) const PTASK_TRIGGER pTrigger)
{ {
TaskTriggerImpl * This = (TaskTriggerImpl *)iface; TaskTriggerImpl * This = impl_from_ITaskTrigger(iface);
TIME_FIELDS field_time; TIME_FIELDS field_time;
LARGE_INTEGER sys_time; LARGE_INTEGER sys_time;
TASK_TRIGGER tmp_trigger_cond; TASK_TRIGGER tmp_trigger_cond;
...@@ -187,7 +199,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_GetTrigger( ...@@ -187,7 +199,7 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_GetTrigger(
ITaskTrigger* iface, ITaskTrigger* iface,
PTASK_TRIGGER pTrigger) PTASK_TRIGGER pTrigger)
{ {
TaskTriggerImpl * This = (TaskTriggerImpl *)iface; TaskTriggerImpl * This = impl_from_ITaskTrigger(iface);
TRACE("(%p, %p)\n", iface, pTrigger); TRACE("(%p, %p)\n", iface, pTrigger);
...@@ -274,7 +286,7 @@ HRESULT TaskTriggerConstructor(LPVOID *ppObj) ...@@ -274,7 +286,7 @@ HRESULT TaskTriggerConstructor(LPVOID *ppObj)
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->lpVtbl = &MSTASK_ITaskTriggerVtbl; This->ITaskTrigger_iface.lpVtbl = &MSTASK_ITaskTriggerVtbl;
This->ref = 1; This->ref = 1;
/* Most fields of triggerCond default to zero. Initialize other /* Most fields of triggerCond default to zero. Initialize other
...@@ -291,7 +303,7 @@ HRESULT TaskTriggerConstructor(LPVOID *ppObj) ...@@ -291,7 +303,7 @@ HRESULT TaskTriggerConstructor(LPVOID *ppObj)
This->triggerCond.TriggerType = TASK_TIME_TRIGGER_DAILY, This->triggerCond.TriggerType = TASK_TIME_TRIGGER_DAILY,
This->triggerCond.Type.Daily.DaysInterval = 1; This->triggerCond.Type.Daily.DaysInterval = 1;
*ppObj = &This->lpVtbl; *ppObj = &This->ITaskTrigger_iface;
InterlockedIncrement(&dll_ref); InterlockedIncrement(&dll_ref);
return S_OK; return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment