mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:13:03 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
77
base/applications/network/net/cmdStop.c
Normal file
77
base/applications/network/net/cmdStop.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS net command
|
||||
* FILE: base/applications/network/net/cmdStop.c
|
||||
* PURPOSE:
|
||||
*
|
||||
* PROGRAMMERS: Magnus Olsen (greatlord@reactos.org)
|
||||
*/
|
||||
|
||||
#include "net.h"
|
||||
|
||||
INT cmdStop(INT argc, WCHAR **argv)
|
||||
{
|
||||
SC_HANDLE hManager = NULL;
|
||||
SC_HANDLE hService = NULL;
|
||||
SERVICE_STATUS ServiceStatus;
|
||||
DWORD dwError = ERROR_SUCCESS;
|
||||
INT nError = 0;
|
||||
INT i;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
ConResPuts(StdOut, IDS_STOP_SYNTAX);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
if (_wcsicmp(argv[i], L"/help") == 0)
|
||||
{
|
||||
ConResPuts(StdOut, IDS_STOP_HELP);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
hManager = OpenSCManagerW(NULL,
|
||||
SERVICES_ACTIVE_DATABASE,
|
||||
SC_MANAGER_ENUMERATE_SERVICE);
|
||||
if (hManager == NULL)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
nError = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
hService = OpenServiceW(hManager,
|
||||
argv[2],
|
||||
SERVICE_STOP);
|
||||
if (hService == NULL)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
nError = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus))
|
||||
{
|
||||
dwError = GetLastError();
|
||||
nError = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (hService != NULL)
|
||||
CloseServiceHandle(hService);
|
||||
|
||||
if (hManager != NULL)
|
||||
CloseServiceHandle(hManager);
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
/* FIXME: Print proper error message */
|
||||
ConPrintf(StdErr, L"Error: %lu\n", dwError);
|
||||
}
|
||||
|
||||
return nError;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue