advapi32: Added check for NULL pointer being passed to QueryServiceStatus for either parameter.

This commit is contained in:
Damian Dixon 2010-12-20 20:34:49 +00:00 committed by Alexandre Julliard
parent a2d1c7df5e
commit fd0bec1f96
2 changed files with 11 additions and 1 deletions

View File

@ -1130,6 +1130,17 @@ BOOL WINAPI QueryServiceStatus(SC_HANDLE hService,
TRACE("%p %p\n", hService, lpservicestatus);
if (!hService)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!lpservicestatus)
{
SetLastError(ERROR_INVALID_ADDRESS);
return FALSE;
}
ret = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&SvcStatusData,
sizeof(SERVICE_STATUS_PROCESS), &dummy);
if (ret) memcpy(lpservicestatus, &SvcStatusData, sizeof(SERVICE_STATUS)) ;

View File

@ -925,7 +925,6 @@ static void test_query_svc(void)
SetLastError(0xdeadbeef);
ret = QueryServiceStatus(svc_handle, NULL);
ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_ADDRESS ||
GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */,
"Unexpected last error %d\n", GetLastError());