mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:56:00 +00:00
-don't cast const char to char
-handle RPC_X_ENUM_VALUE_OUT_OF_RANGE and RPC_X_BYTE_COUNT_TOO_SMALL in ScmRpcStatusToWinError -add some traces -don't write to NULL pointers, don't do strlen on a NULL pointer svn path=/trunk/; revision=38603
This commit is contained in:
parent
76f5148d89
commit
38418a1b4c
7 changed files with 99 additions and 78 deletions
|
@ -48,7 +48,7 @@ ScmOpenServiceKey(LPWSTR lpServiceName,
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
ScmCreateServiceKey(LPWSTR lpServiceName,
|
ScmCreateServiceKey(LPCWSTR lpServiceName,
|
||||||
REGSAM samDesired,
|
REGSAM samDesired,
|
||||||
PHKEY phKey)
|
PHKEY phKey)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ static DWORD dwResumeCount = 1;
|
||||||
|
|
||||||
|
|
||||||
PSERVICE
|
PSERVICE
|
||||||
ScmGetServiceEntryByName(LPWSTR lpServiceName)
|
ScmGetServiceEntryByName(LPCWSTR lpServiceName)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ServiceEntry;
|
PLIST_ENTRY ServiceEntry;
|
||||||
PSERVICE CurrentService;
|
PSERVICE CurrentService;
|
||||||
|
@ -59,7 +59,7 @@ ScmGetServiceEntryByName(LPWSTR lpServiceName)
|
||||||
|
|
||||||
|
|
||||||
PSERVICE
|
PSERVICE
|
||||||
ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName)
|
ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ServiceEntry;
|
PLIST_ENTRY ServiceEntry;
|
||||||
PSERVICE CurrentService;
|
PSERVICE CurrentService;
|
||||||
|
@ -148,7 +148,7 @@ ScmGetServiceEntryByClientHandle(HANDLE Handle)
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
ScmCreateNewServiceRecord(LPWSTR lpServiceName,
|
ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
|
||||||
PSERVICE *lpServiceRecord)
|
PSERVICE *lpServiceRecord)
|
||||||
{
|
{
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
|
@ -225,7 +225,7 @@ ScmDeleteServiceRecord(PSERVICE lpService)
|
||||||
|
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
CreateServiceListEntry(LPWSTR lpServiceName,
|
CreateServiceListEntry(LPCWSTR lpServiceName,
|
||||||
HKEY hServiceKey)
|
HKEY hServiceKey)
|
||||||
{
|
{
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
|
|
|
@ -25,7 +25,7 @@ LIST_ENTRY UnknownGroupListHead;
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
ScmSetServiceGroup(PSERVICE lpService,
|
ScmSetServiceGroup(PSERVICE lpService,
|
||||||
LPWSTR lpGroupName)
|
LPCWSTR lpGroupName)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY GroupEntry;
|
PLIST_ENTRY GroupEntry;
|
||||||
PSERVICE_GROUP lpGroup;
|
PSERVICE_GROUP lpGroup;
|
||||||
|
|
|
@ -1571,13 +1571,13 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
ScmCanonDriverImagePath(DWORD dwStartType,
|
ScmCanonDriverImagePath(DWORD dwStartType,
|
||||||
wchar_t *lpServiceName,
|
const wchar_t *lpServiceName,
|
||||||
wchar_t **lpCanonName)
|
wchar_t **lpCanonName)
|
||||||
{
|
{
|
||||||
DWORD ServiceNameLen, Result;
|
DWORD ServiceNameLen, Result;
|
||||||
UNICODE_STRING NtServiceName;
|
UNICODE_STRING NtServiceName;
|
||||||
WCHAR *RelativeName;
|
WCHAR *RelativeName;
|
||||||
WCHAR *SourceName = lpServiceName;
|
const WCHAR *SourceName = lpServiceName;
|
||||||
|
|
||||||
/* Calculate the length of the service's name */
|
/* Calculate the length of the service's name */
|
||||||
ServiceNameLen = wcslen(lpServiceName);
|
ServiceNameLen = wcslen(lpServiceName);
|
||||||
|
@ -1703,18 +1703,18 @@ ScmCanonDriverImagePath(DWORD dwStartType,
|
||||||
/* Function 12 */
|
/* Function 12 */
|
||||||
DWORD RCreateServiceW(
|
DWORD RCreateServiceW(
|
||||||
SC_RPC_HANDLE hSCManager,
|
SC_RPC_HANDLE hSCManager,
|
||||||
LPWSTR lpServiceName,
|
LPCWSTR lpServiceName,
|
||||||
LPWSTR lpDisplayName,
|
LPCWSTR lpDisplayName,
|
||||||
DWORD dwDesiredAccess,
|
DWORD dwDesiredAccess,
|
||||||
DWORD dwServiceType,
|
DWORD dwServiceType,
|
||||||
DWORD dwStartType,
|
DWORD dwStartType,
|
||||||
DWORD dwErrorControl,
|
DWORD dwErrorControl,
|
||||||
LPWSTR lpBinaryPathName,
|
LPCWSTR lpBinaryPathName,
|
||||||
LPWSTR lpLoadOrderGroup,
|
LPCWSTR lpLoadOrderGroup,
|
||||||
LPDWORD lpdwTagId,
|
LPDWORD lpdwTagId,
|
||||||
LPBYTE lpDependencies,
|
LPBYTE lpDependencies,
|
||||||
DWORD dwDependSize,
|
DWORD dwDependSize,
|
||||||
LPWSTR lpServiceStartName,
|
LPCWSTR lpServiceStartName,
|
||||||
LPBYTE lpPassword,
|
LPBYTE lpPassword,
|
||||||
DWORD dwPwSize,
|
DWORD dwPwSize,
|
||||||
LPSC_RPC_HANDLE lpServiceHandle)
|
LPSC_RPC_HANDLE lpServiceHandle)
|
||||||
|
@ -2740,7 +2740,7 @@ DWORD RStartServiceW(
|
||||||
/* Function 20 */
|
/* Function 20 */
|
||||||
DWORD RGetServiceDisplayNameW(
|
DWORD RGetServiceDisplayNameW(
|
||||||
SC_RPC_HANDLE hSCManager,
|
SC_RPC_HANDLE hSCManager,
|
||||||
LPWSTR lpServiceName,
|
LPCWSTR lpServiceName,
|
||||||
LPWSTR lpDisplayName,
|
LPWSTR lpDisplayName,
|
||||||
DWORD *lpcchBuffer)
|
DWORD *lpcchBuffer)
|
||||||
{
|
{
|
||||||
|
@ -2773,8 +2773,11 @@ DWORD RGetServiceDisplayNameW(
|
||||||
if (*lpcchBuffer == 0)
|
if (*lpcchBuffer == 0)
|
||||||
{
|
{
|
||||||
*lpcchBuffer = 1;
|
*lpcchBuffer = 1;
|
||||||
|
if (lpDisplayName != NULL)
|
||||||
|
{
|
||||||
*lpDisplayName = '\0';
|
*lpDisplayName = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
@ -2783,7 +2786,7 @@ DWORD RGetServiceDisplayNameW(
|
||||||
{
|
{
|
||||||
dwLength = wcslen(lpService->lpServiceName);
|
dwLength = wcslen(lpService->lpServiceName);
|
||||||
|
|
||||||
if (lpServiceName != NULL &&
|
if (lpDisplayName != NULL &&
|
||||||
*lpcchBuffer > dwLength)
|
*lpcchBuffer > dwLength)
|
||||||
{
|
{
|
||||||
wcscpy(lpDisplayName, lpService->lpServiceName);
|
wcscpy(lpDisplayName, lpService->lpServiceName);
|
||||||
|
@ -2811,7 +2814,7 @@ DWORD RGetServiceDisplayNameW(
|
||||||
/* Function 21 */
|
/* Function 21 */
|
||||||
DWORD RGetServiceKeyNameW(
|
DWORD RGetServiceKeyNameW(
|
||||||
SC_RPC_HANDLE hSCManager,
|
SC_RPC_HANDLE hSCManager,
|
||||||
LPWSTR lpDisplayName,
|
LPCWSTR lpDisplayName,
|
||||||
LPWSTR lpServiceName,
|
LPWSTR lpServiceName,
|
||||||
DWORD *lpcchBuffer)
|
DWORD *lpcchBuffer)
|
||||||
{
|
{
|
||||||
|
@ -2844,8 +2847,11 @@ DWORD RGetServiceKeyNameW(
|
||||||
if (*lpcchBuffer == 0)
|
if (*lpcchBuffer == 0)
|
||||||
{
|
{
|
||||||
*lpcchBuffer = 2;
|
*lpcchBuffer = 2;
|
||||||
|
if (lpServiceName != NULL)
|
||||||
|
{
|
||||||
*lpServiceName = '\0';
|
*lpServiceName = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
@ -3774,12 +3780,12 @@ DWORD RStartServiceA(
|
||||||
/* Function 32 */
|
/* Function 32 */
|
||||||
DWORD RGetServiceDisplayNameA(
|
DWORD RGetServiceDisplayNameA(
|
||||||
SC_RPC_HANDLE hSCManager,
|
SC_RPC_HANDLE hSCManager,
|
||||||
LPSTR lpServiceName,
|
LPCSTR lpServiceName,
|
||||||
LPSTR lpDisplayName,
|
LPSTR lpDisplayName,
|
||||||
LPBOUNDED_DWORD_4K lpcchBuffer)
|
LPBOUNDED_DWORD_4K lpcchBuffer)
|
||||||
{
|
{
|
||||||
// PMANAGER_HANDLE hManager;
|
// PMANAGER_HANDLE hManager;
|
||||||
PSERVICE lpService;
|
PSERVICE lpService = NULL;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
LPWSTR lpServiceNameW;
|
LPWSTR lpServiceNameW;
|
||||||
|
@ -3797,6 +3803,8 @@ DWORD RGetServiceDisplayNameA(
|
||||||
// return ERROR_INVALID_HANDLE;
|
// return ERROR_INVALID_HANDLE;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (lpServiceName != NULL)
|
||||||
|
{
|
||||||
dwLength = strlen(lpServiceName) + 1;
|
dwLength = strlen(lpServiceName) + 1;
|
||||||
lpServiceNameW = HeapAlloc(GetProcessHeap(),
|
lpServiceNameW = HeapAlloc(GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
|
@ -3807,13 +3815,14 @@ DWORD RGetServiceDisplayNameA(
|
||||||
MultiByteToWideChar(CP_ACP,
|
MultiByteToWideChar(CP_ACP,
|
||||||
0,
|
0,
|
||||||
lpServiceName,
|
lpServiceName,
|
||||||
strlen(lpServiceName),
|
-1,
|
||||||
lpServiceNameW,
|
lpServiceNameW,
|
||||||
dwLength);
|
dwLength);
|
||||||
|
|
||||||
lpService = ScmGetServiceEntryByName(lpServiceNameW);
|
lpService = ScmGetServiceEntryByName(lpServiceNameW);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, lpServiceNameW);
|
HeapFree(GetProcessHeap(), 0, lpServiceNameW);
|
||||||
|
}
|
||||||
|
|
||||||
if (lpService == NULL)
|
if (lpService == NULL)
|
||||||
{
|
{
|
||||||
|
@ -3824,15 +3833,18 @@ DWORD RGetServiceDisplayNameA(
|
||||||
if (*lpcchBuffer == 0)
|
if (*lpcchBuffer == 0)
|
||||||
{
|
{
|
||||||
*lpcchBuffer = 1;
|
*lpcchBuffer = 1;
|
||||||
|
if (lpDisplayName != NULL)
|
||||||
|
{
|
||||||
*lpDisplayName = '\0';
|
*lpDisplayName = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lpService->lpDisplayName)
|
if (!lpService->lpDisplayName)
|
||||||
{
|
{
|
||||||
dwLength = wcslen(lpService->lpServiceName);
|
dwLength = wcslen(lpService->lpServiceName);
|
||||||
if (lpServiceName != NULL &&
|
if (lpDisplayName != NULL &&
|
||||||
*lpcchBuffer > dwLength)
|
*lpcchBuffer > dwLength)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(CP_ACP,
|
WideCharToMultiByte(CP_ACP,
|
||||||
|
@ -3840,7 +3852,7 @@ DWORD RGetServiceDisplayNameA(
|
||||||
lpService->lpServiceName,
|
lpService->lpServiceName,
|
||||||
wcslen(lpService->lpServiceName),
|
wcslen(lpService->lpServiceName),
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
*lpcchBuffer,
|
dwLength + 1,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -3857,7 +3869,7 @@ DWORD RGetServiceDisplayNameA(
|
||||||
lpService->lpDisplayName,
|
lpService->lpDisplayName,
|
||||||
wcslen(lpService->lpDisplayName),
|
wcslen(lpService->lpDisplayName),
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
*lpcchBuffer,
|
dwLength + 1,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -3875,7 +3887,7 @@ DWORD RGetServiceDisplayNameA(
|
||||||
/* Function 33 */
|
/* Function 33 */
|
||||||
DWORD RGetServiceKeyNameA(
|
DWORD RGetServiceKeyNameA(
|
||||||
SC_RPC_HANDLE hSCManager,
|
SC_RPC_HANDLE hSCManager,
|
||||||
LPSTR lpDisplayName,
|
LPCSTR lpDisplayName,
|
||||||
LPSTR lpServiceName,
|
LPSTR lpServiceName,
|
||||||
LPBOUNDED_DWORD_4K lpcchBuffer)
|
LPBOUNDED_DWORD_4K lpcchBuffer)
|
||||||
{
|
{
|
||||||
|
@ -3900,7 +3912,7 @@ DWORD RGetServiceKeyNameA(
|
||||||
MultiByteToWideChar(CP_ACP,
|
MultiByteToWideChar(CP_ACP,
|
||||||
0,
|
0,
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
strlen(lpDisplayName),
|
-1,
|
||||||
lpDisplayNameW,
|
lpDisplayNameW,
|
||||||
dwLength);
|
dwLength);
|
||||||
|
|
||||||
|
@ -3917,21 +3929,24 @@ DWORD RGetServiceKeyNameA(
|
||||||
if (*lpcchBuffer == 0)
|
if (*lpcchBuffer == 0)
|
||||||
{
|
{
|
||||||
*lpcchBuffer = 1;
|
*lpcchBuffer = 1;
|
||||||
|
if (lpServiceName != NULL)
|
||||||
|
{
|
||||||
*lpServiceName = '\0';
|
*lpServiceName = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = wcslen(lpService->lpServiceName);
|
dwLength = wcslen(lpService->lpServiceName);
|
||||||
if (lpService != NULL &&
|
if (lpServiceName != NULL &&
|
||||||
*lpcchBuffer > dwLength)
|
*lpcchBuffer > dwLength)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(CP_ACP,
|
WideCharToMultiByte(CP_ACP,
|
||||||
0,
|
0,
|
||||||
lpService->lpServiceName,
|
lpService->lpServiceName,
|
||||||
wcslen(lpService->lpServiceName),
|
wcslen(lpService->lpServiceName),
|
||||||
lpServiceName,
|
lpServiceName + 1,
|
||||||
dwLength,
|
dwLength,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -77,7 +77,7 @@ DWORD ScmOpenServiceKey(LPWSTR lpServiceName,
|
||||||
REGSAM samDesired,
|
REGSAM samDesired,
|
||||||
PHKEY phKey);
|
PHKEY phKey);
|
||||||
|
|
||||||
DWORD ScmCreateServiceKey(LPWSTR lpServiceName,
|
DWORD ScmCreateServiceKey(LPCWSTR lpServiceName,
|
||||||
REGSAM samDesired,
|
REGSAM samDesired,
|
||||||
PHKEY phKey);
|
PHKEY phKey);
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ DWORD ScmStartService(PSERVICE Service,
|
||||||
DWORD argc,
|
DWORD argc,
|
||||||
LPWSTR *argv);
|
LPWSTR *argv);
|
||||||
|
|
||||||
PSERVICE ScmGetServiceEntryByName(LPWSTR lpServiceName);
|
PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName);
|
||||||
PSERVICE ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName);
|
PSERVICE ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName);
|
||||||
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
|
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
|
||||||
PSERVICE ScmGetServiceEntryByClientHandle(HANDLE Handle);
|
PSERVICE ScmGetServiceEntryByClientHandle(HANDLE Handle);
|
||||||
DWORD ScmCreateNewServiceRecord(LPWSTR lpServiceName,
|
DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
|
||||||
PSERVICE *lpServiceRecord);
|
PSERVICE *lpServiceRecord);
|
||||||
VOID ScmDeleteServiceRecord(PSERVICE lpService);
|
VOID ScmDeleteServiceRecord(PSERVICE lpService);
|
||||||
DWORD ScmMarkServiceForDelete(PSERVICE pService);
|
DWORD ScmMarkServiceForDelete(PSERVICE pService);
|
||||||
|
@ -130,7 +130,7 @@ DWORD ScmControlDriver(PSERVICE lpService,
|
||||||
|
|
||||||
DWORD ScmCreateGroupList(VOID);
|
DWORD ScmCreateGroupList(VOID);
|
||||||
DWORD ScmSetServiceGroup(PSERVICE lpService,
|
DWORD ScmSetServiceGroup(PSERVICE lpService,
|
||||||
LPWSTR lpGroupName);
|
LPCWSTR lpGroupName);
|
||||||
|
|
||||||
|
|
||||||
/* rpcserver.c */
|
/* rpcserver.c */
|
||||||
|
|
|
@ -36,7 +36,7 @@ SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName)
|
||||||
(UCHAR *)"\\pipe\\ntsvcs",
|
(UCHAR *)"\\pipe\\ntsvcs",
|
||||||
NULL,
|
NULL,
|
||||||
(UCHAR **)&pszStringBinding);
|
(UCHAR **)&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -45,13 +45,13 @@ SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName)
|
||||||
/* Set the binding handle that will be used to bind to the server. */
|
/* Set the binding handle that will be used to bind to the server. */
|
||||||
status = RpcBindingFromStringBindingA(pszStringBinding,
|
status = RpcBindingFromStringBindingA(pszStringBinding,
|
||||||
&hBinding);
|
&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = RpcStringFreeA(&pszStringBinding);
|
status = RpcStringFreeA(&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringFree returned 0x%x\n", status);
|
ERR("RpcStringFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ SVCCTL_HANDLEA_unbind(SVCCTL_HANDLEA szMachineName,
|
||||||
TRACE("SVCCTL_HANDLEA_unbind() called\n");
|
TRACE("SVCCTL_HANDLEA_unbind() called\n");
|
||||||
|
|
||||||
status = RpcBindingFree(&hBinding);
|
status = RpcBindingFree(&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName)
|
||||||
L"\\pipe\\ntsvcs",
|
L"\\pipe\\ntsvcs",
|
||||||
NULL,
|
NULL,
|
||||||
&pszStringBinding);
|
&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -100,13 +100,13 @@ SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName)
|
||||||
/* Set the binding handle that will be used to bind to the server. */
|
/* Set the binding handle that will be used to bind to the server. */
|
||||||
status = RpcBindingFromStringBindingW(pszStringBinding,
|
status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||||
&hBinding);
|
&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = RpcStringFreeW(&pszStringBinding);
|
status = RpcStringFreeW(&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringFree returned 0x%x\n", status);
|
ERR("RpcStringFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName,
|
||||||
TRACE("SVCCTL_HANDLEW_unbind() called\n");
|
TRACE("SVCCTL_HANDLEW_unbind() called\n");
|
||||||
|
|
||||||
status = RpcBindingFree(&hBinding);
|
status = RpcBindingFree(&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ RPC_SERVICE_STATUS_HANDLE_bind(RPC_SERVICE_STATUS_HANDLE hServiceStatus)
|
||||||
L"\\pipe\\ntsvcs",
|
L"\\pipe\\ntsvcs",
|
||||||
NULL,
|
NULL,
|
||||||
&pszStringBinding);
|
&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -155,13 +155,13 @@ RPC_SERVICE_STATUS_HANDLE_bind(RPC_SERVICE_STATUS_HANDLE hServiceStatus)
|
||||||
/* Set the binding handle that will be used to bind to the server. */
|
/* Set the binding handle that will be used to bind to the server. */
|
||||||
status = RpcBindingFromStringBindingW(pszStringBinding,
|
status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||||
&hBinding);
|
&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = RpcStringFreeW(&pszStringBinding);
|
status = RpcStringFreeW(&pszStringBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcStringFree returned 0x%x\n", status);
|
ERR("RpcStringFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ RPC_SERVICE_STATUS_HANDLE_unbind(RPC_SERVICE_STATUS_HANDLE hServiceStatus,
|
||||||
TRACE("RPC_SERVICE_STATUS_HANDLE_unbind() called\n");
|
TRACE("RPC_SERVICE_STATUS_HANDLE_unbind() called\n");
|
||||||
|
|
||||||
status = RpcBindingFree(&hBinding);
|
status = RpcBindingFree(&hBinding);
|
||||||
if (status)
|
if (status != RPC_S_OK)
|
||||||
{
|
{
|
||||||
ERR("RpcBindingFree returned 0x%x\n", status);
|
ERR("RpcBindingFree returned 0x%x\n", status);
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,8 @@ ScmRpcStatusToWinError(RPC_STATUS Status)
|
||||||
return ERROR_INVALID_HANDLE;
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
case RPC_X_NULL_REF_POINTER:
|
case RPC_X_NULL_REF_POINTER:
|
||||||
|
case RPC_X_ENUM_VALUE_OUT_OF_RANGE:
|
||||||
|
case RPC_X_BYTE_COUNT_TOO_SMALL:
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
case STATUS_ACCESS_VIOLATION:
|
case STATUS_ACCESS_VIOLATION:
|
||||||
|
@ -759,6 +761,8 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
LPWSTR lpStr;
|
LPWSTR lpStr;
|
||||||
|
|
||||||
TRACE("CreateServiceW() called\n");
|
TRACE("CreateServiceW() called\n");
|
||||||
|
TRACE("%p %S %S\n", hSCManager,
|
||||||
|
lpServiceName, lpDisplayName);
|
||||||
|
|
||||||
/* Calculate the Dependencies length*/
|
/* Calculate the Dependencies length*/
|
||||||
if (lpDependencies != NULL)
|
if (lpDependencies != NULL)
|
||||||
|
@ -781,18 +785,18 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
{
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
dwError = RCreateServiceW((SC_RPC_HANDLE)hSCManager,
|
dwError = RCreateServiceW((SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpServiceName,
|
lpServiceName,
|
||||||
(LPWSTR)lpDisplayName,
|
lpDisplayName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
dwServiceType,
|
dwServiceType,
|
||||||
dwStartType,
|
dwStartType,
|
||||||
dwErrorControl,
|
dwErrorControl,
|
||||||
(LPWSTR)lpBinaryPathName,
|
lpBinaryPathName,
|
||||||
(LPWSTR)lpLoadOrderGroup,
|
lpLoadOrderGroup,
|
||||||
lpdwTagId,
|
lpdwTagId,
|
||||||
(LPBYTE)lpDependencies,
|
(LPBYTE)lpDependencies,
|
||||||
dwDependenciesLength,
|
dwDependenciesLength,
|
||||||
(LPWSTR)lpServiceStartName,
|
lpServiceStartName,
|
||||||
NULL, /* FIXME: lpPassword */
|
NULL, /* FIXME: lpPassword */
|
||||||
0, /* FIXME: dwPasswordLength */
|
0, /* FIXME: dwPasswordLength */
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
|
@ -1292,6 +1296,8 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
TRACE("GetServiceDisplayNameA() called\n");
|
TRACE("GetServiceDisplayNameA() called\n");
|
||||||
|
TRACE("%p %s %p %p\n", hSCManager,
|
||||||
|
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
|
||||||
|
|
||||||
if (!lpDisplayName)
|
if (!lpDisplayName)
|
||||||
*lpcchBuffer = 0;
|
*lpcchBuffer = 0;
|
||||||
|
@ -1299,7 +1305,7 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
dwError = RGetServiceDisplayNameA((SC_RPC_HANDLE)hSCManager,
|
dwError = RGetServiceDisplayNameA((SC_RPC_HANDLE)hSCManager,
|
||||||
(LPSTR)lpServiceName,
|
lpServiceName,
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
}
|
}
|
||||||
|
@ -1344,7 +1350,7 @@ GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
dwError = RGetServiceDisplayNameW((SC_RPC_HANDLE)hSCManager,
|
dwError = RGetServiceDisplayNameW((SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpServiceName,
|
lpServiceName,
|
||||||
lpDisplayName,
|
lpDisplayName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
}
|
}
|
||||||
|
@ -1386,7 +1392,7 @@ GetServiceKeyNameA(SC_HANDLE hSCManager,
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
dwError = RGetServiceKeyNameA((SC_RPC_HANDLE)hSCManager,
|
dwError = RGetServiceKeyNameA((SC_RPC_HANDLE)hSCManager,
|
||||||
(LPSTR)lpDisplayName,
|
lpDisplayName,
|
||||||
lpServiceName,
|
lpServiceName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
}
|
}
|
||||||
|
@ -1428,7 +1434,7 @@ GetServiceKeyNameW(SC_HANDLE hSCManager,
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
dwError = RGetServiceKeyNameW((SC_RPC_HANDLE)hSCManager,
|
dwError = RGetServiceKeyNameW((SC_RPC_HANDLE)hSCManager,
|
||||||
(LPWSTR)lpDisplayName,
|
lpDisplayName,
|
||||||
lpServiceName,
|
lpServiceName,
|
||||||
lpcchBuffer);
|
lpcchBuffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,18 +380,18 @@ interface svcctl
|
||||||
/* Function 12 */
|
/* Function 12 */
|
||||||
DWORD RCreateServiceW(
|
DWORD RCreateServiceW(
|
||||||
[in] SC_RPC_HANDLE hSCManager,
|
[in] SC_RPC_HANDLE hSCManager,
|
||||||
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpServiceName,
|
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPCWSTR lpServiceName,
|
||||||
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpDisplayName,
|
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPCWSTR lpDisplayName,
|
||||||
[in] DWORD dwDesiredAccess,
|
[in] DWORD dwDesiredAccess,
|
||||||
[in] DWORD dwServiceType,
|
[in] DWORD dwServiceType,
|
||||||
[in] DWORD dwStartType,
|
[in] DWORD dwStartType,
|
||||||
[in] DWORD dwErrorControl,
|
[in] DWORD dwErrorControl,
|
||||||
[in, string, range(0, SC_MAX_PATH_LENGTH)] LPWSTR lpBinaryPathName,
|
[in, string, range(0, SC_MAX_PATH_LENGTH)] LPCWSTR lpBinaryPathName,
|
||||||
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpLoadOrderGroup,
|
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)] LPCWSTR lpLoadOrderGroup,
|
||||||
[in, out, unique] LPDWORD lpdwTagId,
|
[in, out, unique] LPDWORD lpdwTagId,
|
||||||
[in, unique, size_is(dwDependSize)] LPBYTE lpDependencies,
|
[in, unique, size_is(dwDependSize)] LPBYTE lpDependencies,
|
||||||
[in, range(0, SC_MAX_DEPEND_SIZE)] DWORD dwDependSize,
|
[in, range(0, SC_MAX_DEPEND_SIZE)] DWORD dwDependSize,
|
||||||
[in, string, unique, range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] LPWSTR lpServiceStartName,
|
[in, string, unique, range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] LPCWSTR lpServiceStartName,
|
||||||
[in, unique, size_is(dwPwSize)] LPBYTE lpPassword,
|
[in, unique, size_is(dwPwSize)] LPBYTE lpPassword,
|
||||||
[in, range(0, SC_MAX_PWD_SIZE)] DWORD dwPwSize,
|
[in, range(0, SC_MAX_PWD_SIZE)] DWORD dwPwSize,
|
||||||
[out] LPSC_RPC_HANDLE lpServiceHandle);
|
[out] LPSC_RPC_HANDLE lpServiceHandle);
|
||||||
|
@ -454,14 +454,14 @@ interface svcctl
|
||||||
/* Function 20 */
|
/* Function 20 */
|
||||||
DWORD RGetServiceDisplayNameW(
|
DWORD RGetServiceDisplayNameW(
|
||||||
[in] SC_RPC_HANDLE hSCManager,
|
[in] SC_RPC_HANDLE hSCManager,
|
||||||
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpServiceName,
|
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPCWSTR lpServiceName,
|
||||||
[out, string, range(1, 4*1024+1), size_is(*lpcchBuffer + 1)] LPWSTR lpDisplayName,
|
[out, string, range(1, 4*1024+1), size_is(*lpcchBuffer + 1)] LPWSTR lpDisplayName,
|
||||||
[in, out] DWORD* lpcchBuffer);
|
[in, out] DWORD* lpcchBuffer);
|
||||||
|
|
||||||
/* Function 21 */
|
/* Function 21 */
|
||||||
DWORD RGetServiceKeyNameW(
|
DWORD RGetServiceKeyNameW(
|
||||||
[in] SC_RPC_HANDLE hSCManager,
|
[in] SC_RPC_HANDLE hSCManager,
|
||||||
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPWSTR lpDisplayName,
|
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPCWSTR lpDisplayName,
|
||||||
[out, string, range(1, 4*1024+1), size_is(*lpcchBuffer + 1)] LPWSTR lpServiceName,
|
[out, string, range(1, 4*1024+1), size_is(*lpcchBuffer + 1)] LPWSTR lpServiceName,
|
||||||
[in, out] DWORD* lpcchBuffer);
|
[in, out] DWORD* lpcchBuffer);
|
||||||
|
|
||||||
|
@ -566,14 +566,14 @@ interface svcctl
|
||||||
/* Function 32 */
|
/* Function 32 */
|
||||||
DWORD RGetServiceDisplayNameA(
|
DWORD RGetServiceDisplayNameA(
|
||||||
[in] SC_RPC_HANDLE hSCManager,
|
[in] SC_RPC_HANDLE hSCManager,
|
||||||
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPSTR lpServiceName,
|
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPCSTR lpServiceName,
|
||||||
[out, string, size_is(*lpcchBuffer)] LPSTR lpDisplayName,
|
[out, string, size_is(*lpcchBuffer)] LPSTR lpDisplayName,
|
||||||
[in, out] LPBOUNDED_DWORD_4K lpcchBuffer);
|
[in, out] LPBOUNDED_DWORD_4K lpcchBuffer);
|
||||||
|
|
||||||
/* Function 33 */
|
/* Function 33 */
|
||||||
DWORD RGetServiceKeyNameA(
|
DWORD RGetServiceKeyNameA(
|
||||||
[in] SC_RPC_HANDLE hSCManager,
|
[in] SC_RPC_HANDLE hSCManager,
|
||||||
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPSTR lpDisplayName,
|
[in, string, range(0, SC_MAX_NAME_LENGTH)] LPCSTR lpDisplayName,
|
||||||
[out, string, size_is(*lpcchBuffer)] LPSTR lpKeyName,
|
[out, string, size_is(*lpcchBuffer)] LPSTR lpKeyName,
|
||||||
[in, out] LPBOUNDED_DWORD_4K lpcchBuffer);
|
[in, out] LPBOUNDED_DWORD_4K lpcchBuffer);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue