mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 08:54:40 +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;
|
int len;
|
||||||
LPSTR lpStr;
|
LPSTR lpStr;
|
||||||
|
|
||||||
|
if (!hSCManager)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (lpServiceName)
|
if (lpServiceName)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, NULL, 0);
|
len = MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, NULL, 0);
|
||||||
|
@ -1299,6 +1305,12 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
||||||
TRACE("%p %s %p %p\n", hSCManager,
|
TRACE("%p %s %p %p\n", hSCManager,
|
||||||
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
|
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
|
||||||
|
|
||||||
|
if (!hSCManager)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lpDisplayName)
|
if (!lpDisplayName)
|
||||||
*lpcchBuffer = 0;
|
*lpcchBuffer = 0;
|
||||||
|
|
||||||
|
@ -1386,6 +1398,19 @@ GetServiceKeyNameA(SC_HANDLE hSCManager,
|
||||||
|
|
||||||
TRACE("GetServiceKeyNameA() called\n");
|
TRACE("GetServiceKeyNameA() called\n");
|
||||||
|
|
||||||
|
if (!hSCManager)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lpDisplayName)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_ADDRESS);
|
||||||
|
*lpcchBuffer = 1;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lpServiceName)
|
if (!lpServiceName)
|
||||||
*lpcchBuffer = 0;
|
*lpcchBuffer = 0;
|
||||||
|
|
||||||
|
@ -1639,6 +1664,12 @@ OpenServiceA(SC_HANDLE hSCManager,
|
||||||
TRACE("OpenServiceA(%p, %s, %lx)\n",
|
TRACE("OpenServiceA(%p, %s, %lx)\n",
|
||||||
hSCManager, lpServiceName, dwDesiredAccess);
|
hSCManager, lpServiceName, dwDesiredAccess);
|
||||||
|
|
||||||
|
if (!hSCManager)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
|
|
Loading…
Reference in a new issue