From d0790f1bfe092dfe4bc214dd54f4c71160f752e9 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Mon, 7 May 2007 21:56:31 +0200 Subject: [PATCH] advapi32: Implement GetServiceDisplayNameW. --- dlls/advapi32/service.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 5f362155257..22489a9a1a1 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -2073,9 +2073,36 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName, BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPWSTR lpDisplayName, LPDWORD lpcchBuffer) { - FIXME("%p %s %p %p\n", hSCManager, + struct sc_manager *hscm; + DWORD type, size; + LONG ret; + + TRACE("%p %s %p %p\n", hSCManager, debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer); - return FALSE; + + hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER); + if (!hscm) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + size = *lpcchBuffer * sizeof(WCHAR); + ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName, RRF_RT_REG_SZ, &type, lpDisplayName, &size); + if (ret) + { + if (lpDisplayName && *lpcchBuffer) *lpDisplayName = 0; + + if (ret == ERROR_MORE_DATA) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + *lpcchBuffer = (size / sizeof(WCHAR)) - 1; + } + else + SetLastError(ret); + return FALSE; + } + return TRUE; } /****************************************************************************** -- 2.11.4.GIT