mirror of
https://github.com/reactos/reactos.git
synced 2024-09-08 19:59:49 +00:00
SEH-protect all calls to remote functions.
Based on patches from Bug #3669 by bugboy <martinmnet@hotmail.com>. svn path=/trunk/; revision=35605
This commit is contained in:
parent
413b6d969f
commit
866b97d444
|
@ -78,6 +78,26 @@ HandleUnbind(VOID)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static DWORD
|
||||||
|
ScmRpcStatusToWinError(RPC_STATUS Status)
|
||||||
|
{
|
||||||
|
switch (Status)
|
||||||
|
{
|
||||||
|
case RPC_X_SS_IN_NULL_CONTEXT:
|
||||||
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
case RPC_X_NULL_REF_POINTER:
|
||||||
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
case STATUS_ACCESS_VIOLATION:
|
||||||
|
return ERROR_INVALID_ADDRESS;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return (DWORD)Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* ChangeServiceConfig2A
|
* ChangeServiceConfig2A
|
||||||
*
|
*
|
||||||
|
@ -116,9 +136,18 @@ ChangeServiceConfig2A(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RChangeServiceConfig2A(BindingHandle,
|
dwError = RChangeServiceConfig2A(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
Info);
|
Info);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RChangeServiceConfig2A() failed (Error %lu)\n", dwError);
|
ERR("RChangeServiceConfig2A() failed (Error %lu)\n", dwError);
|
||||||
|
@ -170,9 +199,18 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RChangeServiceConfig2W(BindingHandle,
|
dwError = RChangeServiceConfig2W(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
Info);
|
Info);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RChangeServiceConfig2W() failed (Error %lu)\n", dwError);
|
ERR("RChangeServiceConfig2W() failed (Error %lu)\n", dwError);
|
||||||
|
@ -226,6 +264,8 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RChangeServiceConfigA(BindingHandle,
|
dwError = RChangeServiceConfigA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -241,6 +281,13 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
NULL, /* FIXME: lpPassword */
|
NULL, /* FIXME: lpPassword */
|
||||||
0, /* FIXME: dwPasswordLength */
|
0, /* FIXME: dwPasswordLength */
|
||||||
(LPSTR)lpDisplayName);
|
(LPSTR)lpDisplayName);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RChangeServiceConfigA() failed (Error %lu)\n", dwError);
|
ERR("RChangeServiceConfigA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -294,6 +341,8 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RChangeServiceConfigW(BindingHandle,
|
dwError = RChangeServiceConfigW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -309,6 +358,13 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
NULL, /* FIXME: lpPassword */
|
NULL, /* FIXME: lpPassword */
|
||||||
0, /* FIXME: dwPasswordLength */
|
0, /* FIXME: dwPasswordLength */
|
||||||
(LPWSTR)lpDisplayName);
|
(LPWSTR)lpDisplayName);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RChangeServiceConfigW() failed (Error %lu)\n", dwError);
|
ERR("RChangeServiceConfigW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -334,9 +390,18 @@ CloseServiceHandle(SC_HANDLE hSCObject)
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RCloseServiceHandle(BindingHandle,
|
dwError = RCloseServiceHandle(BindingHandle,
|
||||||
(LPSC_RPC_HANDLE)&hSCObject);
|
(LPSC_RPC_HANDLE)&hSCObject);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError)
|
if (dwError)
|
||||||
{
|
{
|
||||||
ERR("RCloseServiceHandle() failed (Error %lu)\n", dwError);
|
ERR("RCloseServiceHandle() failed (Error %lu)\n", dwError);
|
||||||
|
@ -367,11 +432,20 @@ ControlService(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RControlService(BindingHandle,
|
dwError = RControlService(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwControl,
|
dwControl,
|
||||||
lpServiceStatus);
|
lpServiceStatus);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RControlService() failed (Error %lu)\n", dwError);
|
ERR("RControlService() failed (Error %lu)\n", dwError);
|
||||||
|
@ -403,7 +477,6 @@ ControlServiceEx(IN SC_HANDLE hService,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CreateServiceA
|
* CreateServiceA
|
||||||
*
|
*
|
||||||
|
@ -616,6 +689,8 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RCreateServiceW(BindingHandle,
|
dwError = RCreateServiceW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
|
@ -634,6 +709,13 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
NULL, /* FIXME: lpPassword */
|
NULL, /* FIXME: lpPassword */
|
||||||
0, /* FIXME: dwPasswordLength */
|
0, /* FIXME: dwPasswordLength */
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RCreateServiceW() failed (Error %lu)\n", dwError);
|
ERR("RCreateServiceW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -659,9 +741,18 @@ DeleteService(SC_HANDLE hService)
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RDeleteService(BindingHandle,
|
dwError = RDeleteService(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService);
|
(SC_RPC_HANDLE)hService);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RDeleteService() failed (Error %lu)\n", dwError);
|
ERR("RDeleteService() failed (Error %lu)\n", dwError);
|
||||||
|
@ -687,13 +778,15 @@ EnumDependentServicesA(SC_HANDLE hService,
|
||||||
LPDWORD lpServicesReturned)
|
LPDWORD lpServicesReturned)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUSA lpStatusPtr;
|
LPENUM_SERVICE_STATUSA lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusA() called\n");
|
TRACE("EnumServicesStatusA() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumDependentServicesA(BindingHandle,
|
dwError = REnumDependentServicesA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwServiceState,
|
dwServiceState,
|
||||||
|
@ -701,6 +794,12 @@ EnumDependentServicesA(SC_HANDLE hService,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded,
|
pcbBytesNeeded,
|
||||||
lpServicesReturned);
|
lpServicesReturned);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||||
|
@ -743,13 +842,15 @@ EnumDependentServicesW(SC_HANDLE hService,
|
||||||
LPDWORD lpServicesReturned)
|
LPDWORD lpServicesReturned)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUSW lpStatusPtr;
|
LPENUM_SERVICE_STATUSW lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusW() called\n");
|
TRACE("EnumServicesStatusW() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumDependentServicesW(BindingHandle,
|
dwError = REnumDependentServicesW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwServiceState,
|
dwServiceState,
|
||||||
|
@ -757,6 +858,12 @@ EnumDependentServicesW(SC_HANDLE hService,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded,
|
pcbBytesNeeded,
|
||||||
lpServicesReturned);
|
lpServicesReturned);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||||
|
@ -825,13 +932,15 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
||||||
LPDWORD lpResumeHandle)
|
LPDWORD lpResumeHandle)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUSA lpStatusPtr;
|
LPENUM_SERVICE_STATUSA lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusA() called\n");
|
TRACE("EnumServicesStatusA() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumServicesStatusA(BindingHandle,
|
dwError = REnumServicesStatusA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
dwServiceType,
|
dwServiceType,
|
||||||
|
@ -841,6 +950,12 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
||||||
pcbBytesNeeded,
|
pcbBytesNeeded,
|
||||||
lpServicesReturned,
|
lpServicesReturned,
|
||||||
lpResumeHandle);
|
lpResumeHandle);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||||
|
@ -885,13 +1000,15 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
||||||
LPDWORD lpResumeHandle)
|
LPDWORD lpResumeHandle)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUSW lpStatusPtr;
|
LPENUM_SERVICE_STATUSW lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusW() called\n");
|
TRACE("EnumServicesStatusW() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumServicesStatusW(BindingHandle,
|
dwError = REnumServicesStatusW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
dwServiceType,
|
dwServiceType,
|
||||||
|
@ -901,6 +1018,12 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
||||||
pcbBytesNeeded,
|
pcbBytesNeeded,
|
||||||
lpServicesReturned,
|
lpServicesReturned,
|
||||||
lpResumeHandle);
|
lpResumeHandle);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||||
|
@ -947,13 +1070,15 @@ EnumServicesStatusExA(SC_HANDLE hSCManager,
|
||||||
LPCSTR pszGroupName)
|
LPCSTR pszGroupName)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUS_PROCESSA lpStatusPtr;
|
LPENUM_SERVICE_STATUS_PROCESSA lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusExA() called\n");
|
TRACE("EnumServicesStatusExA() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumServicesStatusExA(BindingHandle,
|
dwError = REnumServicesStatusExA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
InfoLevel,
|
InfoLevel,
|
||||||
|
@ -965,6 +1090,12 @@ EnumServicesStatusExA(SC_HANDLE hSCManager,
|
||||||
lpServicesReturned,
|
lpServicesReturned,
|
||||||
lpResumeHandle,
|
lpResumeHandle,
|
||||||
(LPSTR)pszGroupName);
|
(LPSTR)pszGroupName);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError == ERROR_MORE_DATA)
|
if (dwError == ERROR_MORE_DATA)
|
||||||
{
|
{
|
||||||
|
@ -1019,13 +1150,15 @@ EnumServicesStatusExW(SC_HANDLE hSCManager,
|
||||||
LPCWSTR pszGroupName)
|
LPCWSTR pszGroupName)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUS_PROCESSW lpStatusPtr;
|
LPENUM_SERVICE_STATUS_PROCESSW lpStatusPtr;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError;
|
||||||
DWORD dwCount;
|
DWORD dwCount;
|
||||||
|
|
||||||
TRACE("EnumServicesStatusExW() called\n");
|
TRACE("EnumServicesStatusExW() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = REnumServicesStatusExW(BindingHandle,
|
dwError = REnumServicesStatusExW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
InfoLevel,
|
InfoLevel,
|
||||||
|
@ -1037,6 +1170,12 @@ EnumServicesStatusExW(SC_HANDLE hSCManager,
|
||||||
lpServicesReturned,
|
lpServicesReturned,
|
||||||
lpResumeHandle,
|
lpResumeHandle,
|
||||||
(LPWSTR)pszGroupName);
|
(LPWSTR)pszGroupName);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError == ERROR_MORE_DATA)
|
if (dwError == ERROR_MORE_DATA)
|
||||||
{
|
{
|
||||||
|
@ -1090,11 +1229,23 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RGetServiceDisplayNameA(BindingHandle,
|
dwError = RGetServiceDisplayNameA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPSTR)lpServiceName,
|
(LPSTR)lpServiceName,
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
/* HACK: because of a problem with rpcrt4, rpcserver is hacked to return 6 for ERROR_SERVICE_DOES_NOT_EXIST */
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RGetServiceDisplayNameA() failed (Error %lu)\n", dwError);
|
ERR("RGetServiceDisplayNameA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1125,11 +1276,20 @@ GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RGetServiceDisplayNameW(BindingHandle,
|
dwError = RGetServiceDisplayNameW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpServiceName,
|
(LPWSTR)lpServiceName,
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RGetServiceDisplayNameW() failed (Error %lu)\n", dwError);
|
ERR("RGetServiceDisplayNameW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1160,11 +1320,20 @@ GetServiceKeyNameA(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RGetServiceKeyNameA(BindingHandle,
|
dwError = RGetServiceKeyNameA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPSTR)lpDisplayName,
|
(LPSTR)lpDisplayName,
|
||||||
lpServiceName,
|
lpServiceName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RGetServiceKeyNameA() failed (Error %lu)\n", dwError);
|
ERR("RGetServiceKeyNameA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1195,11 +1364,20 @@ GetServiceKeyNameW(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RGetServiceKeyNameW(BindingHandle,
|
dwError = RGetServiceKeyNameW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpDisplayName,
|
(LPWSTR)lpDisplayName,
|
||||||
lpServiceName,
|
lpServiceName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RGetServiceKeyNameW() failed (Error %lu)\n", dwError);
|
ERR("RGetServiceKeyNameW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1228,10 +1406,19 @@ LockServiceDatabase(SC_HANDLE hSCManager)
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RLockServiceDatabase(BindingHandle,
|
dwError = RLockServiceDatabase(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(SC_RPC_LOCK *)&hLock);
|
(SC_RPC_LOCK *)&hLock);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RLockServiceDatabase() failed (Error %lu)\n", dwError);
|
ERR("RLockServiceDatabase() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1305,12 +1492,21 @@ OpenSCManagerA(LPCSTR lpMachineName,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = ROpenSCManagerA(BindingHandle,
|
dwError = ROpenSCManagerA(BindingHandle,
|
||||||
(LPSTR)lpMachineName,
|
(LPSTR)lpMachineName,
|
||||||
(LPSTR)lpDatabaseName,
|
(LPSTR)lpDatabaseName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
(SC_RPC_HANDLE *)&hScm);
|
(SC_RPC_HANDLE *)&hScm);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("ROpenSCManagerA() failed (Error %lu)\n", dwError);
|
ERR("ROpenSCManagerA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1344,12 +1540,21 @@ OpenSCManagerW(LPCWSTR lpMachineName,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = ROpenSCManagerW(BindingHandle,
|
dwError = ROpenSCManagerW(BindingHandle,
|
||||||
(LPWSTR)lpMachineName,
|
(LPWSTR)lpMachineName,
|
||||||
(LPWSTR)lpDatabaseName,
|
(LPWSTR)lpDatabaseName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
(SC_RPC_HANDLE *)&hScm);
|
(SC_RPC_HANDLE *)&hScm);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("ROpenSCManagerW() failed (Error %lu)\n", dwError);
|
ERR("ROpenSCManagerW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1381,12 +1586,21 @@ OpenServiceA(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = ROpenServiceA(BindingHandle,
|
dwError = ROpenServiceA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPSTR)lpServiceName,
|
(LPSTR)lpServiceName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("ROpenServiceA() failed (Error %lu)\n", dwError);
|
ERR("ROpenServiceA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1418,12 +1632,21 @@ OpenServiceW(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = ROpenServiceW(BindingHandle,
|
dwError = ROpenServiceW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpServiceName,
|
(LPWSTR)lpServiceName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (dwError == ERROR_SERVICE_DOES_NOT_EXIST)
|
if (dwError == ERROR_SERVICE_DOES_NOT_EXIST)
|
||||||
|
@ -1458,12 +1681,21 @@ QueryServiceConfigA(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceConfigA(BindingHandle,
|
dwError = RQueryServiceConfigA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
(LPBYTE)lpServiceConfig,
|
(LPBYTE)lpServiceConfig,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceConfigA() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceConfigA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1521,12 +1753,21 @@ QueryServiceConfigW(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceConfigW(BindingHandle,
|
dwError = RQueryServiceConfigW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
(LPBYTE)lpServiceConfig,
|
(LPBYTE)lpServiceConfig,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (dwError == ERROR_INSUFFICIENT_BUFFER)
|
if (dwError == ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
@ -1588,6 +1829,8 @@ QueryServiceConfig2A(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceConfig2A(BindingHandle,
|
dwError = RQueryServiceConfig2A(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -1595,6 +1838,13 @@ QueryServiceConfig2A(SC_HANDLE hService,
|
||||||
lpBuffer,
|
lpBuffer,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceConfig2A() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceConfig2A() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1663,6 +1913,8 @@ QueryServiceConfig2W(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceConfig2W(BindingHandle,
|
dwError = RQueryServiceConfig2W(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -1670,6 +1922,13 @@ QueryServiceConfig2W(SC_HANDLE hService,
|
||||||
lpBuffer,
|
lpBuffer,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceConfig2W() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceConfig2W() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1736,12 +1995,21 @@ QueryServiceLockStatusA(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceLockStatusA(BindingHandle,
|
dwError = RQueryServiceLockStatusA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
lpLockStatus,
|
lpLockStatus,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceLockStatusA() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceLockStatusA() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1778,12 +2046,21 @@ QueryServiceLockStatusW(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceLockStatusW(BindingHandle,
|
dwError = RQueryServiceLockStatusW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hSCManager,
|
(SC_RPC_HANDLE)hSCManager,
|
||||||
lpLockStatus,
|
lpLockStatus,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceLockStatusW() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceLockStatusW() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1822,6 +2099,8 @@ QueryServiceObjectSecurity(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceObjectSecurity(BindingHandle,
|
dwError = RQueryServiceObjectSecurity(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -1829,6 +2108,13 @@ QueryServiceObjectSecurity(SC_HANDLE hService,
|
||||||
(LPBYTE)lpSecurityDescriptor,
|
(LPBYTE)lpSecurityDescriptor,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("QueryServiceObjectSecurity() failed (Error %lu)\n", dwError);
|
ERR("QueryServiceObjectSecurity() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1883,12 +2169,20 @@ SetServiceObjectSecurity(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RSetServiceObjectSecurity(BindingHandle,
|
dwError = RSetServiceObjectSecurity(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwSecurityInformation,
|
dwSecurityInformation,
|
||||||
(LPBYTE)SelfRelativeSD,
|
(LPBYTE)SelfRelativeSD,
|
||||||
Length);
|
Length);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
|
HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
|
||||||
|
|
||||||
|
@ -1919,10 +2213,19 @@ QueryServiceStatus(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceStatus(BindingHandle,
|
dwError = RQueryServiceStatus(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
lpServiceStatus);
|
lpServiceStatus);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceStatus() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceStatus() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1952,6 +2255,8 @@ QueryServiceStatusEx(SC_HANDLE hService,
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RQueryServiceStatusEx(BindingHandle,
|
dwError = RQueryServiceStatusEx(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
|
@ -1959,6 +2264,13 @@ QueryServiceStatusEx(SC_HANDLE hService,
|
||||||
lpBuffer,
|
lpBuffer,
|
||||||
cbBufSize,
|
cbBufSize,
|
||||||
pcbBytesNeeded);
|
pcbBytesNeeded);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RQueryServiceStatusEx() failed (Error %lu)\n", dwError);
|
ERR("RQueryServiceStatusEx() failed (Error %lu)\n", dwError);
|
||||||
|
@ -1982,11 +2294,18 @@ StartServiceA(SC_HANDLE hService,
|
||||||
{
|
{
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RStartServiceA(BindingHandle,
|
dwError = RStartServiceA(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwNumServiceArgs,
|
dwNumServiceArgs,
|
||||||
(LPSTRING_PTRSA)lpServiceArgVectors);
|
(LPSTRING_PTRSA)lpServiceArgVectors);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -2011,10 +2330,18 @@ StartServiceW(SC_HANDLE hService,
|
||||||
{
|
{
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
dwError = RStartServiceW(BindingHandle,
|
dwError = RStartServiceW(BindingHandle,
|
||||||
(SC_RPC_HANDLE)hService,
|
(SC_RPC_HANDLE)hService,
|
||||||
dwNumServiceArgs,
|
dwNumServiceArgs,
|
||||||
(LPSTRING_PTRSW)lpServiceArgVectors);
|
(LPSTRING_PTRSW)lpServiceArgVectors);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -2041,9 +2368,18 @@ UnlockServiceDatabase(SC_LOCK ScLock)
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RUnlockServiceDatabase(BindingHandle,
|
dwError = RUnlockServiceDatabase(BindingHandle,
|
||||||
(SC_RPC_LOCK)ScLock);
|
(SC_RPC_LOCK)ScLock);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("RUnlockServiceDatabase() failed (Error %lu)\n", dwError);
|
ERR("RUnlockServiceDatabase() failed (Error %lu)\n", dwError);
|
||||||
|
@ -2069,10 +2405,19 @@ NotifyBootConfigStatus(BOOL BootAcceptable)
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RNotifyBootConfigStatus(BindingHandle,
|
dwError = RNotifyBootConfigStatus(BindingHandle,
|
||||||
NULL,
|
NULL,
|
||||||
BootAcceptable);
|
BootAcceptable);
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("NotifyBootConfigStatus() failed (Error %lu)\n", dwError);
|
ERR("NotifyBootConfigStatus() failed (Error %lu)\n", dwError);
|
||||||
|
|
Loading…
Reference in a new issue