2 instantiations of SafeServiceHandle
System.ServiceProcess.ServiceController (2)
System\ServiceProcess\ServiceController.cs (2)
631var databaseHandle = new SafeServiceHandle(); 685var serviceHandle = new SafeServiceHandle();
44 references to SafeServiceHandle
System.ServiceProcess.ServiceController (44)
_generated\0\LibraryImports.g.cs (18)
35internal static unsafe partial bool ControlService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int control, global::Interop.Advapi32.SERVICE_STATUS* pStatus) 42global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new(); 78internal static partial bool EnumDependentServices(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int serviceState, nint bufferOfENUM_SERVICE_STATUS, int bufSize, ref int bytesNeeded, ref int numEnumerated) 85global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new(); 124internal static partial bool EnumServicesStatusEx(global::Microsoft.Win32.SafeHandles.SafeServiceHandle databaseHandle, int infolevel, int serviceType, int serviceState, nint status, int size, out int bytesNeeded, out int servicesReturned, ref int resumeHandle, string group) 133global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __databaseHandle_native__marshaller = new(); 174internal static unsafe partial bool GetServiceDisplayName(global::Microsoft.Win32.SafeHandles.SafeServiceHandle SCMHandle, string serviceName, char* displayName, ref int displayNameLength) 181global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __SCMHandle_native__marshaller = new(); 220internal static unsafe partial bool GetServiceKeyName(global::Microsoft.Win32.SafeHandles.SafeServiceHandle SCMHandle, string displayName, char* KeyName, ref int KeyNameLength) 227global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __SCMHandle_native__marshaller = new(); 293internal static partial nint OpenService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle databaseHandle, string serviceName, int access) 299global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __databaseHandle_native__marshaller = new(); 334internal static partial bool QueryServiceConfig(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, nint queryServiceConfigPtr, int bufferSize, out int bytesNeeded) 342global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new(); 380internal static unsafe partial bool QueryServiceStatus(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, global::Interop.Advapi32.SERVICE_STATUS* pStatus) 387global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new(); 423internal static partial bool StartService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int argNum, nint argPtrs) 430global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ControlService.cs (1)
14internal static unsafe partial bool ControlService(SafeServiceHandle serviceHandle, int control, SERVICE_STATUS* pStatus);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.EnumDependentServices.cs (1)
15SafeServiceHandle serviceHandle,
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.EnumServicesStatusEx.cs (1)
15SafeServiceHandle databaseHandle,
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetServiceDisplayName.cs (1)
17internal static unsafe partial bool GetServiceDisplayName(SafeServiceHandle? SCMHandle, string serviceName, char* displayName, ref int displayNameLength);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetServiceKeyName.cs (1)
17internal static unsafe partial bool GetServiceKeyName(SafeServiceHandle? SCMHandle, string displayName, char* KeyName, ref int KeyNameLength);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.OpenService.cs (1)
13internal static partial IntPtr OpenService(SafeServiceHandle? databaseHandle, string serviceName, int access);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.QueryServiceConfig.cs (1)
14internal static partial bool QueryServiceConfig(SafeServiceHandle serviceHandle, IntPtr queryServiceConfigPtr, int bufferSize, out int bytesNeeded);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.QueryServiceStatus.cs (1)
14internal static unsafe partial bool QueryServiceStatus(SafeServiceHandle serviceHandle, SERVICE_STATUS* pStatus);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.StartService.cs (1)
14internal static partial bool StartService(SafeServiceHandle serviceHandle, int argNum, IntPtr argPtrs);
System\ServiceProcess\ServiceController.cs (17)
36private SafeServiceHandle? _serviceManagerHandle; 186using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_ENUMERATE_DEPENDENTS); 304using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_CONFIG); 388using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_CONFIG); 498using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_QUERY_STATUS); 568private unsafe string? GetServiceKeyName(SafeServiceHandle? SCMHandle, string serviceDisplayName) 599private unsafe string? GetServiceDisplayName(SafeServiceHandle? scmHandle, string serviceName) 629private static SafeServiceHandle GetDataBaseHandleWithAccess(string machineName, int serviceControlManagerAccess) 631var databaseHandle = new SafeServiceHandle(); 681private SafeServiceHandle GetServiceHandle(int desiredAccess) 685var serviceHandle = new SafeServiceHandle(); 748using SafeServiceHandle databaseHandle = GetDataBaseHandleWithAccess(machineName, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_ENUMERATE_SERVICE); 805using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_PAUSE_CONTINUE); 821using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_PAUSE_CONTINUE); 837using var serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_USER_DEFINED_CONTROL); 873using SafeServiceHandle serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_START); 940using SafeServiceHandle serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_STOP);