SetServiceObjectSecurity function advapi32

Win32Result<bool> SetServiceObjectSecurity(
  1. SC_HANDLE hService,
  2. OBJECT_SECURITY_INFORMATION dwSecurityInformation,
  3. PSECURITY_DESCRIPTOR lpSecurityDescriptor
)

Sets the security descriptor of a service object.

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

Implementation

Win32Result<bool> SetServiceObjectSecurity(
  SC_HANDLE hService,
  OBJECT_SECURITY_INFORMATION dwSecurityInformation,
  PSECURITY_DESCRIPTOR lpSecurityDescriptor,
) {
  resolveGetLastError();
  final result_ = _SetServiceObjectSecurity(
    hService,
    dwSecurityInformation,
    lpSecurityDescriptor,
  );
  return .new(value: result_ != FALSE, error: GetLastError());
}