2002-12-26 17:23:27 +00:00
|
|
|
/* $Id: scm.c,v 1.14 2002/12/26 17:23:27 robd Exp $
|
1999-05-19 16:43:30 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* FILE: lib/advapi32/service/scm.c
|
|
|
|
* PURPOSE: Service control manager functions
|
|
|
|
* PROGRAMMER: Emanuele Aliberti
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 19990413 EA created
|
|
|
|
* 19990515 EA
|
|
|
|
*/
|
2000-03-26 22:00:10 +00:00
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
|
|
|
#define NTOS_MODE_USER
|
|
|
|
#include <ntos.h>
|
2002-09-08 10:23:54 +00:00
|
|
|
#include <windows.h>
|
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
|
|
|
#include <tchar.h>
|
2000-03-26 22:00:10 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
1999-05-19 16:43:30 +00:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ChangeServiceConfigA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
ChangeServiceConfigA(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCSTR lpBinaryPathName,
|
|
|
|
LPCSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCSTR lpDependencies,
|
|
|
|
LPCSTR lpServiceStartName,
|
|
|
|
LPCSTR lpPassword,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCSTR lpDisplayName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ChangeServiceConfigW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
ChangeServiceConfigW(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCWSTR lpBinaryPathName,
|
|
|
|
LPCWSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCWSTR lpDependencies,
|
|
|
|
LPCWSTR lpServiceStartName,
|
|
|
|
LPCWSTR lpPassword,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCWSTR lpDisplayName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* CloseServiceHandle
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
CloseServiceHandle(SC_HANDLE hSCObject)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ControlService
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
ControlService(SC_HANDLE hService,
|
|
|
|
DWORD dwControl,
|
|
|
|
LPSERVICE_STATUS lpServiceStatus)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* CreateServiceA
|
|
|
|
*/
|
|
|
|
SC_HANDLE
|
|
|
|
STDCALL
|
|
|
|
CreateServiceA(
|
|
|
|
SC_HANDLE hSCManager,
|
2001-10-21 19:06:42 +00:00
|
|
|
LPCSTR lpServiceName,
|
|
|
|
LPCSTR lpDisplayName,
|
1999-05-19 16:43:30 +00:00
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
2001-10-21 19:06:42 +00:00
|
|
|
LPCSTR lpBinaryPathName,
|
|
|
|
LPCSTR lpLoadOrderGroup,
|
1999-05-19 16:43:30 +00:00
|
|
|
LPDWORD lpdwTagId,
|
2001-10-21 19:06:42 +00:00
|
|
|
LPCSTR lpDependencies,
|
|
|
|
LPCSTR lpServiceStartName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCSTR lpPassword)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* CreateServiceW
|
|
|
|
*/
|
|
|
|
SC_HANDLE
|
|
|
|
STDCALL
|
|
|
|
CreateServiceW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpServiceName,
|
|
|
|
LPCWSTR lpDisplayName,
|
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCWSTR lpBinaryPathName,
|
|
|
|
LPCWSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCWSTR lpDependencies,
|
|
|
|
LPCWSTR lpServiceStartName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCWSTR lpPassword)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* DeleteService
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
DeleteService(SC_HANDLE hService)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumDependentServicesA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumDependentServicesA(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSA lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpServicesReturned)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumDependentServicesW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumDependentServicesW(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSW lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpServicesReturned)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumServiceGroupW
|
1999-07-22 21:36:37 +00:00
|
|
|
*
|
1999-07-26 20:46:40 +00:00
|
|
|
* (unknown)
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
1999-07-26 20:46:40 +00:00
|
|
|
BOOL
|
1999-05-19 16:43:30 +00:00
|
|
|
STDCALL
|
1999-07-26 20:46:40 +00:00
|
|
|
EnumServiceGroupW (
|
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3,
|
|
|
|
DWORD Unknown4,
|
|
|
|
DWORD Unknown5,
|
|
|
|
DWORD Unknown6,
|
|
|
|
DWORD Unknown7,
|
2002-12-26 17:23:27 +00:00
|
|
|
DWORD Unknown8)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
1999-07-26 20:46:40 +00:00
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumServicesStatusA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
1999-07-26 20:46:40 +00:00
|
|
|
EnumServicesStatusA (
|
1999-05-19 16:43:30 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSA lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpResumeHandle)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumServicesStatusExA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
EnumServicesStatusExA(SC_HANDLE hSCManager,
|
|
|
|
SC_ENUM_TYPE InfoLevel,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPBYTE lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
|
|
|
LPDWORD lpResumeHandle,
|
|
|
|
LPCSTR pszGroupName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumServicesStatusExW
|
|
|
|
*/
|
1999-07-22 21:36:37 +00:00
|
|
|
BOOL
|
1999-05-19 16:43:30 +00:00
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
EnumServicesStatusExW(SC_HANDLE hSCManager,
|
|
|
|
SC_ENUM_TYPE InfoLevel,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPBYTE lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
|
|
|
LPDWORD lpResumeHandle,
|
|
|
|
LPCWSTR pszGroupName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* EnumServicesStatusW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumServicesStatusW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSW lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpResumeHandle)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetServiceDisplayNameA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceDisplayNameA(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpServiceName,
|
|
|
|
LPSTR lpDisplayName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetServiceDisplayNameW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceDisplayNameW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpServiceName,
|
|
|
|
LPWSTR lpDisplayName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetServiceKeyNameA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceKeyNameA(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpDisplayName,
|
|
|
|
LPSTR lpServiceName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetServiceKeyNameW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceKeyNameW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpDisplayName,
|
|
|
|
LPWSTR lpServiceName,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* LockServiceDatabase
|
|
|
|
*/
|
|
|
|
SC_LOCK
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
LockServiceDatabase(SC_HANDLE hSCManager)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
1999-11-07 08:03:28 +00:00
|
|
|
SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
|
1999-05-19 16:43:30 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-07 08:03:28 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* OpenSCManagerA
|
|
|
|
*/
|
2002-07-20 13:31:34 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenSCManagerA(LPCSTR lpMachineName,
|
|
|
|
LPCSTR lpDatabaseName,
|
|
|
|
DWORD dwDesiredAccess)
|
2000-03-26 22:00:10 +00:00
|
|
|
{
|
2002-07-20 13:31:34 +00:00
|
|
|
SC_HANDLE Handle;
|
|
|
|
UNICODE_STRING MachineNameW;
|
|
|
|
UNICODE_STRING DatabaseNameW;
|
|
|
|
ANSI_STRING MachineNameA;
|
|
|
|
ANSI_STRING DatabaseNameA;
|
|
|
|
|
|
|
|
RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
|
|
|
|
RtlAnsiStringToUnicodeString(&MachineNameW,
|
2000-03-26 22:00:10 +00:00
|
|
|
&MachineNameA,
|
|
|
|
TRUE);
|
2002-07-20 13:31:34 +00:00
|
|
|
RtlInitAnsiString(&DatabaseNameA, (LPSTR)lpDatabaseName);
|
|
|
|
RtlAnsiStringToUnicodeString(&DatabaseNameW,
|
2000-03-26 22:00:10 +00:00
|
|
|
&DatabaseNameA,
|
|
|
|
TRUE);
|
2002-07-20 13:31:34 +00:00
|
|
|
|
|
|
|
Handle = OpenSCManagerW(MachineNameW.Buffer,
|
|
|
|
DatabaseNameW.Buffer,
|
|
|
|
dwDesiredAccess);
|
|
|
|
|
|
|
|
RtlFreeHeap(GetProcessHeap(),
|
|
|
|
0,
|
|
|
|
MachineNameW.Buffer);
|
|
|
|
RtlFreeHeap(GetProcessHeap(),
|
|
|
|
0,
|
|
|
|
DatabaseNameW.Buffer);
|
|
|
|
|
|
|
|
return(Handle);
|
1999-11-07 08:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* OpenSCManagerW
|
|
|
|
*/
|
2002-07-23 08:16:05 +00:00
|
|
|
SC_HANDLE STDCALL OpenSCManagerW(LPCWSTR lpMachineName,
|
|
|
|
LPCWSTR lpDatabaseName,
|
|
|
|
DWORD dwDesiredAccess)
|
2000-03-26 22:00:10 +00:00
|
|
|
{
|
2002-07-23 08:16:05 +00:00
|
|
|
HANDLE hPipe;
|
|
|
|
DWORD dwMode;
|
|
|
|
DWORD dwWait;
|
|
|
|
BOOL fSuccess;
|
|
|
|
HANDLE hStartEvent;
|
|
|
|
LPWSTR lpszPipeName = L"\\\\.\\pipe\\Ntsvcs";
|
2000-03-26 22:00:10 +00:00
|
|
|
|
2002-07-23 08:16:05 +00:00
|
|
|
if(lpMachineName == NULL || wcslen(lpMachineName) == 0)
|
|
|
|
{
|
|
|
|
if(lpDatabaseName != NULL && wcscmp(lpDatabaseName, SERVICES_ACTIVE_DATABASEW) != 0)
|
|
|
|
{ return(NULL); }
|
|
|
|
|
|
|
|
// Only connect to scm when event "SvcctrlStartEvent_A3725DX" is signaled
|
|
|
|
hStartEvent = OpenEvent(SYNCHRONIZE, FALSE, _T("SvcctrlStartEvent_A3725DX"));
|
|
|
|
if(hStartEvent == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_DATABASE_DOES_NOT_EXIST);
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
dwWait = WaitForSingleObject(hStartEvent, INFINITE);
|
|
|
|
if(dwWait == WAIT_FAILED)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_ACCESS_DENIED);
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
CloseHandle(hStartEvent);
|
|
|
|
|
|
|
|
// Try to open a named pipe; wait for it, if necessary
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
hPipe = CreateFileW(lpszPipeName, // pipe name
|
|
|
|
dwDesiredAccess,
|
|
|
|
0, // no sharing
|
|
|
|
NULL, // no security attributes
|
|
|
|
OPEN_EXISTING, // opens existing pipe
|
|
|
|
0, // default attributes
|
|
|
|
NULL); // no template file
|
|
|
|
|
|
|
|
// Break if the pipe handle is valid
|
|
|
|
if(hPipe != INVALID_HANDLE_VALUE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Exit if an error other than ERROR_PIPE_BUSY occurs
|
|
|
|
if(GetLastError()!= ERROR_PIPE_BUSY)
|
|
|
|
{ return(NULL); }
|
|
|
|
|
|
|
|
// All pipe instances are busy, so wait for 20 seconds
|
|
|
|
if(!WaitNamedPipeW(lpszPipeName, 20000))
|
|
|
|
{ return(NULL); }
|
|
|
|
}
|
|
|
|
|
|
|
|
// The pipe connected; change to message-read mode
|
|
|
|
dwMode = PIPE_READMODE_MESSAGE;
|
|
|
|
fSuccess = SetNamedPipeHandleState(
|
|
|
|
hPipe, // pipe handle
|
|
|
|
&dwMode, // new pipe mode
|
|
|
|
NULL, // don't set maximum bytes
|
|
|
|
NULL); // don't set maximum time
|
|
|
|
if(!fSuccess)
|
|
|
|
{
|
|
|
|
CloseHandle(hPipe);
|
|
|
|
return(NULL);
|
|
|
|
}
|
2001-10-21 19:06:42 +00:00
|
|
|
#if 0
|
2002-07-23 08:16:05 +00:00
|
|
|
// Send a message to the pipe server
|
|
|
|
lpvMessage = (argc > 1) ? argv[1] : "default message";
|
|
|
|
|
|
|
|
fSuccess = WriteFile(
|
|
|
|
hPipe, // pipe handle
|
|
|
|
lpvMessage, // message
|
|
|
|
strlen(lpvMessage) + 1, // message length
|
|
|
|
&cbWritten, // bytes written
|
|
|
|
NULL); // not overlapped
|
|
|
|
if(!fSuccess)
|
|
|
|
{
|
|
|
|
CloseHandle(hPipe);
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
// Read from the pipe
|
|
|
|
fSuccess = ReadFile(
|
|
|
|
hPipe, // pipe handle
|
|
|
|
chBuf, // buffer to receive reply
|
|
|
|
512, // size of buffer
|
|
|
|
&cbRead, // number of bytes read
|
|
|
|
NULL); // not overlapped
|
|
|
|
|
|
|
|
if(! fSuccess && GetLastError() != ERROR_MORE_DATA)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Reply from the pipe is written to STDOUT.
|
|
|
|
if(!WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), chBuf, cbRead, &cbWritten, NULL))
|
|
|
|
break;
|
|
|
|
} while(!fSuccess); // repeat loop if ERROR_MORE_DATA
|
|
|
|
|
|
|
|
//CloseHandle(hPipe);
|
2001-10-21 19:06:42 +00:00
|
|
|
#endif
|
2002-07-23 08:16:05 +00:00
|
|
|
return(hPipe);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME: Connect to remote SCM */
|
|
|
|
return(NULL);
|
|
|
|
}
|
1999-11-07 08:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* OpenServiceA
|
|
|
|
*/
|
2002-07-20 13:31:34 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenServiceA(SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpServiceName,
|
|
|
|
DWORD dwDesiredAccess)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2002-07-20 13:31:34 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return(NULL);
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* OpenServiceW
|
|
|
|
*/
|
|
|
|
SC_HANDLE
|
|
|
|
STDCALL
|
|
|
|
OpenServiceW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpServiceName,
|
|
|
|
DWORD dwDesiredAccess
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* PrivilegedServiceAuditAlarmA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
PrivilegedServiceAuditAlarmA(
|
|
|
|
LPCSTR SubsystemName,
|
|
|
|
LPCSTR ServiceName,
|
|
|
|
HANDLE ClientToken,
|
|
|
|
PPRIVILEGE_SET Privileges,
|
2002-12-26 17:23:27 +00:00
|
|
|
BOOL AccessGranted)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* PrivilegedServiceAuditAlarmW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
PrivilegedServiceAuditAlarmW(
|
|
|
|
LPCWSTR SubsystemName,
|
|
|
|
LPCWSTR ServiceName,
|
|
|
|
HANDLE ClientToken,
|
|
|
|
PPRIVILEGE_SET Privileges,
|
2002-12-26 17:23:27 +00:00
|
|
|
BOOL AccessGranted)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceConfigA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceConfigA(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
LPQUERY_SERVICE_CONFIGA lpServiceConfig,
|
|
|
|
DWORD cbBufSize,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceConfigW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceConfigW(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
LPQUERY_SERVICE_CONFIGW lpServiceConfig,
|
|
|
|
DWORD cbBufSize,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceLockStatusA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceLockStatusA(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
|
|
|
|
DWORD cbBufSize,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceLockStatusW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceLockStatusW(
|
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,
|
|
|
|
DWORD cbBufSize,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceObjectSecurity
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceObjectSecurity(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
SECURITY_INFORMATION dwSecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR lpSecurityDescriptor,
|
|
|
|
DWORD cbBufSize,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceStatus
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceStatus(
|
|
|
|
SC_HANDLE hService,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPSERVICE_STATUS lpServiceStatus)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* QueryServiceStatusEx
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
QueryServiceStatusEx(SC_HANDLE hService,
|
|
|
|
SC_STATUS_TYPE InfoLevel,
|
|
|
|
LPBYTE lpBuffer,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* StartServiceA
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
StartServiceA(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwNumServiceArgs,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCSTR *lpServiceArgVectors)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* StartServiceW
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
StartServiceW(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwNumServiceArgs,
|
2002-12-26 17:23:27 +00:00
|
|
|
LPCWSTR *lpServiceArgVectors)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* UnlockServiceDatabase
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
UnlockServiceDatabase(SC_LOCK ScLock)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* EOF */
|