- Check for possible null pointers (invalid address) before dereferencing them.
- Correct some DPRINT formatting.
svn path=/trunk/; revision=58446
lpStr += (wcslen(lpStr) + 1);
/* Append the group name */
- if (lpService->lpGroup != NULL)
+ if ((lpService->lpGroup != NULL) && (lpService->lpGroup->lpGroupName != NULL))
{
wcscpy(lpStr, lpService->lpGroup->lpGroupName);
}
DPRINT("REnumServicesStatusA() called\n");
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ return ERROR_INVALID_ADDRESS;
+ }
+
if ((dwBufSize > 0) && (lpBuffer))
{
lpStatusPtrW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBufSize);
return ERROR_INVALID_HANDLE;
}
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ return ERROR_INVALID_ADDRESS;
+ }
+
*pcbBytesNeeded = 0;
*lpServicesReturned = 0;
DPRINT("REnumServicesStatusExA() called\n");
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ return ERROR_INVALID_ADDRESS;
+ }
+
if (pszGroupName)
{
pszGroupNameW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (strlen(pszGroupName) + 1) * sizeof(WCHAR));
return ERROR_INVALID_HANDLE;
}
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ return ERROR_INVALID_ADDRESS;
+ }
+
*pcbBytesNeeded = 0;
*lpServicesReturned = 0;
hPipe = (HANDLE)Context;
- DPRINT("ScmNamedPipeThread(%lu) - Accepting SCM commands through named pipe\n", hPipe);
+ DPRINT("ScmNamedPipeThread(%p) - Accepting SCM commands through named pipe\n", hPipe);
for (;;)
{
}
}
- DPRINT("ScmNamedPipeThread(%lu) - Disconnecting named pipe connection\n", hPipe);
+ DPRINT("ScmNamedPipeThread(%p) - Disconnecting named pipe connection\n", hPipe);
FlushFileBuffers(hPipe);
DisconnectNamedPipe(hPipe);
CloseHandle(hPipe);
- DPRINT("ScmNamedPipeThread(%lu) - Done.\n", hPipe);
+ DPRINT("ScmNamedPipeThread(%p) - Done.\n", hPipe);
return ERROR_SUCCESS;
}
return FALSE;
}
- DPRINT("CreateNamedPipe() - calling ConnectNamedPipe(%x)\n", hPipe);
+ DPRINT("CreateNamedPipe() - calling ConnectNamedPipe(%p)\n", hPipe);
bConnected = ConnectNamedPipe(hPipe,
NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
DPRINT("CreateNamedPipe() - ConnectNamedPipe() returned %d\n", bConnected);
TRACE("ChangeServiceConfig2A() called\n");
+ if (lpInfo == NULL) return TRUE;
+
/* Fill relevent field of the Info structure */
Info.dwInfoLevel = dwInfoLevel;
switch (dwInfoLevel)
return FALSE;
}
- if (lpInfo == NULL)
- return TRUE;
-
RpcTryExcept
{
dwError = RChangeServiceConfig2A((SC_RPC_HANDLE)hService,
TRACE("ChangeServiceConfig2W() called\n");
+ if (lpInfo == NULL) return TRUE;
+
/* Fill relevent field of the Info structure */
Info.dwInfoLevel = dwInfoLevel;
switch (dwInfoLevel)
return FALSE;
}
- if (lpInfo == NULL)
- return TRUE;
-
RpcTryExcept
{
dwError = RChangeServiceConfig2W((SC_RPC_HANDLE)hService,
return FALSE;
}
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ SetLastError(ERROR_INVALID_ADDRESS);
+ return FALSE;
+ }
+
if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW))
{
lpStatusPtr = &ServiceStatus;
return FALSE;
}
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ SetLastError(ERROR_INVALID_ADDRESS);
+ return FALSE;
+ }
+
if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSA))
{
lpStatusPtr = &ServiceStatus;
return FALSE;
}
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ SetLastError(ERROR_INVALID_ADDRESS);
+ return FALSE;
+ }
+
if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW))
{
lpStatusPtr = &ServiceStatus;
return FALSE;
}
- if (lpServices == NULL ||
- cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSA))
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ SetLastError(ERROR_INVALID_ADDRESS);
+ return FALSE;
+ }
+
+ if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSA))
{
lpStatusPtr = &ServiceStatus;
dwBufferSize = sizeof(ENUM_SERVICE_STATUS_PROCESSA);
return FALSE;
}
- if (lpServices == NULL ||
- cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSW))
+ if (pcbBytesNeeded == NULL || lpServicesReturned == NULL)
+ {
+ SetLastError(ERROR_INVALID_ADDRESS);
+ return FALSE;
+ }
+
+ if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSW))
{
lpStatusPtr = &ServiceStatus;
dwBufferSize = sizeof(ENUM_SERVICE_STATUS_PROCESSW);