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
e4c8d763
Commit
e4c8d763
authored
Apr 01, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Apr 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Display a more specific error message when a service command fails.
Use FormatMessage to get the message for the Win32 error.
parent
e4136355
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
net.c
programs/net/net.c
+24
-2
No files found.
programs/net/net.c
View file @
e4c8d763
...
...
@@ -37,6 +37,20 @@ int output_string(int msg, ...)
return
0
;
}
BOOL
output_error_string
(
DWORD
error
)
{
LPSTR
pBuffer
;
if
(
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_ALLOCATE_BUFFER
,
NULL
,
error
,
0
,
(
LPSTR
)
&
pBuffer
,
0
,
NULL
))
{
fputs
(
pBuffer
,
stdout
);
LocalFree
(
pBuffer
);
return
TRUE
;
}
return
FALSE
;
}
static
BOOL
net_use
(
int
argc
,
char
*
argv
[])
{
USE_INFO_2
*
buffer
,
*
connection
;
...
...
@@ -140,14 +154,22 @@ static BOOL net_service(int operation, char *service_name)
result
=
StartService
(
serviceHandle
,
0
,
NULL
);
if
(
result
)
output_string
(
STRING_START_SVC_SUCCESS
,
service_display_name
);
else
output_string
(
STRING_START_SVC_FAIL
,
service_display_name
);
else
{
if
(
!
output_error_string
(
GetLastError
()))
output_string
(
STRING_START_SVC_FAIL
,
service_display_name
);
}
break
;
case
NET_STOP
:
output_string
(
STRING_STOP_SVC
,
service_display_name
);
result
=
StopService
(
SCManager
,
serviceHandle
);
if
(
result
)
output_string
(
STRING_STOP_SVC_SUCCESS
,
service_display_name
);
else
output_string
(
STRING_STOP_SVC_FAIL
,
service_display_name
);
else
{
if
(
!
output_error_string
(
GetLastError
()))
output_string
(
STRING_STOP_SVC_FAIL
,
service_display_name
);
}
break
;
}
...
...
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