Commit ac5dca86 authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

advapi32: Fix return value to indicate error when NULL string is passed in.

parent 3cfb018e
...@@ -2078,6 +2078,9 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName, ...@@ -2078,6 +2078,9 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
size = *lpcchBuffer; size = *lpcchBuffer;
ret = RegGetValueA(hscm->hkey, lpServiceName, "DisplayName", RRF_RT_REG_SZ, &type, lpDisplayName, &size); ret = RegGetValueA(hscm->hkey, lpServiceName, "DisplayName", RRF_RT_REG_SZ, &type, lpDisplayName, &size);
if (!ret && !lpDisplayName && size)
ret = ERROR_MORE_DATA;
if (ret) if (ret)
{ {
if (lpDisplayName && *lpcchBuffer) *lpDisplayName = 0; if (lpDisplayName && *lpcchBuffer) *lpDisplayName = 0;
...@@ -2116,6 +2119,9 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, ...@@ -2116,6 +2119,9 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
size = *lpcchBuffer * sizeof(WCHAR); size = *lpcchBuffer * sizeof(WCHAR);
ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName, RRF_RT_REG_SZ, &type, lpDisplayName, &size); ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName, RRF_RT_REG_SZ, &type, lpDisplayName, &size);
if (!ret && !lpDisplayName && size)
ret = ERROR_MORE_DATA;
if (ret) if (ret)
{ {
if (lpDisplayName && *lpcchBuffer) *lpDisplayName = 0; if (lpDisplayName && *lpcchBuffer) *lpDisplayName = 0;
......
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