EnumServicesStatus function advapi32

Win32Result<bool> EnumServicesStatus(
  1. SC_HANDLE hSCManager,
  2. ENUM_SERVICE_TYPE dwServiceType,
  3. ENUM_SERVICE_STATE dwServiceState,
  4. Pointer<ENUM_SERVICE_STATUS>? lpServices,
  5. int cbBufSize,
  6. Pointer<Uint32> pcbBytesNeeded,
  7. Pointer<Uint32> lpServicesReturned,
  8. Pointer<Uint32>? lpResumeHandle,
)

Enumerates services in the specified service control manager database.

The name and status of each service are provided.

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

Implementation

Win32Result<bool> EnumServicesStatus(
  SC_HANDLE hSCManager,
  ENUM_SERVICE_TYPE dwServiceType,
  ENUM_SERVICE_STATE dwServiceState,
  Pointer<ENUM_SERVICE_STATUS>? lpServices,
  int cbBufSize,
  Pointer<Uint32> pcbBytesNeeded,
  Pointer<Uint32> lpServicesReturned,
  Pointer<Uint32>? lpResumeHandle,
) {
  final result_ = EnumServicesStatusW_Wrapper(
    hSCManager,
    dwServiceType,
    dwServiceState,
    lpServices ?? nullptr,
    cbBufSize,
    pcbBytesNeeded,
    lpServicesReturned,
    lpResumeHandle ?? nullptr,
  );
  return .new(value: result_.value.i32 != FALSE, error: result_.error);
}