mirror of
https://github.com/reactos/reactos.git
synced 2024-10-03 07:53:49 +00:00
- Improve error checking
svn path=/trunk/; revision=39413
This commit is contained in:
parent
be4863c855
commit
80187e8d4e
|
@ -602,6 +602,12 @@ CreateServiceA(SC_HANDLE hSCManager,
|
|||
int len;
|
||||
LPSTR lpStr;
|
||||
|
||||
if (!hSCManager)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lpServiceName)
|
||||
{
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, NULL, 0);
|
||||
|
@ -1299,6 +1305,12 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
|||
TRACE("%p %s %p %p\n", hSCManager,
|
||||
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
|
||||
|
||||
if (!hSCManager)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpDisplayName)
|
||||
*lpcchBuffer = 0;
|
||||
|
||||
|
@ -1386,6 +1398,19 @@ GetServiceKeyNameA(SC_HANDLE hSCManager,
|
|||
|
||||
TRACE("GetServiceKeyNameA() called\n");
|
||||
|
||||
if (!hSCManager)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpDisplayName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_ADDRESS);
|
||||
*lpcchBuffer = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpServiceName)
|
||||
*lpcchBuffer = 0;
|
||||
|
||||
|
@ -1639,6 +1664,12 @@ OpenServiceA(SC_HANDLE hSCManager,
|
|||
TRACE("OpenServiceA(%p, %s, %lx)\n",
|
||||
hSCManager, lpServiceName, dwDesiredAccess);
|
||||
|
||||
if (!hSCManager)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
/* Call to services.exe using RPC */
|
||||
|
|
Loading…
Reference in a new issue