GetServiceDisplayName function advapi32

Win32Result<bool> GetServiceDisplayName(
  1. SC_HANDLE hSCManager,
  2. PCWSTR lpServiceName,
  3. PWSTR? lpDisplayName,
  4. Pointer<Uint32> lpcchBuffer,
)

Retrieves the display name of the specified service.

To learn more, see learn.microsoft.com/windows/win32/api/winsvc/nf-winsvc-getservicedisplaynamew.

Implementation

Win32Result<bool> GetServiceDisplayName(
  SC_HANDLE hSCManager,
  PCWSTR lpServiceName,
  PWSTR? lpDisplayName,
  Pointer<Uint32> lpcchBuffer,
) {
  resolveGetLastError();
  final result_ = _GetServiceDisplayName(
    hSCManager,
    lpServiceName,
    lpDisplayName ?? nullptr,
    lpcchBuffer,
  );
  return .new(value: result_ != FALSE, error: GetLastError());
}