func (m *Mgr) LockStatus() (*LockStatus, error) {
	bytesNeeded := uint32(unsafe.Sizeof(windows.QUERY_SERVICE_LOCK_STATUS{}) + 1024)
	for {
		bytes := make([]byte, bytesNeeded)
		lockStatus := (*windows.QUERY_SERVICE_LOCK_STATUS)(unsafe.Pointer(&bytes[0]))
		err := windows.QueryServiceLockStatus(m.Handle, lockStatus, uint32(len(bytes)), &bytesNeeded)
		if err == windows.ERROR_INSUFFICIENT_BUFFER && bytesNeeded >= uint32(unsafe.Sizeof(windows.QUERY_SERVICE_LOCK_STATUS{})) {
			continue
		}
		if err != nil {
			return nil, err
		}
		status := &LockStatus{
			IsLocked: lockStatus.IsLocked != 0,
			Age:      time.Duration(lockStatus.LockDuration) * time.Second,
			Owner:    windows.UTF16PtrToString(lockStatus.LockOwner),
		}
		return status, nil
	}
}
// LockStatus returns whether the service control manager is locked by
// the system, for how long, and by whom. A locked SCM indicates that
// most service actions will block until the system unlocks the SCM.
LockStatus returns whether the service control manager is locked by
the system, for how long, and by whom. A locked SCM indicates that
most service actions will block until the system unlocks the SCM.
// LockStatus returns whether the service control manager is locked by // the system for how long and by whom . A locked SCM indicates that // most service actions will block until the system unlocks the SCM .
func (m *Mgr) LockStatus() (*LockStatus, error) {
	bytesNeeded := uint32(unsafe.Sizeof(windows.QUERY_SERVICE_LOCK_STATUS{}) + 1024)
	for {
		bytes := make([]byte, bytesNeeded)
		lockStatus := (*windows.QUERY_SERVICE_LOCK_STATUS)(unsafe.Pointer(&bytes[0]))
		err := windows.QueryServiceLockStatus(m.Handle, lockStatus, uint32(len(bytes)), &bytesNeeded)
		if err == windows.ERROR_INSUFFICIENT_BUFFER && bytesNeeded >= uint32(unsafe.Sizeof(windows.QUERY_SERVICE_LOCK_STATUS{})) {
			continue
		}
		if err != nil {
			return nil, err
		}
		status := &LockStatus{
			IsLocked: lockStatus.IsLocked != 0,
			Age:      time.Duration(lockStatus.LockDuration) * time.Second,
			Owner:    windows.UTF16PtrToString(lockStatus.LockOwner),
		}
		return status, nil
	}
}
func ( m * Mgr ) LockStatus ( ) ( * LockStatus , error ) { bytesNeeded := uint32 ( unsafe . Sizeof ( windows . QUERY_SERVICE_LOCK_STATUS { } ) + 1024 ) for { bytes := make ( [ ] byte , bytesNeeded ) lockStatus := ( * windows . QUERY_SERVICE_LOCK_STATUS ) ( unsafe . Pointer ( & bytes [ 0 ] ) ) err := windows . QueryServiceLockStatus ( m . Handle , lockStatus , uint32 ( len ( bytes ) ) , & bytesNeeded ) if err == windows . ERROR_INSUFFICIENT_BUFFER && bytesNeeded >= uint32 ( unsafe . Sizeof ( windows . QUERY_SERVICE_LOCK_STATUS { } ) ) { continue } if err != nil { return nil , err } status := & LockStatus { IsLocked : lockStatus . IsLocked != 0 , Age : time . Duration ( lockStatus . LockDuration ) * time . Second , Owner : windows . UTF16PtrToString ( lockStatus . LockOwner ) , } return status , nil } }
LockStatus returns whether the service control manager is locked by
the system, for how long, and by whom.
LockStatus returns whether the service control manager is locked by the system for how long and by whom .