* Sync to Wine 1.3.37.

svn path=/trunk/; revision=55257
This commit is contained in:
Amine Khaldi 2012-01-27 18:48:31 +00:00
parent 4365081a5a
commit 04c708b1b0
10 changed files with 118 additions and 198 deletions

View file

@ -21,12 +21,23 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); WINE_DEFAULT_DEBUG_CHANNEL(mstask);
struct ClassFactoryImpl
{
IClassFactory IClassFactory_iface;
LONG ref;
};
static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
}
static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface( static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface(
LPCLASSFACTORY iface, LPCLASSFACTORY iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
ClassFactoryImpl *This = (ClassFactoryImpl *)iface; ClassFactoryImpl *This = impl_from_IClassFactory(iface);
TRACE("IID: %s\n",debugstr_guid(riid)); TRACE("IID: %s\n",debugstr_guid(riid));
if (ppvObj == NULL) if (ppvObj == NULL)
@ -35,7 +46,7 @@ static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface(
if (IsEqualGUID(riid, &IID_IUnknown) || if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IClassFactory)) IsEqualGUID(riid, &IID_IClassFactory))
{ {
*ppvObj = &This->lpVtbl; *ppvObj = &This->IClassFactory_iface;
IClassFactory_AddRef(iface); IClassFactory_AddRef(iface);
return S_OK; return S_OK;
} }
@ -105,4 +116,4 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
MSTASK_IClassFactory_LockServer MSTASK_IClassFactory_LockServer
}; };
ClassFactoryImpl MSTASK_ClassFactory = { &IClassFactory_Vtbl }; ClassFactoryImpl MSTASK_ClassFactory = { { &IClassFactory_Vtbl } };

View file

@ -1,16 +0,0 @@
[version]
Signature="$CHICAGO$"
[RegisterDll]
AddReg=Classes.Reg
[UnregisterDll]
DelReg=Classes.Reg
[Classes.Reg]
HKCR,"CLSID\%CLSID_CTaskScheduler%",,,"CTaskScheduler"
HKCR,"CLSID\%CLSID_CTaskScheduler%\InProcServer32",,,"mstask.dll"
HKCR,"CLSID\%CLSID_CTaskScheduler%\InProcServer32","ThreadingModel",,"Both"
HKCR,"CLSID\%CLSID_CTask%",,,"CTask"
HKCR,"CLSID\%CLSID_CTask%\InProcServer32",,,"mstask.dll"
HKCR,"CLSID\%CLSID_CTask%\InProcServer32","ThreadingModel",,"Both"

View file

@ -0,0 +1,17 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{148BD52A-A2AB-11CE-B11F-00AA00530503}' = s 'CTaskScheduler'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
'{148BD520-A2AB-11CE-B11F-00AA00530503}' = s 'CTask'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
}
}

View file

@ -19,8 +19,8 @@
#include <stdio.h> #include <stdio.h>
#include "mstask_private.h" #include "mstask_private.h"
#include "winreg.h" #include "objbase.h"
#include "advpub.h" #include "rpcproxy.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -66,97 +66,12 @@ HRESULT WINAPI DllCanUnloadNow(void)
return dll_ref != 0 ? S_FALSE : S_OK; return dll_ref != 0 ? S_FALSE : S_OK;
} }
static inline char *mstask_strdup(const char *s)
{
size_t n = strlen(s) + 1;
char *d = HeapAlloc(GetProcessHeap(), 0, n);
return d ? memcpy(d, s, n) : NULL;
}
static HRESULT init_register_strtable(STRTABLEA *strtable)
{
#define CLSID_EXPANSION_ENTRY(id) { "CLSID_" #id, &CLSID_ ## id }
static const struct
{
const char *name;
const CLSID *clsid;
}
expns[] =
{
CLSID_EXPANSION_ENTRY(CTaskScheduler),
CLSID_EXPANSION_ENTRY(CTask)
};
#undef CLSID_EXPANSION_ENTRY
static STRENTRYA pse[sizeof expns / sizeof expns[0]];
unsigned int i;
strtable->cEntries = sizeof pse / sizeof pse[0];
strtable->pse = pse;
for (i = 0; i < strtable->cEntries; i++)
{
static const char dummy_sample[] =
"{12345678-1234-1234-1234-123456789012}";
const CLSID *clsid = expns[i].clsid;
pse[i].pszName = mstask_strdup(expns[i].name);
pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, sizeof dummy_sample);
if (!pse[i].pszName || !pse[i].pszValue)
return E_OUTOFMEMORY;
sprintf(pse[i].pszValue,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
clsid->Data1, clsid->Data2, clsid->Data3, clsid->Data4[0],
clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6],
clsid->Data4[7]);
}
return S_OK;
}
static void cleanup_register_strtable(STRTABLEA *strtable)
{
unsigned int i;
for (i = 0; i < strtable->cEntries; i++)
{
HeapFree(GetProcessHeap(), 0, strtable->pse[i].pszName);
HeapFree(GetProcessHeap(), 0, strtable->pse[i].pszValue);
if (!strtable->pse[i].pszName || !strtable->pse[i].pszValue)
return;
}
}
static HRESULT register_mstask(BOOL do_register)
{
HRESULT hr;
STRTABLEA strtable;
HMODULE hAdvpack;
HRESULT (WINAPI *pRegInstall)(HMODULE hm,
LPCSTR pszSection, const STRTABLEA* pstTable);
static const WCHAR wszAdvpack[] =
{'a','d','v','p','a','c','k','.','d','l','l',0};
TRACE("(%x)\n", do_register);
hAdvpack = LoadLibraryW(wszAdvpack);
pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall");
hr = init_register_strtable(&strtable);
if (SUCCEEDED(hr))
hr = pRegInstall(hInst, do_register ? "RegisterDll" : "UnregisterDll",
&strtable);
cleanup_register_strtable(&strtable);
if (FAILED(hr))
WINE_ERR("RegInstall failed: %08x\n", hr);
return hr;
}
HRESULT WINAPI DllRegisterServer(void) HRESULT WINAPI DllRegisterServer(void)
{ {
return register_mstask(TRUE); return __wine_register_resources( hInst );
} }
HRESULT WINAPI DllUnregisterServer(void) HRESULT WINAPI DllUnregisterServer(void)
{ {
return register_mstask(FALSE); return __wine_unregister_resources( hInst );
} }

View file

@ -29,42 +29,13 @@
#include "ole2.h" #include "ole2.h"
#include "mstask.h" #include "mstask.h"
extern LONG dll_ref; extern LONG dll_ref DECLSPEC_HIDDEN;
typedef struct typedef struct ClassFactoryImpl ClassFactoryImpl;
{ extern ClassFactoryImpl MSTASK_ClassFactory DECLSPEC_HIDDEN;
const IClassFactoryVtbl *lpVtbl;
LONG ref;
} ClassFactoryImpl;
extern ClassFactoryImpl MSTASK_ClassFactory;
typedef struct extern HRESULT TaskTriggerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN;
{ extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN;
const ITaskTriggerVtbl *lpVtbl; extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj) DECLSPEC_HIDDEN;
LONG ref;
TASK_TRIGGER triggerCond;
} TaskTriggerImpl;
extern HRESULT TaskTriggerConstructor(LPVOID *ppObj);
typedef struct
{
const ITaskSchedulerVtbl *lpVtbl;
LONG ref;
} TaskSchedulerImpl;
extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj);
typedef struct
{
const ITaskVtbl *lpVtbl;
const IPersistFileVtbl *persistVtbl;
LONG ref;
LPWSTR taskName;
LPWSTR applicationName;
LPWSTR parameters;
LPWSTR comment;
DWORD maxRunTime;
LPWSTR accountName;
} TaskImpl;
extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj);
#endif /* __MSTASK_PRIVATE_H__ */ #endif /* __MSTASK_PRIVATE_H__ */

