2005-04-15 22:02:37 +00:00
|
|
|
/*
|
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
|
2005-04-15 22:02:37 +00:00
|
|
|
* Eric Kohl
|
1999-05-19 16:43:30 +00:00
|
|
|
* UPDATE HISTORY:
|
2002-12-27 14:40:03 +00:00
|
|
|
* 19990413 EA created
|
|
|
|
* 19990515 EA
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2000-03-26 22:00:10 +00:00
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2005-08-05 10:31:28 +00:00
|
|
|
#include <advapi32.h>
|
2005-04-17 11:01:00 +00:00
|
|
|
#include "svcctl_c.h"
|
2005-04-15 22:02:37 +00:00
|
|
|
|
2004-09-26 20:28:22 +00:00
|
|
|
#define NDEBUG
|
2002-12-27 14:40:03 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
2000-03-26 22:00:10 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
1999-05-19 16:43:30 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
handle_t BindingHandle = NULL;
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
HandleBind(VOID)
|
|
|
|
{
|
|
|
|
LPWSTR pszStringBinding;
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
|
|
|
if (BindingHandle != NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = RpcStringBindingComposeW(NULL,
|
|
|
|
L"ncacn_np",
|
|
|
|
NULL,
|
|
|
|
L"\\pipe\\ntsvcs",
|
|
|
|
NULL,
|
|
|
|
&pszStringBinding);
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
DPRINT1("RpcStringBindingCompose returned 0x%x\n", status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the binding handle that will be used to bind to the server. */
|
|
|
|
status = RpcBindingFromStringBindingW(pszStringBinding,
|
|
|
|
&BindingHandle);
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = RpcStringFreeW(&pszStringBinding);
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
DPRINT1("RpcStringFree returned 0x%x\n", status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static VOID
|
|
|
|
HandleUnbind(VOID)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
|
|
|
if (BindingHandle == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = RpcBindingFree(&BindingHandle);
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
DPRINT1("RpcBindingFree returned 0x%x\n", status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* ChangeServiceConfigA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
ChangeServiceConfigA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCSTR lpBinaryPathName,
|
|
|
|
LPCSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCSTR lpDependencies,
|
|
|
|
LPCSTR lpServiceStartName,
|
|
|
|
LPCSTR lpPassword,
|
|
|
|
LPCSTR lpDisplayName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("ChangeServiceConfigA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* ChangeServiceConfigW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-10-23 19:50:05 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-10-23 19:50:05 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
ChangeServiceConfigW(SC_HANDLE hService,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCWSTR lpBinaryPathName,
|
|
|
|
LPCWSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCWSTR lpDependencies,
|
|
|
|
LPCWSTR lpServiceStartName,
|
|
|
|
LPCWSTR lpPassword,
|
|
|
|
LPCWSTR lpDisplayName)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-10-23 19:50:05 +00:00
|
|
|
DWORD dwError;
|
|
|
|
DWORD dwDependenciesLength = 0;
|
|
|
|
DWORD dwLength;
|
|
|
|
LPWSTR lpStr;
|
|
|
|
|
|
|
|
DPRINT1("ChangeServiceConfigW() called\n");
|
|
|
|
|
|
|
|
/* Calculate the Dependencies length*/
|
|
|
|
if (lpDependencies != NULL)
|
|
|
|
{
|
|
|
|
lpStr = (LPWSTR)lpDependencies;
|
|
|
|
while (*lpStr)
|
|
|
|
{
|
|
|
|
dwLength = wcslen(lpStr) + 1;
|
|
|
|
dwDependenciesLength += dwLength;
|
|
|
|
lpStr = lpStr + dwLength;
|
|
|
|
}
|
|
|
|
dwDependenciesLength++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Encrypt the password */
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrChangeServiceConfigW(BindingHandle,
|
|
|
|
(unsigned int)hService,
|
|
|
|
dwServiceType,
|
|
|
|
dwStartType,
|
|
|
|
dwErrorControl,
|
|
|
|
(LPWSTR)lpBinaryPathName,
|
|
|
|
(LPWSTR)lpLoadOrderGroup,
|
|
|
|
lpdwTagId,
|
|
|
|
(LPWSTR)lpDependencies,
|
|
|
|
dwDependenciesLength,
|
|
|
|
(LPWSTR)lpServiceStartName,
|
|
|
|
NULL, /* FIXME: lpPassword */
|
|
|
|
0, /* FIXME: dwPasswordLength */
|
|
|
|
(LPWSTR)lpDisplayName);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrChangeServiceConfigW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* CloseServiceHandle
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-15 22:02:37 +00:00
|
|
|
BOOL STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
CloseServiceHandle(SC_HANDLE hSCObject)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-15 22:02:37 +00:00
|
|
|
DWORD dwError;
|
2002-12-27 14:40:03 +00:00
|
|
|
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT("CloseServiceHandle() called\n");
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrCloseServiceHandle(BindingHandle,
|
|
|
|
(unsigned int)hSCObject);
|
|
|
|
if (dwError)
|
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError);
|
2005-04-15 22:02:37 +00:00
|
|
|
SetLastError(dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT("CloseServiceHandle() done\n");
|
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* ControlService
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-15 22:02:37 +00:00
|
|
|
BOOL STDCALL
|
2002-12-27 14:40:03 +00:00
|
|
|
ControlService(SC_HANDLE hService,
|
|
|
|
DWORD dwControl,
|
|
|
|
LPSERVICE_STATUS lpServiceStatus)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-15 22:02:37 +00:00
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT("ControlService(%x, %x, %p)\n",
|
|
|
|
hService, dwControl, lpServiceStatus);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrControlService(BindingHandle,
|
|
|
|
(unsigned int)hService,
|
|
|
|
dwControl,
|
|
|
|
lpServiceStatus);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError);
|
2005-04-15 22:02:37 +00:00
|
|
|
SetLastError(dwError);
|
2002-12-27 14:40:03 +00:00
|
|
|
return FALSE;
|
2005-04-15 22:02:37 +00:00
|
|
|
}
|
|
|
|
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT("ControlService() done\n");
|
2005-04-17 11:01:00 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-25 22:06:31 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* ControlServiceEx
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
ControlServiceEx(IN SC_HANDLE hService,
|
|
|
|
IN DWORD dwControl,
|
|
|
|
IN DWORD dwInfoLevel,
|
|
|
|
IN OUT PVOID pControlParams)
|
|
|
|
{
|
|
|
|
DPRINT1("ControlServiceEx(0x%p, 0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n",
|
|
|
|
hService, dwControl, dwInfoLevel, pControlParams);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* CreateServiceA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
SC_HANDLE
|
|
|
|
STDCALL
|
|
|
|
CreateServiceA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpServiceName,
|
|
|
|
LPCSTR lpDisplayName,
|
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwStartType,
|
|
|
|
DWORD dwErrorControl,
|
|
|
|
LPCSTR lpBinaryPathName,
|
|
|
|
LPCSTR lpLoadOrderGroup,
|
|
|
|
LPDWORD lpdwTagId,
|
|
|
|
LPCSTR lpDependencies,
|
|
|
|
LPCSTR lpServiceStartName,
|
|
|
|
LPCSTR lpPassword)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("CreateServiceA is unimplemented, but returning INVALID_HANDLE_VALUE instead of NULL\n");
|
|
|
|
return INVALID_HANDLE_VALUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* CreateServiceW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-10-23 19:50:05 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-10-09 20:24:00 +00:00
|
|
|
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,
|
|
|
|
LPCWSTR lpPassword)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-10-09 20:24:00 +00:00
|
|
|
SC_HANDLE hService = NULL;
|
|
|
|
DWORD dwError;
|
2005-10-15 19:34:53 +00:00
|
|
|
DWORD dwDependenciesLength = 0;
|
|
|
|
DWORD dwLength;
|
|
|
|
LPWSTR lpStr;
|
2005-10-09 20:24:00 +00:00
|
|
|
|
|
|
|
DPRINT1("CreateServiceW() called\n");
|
|
|
|
|
2005-10-15 19:34:53 +00:00
|
|
|
/* Calculate the Dependencies length*/
|
|
|
|
if (lpDependencies != NULL)
|
|
|
|
{
|
|
|
|
lpStr = (LPWSTR)lpDependencies;
|
|
|
|
while (*lpStr)
|
|
|
|
{
|
|
|
|
dwLength = wcslen(lpStr) + 1;
|
|
|
|
dwDependenciesLength += dwLength;
|
|
|
|
lpStr = lpStr + dwLength;
|
|
|
|
}
|
|
|
|
dwDependenciesLength++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Encrypt the password */
|
|
|
|
|
2005-10-09 20:24:00 +00:00
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrCreateServiceW(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(LPWSTR)lpServiceName,
|
|
|
|
(LPWSTR)lpDisplayName,
|
|
|
|
dwDesiredAccess,
|
|
|
|
dwServiceType,
|
|
|
|
dwStartType,
|
|
|
|
dwErrorControl,
|
|
|
|
(LPWSTR)lpBinaryPathName,
|
|
|
|
(LPWSTR)lpLoadOrderGroup,
|
|
|
|
lpdwTagId,
|
2005-10-23 19:50:05 +00:00
|
|
|
(LPWSTR)lpDependencies,
|
2005-10-15 19:34:53 +00:00
|
|
|
dwDependenciesLength,
|
2005-10-09 20:24:00 +00:00
|
|
|
(LPWSTR)lpServiceStartName,
|
|
|
|
NULL, /* FIXME: lpPassword */
|
|
|
|
0, /* FIXME: dwPasswordLength */
|
|
|
|
(unsigned int *)&hService);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hService;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* DeleteService
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-16 12:50:33 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-15 22:02:37 +00:00
|
|
|
BOOL STDCALL
|
2002-12-26 17:23:27 +00:00
|
|
|
DeleteService(SC_HANDLE hService)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-15 22:02:37 +00:00
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT("DeleteService(%x)\n", hService);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrDeleteService(BindingHandle,
|
|
|
|
(unsigned int)hService);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError);
|
2005-04-15 22:02:37 +00:00
|
|
|
SetLastError(dwError);
|
2004-04-12 17:20:47 +00:00
|
|
|
return FALSE;
|
2005-04-15 22:02:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumDependentServicesA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumDependentServicesA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSA lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumDependentServicesA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumDependentServicesW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumDependentServicesW(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSW lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumDependentServicesW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumServiceGroupW
|
1999-07-22 21:36:37 +00:00
|
|
|
*
|
2003-07-10 15:05:55 +00:00
|
|
|
* @unimplemented
|
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 (
|
2002-12-27 14:40:03 +00:00
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3,
|
|
|
|
DWORD Unknown4,
|
|
|
|
DWORD Unknown5,
|
|
|
|
DWORD Unknown6,
|
|
|
|
DWORD Unknown7,
|
|
|
|
DWORD Unknown8)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumServiceGroupW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumServicesStatusA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
1999-07-26 20:46:40 +00:00
|
|
|
EnumServicesStatusA (
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSA lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
|
|
|
LPDWORD lpResumeHandle)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumServicesStatusA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumServicesStatusExA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
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
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumServicesStatusExA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumServicesStatusExW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
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
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumServicesStatusExW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* EnumServicesStatusW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
EnumServicesStatusW(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
DWORD dwServiceType,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSW lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned,
|
|
|
|
LPDWORD lpResumeHandle)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("EnumServicesStatusW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* GetServiceDisplayNameA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceDisplayNameA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpServiceName,
|
|
|
|
LPSTR lpDisplayName,
|
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("GetServiceDisplayNameA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* GetServiceDisplayNameW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-10-30 13:13:53 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-10-30 13:13:53 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpServiceName,
|
|
|
|
LPWSTR lpDisplayName,
|
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-10-30 13:13:53 +00:00
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
DPRINT("GetServiceDisplayNameW() called\n");
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
dwError = ScmrGetServiceDisplayNameW(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(LPWSTR)lpServiceName,
|
|
|
|
lpDisplayName,
|
|
|
|
lpcchBuffer);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrGetServiceDisplayNameW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* GetServiceKeyNameA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
GetServiceKeyNameA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPCSTR lpDisplayName,
|
|
|
|
LPSTR lpServiceName,
|
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("GetServiceKeyNameA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* GetServiceKeyNameW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-10-30 13:13:53 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
GetServiceKeyNameW(SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpDisplayName,
|
|
|
|
LPWSTR lpServiceName,
|
|
|
|
LPDWORD lpcchBuffer)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-10-30 13:13:53 +00:00
|
|
|
#if 0
|
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
DPRINT("GetServiceKeyNameW() called\n");
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
dwError = ScmrGetServiceKeyNameW(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(LPWSTR)lpDisplayName,
|
|
|
|
lpServiceName,
|
|
|
|
lpcchBuffer);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrGetServiceKeyNameW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
#endif
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("GetServiceKeyNameW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* LockServiceDatabase
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-16 12:50:33 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-16 12:50:33 +00:00
|
|
|
SC_LOCK STDCALL
|
2005-04-15 22:02:37 +00:00
|
|
|
LockServiceDatabase(SC_HANDLE hSCManager)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-16 12:50:33 +00:00
|
|
|
SC_LOCK hLock;
|
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
DPRINT("LockServiceDatabase(%x)\n", hSCManager);
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrLockServiceDatabase(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(unsigned int *)&hLock);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
|
2005-04-16 12:50:33 +00:00
|
|
|
SetLastError(dwError);
|
2002-12-27 14:40:03 +00:00
|
|
|
return NULL;
|
2005-04-16 12:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DPRINT("hLock = %p\n", hLock);
|
|
|
|
|
|
|
|
return hLock;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
static VOID
|
|
|
|
WaitForSCManager(VOID)
|
|
|
|
{
|
|
|
|
HANDLE hEvent;
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("WaitForSCManager() called\n");
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
/* Try to open the existing event */
|
|
|
|
hEvent = OpenEventW(SYNCHRONIZE,
|
|
|
|
FALSE,
|
|
|
|
L"SvcctrlStartEvent_A3725DX");
|
|
|
|
if (hEvent == NULL)
|
|
|
|
{
|
|
|
|
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Try to create a new event */
|
|
|
|
hEvent = CreateEventW(NULL,
|
|
|
|
TRUE,
|
|
|
|
FALSE,
|
|
|
|
L"SvcctrlStartEvent_A3725DX");
|
|
|
|
if (hEvent == NULL)
|
|
|
|
{
|
|
|
|
/* Try to open the existing event again */
|
|
|
|
hEvent = OpenEventW(SYNCHRONIZE,
|
|
|
|
FALSE,
|
|
|
|
L"SvcctrlStartEvent_A3725DX");
|
|
|
|
if (hEvent == NULL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wait for 3 minutes */
|
|
|
|
WaitForSingleObject(hEvent, 180000);
|
|
|
|
CloseHandle(hEvent);
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("ScmWaitForSCManager() done\n");
|
2005-04-15 22:02:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-07 08:03:28 +00:00
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* OpenSCManagerA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-15 22:02:37 +00:00
|
|
|
* @implemented
|
1999-11-07 08:03:28 +00:00
|
|
|
*/
|
2002-07-20 13:31:34 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenSCManagerA(LPCSTR lpMachineName,
|
2005-04-15 22:02:37 +00:00
|
|
|
LPCSTR lpDatabaseName,
|
|
|
|
DWORD dwDesiredAccess)
|
2000-03-26 22:00:10 +00:00
|
|
|
{
|
2005-04-15 22:02:37 +00:00
|
|
|
SC_HANDLE hScm = NULL;
|
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("OpenSCManagerA(%s, %s, %lx)\n",
|
2005-04-15 22:02:37 +00:00
|
|
|
lpMachineName, lpDatabaseName, dwDesiredAccess);
|
2002-07-20 13:31:34 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
WaitForSCManager();
|
2002-12-27 14:40:03 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
HandleBind();
|
2002-07-20 13:31:34 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrOpenSCManagerA(BindingHandle,
|
|
|
|
(LPSTR)lpMachineName,
|
|
|
|
(LPSTR)lpDatabaseName,
|
|
|
|
dwDesiredAccess,
|
|
|
|
(unsigned int*)&hScm);
|
2005-04-17 19:56:50 +00:00
|
|
|
if (dwError != ERROR_SUCCESS)
|
2005-04-15 22:02:37 +00:00
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
|
2005-04-15 22:02:37 +00:00
|
|
|
SetLastError(dwError);
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-07-20 13:31:34 +00:00
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("hScm = %p\n", hScm);
|
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
return hScm;
|
1999-11-07 08:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* OpenSCManagerW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-16 12:50:33 +00:00
|
|
|
* @implemented
|
1999-11-07 08:03:28 +00:00
|
|
|
*/
|
2005-04-15 22:02:37 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenSCManagerW(LPCWSTR lpMachineName,
|
|
|
|
LPCWSTR lpDatabaseName,
|
|
|
|
DWORD dwDesiredAccess)
|
|
|
|
{
|
|
|
|
SC_HANDLE hScm = NULL;
|
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("OpenSCManagerW(%S, %S, %lx)\n",
|
2005-04-15 22:02:37 +00:00
|
|
|
lpMachineName, lpDatabaseName, dwDesiredAccess);
|
|
|
|
|
|
|
|
WaitForSCManager();
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrOpenSCManagerW(BindingHandle,
|
|
|
|
(LPWSTR)lpMachineName,
|
|
|
|
(LPWSTR)lpDatabaseName,
|
|
|
|
dwDesiredAccess,
|
|
|
|
(unsigned int*)&hScm);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-08-07 04:03:25 +00:00
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("hScm = %p\n", hScm);
|
2002-12-27 14:40:03 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
return hScm;
|
1999-11-07 08:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* OpenServiceA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-15 22:02:37 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2004-04-12 17:20:47 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenServiceA(SC_HANDLE hSCManager,
|
2005-04-16 12:50:33 +00:00
|
|
|
LPCSTR lpServiceName,
|
|
|
|
DWORD dwDesiredAccess)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-15 22:02:37 +00:00
|
|
|
SC_HANDLE hService = NULL;
|
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("OpenServiceA(%p, %s, %lx)\n",
|
|
|
|
hSCManager, lpServiceName, dwDesiredAccess);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrOpenServiceA(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(LPSTR)lpServiceName,
|
|
|
|
dwDesiredAccess,
|
|
|
|
(unsigned int*)&hService);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("hService = %p\n", hService);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
return hService;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* OpenServiceW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-15 22:02:37 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-15 22:02:37 +00:00
|
|
|
SC_HANDLE STDCALL
|
|
|
|
OpenServiceW(SC_HANDLE hSCManager,
|
|
|
|
LPCWSTR lpServiceName,
|
|
|
|
DWORD dwDesiredAccess)
|
|
|
|
{
|
|
|
|
SC_HANDLE hService = NULL;
|
|
|
|
DWORD dwError;
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("OpenServiceW(%p, %S, %lx)\n",
|
|
|
|
hSCManager, lpServiceName, dwDesiredAccess);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrOpenServiceW(BindingHandle,
|
|
|
|
(unsigned int)hSCManager,
|
|
|
|
(LPWSTR)lpServiceName,
|
|
|
|
dwDesiredAccess,
|
|
|
|
(unsigned int*)&hService);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-04-16 12:50:33 +00:00
|
|
|
DPRINT("hService = %p\n", hService);
|
2005-04-15 22:02:37 +00:00
|
|
|
|
|
|
|
return hService;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceConfigA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceConfigA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
LPQUERY_SERVICE_CONFIGA lpServiceConfig,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceConfigA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceConfigW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceConfigW(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
LPQUERY_SERVICE_CONFIGW lpServiceConfig,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceConfigW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceLockStatusA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceLockStatusA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceLockStatusA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceLockStatusW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceLockStatusW(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hSCManager,
|
|
|
|
LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceLockStatusW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceObjectSecurity
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
QueryServiceObjectSecurity(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
SECURITY_INFORMATION dwSecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR lpSecurityDescriptor,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceObjectSecurity is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceStatus
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-23 00:01:37 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-23 00:01:37 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
QueryServiceStatus(SC_HANDLE hService,
|
|
|
|
LPSERVICE_STATUS lpServiceStatus)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-23 00:01:37 +00:00
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
DPRINT("QueryServiceStatus(%p, %p)\n",
|
|
|
|
hService, lpServiceStatus);
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrQueryServiceStatus(BindingHandle,
|
|
|
|
(unsigned int)hService,
|
|
|
|
lpServiceStatus);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
2002-12-27 14:40:03 +00:00
|
|
|
return FALSE;
|
2005-04-23 00:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* QueryServiceStatusEx
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
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
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("QueryServiceStatusEx is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* StartServiceA
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
StartServiceA(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwNumServiceArgs,
|
|
|
|
LPCSTR *lpServiceArgVectors)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("StartServiceA is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* StartServiceW
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
STDCALL
|
|
|
|
StartServiceW(
|
2002-12-27 14:40:03 +00:00
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwNumServiceArgs,
|
|
|
|
LPCWSTR *lpServiceArgVectors)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2004-09-26 20:28:22 +00:00
|
|
|
DPRINT1("StartServiceW is unimplemented\n");
|
2002-12-27 14:40:03 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2002-12-27 14:40:03 +00:00
|
|
|
* UnlockServiceDatabase
|
2003-07-10 15:05:55 +00:00
|
|
|
*
|
2005-04-16 12:50:33 +00:00
|
|
|
* @implemented
|
1999-05-19 16:43:30 +00:00
|
|
|
*/
|
2005-04-16 12:50:33 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
UnlockServiceDatabase(SC_LOCK ScLock)
|
1999-05-19 16:43:30 +00:00
|
|
|
{
|
2005-04-16 12:50:33 +00:00
|
|
|
DWORD dwError;
|
|
|
|
|
2005-10-15 19:34:53 +00:00
|
|
|
DPRINT("UnlockServiceDatabase(%x)\n", ScLock);
|
2005-04-16 12:50:33 +00:00
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrUnlockServiceDatabase(BindingHandle,
|
|
|
|
(unsigned int)ScLock);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
2005-04-17 19:56:50 +00:00
|
|
|
DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError);
|
2005-04-16 12:50:33 +00:00
|
|
|
SetLastError(dwError);
|
2002-12-27 14:40:03 +00:00
|
|
|
return FALSE;
|
2005-04-16 12:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-05-19 16:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-15 19:34:53 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* NotifyBootConfigStatus
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
NotifyBootConfigStatus(BOOL BootAcceptable)
|
|
|
|
{
|
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
DPRINT1("NotifyBootConfigStatus()\n");
|
|
|
|
|
|
|
|
HandleBind();
|
|
|
|
|
|
|
|
/* Call to services.exe using RPC */
|
|
|
|
dwError = ScmrNotifyBootConfigStatus(BindingHandle,
|
|
|
|
BootAcceptable);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("NotifyBootConfigStatus() failed (Error %lu)\n", dwError);
|
|
|
|
SetLastError(dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
|
|
|
|
{
|
2005-05-05 13:24:39 +00:00
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
2005-04-15 22:02:37 +00:00
|
|
|
}
|
|
|
|
|
2005-10-15 19:34:53 +00:00
|
|
|
|
2005-04-15 22:02:37 +00:00
|
|
|
void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
|
|
|
|
{
|
2005-05-05 13:24:39 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
2005-04-15 22:02:37 +00:00
|
|
|
}
|
|
|
|
|
1999-05-19 16:43:30 +00:00
|
|
|
/* EOF */
|