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
c2148f9e
Commit
c2148f9e
authored
Mar 14, 2014
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schedsvc: Mark service as auto-start once a task is registered.
parent
79fe4375
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
3 deletions
+58
-3
schedsvc.c
dlls/schedsvc/schedsvc.c
+5
-1
schedsvc_private.h
dlls/schedsvc/schedsvc_private.h
+2
-0
svc_main.c
dlls/schedsvc/svc_main.c
+51
-2
No files found.
dlls/schedsvc/schedsvc.c
View file @
c2148f9e
...
...
@@ -208,7 +208,11 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl
}
hr
=
write_xml_utf8
(
full_name
,
disposition
,
xml
);
if
(
hr
==
S_OK
)
*
actual_path
=
heap_strdupW
(
relative_path
);
if
(
hr
==
S_OK
)
{
*
actual_path
=
heap_strdupW
(
relative_path
);
schedsvc_auto_start
();
}
heap_free
(
full_name
);
return
hr
;
...
...
dlls/schedsvc/schedsvc_private.h
View file @
c2148f9e
...
...
@@ -21,6 +21,8 @@
#include "wine/unicode.h"
void
schedsvc_auto_start
(
void
)
DECLSPEC_HIDDEN
;
static
void
*
heap_alloc_zero
(
SIZE_T
size
)
__WINE_ALLOC_SIZE
(
1
);
static
inline
void
*
heap_alloc_zero
(
SIZE_T
size
)
{
...
...
dlls/schedsvc/svc_main.c
View file @
c2148f9e
...
...
@@ -29,9 +29,60 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
schedsvc
);
static
const
WCHAR
scheduleW
[]
=
{
'S'
,
'c'
,
'h'
,
'e'
,
'd'
,
'u'
,
'l'
,
'e'
,
0
};
static
SERVICE_STATUS_HANDLE
schedsvc_handle
;
static
HANDLE
done_event
;
void
schedsvc_auto_start
(
void
)
{
static
DWORD
start_type
;
SC_HANDLE
scm
,
service
;
QUERY_SERVICE_CONFIGW
*
cfg
;
DWORD
cfg_size
;
if
(
start_type
==
SERVICE_AUTO_START
)
return
;
TRACE
(
"changing service start type to SERVICE_AUTO_START
\n
"
);
scm
=
OpenSCManagerW
(
NULL
,
NULL
,
0
);
if
(
!
scm
)
{
WARN
(
"failed to open SCM (%u)
\n
"
,
GetLastError
());
return
;
}
service
=
OpenServiceW
(
scm
,
scheduleW
,
SERVICE_QUERY_CONFIG
|
SERVICE_CHANGE_CONFIG
);
if
(
service
)
{
if
(
!
QueryServiceConfigW
(
service
,
NULL
,
0
,
&
cfg_size
)
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
cfg
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cfg_size
);
if
(
cfg
)
{
if
(
QueryServiceConfigW
(
service
,
cfg
,
cfg_size
,
&
cfg_size
))
{
start_type
=
cfg
->
dwStartType
;
if
(
start_type
!=
SERVICE_AUTO_START
)
{
if
(
ChangeServiceConfigW
(
service
,
SERVICE_NO_CHANGE
,
SERVICE_AUTO_START
,
SERVICE_NO_CHANGE
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
))
start_type
=
SERVICE_AUTO_START
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
cfg
);
}
}
else
WARN
(
"failed to query service config (%u)
\n
"
,
GetLastError
());
CloseServiceHandle
(
service
);
}
else
WARN
(
"failed to open service (%u)
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm
);
}
static
void
schedsvc_update_status
(
DWORD
state
)
{
SERVICE_STATUS
status
;
...
...
@@ -122,8 +173,6 @@ static void RPC_finish(void)
void
WINAPI
ServiceMain
(
DWORD
argc
,
LPWSTR
*
argv
)
{
static
const
WCHAR
scheduleW
[]
=
{
'S'
,
'c'
,
'h'
,
'e'
,
'd'
,
'u'
,
'l'
,
'e'
,
0
};
WINE_TRACE
(
"starting Task Scheduler Service
\n
"
);
if
(
RPC_init
()
!=
RPC_S_OK
)
return
;
...
...
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