View file

@ -1,20 +1 @@
/* 1 WINE_REGISTRY mstask.rgs
* Copyright 2008 Google (Roy Shea)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @makedep: mstask.inf */
REGINST REGINST mstask.inf

View file

@ -21,9 +21,27 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); WINE_DEFAULT_DEBUG_CHANNEL(mstask);
typedef struct
{
ITask ITask_iface;
IPersistFile IPersistFile_iface;
LONG ref;
LPWSTR taskName;
LPWSTR applicationName;
LPWSTR parameters;
LPWSTR comment;
DWORD maxRunTime;
LPWSTR accountName;
} TaskImpl;
static inline TaskImpl *impl_from_ITask(ITask *iface)
{
return CONTAINING_RECORD(iface, TaskImpl, ITask_iface);
}
static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface ) static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface )
{ {
return (TaskImpl*) ((char*)(iface) - FIELD_OFFSET(TaskImpl, persistVtbl)); return CONTAINING_RECORD(iface, TaskImpl, IPersistFile_iface);
} }
static void TaskDestructor(TaskImpl *This) static void TaskDestructor(TaskImpl *This)
@ -42,7 +60,7 @@ static HRESULT WINAPI MSTASK_ITask_QueryInterface(
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
TaskImpl * This = (TaskImpl *)iface; TaskImpl * This = impl_from_ITask(iface);
TRACE("IID: %s\n", debugstr_guid(riid)); TRACE("IID: %s\n", debugstr_guid(riid));
if (ppvObject == NULL) if (ppvObject == NULL)
@ -51,13 +69,13 @@ static HRESULT WINAPI MSTASK_ITask_QueryInterface(
if (IsEqualGUID(riid, &IID_IUnknown) || if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ITask)) IsEqualGUID(riid, &IID_ITask))
{ {
*ppvObject = &This->lpVtbl; *ppvObject = &This->ITask_iface;
ITask_AddRef(iface); ITask_AddRef(iface);
return S_OK; return S_OK;
} }
else if (IsEqualGUID(riid, &IID_IPersistFile)) else if (IsEqualGUID(riid, &IID_IPersistFile))
{ {
*ppvObject = &This->persistVtbl; *ppvObject = &This->IPersistFile_iface;
ITask_AddRef(iface); ITask_AddRef(iface);
return S_OK; return S_OK;
} }
@ -70,7 +88,7 @@ static HRESULT WINAPI MSTASK_ITask_QueryInterface(
static ULONG WINAPI MSTASK_ITask_AddRef( static ULONG WINAPI MSTASK_ITask_AddRef(
ITask* iface) ITask* iface)
{ {
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedIncrement(&This->ref); ref = InterlockedIncrement(&This->ref);
@ -80,7 +98,7 @@ static ULONG WINAPI MSTASK_ITask_AddRef(
static ULONG WINAPI MSTASK_ITask_Release( static ULONG WINAPI MSTASK_ITask_Release(
ITask* iface) ITask* iface)
{ {
TaskImpl * This = (TaskImpl *)iface; TaskImpl * This = impl_from_ITask(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
@ -222,7 +240,7 @@ static HRESULT WINAPI MSTASK_ITask_SetComment(
LPCWSTR pwszComment) LPCWSTR pwszComment)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
LPWSTR tmp_comment; LPWSTR tmp_comment;
TRACE("(%p, %s)\n", iface, debugstr_w(pwszComment)); TRACE("(%p, %s)\n", iface, debugstr_w(pwszComment));
@ -252,7 +270,7 @@ static HRESULT WINAPI MSTASK_ITask_GetComment(
LPWSTR *ppwszComment) LPWSTR *ppwszComment)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %p)\n", iface, ppwszComment); TRACE("(%p, %p)\n", iface, ppwszComment);
@ -357,7 +375,7 @@ static HRESULT WINAPI MSTASK_ITask_SetAccountInformation(
LPCWSTR pwszPassword) LPCWSTR pwszPassword)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
LPWSTR tmp_account_name; LPWSTR tmp_account_name;
TRACE("(%p, %s, %s): partial stub\n", iface, debugstr_w(pwszAccountName), TRACE("(%p, %s, %s): partial stub\n", iface, debugstr_w(pwszAccountName),
@ -381,7 +399,7 @@ static HRESULT WINAPI MSTASK_ITask_GetAccountInformation(
LPWSTR *ppwszAccountName) LPWSTR *ppwszAccountName)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %p): partial stub\n", iface, ppwszAccountName); TRACE("(%p, %p): partial stub\n", iface, ppwszAccountName);
@ -403,7 +421,7 @@ static HRESULT WINAPI MSTASK_ITask_SetApplicationName(
LPCWSTR pwszApplicationName) LPCWSTR pwszApplicationName)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
LPWSTR tmp_name; LPWSTR tmp_name;
TRACE("(%p, %s)\n", iface, debugstr_w(pwszApplicationName)); TRACE("(%p, %s)\n", iface, debugstr_w(pwszApplicationName));
@ -450,7 +468,7 @@ static HRESULT WINAPI MSTASK_ITask_GetApplicationName(
LPWSTR *ppwszApplicationName) LPWSTR *ppwszApplicationName)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %p)\n", iface, ppwszApplicationName); TRACE("(%p, %p)\n", iface, ppwszApplicationName);
@ -472,7 +490,7 @@ static HRESULT WINAPI MSTASK_ITask_SetParameters(
LPCWSTR pwszParameters) LPCWSTR pwszParameters)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
LPWSTR tmp_parameters; LPWSTR tmp_parameters;
TRACE("(%p, %s)\n", iface, debugstr_w(pwszParameters)); TRACE("(%p, %s)\n", iface, debugstr_w(pwszParameters));
@ -501,7 +519,7 @@ static HRESULT WINAPI MSTASK_ITask_GetParameters(
LPWSTR *ppwszParameters) LPWSTR *ppwszParameters)
{ {
DWORD n; DWORD n;
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %p)\n", iface, ppwszParameters); TRACE("(%p, %p)\n", iface, ppwszParameters);
@ -570,7 +588,7 @@ static HRESULT WINAPI MSTASK_ITask_SetMaxRunTime(
ITask* iface, ITask* iface,
DWORD dwMaxRunTime) DWORD dwMaxRunTime)
{ {
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %d)\n", iface, dwMaxRunTime); TRACE("(%p, %d)\n", iface, dwMaxRunTime);
@ -582,7 +600,7 @@ static HRESULT WINAPI MSTASK_ITask_GetMaxRunTime(
ITask* iface, ITask* iface,
DWORD *pdwMaxRunTime) DWORD *pdwMaxRunTime)
{ {
TaskImpl *This = (TaskImpl *)iface; TaskImpl *This = impl_from_ITask(iface);
TRACE("(%p, %p)\n", iface, pdwMaxRunTime); TRACE("(%p, %p)\n", iface, pdwMaxRunTime);
@ -597,7 +615,7 @@ static HRESULT WINAPI MSTASK_IPersistFile_QueryInterface(
{ {
TaskImpl *This = impl_from_IPersistFile(iface); TaskImpl *This = impl_from_IPersistFile(iface);
TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject); TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject);
return ITask_QueryInterface((ITask *) This, riid, ppvObject); return ITask_QueryInterface(&This->ITask_iface, riid, ppvObject);
} }
static ULONG WINAPI MSTASK_IPersistFile_AddRef( static ULONG WINAPI MSTASK_IPersistFile_AddRef(
@ -746,8 +764,8 @@ HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj)
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->lpVtbl = &MSTASK_ITaskVtbl; This->ITask_iface.lpVtbl = &MSTASK_ITaskVtbl;
This->persistVtbl = &MSTASK_IPersistFileVtbl; This->IPersistFile_iface.lpVtbl = &MSTASK_IPersistFileVtbl;
This->ref = 1; This->ref = 1;
n = (lstrlenW(pwszTaskName) + 1) * sizeof(WCHAR); n = (lstrlenW(pwszTaskName) + 1) * sizeof(WCHAR);
This->taskName = HeapAlloc(GetProcessHeap(), 0, n); This->taskName = HeapAlloc(GetProcessHeap(), 0, n);
@ -765,7 +783,7 @@ HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj)
/* Default time is 3 days = 259200000 ms */ /* Default time is 3 days = 259200000 ms */
This->maxRunTime = 259200000; This->maxRunTime = 259200000;
*ppObj = &This->lpVtbl; *ppObj = &This->ITask_iface;
InterlockedIncrement(&dll_ref); InterlockedIncrement(&dll_ref);
return S_OK; return S_OK;
} }

View file

@ -22,6 +22,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); WINE_DEFAULT_DEBUG_CHANNEL(mstask);
typedef struct
{
ITaskScheduler ITaskScheduler_iface;
LONG ref;
} TaskSchedulerImpl;
static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
{
return CONTAINING_RECORD(iface, TaskSchedulerImpl, ITaskScheduler_iface);
}
static void TaskSchedulerDestructor(TaskSchedulerImpl *This) static void TaskSchedulerDestructor(TaskSchedulerImpl *This)
{ {
TRACE("%p\n", This); TRACE("%p\n", This);
@ -34,14 +45,14 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
TRACE("IID: %s\n", debugstr_guid(riid)); TRACE("IID: %s\n", debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown) || if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ITaskScheduler)) IsEqualGUID(riid, &IID_ITaskScheduler))
{ {
*ppvObject = &This->lpVtbl; *ppvObject = &This->ITaskScheduler_iface;
ITaskScheduler_AddRef(iface); ITaskScheduler_AddRef(iface);
return S_OK; return S_OK;
} }
@ -53,7 +64,7 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
static ULONG WINAPI MSTASK_ITaskScheduler_AddRef( static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
ITaskScheduler* iface) ITaskScheduler* iface)
{ {
TaskSchedulerImpl *This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
TRACE("\n"); TRACE("\n");
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
@ -61,7 +72,7 @@ static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
static ULONG WINAPI MSTASK_ITaskScheduler_Release( static ULONG WINAPI MSTASK_ITaskScheduler_Release(
ITaskScheduler* iface) ITaskScheduler* iface)
{ {
TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
@ -178,10 +189,10 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj)
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->lpVtbl = &MSTASK_ITaskSchedulerVtbl; This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl;
This->ref = 1; This->ref = 1;
*ppObj = &This->lpVtbl; *ppObj = &This->ITaskScheduler_iface;
InterlockedIncrement(&dll_ref); InterlockedIncrement(&dll_ref);
return S_OK; return S_OK;
} }

View file

@ -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(
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(
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(
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(
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(
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)
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)
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;
} }

View file

@ -110,7 +110,7 @@ reactos/dll/win32/msnet32 # Autosync
reactos/dll/win32/msrle32 # Autosync reactos/dll/win32/msrle32 # Autosync
reactos/dll/win32/mssign32 # Autosync reactos/dll/win32/mssign32 # Autosync
reactos/dll/win32/mssip32 # Autosync reactos/dll/win32/mssip32 # Autosync
reactos/dll/win32/mstask # Autosync reactos/dll/win32/mstask # Synced to Wine-1.3.37
reactos/dll/win32/msvcrt20 # Autosync reactos/dll/win32/msvcrt20 # Autosync
reactos/dll/win32/msvfw32 # Autosync reactos/dll/win32/msvfw32 # Autosync
reactos/dll/win32/msvidc32 # Autosync reactos/dll/win32/msvidc32 # Autosync