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
0c1c1fc2
Commit
0c1c1fc2
authored
May 20, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: Add a helper function to send a command to the service.
parent
be57450f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
20 deletions
+35
-20
rpc.c
programs/services/rpc.c
+28
-11
services.c
programs/services/services.c
+5
-9
services.h
programs/services/services.h
+2
-0
No files found.
programs/services/rpc.c
View file @
0c1c1fc2
...
...
@@ -888,12 +888,37 @@ static BOOL service_accepts_control(const struct service_entry *service, DWORD d
}
/******************************************************************************
* service_send_command
*/
BOOL
service_send_command
(
struct
service_entry
*
service
,
HANDLE
pipe
,
const
void
*
data
,
DWORD
size
,
DWORD
*
result
)
{
DWORD
count
;
BOOL
r
;
r
=
WriteFile
(
pipe
,
data
,
size
,
&
count
,
NULL
);
if
(
!
r
||
count
!=
size
)
{
WINE_ERR
(
"service protocol error - failed to write pipe!
\n
"
);
return
FALSE
;
}
r
=
ReadFile
(
pipe
,
result
,
sizeof
*
result
,
&
count
,
NULL
);
if
(
!
r
||
count
!=
sizeof
*
result
)
{
WINE_ERR
(
"service protocol error - failed to read pipe "
"r = %d count = %d!
\n
"
,
r
,
count
);
return
FALSE
;
}
return
r
;
}
/******************************************************************************
* service_send_control
*/
static
BOOL
service_send_control
(
struct
service_entry
*
service
,
HANDLE
pipe
,
DWORD
dwControl
,
DWORD
*
result
)
{
service_start_info
*
ssi
;
DWORD
len
,
count
=
0
;
DWORD
len
;
BOOL
r
;
/* calculate how much space we need to send the startup info */
...
...
@@ -906,16 +931,8 @@ static BOOL service_send_control(struct service_entry *service, HANDLE pipe, DWO
ssi
->
name_size
=
strlenW
(
service
->
name
)
+
1
;
strcpyW
(
ssi
->
data
,
service
->
name
);
r
=
WriteFile
(
pipe
,
ssi
,
ssi
->
total_size
,
&
count
,
NULL
);
if
(
!
r
||
count
!=
ssi
->
total_size
)
{
WINE_ERR
(
"service protocol error - failed to write pipe!
\n
"
);
return
r
;
}
r
=
ReadFile
(
pipe
,
result
,
sizeof
*
result
,
&
count
,
NULL
);
if
(
!
r
||
count
!=
sizeof
*
result
)
WINE_ERR
(
"service protocol error - failed to read pipe "
"r = %d count = %d!
\n
"
,
r
,
count
);
r
=
service_send_command
(
service
,
pipe
,
ssi
,
ssi
->
total_size
,
result
);
HeapFree
(
GetProcessHeap
(),
0
,
ssi
);
return
r
;
}
...
...
programs/services/services.c
View file @
0c1c1fc2
...
...
@@ -671,7 +671,7 @@ static DWORD service_wait_for_startup(struct service_entry *service_entry, HANDL
*/
static
BOOL
service_send_start_message
(
struct
service_entry
*
service
,
LPCWSTR
*
argv
,
DWORD
argc
)
{
DWORD
i
,
len
,
count
,
result
;
DWORD
i
,
len
,
result
;
service_start_info
*
ssi
;
LPWSTR
p
;
BOOL
r
;
...
...
@@ -708,15 +708,11 @@ static BOOL service_send_start_message(struct service_entry *service, LPCWSTR *a
}
*
p
=
0
;
r
=
WriteFile
(
service
->
control_pipe
,
ssi
,
ssi
->
total_size
,
&
count
,
NULL
);
if
(
r
)
r
=
service_send_command
(
service
,
service
->
control_pipe
,
ssi
,
ssi
->
total_size
,
&
result
);
if
(
r
&&
result
)
{
r
=
ReadFile
(
service
->
control_pipe
,
&
result
,
sizeof
result
,
&
count
,
NULL
);
if
(
r
&&
result
)
{
SetLastError
(
result
);
r
=
FALSE
;
}
SetLastError
(
result
);
r
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
ssi
);
...
...
programs/services/services.h
View file @
0c1c1fc2
...
...
@@ -75,6 +75,8 @@ void service_lock_shared(struct service_entry *service);
void
service_lock_exclusive
(
struct
service_entry
*
service
);
void
service_unlock
(
struct
service_entry
*
service
);
DWORD
service_start
(
struct
service_entry
*
service
,
DWORD
service_argc
,
LPCWSTR
*
service_argv
);
BOOL
service_send_command
(
struct
service_entry
*
service
,
HANDLE
pipe
,
const
void
*
data
,
DWORD
size
,
DWORD
*
result
);
extern
HANDLE
g_hStartedEvent
;
...
...
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