mirror of
https://github.com/reactos/wine.git
synced 2025-02-16 19:10:35 +00:00
advapi32/service: Handle is checked before servicename.
This commit is contained in:
parent
fc4c73902a
commit
83d8cbcc48
@ -2273,12 +2273,6 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
|
||||
TRACE("%p %s %p %p\n", hSCManager,
|
||||
debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
|
||||
|
||||
if (!lpServiceName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
|
||||
if (!hscm)
|
||||
{
|
||||
@ -2286,6 +2280,12 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpServiceName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_ADDRESS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size = *lpcchBuffer;
|
||||
ret = RegGetValueA(hscm->hkey, lpServiceName, "DisplayName", RRF_RT_REG_SZ, &type, lpDisplayName, &size);
|
||||
if (!ret && !lpDisplayName && size)
|
||||
@ -2320,12 +2320,6 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
|
||||
TRACE("%p %s %p %p\n", hSCManager,
|
||||
debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer);
|
||||
|
||||
if (!lpServiceName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
|
||||
if (!hscm)
|
||||
{
|
||||
@ -2333,6 +2327,12 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpServiceName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_ADDRESS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size = *lpcchBuffer * sizeof(WCHAR);
|
||||
ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName, RRF_RT_REG_SZ, &type, lpDisplayName, &size);
|
||||
if (!ret && !lpDisplayName && size)
|
||||
|
@ -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());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user