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
b5c1a8f6
Commit
b5c1a8f6
authored
Apr 09, 2018
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: Add a 3000 ms timeout to StartService.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f1b88ab1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
rpc.c
programs/services/rpc.c
+2
-2
services.c
programs/services/services.c
+12
-3
services.h
programs/services/services.h
+1
-1
No files found.
programs/services/rpc.c
View file @
b5c1a8f6
...
...
@@ -1212,7 +1212,7 @@ DWORD __cdecl svcctl_StartServiceW(
if
(
service
->
service_entry
->
config
.
dwStartType
==
SERVICE_DISABLED
)
return
ERROR_SERVICE_DISABLED
;
if
(
!
scmdatabase_lock_startup
(
service
->
service_entry
->
db
))
if
(
!
scmdatabase_lock_startup
(
service
->
service_entry
->
db
,
3000
))
return
ERROR_SERVICE_DATABASE_LOCKED
;
err
=
service_start
(
service
->
service_entry
,
dwNumServiceArgs
,
lpServiceArgVectors
);
...
...
@@ -1374,7 +1374,7 @@ DWORD __cdecl svcctl_LockServiceDatabase(
if
((
err
=
validate_scm_handle
(
hSCManager
,
SC_MANAGER_LOCK
,
&
manager
))
!=
ERROR_SUCCESS
)
return
err
;
if
(
!
scmdatabase_lock_startup
(
manager
->
db
))
if
(
!
scmdatabase_lock_startup
(
manager
->
db
,
0
))
return
ERROR_SERVICE_DATABASE_LOCKED
;
lock
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
sc_lock
));
...
...
programs/services/services.c
View file @
b5c1a8f6
...
...
@@ -361,7 +361,7 @@ static void scmdatabase_autostart_services(struct scmdatabase *db)
scmdatabase_unlock
(
db
);
qsort
(
services_list
,
size
,
sizeof
(
services_list
[
0
]),
compare_tags
);
while
(
!
scmdatabase_lock_startup
(
db
))
Sleep
(
10
);
scmdatabase_lock_startup
(
db
,
INFINITE
);
for
(
i
=
0
;
i
<
size
;
i
++
)
{
...
...
@@ -619,9 +619,18 @@ static DWORD scmdatabase_load_services(struct scmdatabase *db)
return
ERROR_SUCCESS
;
}
BOOL
scmdatabase_lock_startup
(
struct
scmdatabase
*
db
)
BOOL
scmdatabase_lock_startup
(
struct
scmdatabase
*
db
,
int
timeout
)
{
return
!
InterlockedCompareExchange
(
&
db
->
service_start_lock
,
TRUE
,
FALSE
);
while
(
InterlockedCompareExchange
(
&
db
->
service_start_lock
,
TRUE
,
FALSE
))
{
if
(
timeout
!=
INFINITE
)
{
timeout
-=
10
;
if
(
timeout
<=
0
)
return
FALSE
;
}
Sleep
(
10
);
}
return
TRUE
;
}
void
scmdatabase_unlock_startup
(
struct
scmdatabase
*
db
)
...
...
programs/services/services.h
View file @
b5c1a8f6
...
...
@@ -77,7 +77,7 @@ struct service_entry *scmdatabase_find_service(struct scmdatabase *db, LPCWSTR n
struct
service_entry
*
scmdatabase_find_service_by_displayname
(
struct
scmdatabase
*
db
,
LPCWSTR
name
);
DWORD
scmdatabase_add_service
(
struct
scmdatabase
*
db
,
struct
service_entry
*
entry
);
BOOL
scmdatabase_lock_startup
(
struct
scmdatabase
*
db
);
BOOL
scmdatabase_lock_startup
(
struct
scmdatabase
*
db
,
int
timeout
);
void
scmdatabase_unlock_startup
(
struct
scmdatabase
*
db
);
void
scmdatabase_lock
(
struct
scmdatabase
*
db
);
...
...
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