113 references to Advapi32
System.ServiceProcess.ServiceController (113)
_generated\0\LibraryImports.g.cs (7)
35internal static unsafe partial bool ControlService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int control, global::Interop.Advapi32.SERVICE_STATUS* pStatus) 68static extern unsafe int __PInvoke(nint __serviceHandle_native, int __control_native, global::Interop.Advapi32.SERVICE_STATUS* __pStatus_native); 380internal static unsafe partial bool QueryServiceStatus(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, global::Interop.Advapi32.SERVICE_STATUS* pStatus) 413static extern unsafe int __PInvoke(nint __serviceHandle_native, global::Interop.Advapi32.SERVICE_STATUS* __pStatus_native); 466public static unsafe partial bool SetServiceStatus(nint serviceStatusHandle, global::Interop.Advapi32.SERVICE_STATUS* status) 483static extern unsafe int __PInvoke(nint __serviceStatusHandle_native, global::Interop.Advapi32.SERVICE_STATUS* __status_native); 493public static partial nint RegisterServiceCtrlHandlerEx(string serviceName, global::Interop.Advapi32.ServiceControlCallbackEx callback, nint userData)
Microsoft\Win32\SafeHandles\SafeServiceHandle.cs (1)
30return Interop.Advapi32.CloseServiceHandle(handle);
System\ServiceProcess\PowerBroadcastStatus.cs (9)
8BatteryLow = Interop.Advapi32.PowerBroadcastStatus.PBT_APMBATTERYLOW, 9OemEvent = Interop.Advapi32.PowerBroadcastStatus.PBT_APMOEMEVENT, 10PowerStatusChange = Interop.Advapi32.PowerBroadcastStatus.PBT_APMPOWERSTATUSCHANGE, 11QuerySuspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMQUERYSUSPEND, 12QuerySuspendFailed = Interop.Advapi32.PowerBroadcastStatus.PBT_APMQUERYSUSPENDFAILED, 13ResumeAutomatic = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMEAUTOMATIC, 14ResumeCritical = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMECRITICAL, 15ResumeSuspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMESUSPEND, 16Suspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMSUSPEND,
System\ServiceProcess\ServiceBase.cs (1)
12using static Interop.Advapi32;
System\ServiceProcess\ServiceController.cs (67)
79private ServiceController(string machineName, Interop.Advapi32.ENUM_SERVICE_STATUS status) 98private ServiceController(string machineName, Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS status) 120return (_commandsAccepted & Interop.Advapi32.AcceptOptions.ACCEPT_PAUSE_CONTINUE) != 0; 132return (_commandsAccepted & Interop.Advapi32.AcceptOptions.ACCEPT_SHUTDOWN) != 0; 144return (_commandsAccepted & Interop.Advapi32.AcceptOptions.ACCEPT_STOP) != 0; 186using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_ENUMERATE_DEPENDENTS); 190bool result = Interop.Advapi32.EnumDependentServices(serviceHandle, Interop.Advapi32.ServiceState.SERVICE_STATE_ALL, IntPtr.Zero, 0, 208result = Interop.Advapi32.EnumDependentServices(serviceHandle, Interop.Advapi32.ServiceState.SERVICE_STATE_ALL, enumBuffer, bytesNeeded, 218Interop.Advapi32.ENUM_SERVICE_STATUS status = new Interop.Advapi32.ENUM_SERVICE_STATUS(); 219IntPtr structPtr = (IntPtr)(pEnumBuffer + ((nint)i * Marshal.SizeOf<Interop.Advapi32.ENUM_SERVICE_STATUS>())); 304using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_CONFIG); 305bool success = Interop.Advapi32.QueryServiceConfig(serviceHandle, IntPtr.Zero, 0, out int bytesNeeded); 320success = Interop.Advapi32.QueryServiceConfig(serviceHandle, bufPtr, bytesNeeded, out bytesNeeded); 324Interop.Advapi32.QUERY_SERVICE_CONFIG config = new Interop.Advapi32.QUERY_SERVICE_CONFIG(); 346Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS[] loadGroup = GetServicesInGroup(_machineName, dependencyNameStr.Substring(1)); 347foreach (Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS groupMember in loadGroup) 388using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_CONFIG); 389bool success = Interop.Advapi32.QueryServiceConfig(serviceHandle, IntPtr.Zero, 0, out int bytesNeeded); 399success = Interop.Advapi32.QueryServiceConfig(serviceHandle, bufPtr, bytesNeeded, out bytesNeeded); 403Interop.Advapi32.QUERY_SERVICE_CONFIG config = new Interop.Advapi32.QUERY_SERVICE_CONFIG(); 422return GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_ALL_ACCESS); 498using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_STATUS); 499Interop.Advapi32.SERVICE_STATUS svcStatus = default; 500bool success = Interop.Advapi32.QueryServiceStatus(serviceHandle, &svcStatus); 577if (Interop.Advapi32.GetServiceKeyName(SCMHandle, serviceDisplayName, c, ref bufLen)) 608if (Interop.Advapi32.GetServiceDisplayName(scmHandle, serviceName, c, ref bufLen)) 633Interop.Advapi32.OpenSCManager(null, null, serviceControlManagerAccess) : 634Interop.Advapi32.OpenSCManager(machineName, null, serviceControlManagerAccess)); 654_serviceManagerHandle ??= GetDataBaseHandleWithAccess(_machineName, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_CONNECT); 673return GetServicesOfType(machineName, Interop.Advapi32.ServiceTypeOptions.SERVICE_DRIVER); 686Marshal.InitHandle(serviceHandle, Interop.Advapi32.OpenService(_serviceManagerHandle, ServiceName, desiredAccess)); 713return GetServicesOfType(machineName, Interop.Advapi32.ServiceTypeOptions.SERVICE_WIN32); 722private static Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS[] GetServicesInGroup(string machineName, string group) 724return GetServices(machineName, Interop.Advapi32.ServiceTypeOptions.SERVICE_WIN32, group, status => status); 742private static unsafe T[] GetServices<T>(string machineName, int serviceType, string? group, Func<Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS, T> selector) 748using SafeServiceHandle databaseHandle = GetDataBaseHandleWithAccess(machineName, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_ENUMERATE_SERVICE); 749Interop.Advapi32.EnumServicesStatusEx( 751Interop.Advapi32.ServiceControllerOptions.SC_ENUM_PROCESS_INFO, 753Interop.Advapi32.StatusOptions.STATUS_ALL, 767Interop.Advapi32.EnumServicesStatusEx( 769Interop.Advapi32.ServiceControllerOptions.SC_ENUM_PROCESS_INFO, 771Interop.Advapi32.StatusOptions.STATUS_ALL, 786IntPtr structPtr = (IntPtr)(pMemory + ((nint)i * Marshal.SizeOf<Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS>())); 787Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS status = new Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS(); 805using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_PAUSE_CONTINUE); 806Interop.Advapi32.SERVICE_STATUS status = default; 807bool result = Interop.Advapi32.ControlService(serviceHandle, Interop.Advapi32.ControlOptions.CONTROL_PAUSE, &status); 821using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_PAUSE_CONTINUE); 822Interop.Advapi32.SERVICE_STATUS status = default; 823bool result = Interop.Advapi32.ControlService(serviceHandle, Interop.Advapi32.ControlOptions.CONTROL_CONTINUE, &status); 837using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_USER_DEFINED_CONTROL); 838Interop.Advapi32.SERVICE_STATUS status = default; 839bool result = Interop.Advapi32.ControlService(serviceHandle, command, &status); 873using SafeServiceHandle serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_START); 897bool result = Interop.Advapi32.StartService(serviceHandle, args.Length, argPtrsHandle.AddrOfPinnedObject()); 940using SafeServiceHandle serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_STOP); 957Interop.Advapi32.SERVICE_STATUS status = default; 958bool result = Interop.Advapi32.ControlService(serviceHandle, Interop.Advapi32.ControlOptions.CONTROL_STOP, &status);
System\ServiceProcess\ServiceControllerStatus.cs (7)
8ContinuePending = Interop.Advapi32.ServiceControlStatus.STATE_CONTINUE_PENDING, 9Paused = Interop.Advapi32.ServiceControlStatus.STATE_PAUSED, 10PausePending = Interop.Advapi32.ServiceControlStatus.STATE_PAUSE_PENDING, 11Running = Interop.Advapi32.ServiceControlStatus.STATE_RUNNING, 12StartPending = Interop.Advapi32.ServiceControlStatus.STATE_START_PENDING, 13Stopped = Interop.Advapi32.ServiceControlStatus.STATE_STOPPED, 14StopPending = Interop.Advapi32.ServiceControlStatus.STATE_STOP_PENDING
System\ServiceProcess\ServiceStartMode.cs (5)
8Manual = Interop.Advapi32.ServiceStartModes.START_TYPE_DEMAND, 9Automatic = Interop.Advapi32.ServiceStartModes.START_TYPE_AUTO, 10Disabled = Interop.Advapi32.ServiceStartModes.START_TYPE_DISABLED, 11Boot = Interop.Advapi32.ServiceStartModes.START_TYPE_BOOT, 12System = Interop.Advapi32.ServiceStartModes.START_TYPE_SYSTEM
System\ServiceProcess\ServiceType.cs (7)
10Adapter = Interop.Advapi32.ServiceTypeOptions.SERVICE_ADAPTER, 11FileSystemDriver = Interop.Advapi32.ServiceTypeOptions.SERVICE_FILE_SYSTEM_DRIVER, 12InteractiveProcess = Interop.Advapi32.ServiceTypeOptions.SERVICE_INTERACTIVE_PROCESS, 13KernelDriver = Interop.Advapi32.ServiceTypeOptions.SERVICE_KERNEL_DRIVER, 14RecognizerDriver = Interop.Advapi32.ServiceTypeOptions.SERVICE_RECOGNIZER_DRIVER, 15Win32OwnProcess = Interop.Advapi32.ServiceTypeOptions.SERVICE_WIN32_OWN_PROCESS, 16Win32ShareProcess = Interop.Advapi32.ServiceTypeOptions.SERVICE_WIN32_SHARE_PROCESS
System\ServiceProcess\SessionChangeReason.cs (9)
14ConsoleConnect = Interop.Advapi32.SessionStateChange.WTS_CONSOLE_CONNECT, 19ConsoleDisconnect = Interop.Advapi32.SessionStateChange.WTS_CONSOLE_DISCONNECT, 24RemoteConnect = Interop.Advapi32.SessionStateChange.WTS_REMOTE_CONNECT, 29RemoteDisconnect = Interop.Advapi32.SessionStateChange.WTS_REMOTE_DISCONNECT, 34SessionLogon = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOGON, 39SessionLogoff = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOGOFF, 44SessionLock = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOCK, 49SessionUnlock = Interop.Advapi32.SessionStateChange.WTS_SESSION_UNLOCK, 54SessionRemoteControl = Interop.Advapi32.SessionStateChange.WTS_SESSION_REMOTE_CONTROL