Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
46b27469
Commit
46b27469
authored
Aug 11, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Aug 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: Store process id in the process object.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c8187d62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
41 deletions
+17
-41
rpc.c
programs/services/rpc.c
+14
-37
services.c
programs/services/services.c
+1
-3
services.h
programs/services/services.h
+2
-1
No files found.
programs/services/rpc.c
View file @
46b27469
...
...
@@ -761,13 +761,7 @@ DWORD __cdecl svcctl_SetServiceStatus(
service_lock
(
service
->
service_entry
);
/* FIXME: be a bit more discriminant about what parts of the status we set
* and check that fields are valid */
service
->
service_entry
->
status
.
dwServiceType
=
lpServiceStatus
->
dwServiceType
;
service
->
service_entry
->
status
.
dwCurrentState
=
lpServiceStatus
->
dwCurrentState
;
service
->
service_entry
->
status
.
dwControlsAccepted
=
lpServiceStatus
->
dwControlsAccepted
;
service
->
service_entry
->
status
.
dwWin32ExitCode
=
lpServiceStatus
->
dwWin32ExitCode
;
service
->
service_entry
->
status
.
dwServiceSpecificExitCode
=
lpServiceStatus
->
dwServiceSpecificExitCode
;
service
->
service_entry
->
status
.
dwCheckPoint
=
lpServiceStatus
->
dwCheckPoint
;
service
->
service_entry
->
status
.
dwWaitHint
=
lpServiceStatus
->
dwWaitHint
;
service
->
service_entry
->
status
=
*
lpServiceStatus
;
if
((
process
=
service
->
service_entry
->
process
))
{
if
(
lpServiceStatus
->
dwCurrentState
==
SERVICE_STOPPED
)
...
...
@@ -886,6 +880,14 @@ DWORD __cdecl svcctl_QueryServiceConfig2W( SC_RPC_HANDLE hService, DWORD level,
return
err
;
}
static
void
fill_status_process
(
SERVICE_STATUS_PROCESS
*
status
,
struct
service_entry
*
service
)
{
struct
process_entry
*
process
=
service
->
process
;
memcpy
(
status
,
&
service
->
status
,
sizeof
(
service
->
status
));
status
->
dwProcessId
=
process
?
process
->
process_id
:
0
;
status
->
dwServiceFlags
=
0
;
}
DWORD
__cdecl
svcctl_QueryServiceStatusEx
(
SC_RPC_HANDLE
hService
,
SC_STATUS_TYPE
InfoLevel
,
...
...
@@ -918,17 +920,7 @@ DWORD __cdecl svcctl_QueryServiceStatusEx(
}
service_lock
(
service
->
service_entry
);
pSvcStatusData
->
dwServiceType
=
service
->
service_entry
->
status
.
dwServiceType
;
pSvcStatusData
->
dwCurrentState
=
service
->
service_entry
->
status
.
dwCurrentState
;
pSvcStatusData
->
dwControlsAccepted
=
service
->
service_entry
->
status
.
dwControlsAccepted
;
pSvcStatusData
->
dwWin32ExitCode
=
service
->
service_entry
->
status
.
dwWin32ExitCode
;
pSvcStatusData
->
dwServiceSpecificExitCode
=
service
->
service_entry
->
status
.
dwServiceSpecificExitCode
;
pSvcStatusData
->
dwCheckPoint
=
service
->
service_entry
->
status
.
dwCheckPoint
;
pSvcStatusData
->
dwWaitHint
=
service
->
service_entry
->
status
.
dwWaitHint
;
pSvcStatusData
->
dwProcessId
=
service
->
service_entry
->
status
.
dwProcessId
;
pSvcStatusData
->
dwServiceFlags
=
service
->
service_entry
->
status
.
dwServiceFlags
;
fill_status_process
(
pSvcStatusData
,
service
->
service_entry
);
service_unlock
(
service
->
service_entry
);
return
ERROR_SUCCESS
;
...
...
@@ -1151,16 +1143,7 @@ DWORD __cdecl svcctl_ControlService(
if
(
result
!=
ERROR_SUCCESS
)
{
if
(
lpServiceStatus
)
{
lpServiceStatus
->
dwServiceType
=
service
->
service_entry
->
status
.
dwServiceType
;
lpServiceStatus
->
dwCurrentState
=
service
->
service_entry
->
status
.
dwCurrentState
;
lpServiceStatus
->
dwControlsAccepted
=
service
->
service_entry
->
status
.
dwControlsAccepted
;
lpServiceStatus
->
dwWin32ExitCode
=
service
->
service_entry
->
status
.
dwWin32ExitCode
;
lpServiceStatus
->
dwServiceSpecificExitCode
=
service
->
service_entry
->
status
.
dwServiceSpecificExitCode
;
lpServiceStatus
->
dwCheckPoint
=
service
->
service_entry
->
status
.
dwCheckPoint
;
lpServiceStatus
->
dwWaitHint
=
service
->
service_entry
->
status
.
dwWaitHint
;
}
if
(
lpServiceStatus
)
*
lpServiceStatus
=
service
->
service_entry
->
status
;
service_unlock
(
service
->
service_entry
);
return
result
;
}
...
...
@@ -1195,13 +1178,7 @@ DWORD __cdecl svcctl_ControlService(
if
(
lpServiceStatus
)
{
service_lock
(
service
->
service_entry
);
lpServiceStatus
->
dwServiceType
=
service
->
service_entry
->
status
.
dwServiceType
;
lpServiceStatus
->
dwCurrentState
=
service
->
service_entry
->
status
.
dwCurrentState
;
lpServiceStatus
->
dwControlsAccepted
=
service
->
service_entry
->
status
.
dwControlsAccepted
;
lpServiceStatus
->
dwWin32ExitCode
=
service
->
service_entry
->
status
.
dwWin32ExitCode
;
lpServiceStatus
->
dwServiceSpecificExitCode
=
service
->
service_entry
->
status
.
dwServiceSpecificExitCode
;
lpServiceStatus
->
dwCheckPoint
=
service
->
service_entry
->
status
.
dwCheckPoint
;
lpServiceStatus
->
dwWaitHint
=
service
->
service_entry
->
status
.
dwWaitHint
;
*
lpServiceStatus
=
service
->
service_entry
->
status
;
service_unlock
(
service
->
service_entry
);
}
...
...
@@ -1365,7 +1342,7 @@ DWORD __cdecl svcctl_EnumServicesStatusW(
s
->
lpDisplayName
=
(
WCHAR
*
)
offset
;
offset
+=
sz
;
}
memcpy
(
&
s
->
ServiceStatus
,
&
service
->
status
,
sizeof
(
SERVICE_STATUS
))
;
s
->
ServiceStatus
=
service
->
status
;
s
++
;
}
}
...
...
@@ -1490,7 +1467,7 @@ DWORD __cdecl svcctl_EnumServicesStatusExW(
s
->
lpDisplayName
=
(
WCHAR
*
)
offset
;
offset
+=
sz
;
}
s
->
ServiceStatusProcess
=
service
->
status
;
fill_status_process
(
&
s
->
ServiceStatusProcess
,
service
)
;
s
++
;
}
}
...
...
programs/services/services.c
View file @
46b27469
...
...
@@ -791,7 +791,7 @@ static DWORD service_start_process(struct service_entry *service_entry, struct p
return
err
;
}
service_entry
->
status
.
dwProcessI
d
=
pi
.
dwProcessId
;
process
->
process_i
d
=
pi
.
dwProcessId
;
process
->
process
=
pi
.
hProcess
;
CloseHandle
(
pi
.
hThread
);
...
...
@@ -936,7 +936,6 @@ void service_terminate(struct service_entry *service)
release_process
(
process
);
service
->
process
=
NULL
;
}
service
->
status
.
dwProcessId
=
0
;
service
->
status
.
dwCurrentState
=
SERVICE_STOPPED
;
service_unlock
(
service
);
}
...
...
@@ -951,7 +950,6 @@ void process_terminate(struct process_entry *process)
LIST_FOR_EACH_ENTRY
(
service
,
&
db
->
services
,
struct
service_entry
,
entry
)
{
if
(
service
->
process
!=
process
)
continue
;
service
->
status
.
dwProcessId
=
0
;
service
->
status
.
dwCurrentState
=
SERVICE_STOPPED
;
service
->
process
=
NULL
;
release_process
(
process
);
...
...
programs/services/services.h
View file @
46b27469
...
...
@@ -37,6 +37,7 @@ struct process_entry
struct
list
entry
;
struct
scmdatabase
*
db
;
LONG
ref_count
;
DWORD
process_id
;
HANDLE
process
;
HANDLE
control_mutex
;
HANDLE
control_pipe
;
...
...
@@ -50,7 +51,7 @@ struct service_entry
struct
scmdatabase
*
db
;
LONG
ref_count
;
/* number of references - if goes to zero and the service is deleted the structure will be freed */
LPWSTR
name
;
SERVICE_STATUS
_PROCESS
status
;
SERVICE_STATUS
status
;
QUERY_SERVICE_CONFIGW
config
;
DWORD
preshutdown_timeout
;
LPWSTR
description
;
...
...
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