advapi32: Handle to Service Control Manager is checked first.
This commit is contained in:
parent
64054b005c
commit
06d6a03d45
|
@ -1228,12 +1228,6 @@ SC_HANDLE WINAPI OpenServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
|
||||||
|
|
||||||
TRACE("%p %s %d\n", hSCManager, debugstr_w(lpServiceName), dwDesiredAccess);
|
TRACE("%p %s %d\n", hSCManager, debugstr_w(lpServiceName), dwDesiredAccess);
|
||||||
|
|
||||||
if (!lpServiceName)
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_ADDRESS);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hscm = sc_handle_get_handle_data( hSCManager, SC_HTYPE_MANAGER );
|
hscm = sc_handle_get_handle_data( hSCManager, SC_HTYPE_MANAGER );
|
||||||
if (!hscm)
|
if (!hscm)
|
||||||
{
|
{
|
||||||
|
@ -1241,6 +1235,12 @@ SC_HANDLE WINAPI OpenServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!lpServiceName)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_ADDRESS);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
r = RegOpenKeyExW( hscm->hkey, lpServiceName, 0, KEY_ALL_ACCESS, &hKey );
|
r = RegOpenKeyExW( hscm->hkey, lpServiceName, 0, KEY_ALL_ACCESS, &hKey );
|
||||||
if (r!=ERROR_SUCCESS)
|
if (r!=ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,7 +93,6 @@ static void test_open_svc(void)
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
svc_handle = OpenServiceA(NULL, NULL, 0);
|
svc_handle = OpenServiceA(NULL, NULL, 0);
|
||||||
ok(!svc_handle, "Expected failure\n");
|
ok(!svc_handle, "Expected failure\n");
|
||||||
todo_wine
|
|
||||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||||
|
|
||||||
/* TODO: Add some tests with invalid handles. These produce errors on Windows but crash on Wine */
|
/* TODO: Add some tests with invalid handles. These produce errors on Windows but crash on Wine */
|
||||||
|
|
Loading…
Reference in New Issue