taskschd: Add IRegistrationTrigger stub implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46773
This commit is contained in:
parent
c34159db39
commit
4b9e76914a
2 changed files with 269 additions and 0 deletions
|
@ -324,6 +324,242 @@ static HRESULT DailyTrigger_create(ITrigger **trigger)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
IRegistrationTrigger IRegistrationTrigger_iface;
|
||||
LONG ref;
|
||||
} RegistrationTrigger;
|
||||
|
||||
static inline RegistrationTrigger *impl_from_IRegistrationTrigger(IRegistrationTrigger *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, RegistrationTrigger, IRegistrationTrigger_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_QueryInterface(IRegistrationTrigger *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
||||
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) ||
|
||||
IsEqualGUID(&IID_IDispatch, riid) ||
|
||||
IsEqualGUID(&IID_ITrigger, riid) ||
|
||||
IsEqualGUID(&IID_IRegistrationTrigger, riid))
|
||||
{
|
||||
*ppv = &This->IRegistrationTrigger_iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("unsupported riid %s\n", debugstr_guid(riid));
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI RegistrationTrigger_AddRef(IRegistrationTrigger *iface)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
LONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI RegistrationTrigger_Release(IRegistrationTrigger *iface)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
LONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
|
||||
if(!ref)
|
||||
{
|
||||
TRACE("destroying %p\n", iface);
|
||||
free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_GetTypeInfoCount(IRegistrationTrigger *iface, UINT *count)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, count);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_GetTypeInfo(IRegistrationTrigger *iface, UINT index, LCID lcid, ITypeInfo **info)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%u %lu %p)\n", This, index, lcid, info);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_GetIDsOfNames(IRegistrationTrigger *iface, REFIID riid, LPOLESTR *names,
|
||||
UINT count, LCID lcid, DISPID *dispid)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), names, count, lcid, dispid);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_Invoke(IRegistrationTrigger *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags,
|
||||
DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *argerr)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%ld %s %lx %x %p %p %p %p)\n", This, dispid, debugstr_guid(riid), lcid, flags,
|
||||
params, result, excepinfo, argerr);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_Type(IRegistrationTrigger *iface, TASK_TRIGGER_TYPE2 *type)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, type);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_Id(IRegistrationTrigger *iface, BSTR *id)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, id);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_Id(IRegistrationTrigger *iface, BSTR id)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(id));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_Repetition(IRegistrationTrigger *iface, IRepetitionPattern **repeat)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, repeat);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_Repetition(IRegistrationTrigger *iface, IRepetitionPattern *repeat)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, repeat);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_ExecutionTimeLimit(IRegistrationTrigger *iface, BSTR *limit)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, limit);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_ExecutionTimeLimit(IRegistrationTrigger *iface, BSTR limit)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(limit));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_StartBoundary(IRegistrationTrigger *iface, BSTR *start)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, start);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_StartBoundary(IRegistrationTrigger *iface, BSTR start)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(start));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_EndBoundary(IRegistrationTrigger *iface, BSTR *end)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, end);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_EndBoundary(IRegistrationTrigger *iface, BSTR end)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(end));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_Enabled(IRegistrationTrigger *iface, VARIANT_BOOL *enabled)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, enabled);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_Enabled(IRegistrationTrigger *iface, VARIANT_BOOL enabled)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%x)\n", This, enabled);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_get_Delay(IRegistrationTrigger *iface, BSTR *pDelay)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pDelay);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RegistrationTrigger_put_Delay(IRegistrationTrigger *iface, BSTR delay)
|
||||
{
|
||||
RegistrationTrigger *This = impl_from_IRegistrationTrigger(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(delay));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IRegistrationTriggerVtbl RegistrationTrigger_vtbl = {
|
||||
RegistrationTrigger_QueryInterface,
|
||||
RegistrationTrigger_AddRef,
|
||||
RegistrationTrigger_Release,
|
||||
RegistrationTrigger_GetTypeInfoCount,
|
||||
RegistrationTrigger_GetTypeInfo,
|
||||
RegistrationTrigger_GetIDsOfNames,
|
||||
RegistrationTrigger_Invoke,
|
||||
RegistrationTrigger_get_Type,
|
||||
RegistrationTrigger_get_Id,
|
||||
RegistrationTrigger_put_Id,
|
||||
RegistrationTrigger_get_Repetition,
|
||||
RegistrationTrigger_put_Repetition,
|
||||
RegistrationTrigger_get_ExecutionTimeLimit,
|
||||
RegistrationTrigger_put_ExecutionTimeLimit,
|
||||
RegistrationTrigger_get_StartBoundary,
|
||||
RegistrationTrigger_put_StartBoundary,
|
||||
RegistrationTrigger_get_EndBoundary,
|
||||
RegistrationTrigger_put_EndBoundary,
|
||||
RegistrationTrigger_get_Enabled,
|
||||
RegistrationTrigger_put_Enabled,
|
||||
RegistrationTrigger_get_Delay,
|
||||
RegistrationTrigger_put_Delay
|
||||
};
|
||||
|
||||
static HRESULT RegistrationTrigger_create(ITrigger **trigger)
|
||||
{
|
||||
RegistrationTrigger *registration_trigger;
|
||||
|
||||
registration_trigger = malloc(sizeof(*registration_trigger));
|
||||
if (!registration_trigger)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
registration_trigger->IRegistrationTrigger_iface.lpVtbl = &RegistrationTrigger_vtbl;
|
||||
registration_trigger->ref = 1;
|
||||
|
||||
*trigger = (ITrigger*)®istration_trigger->IRegistrationTrigger_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ITriggerCollection ITriggerCollection_iface;
|
||||
|
@ -439,6 +675,8 @@ static HRESULT WINAPI TriggerCollection_Create(ITriggerCollection *iface, TASK_T
|
|||
switch(type) {
|
||||
case TASK_TRIGGER_DAILY:
|
||||
return DailyTrigger_create(trigger);
|
||||
case TASK_TRIGGER_REGISTRATION:
|
||||
return RegistrationTrigger_create(trigger);
|
||||
default:
|
||||
FIXME("Unimplemented type %d\n", type);
|
||||
return E_NOTIMPL;
|
||||
|
|
|
@ -1391,6 +1391,31 @@ static void test_daily_trigger(ITrigger *trigger)
|
|||
IDailyTrigger_Release(daily_trigger);
|
||||
}
|
||||
|
||||
static void test_registration_trigger(ITrigger *trigger)
|
||||
{
|
||||
IRegistrationTrigger *reg_trigger;
|
||||
VARIANT_BOOL enabled;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ITrigger_QueryInterface(trigger, &IID_IRegistrationTrigger, (void**)®_trigger);
|
||||
ok(hr == S_OK, "Could not get IRegistrationTrigger iface: %08lx\n", hr);
|
||||
|
||||
enabled = VARIANT_FALSE;
|
||||
hr = IRegistrationTrigger_get_Enabled(reg_trigger, &enabled);
|
||||
todo_wine ok(hr == S_OK, "get_Enabled failed: %08lx\n", hr);
|
||||
todo_wine ok(enabled == VARIANT_TRUE, "got %d\n", enabled);
|
||||
|
||||
hr = IRegistrationTrigger_put_Enabled(reg_trigger, VARIANT_FALSE);
|
||||
todo_wine ok(hr == S_OK, "put_Enabled failed: %08lx\n", hr);
|
||||
|
||||
enabled = VARIANT_TRUE;
|
||||
hr = IRegistrationTrigger_get_Enabled(reg_trigger, &enabled);
|
||||
todo_wine ok(hr == S_OK, "get_Enabled failed: %08lx\n", hr);
|
||||
todo_wine ok(enabled == VARIANT_FALSE, "got %d\n", enabled);
|
||||
|
||||
IRegistrationTrigger_Release(reg_trigger);
|
||||
}
|
||||
|
||||
static void create_action(ITaskDefinition *taskdef)
|
||||
{
|
||||
static WCHAR task1_exe[] = L"task1.exe";
|
||||
|
@ -1789,6 +1814,12 @@ static void test_TaskDefinition(void)
|
|||
ok(trigger != NULL, "trigger = NULL\n");
|
||||
test_daily_trigger(trigger);
|
||||
ITrigger_Release(trigger);
|
||||
|
||||
hr = ITriggerCollection_Create(trigger_col, TASK_TRIGGER_REGISTRATION, &trigger);
|
||||
ok(hr == S_OK, "Create failed: %08lx\n", hr);
|
||||
ok(trigger != NULL, "trigger = NULL\n");
|
||||
test_registration_trigger(trigger);
|
||||
ITrigger_Release(trigger);
|
||||
ITriggerCollection_Release(trigger_col);
|
||||
|
||||
hr = ITaskDefinition_get_Triggers(taskdef, &trigger_col2);
|
||||
|
|
Loading…
Add table
Reference in a new issue