mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:01:48 +00:00
Service Manager:
- Fix declaration of SERVICE_STATUS_HANDLE in the PSDK. - Add a new custom binding handle to svcctl.idl as an alias of SERVICE_STATUS_HANDLE. - Enable all custom binding handles in svcctl.idl and fix services.exe and advapi32.dll accordingly. svn path=/trunk/; revision=36985
This commit is contained in:
parent
d1c6a82adb
commit
c22ad7e659
5 changed files with 207 additions and 40 deletions
|
@ -1004,8 +1004,8 @@ ScmIsValidServiceState(DWORD dwCurrentState)
|
|||
|
||||
/* Function 7 */
|
||||
DWORD RSetServiceStatus(
|
||||
handle_t BindingHandle,
|
||||
SC_RPC_HANDLE hServiceStatus,
|
||||
// handle_t BindingHandle,
|
||||
RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
LPSERVICE_STATUS lpServiceStatus)
|
||||
{
|
||||
PSERVICE lpService;
|
||||
|
@ -1026,7 +1026,7 @@ DWORD RSetServiceStatus(
|
|||
return ERROR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
lpService = ScmGetServiceEntryByClientHandle((ULONG)hServiceStatus);
|
||||
lpService = ScmGetServiceEntryByClientHandle(hServiceStatus);
|
||||
if (lpService == NULL)
|
||||
{
|
||||
DPRINT1("lpService == NULL!\n");
|
||||
|
@ -1091,8 +1091,8 @@ DWORD RNotifyBootConfigStatus(
|
|||
|
||||
/* Function 10 */
|
||||
DWORD RI_ScSetServiceBitsW(
|
||||
handle_t BindingHandle,
|
||||
SC_RPC_HANDLE hServiceStatus,
|
||||
// handle_t BindingHandle,
|
||||
RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
DWORD dwServiceBits,
|
||||
int bSetBitsOn,
|
||||
int bUpdateImmediately,
|
||||
|
@ -2388,7 +2388,7 @@ Done:;
|
|||
|
||||
/* Function 15 */
|
||||
DWORD ROpenSCManagerW(
|
||||
handle_t BindingHandle,
|
||||
// handle_t BindingHandle,
|
||||
LPWSTR lpMachineName,
|
||||
LPWSTR lpDatabaseName,
|
||||
DWORD dwDesiredAccess,
|
||||
|
@ -2893,8 +2893,8 @@ DWORD RGetServiceKeyNameW(
|
|||
|
||||
/* Function 22 */
|
||||
DWORD RI_ScSetServiceBitsA(
|
||||
handle_t BindingHandle,
|
||||
SC_RPC_HANDLE hServiceStatus,
|
||||
// handle_t BindingHandle,
|
||||
RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
DWORD dwServiceBits,
|
||||
int bSetBitsOn,
|
||||
int bUpdateImmediately,
|
||||
|
@ -3462,7 +3462,7 @@ Done:;
|
|||
|
||||
/* Function 27 */
|
||||
DWORD ROpenSCManagerA(
|
||||
handle_t BindingHandle,
|
||||
// handle_t BindingHandle,
|
||||
LPSTR lpMachineName,
|
||||
LPSTR lpDatabaseName,
|
||||
DWORD dwDesiredAccess,
|
||||
|
@ -3482,7 +3482,7 @@ DWORD ROpenSCManagerA(
|
|||
RtlCreateUnicodeStringFromAsciiz(&DatabaseName,
|
||||
lpDatabaseName);
|
||||
|
||||
dwError = ROpenSCManagerW(BindingHandle,
|
||||
dwError = ROpenSCManagerW(//BindingHandle,
|
||||
lpMachineName ? MachineName.Buffer : NULL,
|
||||
lpDatabaseName ? DatabaseName.Buffer : NULL,
|
||||
dwDesiredAccess,
|
||||
|
|
|
@ -77,6 +77,172 @@ HandleUnbind(VOID)
|
|||
}
|
||||
#endif
|
||||
|
||||
handle_t __RPC_USER
|
||||
SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName)
|
||||
{
|
||||
handle_t hBinding = NULL;
|
||||
UCHAR *pszStringBinding;
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("SVCCTL_HANDLEA_bind() called\n");
|
||||
|
||||
status = RpcStringBindingComposeA((UCHAR *)szMachineName,
|
||||
(UCHAR *)"ncacn_np",
|
||||
NULL,
|
||||
(UCHAR *)"\\pipe\\ntsvcs",
|
||||
NULL,
|
||||
(UCHAR **)&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the binding handle that will be used to bind to the server. */
|
||||
status = RpcBindingFromStringBindingA(pszStringBinding,
|
||||
&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
status = RpcStringFreeA(&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringFree returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
return hBinding;
|
||||
}
|
||||
|
||||
|
||||
void __RPC_USER
|
||||
SVCCTL_HANDLEA_unbind(SVCCTL_HANDLEA szMachineName,
|
||||
handle_t hBinding)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("SVCCTL_HANDLEA_unbind() called\n");
|
||||
|
||||
status = RpcBindingFree(&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handle_t __RPC_USER
|
||||
SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName)
|
||||
{
|
||||
handle_t hBinding = NULL;
|
||||
LPWSTR pszStringBinding;
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("SVCCTL_HANDLEW_bind() called\n");
|
||||
|
||||
|
||||
status = RpcStringBindingComposeW(szMachineName,
|
||||
L"ncacn_np",
|
||||
NULL,
|
||||
L"\\pipe\\ntsvcs",
|
||||
NULL,
|
||||
&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the binding handle that will be used to bind to the server. */
|
||||
status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||
&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
status = RpcStringFreeW(&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringFree returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
return hBinding;
|
||||
}
|
||||
|
||||
|
||||
void __RPC_USER
|
||||
SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName,
|
||||
handle_t hBinding)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("SVCCTL_HANDLEW_unbind() called\n");
|
||||
|
||||
status = RpcBindingFree(&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handle_t __RPC_USER
|
||||
RPC_SERVICE_STATUS_HANDLE_bind(RPC_SERVICE_STATUS_HANDLE hServiceStatus)
|
||||
{
|
||||
handle_t hBinding = NULL;
|
||||
LPWSTR pszStringBinding;
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("RPC_SERVICE_STATUS_HANDLE_bind() called\n");
|
||||
|
||||
|
||||
status = RpcStringBindingComposeW(NULL,
|
||||
L"ncacn_np",
|
||||
NULL,
|
||||
L"\\pipe\\ntsvcs",
|
||||
NULL,
|
||||
&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the binding handle that will be used to bind to the server. */
|
||||
status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||
&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
status = RpcStringFreeW(&pszStringBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcStringFree returned 0x%x\n", status);
|
||||
}
|
||||
|
||||
return hBinding;
|
||||
}
|
||||
|
||||
|
||||
void __RPC_USER
|
||||
RPC_SERVICE_STATUS_HANDLE_unbind(RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
handle_t hBinding)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
|
||||
ERR("RPC_SERVICE_STATUS_HANDLE_unbind() called\n");
|
||||
|
||||
status = RpcBindingFree(&hBinding);
|
||||
if (status)
|
||||
{
|
||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
ScmRpcStatusToWinError(RPC_STATUS Status)
|
||||
|
@ -1494,12 +1660,12 @@ OpenSCManagerA(LPCSTR lpMachineName,
|
|||
|
||||
WaitForSCManager();
|
||||
|
||||
HandleBind();
|
||||
// HandleBind();
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
/* Call to services.exe using RPC */
|
||||
dwError = ROpenSCManagerA(BindingHandle,
|
||||
dwError = ROpenSCManagerA(//BindingHandle,
|
||||
(LPSTR)lpMachineName,
|
||||
(LPSTR)lpDatabaseName,
|
||||
dwDesiredAccess,
|
||||
|
@ -1542,12 +1708,12 @@ OpenSCManagerW(LPCWSTR lpMachineName,
|
|||
|
||||
WaitForSCManager();
|
||||
|
||||
HandleBind();
|
||||
// HandleBind();
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
/* Call to services.exe using RPC */
|
||||
dwError = ROpenSCManagerW(BindingHandle,
|
||||
dwError = ROpenSCManagerW(//BindingHandle,
|
||||
(LPWSTR)lpMachineName,
|
||||
(LPWSTR)lpDatabaseName,
|
||||
dwDesiredAccess,
|
||||
|
|
|
@ -536,7 +536,7 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName,
|
|||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
I_ScSetServiceBitsA(SC_RPC_HANDLE hServiceStatus,
|
||||
I_ScSetServiceBitsA(SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
DWORD dwServiceBits,
|
||||
BOOL bSetBitsOn,
|
||||
BOOL bUpdateImmediately,
|
||||
|
@ -544,13 +544,13 @@ I_ScSetServiceBitsA(SC_RPC_HANDLE hServiceStatus,
|
|||
{
|
||||
BOOL bResult;
|
||||
|
||||
HandleBind();
|
||||
// HandleBind();
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
/* Call to services.exe using RPC */
|
||||
bResult = RI_ScSetServiceBitsA(BindingHandle,
|
||||
(SC_RPC_HANDLE)hServiceStatus,
|
||||
bResult = RI_ScSetServiceBitsA(//BindingHandle,
|
||||
(RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
|
||||
dwServiceBits,
|
||||
bSetBitsOn,
|
||||
bUpdateImmediately,
|
||||
|
@ -575,7 +575,7 @@ I_ScSetServiceBitsA(SC_RPC_HANDLE hServiceStatus,
|
|||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
I_ScSetServiceBitsW(SC_RPC_HANDLE hServiceStatus,
|
||||
I_ScSetServiceBitsW(SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
DWORD dwServiceBits,
|
||||
BOOL bSetBitsOn,
|
||||
BOOL bUpdateImmediately,
|
||||
|
@ -583,13 +583,13 @@ I_ScSetServiceBitsW(SC_RPC_HANDLE hServiceStatus,
|
|||
{
|
||||
BOOL bResult;
|
||||
|
||||
HandleBind();
|
||||
// HandleBind();
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
/* Call to services.exe using RPC */
|
||||
bResult = RI_ScSetServiceBitsW(BindingHandle,
|
||||
(SC_RPC_HANDLE)hServiceStatus,
|
||||
bResult = RI_ScSetServiceBitsW(//BindingHandle,
|
||||
(RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
|
||||
dwServiceBits,
|
||||
bSetBitsOn,
|
||||
bUpdateImmediately,
|
||||
|
@ -639,11 +639,11 @@ SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
|
|||
TRACE("SetServiceStatus() called\n");
|
||||
TRACE("hServiceStatus %lu\n", hServiceStatus);
|
||||
|
||||
HandleBind();
|
||||
// HandleBind();
|
||||
|
||||
/* Call to services.exe using RPC */
|
||||
dwError = RSetServiceStatus(BindingHandle,
|
||||
(SC_RPC_HANDLE)hServiceStatus,
|
||||
dwError = RSetServiceStatus(//BindingHandle,
|
||||
(RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
|
||||
lpServiceStatus);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -158,7 +158,7 @@ typedef struct _SERVICE_TABLE_ENTRYW {
|
|||
DECLARE_HANDLE(SC_HANDLE);
|
||||
typedef SC_HANDLE *LPSC_HANDLE;
|
||||
typedef PVOID SC_LOCK;
|
||||
typedef DWORD SERVICE_STATUS_HANDLE;
|
||||
DECLARE_HANDLE(SERVICE_STATUS_HANDLE);
|
||||
typedef VOID(WINAPI *LPHANDLER_FUNCTION)(DWORD);
|
||||
typedef DWORD (WINAPI *LPHANDLER_FUNCTION_EX)(DWORD,DWORD,LPVOID,LPVOID);
|
||||
typedef struct _SERVICE_DESCRIPTIONA {
|
||||
|
|
|
@ -15,8 +15,9 @@ const unsigned short SC_MAX_COMMENT_LENGTH = 128;
|
|||
const unsigned short SC_MAX_ARGUMENT_LENGTH = 1024;
|
||||
const unsigned short SC_MAX_ARGUMENTS = 1024;
|
||||
|
||||
typedef /*[handle]*/ LPSTR SVCCTL_HANDLEA;
|
||||
typedef /*[handle]*/ LPWSTR SVCCTL_HANDLEW;
|
||||
typedef [handle] LPSTR SVCCTL_HANDLEA;
|
||||
typedef [handle] LPWSTR SVCCTL_HANDLEW;
|
||||
typedef [handle] ULONG_PTR RPC_SERVICE_STATUS_HANDLE;
|
||||
typedef /*[context_handle]*/ unsigned long SC_RPC_HANDLE;
|
||||
typedef SC_RPC_HANDLE* LPSC_RPC_HANDLE;
|
||||
typedef /*[context_handle]*/ unsigned long SC_RPC_LOCK;
|
||||
|
@ -296,9 +297,9 @@ typedef struct _STRING_PTRSW {
|
|||
uuid(367abb81-9844-35f1-ad32-98f038001003),
|
||||
version(2.0),
|
||||
pointer_default(unique),
|
||||
#ifndef __midl
|
||||
// #ifndef __midl
|
||||
,explicit_handle
|
||||
#endif
|
||||
// #endif
|
||||
]
|
||||
interface svcctl
|
||||
{
|
||||
|
@ -350,8 +351,8 @@ interface svcctl
|
|||
|
||||
/* Function 7 */
|
||||
DWORD RSetServiceStatus(
|
||||
[in] handle_t BindingHandle,
|
||||
[in] SC_RPC_HANDLE hServiceStatus,
|
||||
// [in] handle_t BindingHandle,
|
||||
[in] RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
[in] LPSERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/* Function 8 */
|
||||
|
@ -367,8 +368,8 @@ interface svcctl
|
|||
|
||||
/* Function 10 */
|
||||
DWORD RI_ScSetServiceBitsW(
|
||||
[in] handle_t BindingHandle,
|
||||
[in] SC_RPC_HANDLE hServiceStatus,
|
||||
// [in] handle_t BindingHandle,
|
||||
[in] RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
[in] DWORD dwServiceBits,
|
||||
[in] BOOL bSetBitsOn,
|
||||
[in] BOOL bUpdateImmediately,
|
||||
|
@ -435,8 +436,8 @@ interface svcctl
|
|||
|
||||
/* Function 15 */
|
||||
DWORD ROpenSCManagerW(
|
||||
[in] handle_t BindingHandle,
|
||||
[in, string, unique, range(0, SC_MAX_COMPUTER_NAME_LENGTH)] LPWSTR lpMachineName,
|
||||
// [in] handle_t BindingHandle,
|
||||
[in, string, unique, range(0, SC_MAX_COMPUTER_NAME_LENGTH)] SVCCTL_HANDLEW lpMachineName,
|
||||
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpDatabaseName,
|
||||
[in] DWORD dwDesiredAccess,
|
||||
[out] LPSC_RPC_HANDLE lpScHandle);
|
||||
|
@ -491,8 +492,8 @@ interface svcctl
|
|||
|
||||
/* Function 22 */
|
||||
DWORD RI_ScSetServiceBitsA(
|
||||
[in] handle_t BindingHandle,
|
||||
[in] SC_RPC_HANDLE hServiceStatus,
|
||||
// [in] handle_t BindingHandle,
|
||||
[in] RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
[in] DWORD dwServiceBits,
|
||||
[in] BOOL bSetBitsOn,
|
||||
[in] BOOL bUpdateImmediately,
|
||||
|
@ -559,8 +560,8 @@ interface svcctl
|
|||
|
||||
/* Function 27 */
|
||||
DWORD ROpenSCManagerA(
|
||||
[in] handle_t BindingHandle,
|
||||
[in, string, unique, range(0, SC_MAX_COMPUTER_NAME_LENGTH)] LPSTR lpMachineName,
|
||||
// [in] handle_t BindingHandle,
|
||||
[in, string, unique, range(0, SC_MAX_COMPUTER_NAME_LENGTH)] SVCCTL_HANDLEA lpMachineName,
|
||||
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPSTR lpDatabaseName,
|
||||
[in] DWORD dwDesiredAccess,
|
||||
[out] LPSC_RPC_HANDLE lpScHandle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue