File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.ServiceProcess.ServiceController\src\System.ServiceProcess.ServiceController.csproj (System.ServiceProcess.ServiceController)
// <auto-generated/>
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CloseServiceHandle(nint handle)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(handle);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CloseServiceHandle", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool ControlService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int control, global::Interop.Advapi32.SERVICE_STATUS* pStatus)
        {
            int __lastError;
            nint __serviceHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __serviceHandle_native__marshaller.FromManaged(serviceHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __serviceHandle_native = __serviceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__serviceHandle_native, control, pStatus);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __serviceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ControlService", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceHandle_native, int __control_native, global::Interop.Advapi32.SERVICE_STATUS* __pStatus_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EnumDependentServices(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int serviceState, nint bufferOfENUM_SERVICE_STATUS, int bufSize, ref int bytesNeeded, ref int numEnumerated)
        {
            int __lastError;
            nint __serviceHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __serviceHandle_native__marshaller.FromManaged(serviceHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __numEnumerated_native = &numEnumerated)
                fixed (int* __bytesNeeded_native = &bytesNeeded)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __serviceHandle_native = __serviceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__serviceHandle_native, serviceState, bufferOfENUM_SERVICE_STATUS, bufSize, __bytesNeeded_native, __numEnumerated_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __serviceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "EnumDependentServicesW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceHandle_native, int __serviceState_native, nint __bufferOfENUM_SERVICE_STATUS_native, int __bufSize_native, int* __bytesNeeded_native, int* __numEnumerated_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal 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)
        {
            int __lastError;
            bytesNeeded = default;
            servicesReturned = default;
            nint __databaseHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __databaseHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __databaseHandle_native__marshaller.FromManaged(databaseHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __group_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(group))
                fixed (int* __resumeHandle_native = &resumeHandle)
                fixed (int* __servicesReturned_native = &servicesReturned)
                fixed (int* __bytesNeeded_native = &bytesNeeded)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __databaseHandle_native = __databaseHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__databaseHandle_native, infolevel, serviceType, serviceState, status, size, __bytesNeeded_native, __servicesReturned_native, __resumeHandle_native, (ushort*)__group_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __databaseHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "EnumServicesStatusExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __databaseHandle_native, int __infolevel_native, int __serviceType_native, int __serviceState_native, nint __status_native, int __size_native, int* __bytesNeeded_native, int* __servicesReturned_native, int* __resumeHandle_native, ushort* __group_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool GetServiceDisplayName(global::Microsoft.Win32.SafeHandles.SafeServiceHandle SCMHandle, string serviceName, char* displayName, ref int displayNameLength)
        {
            int __lastError;
            nint __SCMHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __SCMHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __SCMHandle_native__marshaller.FromManaged(SCMHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __displayNameLength_native = &displayNameLength)
                fixed (void* __serviceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serviceName))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __SCMHandle_native = __SCMHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__SCMHandle_native, (ushort*)__serviceName_native, displayName, __displayNameLength_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __SCMHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetServiceDisplayNameW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __SCMHandle_native, ushort* __serviceName_native, char* __displayName_native, int* __displayNameLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool GetServiceKeyName(global::Microsoft.Win32.SafeHandles.SafeServiceHandle SCMHandle, string displayName, char* KeyName, ref int KeyNameLength)
        {
            int __lastError;
            nint __SCMHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __SCMHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __SCMHandle_native__marshaller.FromManaged(SCMHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __KeyNameLength_native = &KeyNameLength)
                fixed (void* __displayName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(displayName))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __SCMHandle_native = __SCMHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__SCMHandle_native, (ushort*)__displayName_native, KeyName, __KeyNameLength_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __SCMHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetServiceKeyNameW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __SCMHandle_native, ushort* __displayName_native, char* __KeyName_native, int* __KeyNameLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nint OpenSCManager(string machineName, string databaseName, int access)
        {
            int __lastError;
            nint __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __databaseName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(databaseName))
            fixed (void* __machineName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(machineName))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__machineName_native, (ushort*)__databaseName_native, access);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenSCManagerW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __machineName_native, ushort* __databaseName_native, int __access_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nint OpenService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle databaseHandle, string serviceName, int access)
        {
            int __lastError;
            nint __databaseHandle_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __databaseHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __databaseHandle_native__marshaller.FromManaged(databaseHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __serviceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serviceName))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __databaseHandle_native = __databaseHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__databaseHandle_native, (ushort*)__serviceName_native, access);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __databaseHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenServiceW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(nint __databaseHandle_native, ushort* __serviceName_native, int __access_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool QueryServiceConfig(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, nint queryServiceConfigPtr, int bufferSize, out int bytesNeeded)
        {
            int __lastError;
            bytesNeeded = default;
            nint __serviceHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __serviceHandle_native__marshaller.FromManaged(serviceHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __bytesNeeded_native = &bytesNeeded)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __serviceHandle_native = __serviceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__serviceHandle_native, queryServiceConfigPtr, bufferSize, __bytesNeeded_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __serviceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "QueryServiceConfigW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceHandle_native, nint __queryServiceConfigPtr_native, int __bufferSize_native, int* __bytesNeeded_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool QueryServiceStatus(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, global::Interop.Advapi32.SERVICE_STATUS* pStatus)
        {
            int __lastError;
            nint __serviceHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __serviceHandle_native__marshaller.FromManaged(serviceHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __serviceHandle_native = __serviceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__serviceHandle_native, pStatus);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __serviceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "QueryServiceStatus", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceHandle_native, global::Interop.Advapi32.SERVICE_STATUS* __pStatus_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool StartService(global::Microsoft.Win32.SafeHandles.SafeServiceHandle serviceHandle, int argNum, nint argPtrs)
        {
            int __lastError;
            nint __serviceHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeServiceHandle>.ManagedToUnmanagedIn __serviceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __serviceHandle_native__marshaller.FromManaged(serviceHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __serviceHandle_native = __serviceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__serviceHandle_native, argNum, argPtrs);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __serviceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "StartServiceW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceHandle_native, int __argNum_native, nint __argPtrs_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static unsafe partial bool SetServiceStatus(nint serviceStatusHandle, global::Interop.Advapi32.SERVICE_STATUS* status)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(serviceStatusHandle, status);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "SetServiceStatus", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __serviceStatusHandle_native, global::Interop.Advapi32.SERVICE_STATUS* __status_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint RegisterServiceCtrlHandlerEx(string serviceName, global::Interop.Advapi32.ServiceControlCallbackEx callback, nint userData)
        {
            int __lastError;
            nint __callback_native;
            nint __retVal;
            // Marshal - Convert managed data to native data.
            __callback_native = callback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback) : default;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __serviceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serviceName))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__serviceName_native, __callback_native, userData);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
            global::System.GC.KeepAlive(callback);
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegisterServiceCtrlHandlerExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __serviceName_native, nint __callback_native, nint __userData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool StartServiceCtrlDispatcher(nint entry)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(entry);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "StartServiceCtrlDispatcherW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __entry_native);
        }
    }
}