Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b4539f71
Commit
b4539f71
authored
Mar 13, 2018
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mstask: Reimplement ITask constructor using ITaskFolder methods.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fd03094
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
22 deletions
+59
-22
factory.c
dlls/mstask/factory.c
+1
-0
mstask_main.c
dlls/mstask/mstask_main.c
+1
-0
mstask_private.h
dlls/mstask/mstask_private.h
+1
-1
task.c
dlls/mstask/task.c
+36
-14
task_scheduler.c
dlls/mstask/task_scheduler.c
+19
-7
task_trigger.c
dlls/mstask/task_trigger.c
+1
-0
No files found.
dlls/mstask/factory.c
View file @
b4539f71
...
...
@@ -23,6 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "taskschd.h"
#include "mstask.h"
#include "mstask_private.h"
#include "wine/debug.h"
...
...
dlls/mstask/mstask_main.c
View file @
b4539f71
...
...
@@ -24,6 +24,7 @@
#include "winbase.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "taskschd.h"
#include "mstask.h"
#include "mstask_private.h"
#include "wine/debug.h"
...
...
dlls/mstask/mstask_private.h
View file @
b4539f71
...
...
@@ -26,6 +26,6 @@ extern ClassFactoryImpl MSTASK_ClassFactory DECLSPEC_HIDDEN;
extern
HRESULT
TaskTriggerConstructor
(
LPVOID
*
ppObj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
TaskSchedulerConstructor
(
LPVOID
*
ppObj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
TaskConstructor
(
LPCWSTR
pwszTaskName
,
LPVOID
*
ppObj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
TaskConstructor
(
ITaskFolder
*
folder
,
const
WCHAR
*
task_name
,
ITask
**
task
,
BOOL
create
)
DECLSPEC_HIDDEN
;
#endif
/* __MSTASK_PRIVATE_H__ */
dlls/mstask/task.c
View file @
b4539f71
/*
* 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
...
...
@@ -23,6 +24,7 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "taskschd.h"
#include "mstask.h"
#include "mstask_private.h"
#include "wine/debug.h"
...
...
@@ -34,7 +36,7 @@ typedef struct
ITask
ITask_iface
;
IPersistFile
IPersistFile_iface
;
LONG
ref
;
LPWSTR
taskName
;
IRegisteredTask
*
regtask
;
LPWSTR
applicationName
;
LPWSTR
parameters
;
LPWSTR
comment
;
...
...
@@ -58,7 +60,6 @@ static void TaskDestructor(TaskImpl *This)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
accountName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
comment
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
parameters
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
taskName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
InterlockedDecrement
(
&
dll_ref
);
}
...
...
@@ -761,28 +762,49 @@ static const IPersistFileVtbl MSTASK_IPersistFileVtbl =
MSTASK_IPersistFile_GetCurFile
};
HRESULT
TaskConstructor
(
LPCWSTR
pwszTaskName
,
LPVOID
*
ppObj
)
HRESULT
TaskConstructor
(
ITaskFolder
*
folder
,
const
WCHAR
*
task_name
,
ITask
**
task
,
BOOL
create
)
{
TaskImpl
*
This
;
int
n
;
IRegisteredTask
*
regtask
;
BSTR
bstr
;
HRESULT
hr
;
TRACE
(
"(%s, %p)
\n
"
,
debugstr_w
(
pwszTaskName
),
ppObj
);
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
,
&
regtask
);
}
else
hr
=
ITaskFolder_GetTask
(
folder
,
bstr
,
&
regtask
);
SysFreeString
(
bstr
);
if
(
hr
!=
S_OK
)
return
hr
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
if
(
!
This
)
{
IRegisteredTask_Release
(
regtask
);
return
E_OUTOFMEMORY
;
}
This
->
ITask_iface
.
lpVtbl
=
&
MSTASK_ITaskVtbl
;
This
->
IPersistFile_iface
.
lpVtbl
=
&
MSTASK_IPersistFileVtbl
;
This
->
ref
=
1
;
n
=
(
lstrlenW
(
pwszTaskName
)
+
1
)
*
sizeof
(
WCHAR
);
This
->
taskName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
n
);
if
(
!
This
->
taskName
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
E_OUTOFMEMORY
;
}
lstrcpyW
(
This
->
taskName
,
pwszTaskName
);
This
->
regtask
=
regtask
;
This
->
applicationName
=
NULL
;
This
->
parameters
=
NULL
;
This
->
comment
=
NULL
;
...
...
@@ -791,7 +813,7 @@ HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj)
/* Default time is 3 days = 259200000 ms */
This
->
maxRunTime
=
259200000
;
*
ppObj
=
&
This
->
ITask_iface
;
*
task
=
&
This
->
ITask_iface
;
InterlockedIncrement
(
&
dll_ref
);
return
S_OK
;
}
dlls/mstask/task_scheduler.c
View file @
b4539f71
...
...
@@ -37,6 +37,7 @@ typedef struct
ITaskScheduler
ITaskScheduler_iface
;
LONG
ref
;
ITaskService
*
service
;
ITaskFolder
*
root
;
}
TaskSchedulerImpl
;
typedef
struct
...
...
@@ -58,6 +59,7 @@ 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
);
...
...
@@ -290,14 +292,15 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(
static
HRESULT
WINAPI
MSTASK_ITaskScheduler_NewWorkItem
(
ITaskScheduler
*
iface
,
LPCWSTR
pwszTaskN
ame
,
LPCWSTR
task_n
ame
,
REFCLSID
rclsid
,
REFIID
riid
,
IUnknown
**
ppun
k
)
IUnknown
**
tas
k
)
{
HRESULT
hr
;
TRACE
(
"(%p, %s, %s, %s, %p)
\n
"
,
iface
,
debugstr_w
(
pwszTaskName
),
debugstr_guid
(
rclsid
)
,
debugstr_guid
(
riid
),
ppunk
);
TaskSchedulerImpl
*
This
=
impl_from_ITaskScheduler
(
iface
);
TRACE
(
"(%p, %s, %s, %s, %p)
\n
"
,
iface
,
debugstr_w
(
task_name
),
debugstr_guid
(
rclsid
),
debugstr_guid
(
riid
),
task
);
if
(
!
IsEqualGUID
(
rclsid
,
&
CLSID_CTask
))
return
CLASS_E_CLASSNOTAVAILABLE
;
...
...
@@ -305,8 +308,7 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(
if
(
!
IsEqualGUID
(
riid
,
&
IID_ITask
))
return
E_NOINTERFACE
;
hr
=
TaskConstructor
(
pwszTaskName
,
(
LPVOID
*
)
ppunk
);
return
hr
;
return
TaskConstructor
(
This
->
root
,
task_name
,
(
ITask
**
)
task
,
TRUE
);
}
static
HRESULT
WINAPI
MSTASK_ITaskScheduler_AddWorkItem
(
...
...
@@ -347,6 +349,7 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj)
{
TaskSchedulerImpl
*
This
;
ITaskService
*
service
;
ITaskFolder
*
root
;
VARIANT
v_null
;
HRESULT
hr
;
...
...
@@ -363,15 +366,24 @@ 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
;
...
...
dlls/mstask/task_trigger.c
View file @
b4539f71
...
...
@@ -24,6 +24,7 @@
#include "winbase.h"
#include "objbase.h"
#include "winternl.h"
#include "taskschd.h"
#include "mstask.h"
#include "mstask_private.h"
#include "wine/debug.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment