- Improve error checking

svn path=/trunk/; revision=39413
This commit is contained in:
Johannes Anderwald 2009-02-05 17:22:59 +00:00
parent be4863c855
commit 80187e8d4e

View file

@ -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 */