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
9aaaafa7
Commit
9aaaafa7
authored
May 28, 2007
by
Tim Schwartz
Committed by
Alexandre Julliard
May 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net.exe: Add NET START command.
parent
db4586d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
5 deletions
+65
-5
Makefile.in
programs/net/Makefile.in
+1
-1
net.c
programs/net/net.c
+64
-4
No files found.
programs/net/Makefile.in
View file @
9aaaafa7
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
net.exe
APPMODE
=
-mconsole
IMPORTS
=
kernel32
IMPORTS
=
advapi32
kernel32
C_SRCS
=
net.c
...
...
programs/net/net.c
View file @
9aaaafa7
...
...
@@ -18,15 +18,59 @@
#include <stdio.h>
#include <string.h>
#include <windows.h>
#define NET_START 0001
static
BOOL
net_service
(
int
operation
,
char
*
service_name
)
{
SC_HANDLE
SCManager
,
serviceHandle
;
BOOL
result
=
0
;
char
service_display_name
[
4096
];
DWORD
buffer_size
=
sizeof
(
service_display_name
);
SCManager
=
OpenSCManager
(
NULL
,
NULL
,
SC_MANAGER_ALL_ACCESS
);
if
(
!
SCManager
)
{
printf
(
"Couldn't get handle to SCManager.
\n
"
);
return
FALSE
;
}
serviceHandle
=
OpenService
(
SCManager
,
service_name
,
SC_MANAGER_ALL_ACCESS
);
if
(
!
serviceHandle
)
{
printf
(
"Couldn't get handle to service.
\n
"
);
CloseServiceHandle
(
SCManager
);
return
FALSE
;
}
GetServiceDisplayName
(
SCManager
,
service_name
,
service_display_name
,
&
buffer_size
);
if
(
!
service_display_name
[
0
])
strcpy
(
service_display_name
,
service_name
);
switch
(
operation
)
{
case
NET_START
:
printf
(
"The %s service is starting.
\n
"
,
service_display_name
);
result
=
StartService
(
serviceHandle
,
0
,
NULL
);
printf
(
"The %s service "
,
service_display_name
);
if
(
!
result
)
printf
(
"failed to start.
\n
"
);
else
printf
(
"was started successfully.
\n
"
);
break
;
}
CloseServiceHandle
(
serviceHandle
);
CloseServiceHandle
(
SCManager
);
return
result
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
ret
=
0
;
if
(
argc
<
2
)
{
printf
(
"The syntax of this command is:
\n\n
"
);
printf
(
"NET [ HELP ]
\n
"
);
printf
(
"NET [ HELP
| START
]
\n
"
);
return
1
;
}
...
...
@@ -35,7 +79,23 @@ int main(int argc, char *argv[])
printf
(
"The syntax of this command is:
\n\n
"
);
printf
(
"NET HELP command
\n
-or-
\n
NET command /HELP
\n\n
"
);
printf
(
" Commands available are:
\n
"
);
printf
(
" NET HELP
\n
"
);
printf
(
" NET HELP
NET START
\n
"
);
}
return
ret
;
if
(
!
strcasecmp
(
argv
[
1
],
"start"
))
{
if
(
argc
<
3
)
{
printf
(
"Specify service name to start.
\n
"
);
return
1
;
}
if
(
!
net_service
(
NET_START
,
argv
[
2
]))
{
return
1
;
}
return
0
;
}
return
0
;
}
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