Commit 83d8cbcc authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

advapi32/service: Handle is checked before servicename.

parent fc4c7390
......@@ -2273,16 +2273,16 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
TRACE("%p %s %p %p\n", hSCManager,
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
if (!lpServiceName)
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
if (!hscm)
{
SetLastError(ERROR_INVALID_PARAMETER);
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
if (!hscm)
if (!lpServiceName)
{
SetLastError(ERROR_INVALID_HANDLE);
SetLastError(ERROR_INVALID_ADDRESS);
return FALSE;
}
......@@ -2320,16 +2320,16 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
TRACE("%p %s %p %p\n", hSCManager,
debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer);
if (!lpServiceName)
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
if (!hscm)
{
SetLastError(ERROR_INVALID_PARAMETER);
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
if (!hscm)
if (!lpServiceName)
{
SetLastError(ERROR_INVALID_HANDLE);
SetLastError(ERROR_INVALID_ADDRESS);
return FALSE;
}
......
......@@ -392,7 +392,6 @@ static void test_get_displayname(void)
SetLastError(0xdeadbeef);
ret = GetServiceDisplayNameA(NULL, NULL, NULL, &displaysize);
ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment