File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj (System.Diagnostics.EventLog)
// <auto-generated/>
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtQuery(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string path, string query, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __query_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(query))
                fixed (void* __path_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(path))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__path_native, (ushort*)__query_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtQuery", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, ushort* __path_native, ushort* __query_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtSeek(global::System.Diagnostics.Eventing.Reader.EventLogHandle resultSet, long position, global::System.Diagnostics.Eventing.Reader.EventLogHandle bookmark, int timeout, global::Microsoft.Win32.UnsafeNativeMethods.EvtSeekFlags flags)
        {
            int __lastError;
            nint __resultSet_native = default;
            nint __bookmark_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __bookmark_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __resultSet_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bookmark_native__marshaller.FromManaged(bookmark);
                __resultSet_native__marshaller.FromManaged(resultSet);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bookmark_native = __bookmark_native__marshaller.ToUnmanaged();
                    __resultSet_native = __resultSet_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__resultSet_native, position, __bookmark_native, timeout, flags);
                    __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.
                __bookmark_native__marshaller.Free();
                __resultSet_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtSeek", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __resultSet_native, long __position_native, nint __bookmark_native, int __timeout_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtSeekFlags __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtSubscribe(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, global::Microsoft.Win32.SafeHandles.SafeWaitHandle signalEvent, string path, string query, global::System.Diagnostics.Eventing.Reader.EventLogHandle bookmark, nint context, nint callback, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            nint __signalEvent_native = default;
            nint __bookmark_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __bookmark_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeWaitHandle>.ManagedToUnmanagedIn __signalEvent_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bookmark_native__marshaller.FromManaged(bookmark);
                __signalEvent_native__marshaller.FromManaged(signalEvent);
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __query_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(query))
                fixed (void* __path_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(path))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bookmark_native = __bookmark_native__marshaller.ToUnmanaged();
                    __signalEvent_native = __signalEvent_native__marshaller.ToUnmanaged();
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, __signalEvent_native, (ushort*)__path_native, (ushort*)__query_native, __bookmark_native, context, callback, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bookmark_native__marshaller.Free();
                __signalEvent_native__marshaller.Free();
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtSubscribe", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, nint __signalEvent_native, ushort* __path_native, ushort* __query_native, nint __bookmark_native, nint __context_native, nint __callback_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtNext(global::System.Diagnostics.Eventing.Reader.EventLogHandle queryHandle, int eventSize, nint[] events, int timeout, int flags, ref int returned)
        {
            int __lastError;
            nint __queryHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __queryHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __queryHandle_native__marshaller.FromManaged(queryHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __returned_native = &returned)
                fixed (void* __events_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<nint, nint>.ManagedToUnmanagedIn.GetPinnableReference(events))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __queryHandle_native = __queryHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__queryHandle_native, eventSize, (nint*)__events_native, timeout, flags, __returned_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.
                __queryHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtNext", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __queryHandle_native, int __eventSize_native, nint* __events_native, int __timeout_native, int __flags_native, int* __returned_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtCancel(global::System.Diagnostics.Eventing.Reader.EventLogHandle handle)
        {
            int __lastError;
            nint __handle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__handle_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.
                __handle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtCancel", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtClose(nint handle)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(handle);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtClose", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetEventInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.UnsafeNativeMethods.EvtEventPropertyId propertyId, int bufferSize, nint bufferPtr, out int bufferUsed)
        {
            int __lastError;
            bufferUsed = default;
            nint __eventHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __bufferUsed_native = &bufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__eventHandle_native, propertyId, bufferSize, bufferPtr, __bufferUsed_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.
                __eventHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetEventInfo", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __eventHandle_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtEventPropertyId __propertyId_native, int __bufferSize_native, nint __bufferPtr_native, int* __bufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetQueryInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle queryHandle, global::Microsoft.Win32.UnsafeNativeMethods.EvtQueryPropertyId propertyId, int bufferSize, nint buffer, ref int bufferRequired)
        {
            int __lastError;
            nint __queryHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __queryHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __queryHandle_native__marshaller.FromManaged(queryHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __bufferRequired_native = &bufferRequired)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __queryHandle_native = __queryHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__queryHandle_native, propertyId, bufferSize, buffer, __bufferRequired_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.
                __queryHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetQueryInfo", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __queryHandle_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtQueryPropertyId __propertyId_native, int __bufferSize_native, nint __buffer_native, int* __bufferRequired_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenPublisherMetadata(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string publisherId, string logFilePath, int locale, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __logFilePath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(logFilePath))
                fixed (void* __publisherId_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(publisherId))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__publisherId_native, (ushort*)__logFilePath_native, locale, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenPublisherMetadata", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, ushort* __publisherId_native, ushort* __logFilePath_native, int __locale_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetPublisherMetadataProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::Microsoft.Win32.UnsafeNativeMethods.EvtPublisherMetadataPropertyId propertyId, int flags, int publisherMetadataPropertyBufferSize, nint publisherMetadataPropertyBuffer, out int publisherMetadataPropertyBufferUsed)
        {
            int __lastError;
            publisherMetadataPropertyBufferUsed = default;
            nint __publisherMetadataHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __publisherMetadataHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __publisherMetadataHandle_native__marshaller.FromManaged(publisherMetadataHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __publisherMetadataPropertyBufferUsed_native = &publisherMetadataPropertyBufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __publisherMetadataHandle_native = __publisherMetadataHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__publisherMetadataHandle_native, propertyId, flags, publisherMetadataPropertyBufferSize, publisherMetadataPropertyBuffer, __publisherMetadataPropertyBufferUsed_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.
                __publisherMetadataHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetPublisherMetadataProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtPublisherMetadataPropertyId __propertyId_native, int __flags_native, int __publisherMetadataPropertyBufferSize_native, nint __publisherMetadataPropertyBuffer_native, int* __publisherMetadataPropertyBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetObjectArraySize(global::System.Diagnostics.Eventing.Reader.EventLogHandle objectArray, out int objectArraySize)
        {
            int __lastError;
            objectArraySize = default;
            nint __objectArray_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __objectArray_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __objectArray_native__marshaller.FromManaged(objectArray);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __objectArraySize_native = &objectArraySize)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __objectArray_native = __objectArray_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__objectArray_native, __objectArraySize_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.
                __objectArray_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetObjectArraySize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __objectArray_native, int* __objectArraySize_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetObjectArrayProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle objectArray, int propertyId, int arrayIndex, int flags, int propertyValueBufferSize, nint propertyValueBuffer, out int propertyValueBufferUsed)
        {
            int __lastError;
            propertyValueBufferUsed = default;
            nint __objectArray_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __objectArray_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __objectArray_native__marshaller.FromManaged(objectArray);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __propertyValueBufferUsed_native = &propertyValueBufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __objectArray_native = __objectArray_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__objectArray_native, propertyId, arrayIndex, flags, propertyValueBufferSize, propertyValueBuffer, __propertyValueBufferUsed_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.
                __objectArray_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetObjectArrayProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __objectArray_native, int __propertyId_native, int __arrayIndex_native, int __flags_native, int __propertyValueBufferSize_native, nint __propertyValueBuffer_native, int* __propertyValueBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenEventMetadataEnum(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadata, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __publisherMetadata_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __publisherMetadata_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __publisherMetadata_native__marshaller.FromManaged(publisherMetadata);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __publisherMetadata_native = __publisherMetadata_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__publisherMetadata_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __publisherMetadata_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenEventMetadataEnum", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __publisherMetadata_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtNextEventMetadata(global::System.Diagnostics.Eventing.Reader.EventLogHandle eventMetadataEnum, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __eventMetadataEnum_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventMetadataEnum_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventMetadataEnum_native__marshaller.FromManaged(eventMetadataEnum);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventMetadataEnum_native = __eventMetadataEnum_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__eventMetadataEnum_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __eventMetadataEnum_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtNextEventMetadata", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __eventMetadataEnum_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetEventMetadataProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle eventMetadata, global::Microsoft.Win32.UnsafeNativeMethods.EvtEventMetadataPropertyId propertyId, int flags, int eventMetadataPropertyBufferSize, nint eventMetadataPropertyBuffer, out int eventMetadataPropertyBufferUsed)
        {
            int __lastError;
            eventMetadataPropertyBufferUsed = default;
            nint __eventMetadata_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventMetadata_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventMetadata_native__marshaller.FromManaged(eventMetadata);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __eventMetadataPropertyBufferUsed_native = &eventMetadataPropertyBufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventMetadata_native = __eventMetadata_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__eventMetadata_native, propertyId, flags, eventMetadataPropertyBufferSize, eventMetadataPropertyBuffer, __eventMetadataPropertyBufferUsed_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.
                __eventMetadata_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetEventMetadataProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __eventMetadata_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtEventMetadataPropertyId __propertyId_native, int __flags_native, int __eventMetadataPropertyBufferSize_native, nint __eventMetadataPropertyBuffer_native, int* __eventMetadataPropertyBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenChannelEnum(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenChannelEnum", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtNextChannelPath(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelEnum, int channelPathBufferSize, char[] channelPathBuffer, out int channelPathBufferUsed)
        {
            int __lastError;
            channelPathBufferUsed = default;
            nint __channelEnum_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __channelEnum_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __channelEnum_native__marshaller.FromManaged(channelEnum);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __channelPathBufferUsed_native = &channelPathBufferUsed)
                fixed (void* __channelPathBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(channelPathBuffer))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __channelEnum_native = __channelEnum_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__channelEnum_native, channelPathBufferSize, (char*)__channelPathBuffer_native, __channelPathBufferUsed_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.
                __channelEnum_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtNextChannelPath", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __channelEnum_native, int __channelPathBufferSize_native, char* __channelPathBuffer_native, int* __channelPathBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenPublisherEnum(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenPublisherEnum", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtNextPublisherId(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherEnum, int publisherIdBufferSize, char[] publisherIdBuffer, out int publisherIdBufferUsed)
        {
            int __lastError;
            publisherIdBufferUsed = default;
            nint __publisherEnum_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __publisherEnum_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __publisherEnum_native__marshaller.FromManaged(publisherEnum);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __publisherIdBufferUsed_native = &publisherIdBufferUsed)
                fixed (void* __publisherIdBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(publisherIdBuffer))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __publisherEnum_native = __publisherEnum_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__publisherEnum_native, publisherIdBufferSize, (char*)__publisherIdBuffer_native, __publisherIdBufferUsed_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.
                __publisherEnum_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtNextPublisherId", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __publisherEnum_native, int __publisherIdBufferSize_native, char* __publisherIdBuffer_native, int* __publisherIdBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenChannelConfig(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string channelPath, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __channelPath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(channelPath))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__channelPath_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenChannelConfig", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, ushort* __channelPath_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtSaveChannelConfig(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelConfig, int flags)
        {
            int __lastError;
            nint __channelConfig_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __channelConfig_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __channelConfig_native__marshaller.FromManaged(channelConfig);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __channelConfig_native = __channelConfig_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__channelConfig_native, flags);
                    __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.
                __channelConfig_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtSaveChannelConfig", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __channelConfig_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtSetChannelConfigProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelConfig, global::Microsoft.Win32.UnsafeNativeMethods.EvtChannelConfigPropertyId propertyId, int flags, ref global::Microsoft.Win32.UnsafeNativeMethods.EvtVariant propertyValue)
        {
            int __lastError;
            nint __channelConfig_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __channelConfig_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __channelConfig_native__marshaller.FromManaged(channelConfig);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Microsoft.Win32.UnsafeNativeMethods.EvtVariant* __propertyValue_native = &propertyValue)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __channelConfig_native = __channelConfig_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__channelConfig_native, propertyId, flags, __propertyValue_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.
                __channelConfig_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtSetChannelConfigProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __channelConfig_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtChannelConfigPropertyId __propertyId_native, int __flags_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtVariant* __propertyValue_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetChannelConfigProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelConfig, global::Microsoft.Win32.UnsafeNativeMethods.EvtChannelConfigPropertyId propertyId, int flags, int propertyValueBufferSize, nint propertyValueBuffer, out int propertyValueBufferUsed)
        {
            int __lastError;
            propertyValueBufferUsed = default;
            nint __channelConfig_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __channelConfig_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __channelConfig_native__marshaller.FromManaged(channelConfig);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __propertyValueBufferUsed_native = &propertyValueBufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __channelConfig_native = __channelConfig_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__channelConfig_native, propertyId, flags, propertyValueBufferSize, propertyValueBuffer, __propertyValueBufferUsed_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.
                __channelConfig_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetChannelConfigProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __channelConfig_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtChannelConfigPropertyId __propertyId_native, int __flags_native, int __propertyValueBufferSize_native, nint __propertyValueBuffer_native, int* __propertyValueBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenLog(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string path, global::System.Diagnostics.Eventing.Reader.PathType flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __session_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __path_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(path))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__path_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenLog", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __session_native, ushort* __path_native, global::System.Diagnostics.Eventing.Reader.PathType __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtGetLogInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle log, global::Microsoft.Win32.UnsafeNativeMethods.EvtLogPropertyId propertyId, int propertyValueBufferSize, nint propertyValueBuffer, out int propertyValueBufferUsed)
        {
            int __lastError;
            propertyValueBufferUsed = default;
            nint __log_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __log_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __log_native__marshaller.FromManaged(log);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __propertyValueBufferUsed_native = &propertyValueBufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __log_native = __log_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__log_native, propertyId, propertyValueBufferSize, propertyValueBuffer, __propertyValueBufferUsed_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.
                __log_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtGetLogInfo", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __log_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtLogPropertyId __propertyId_native, int __propertyValueBufferSize_native, nint __propertyValueBuffer_native, int* __propertyValueBufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtExportLog(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string channelPath, string query, string targetFilePath, int flags)
        {
            int __lastError;
            nint __session_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __targetFilePath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(targetFilePath))
                fixed (void* __query_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(query))
                fixed (void* __channelPath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(channelPath))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__channelPath_native, (ushort*)__query_native, (ushort*)__targetFilePath_native, flags);
                    __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.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtExportLog", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __session_native, ushort* __channelPath_native, ushort* __query_native, ushort* __targetFilePath_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtArchiveExportedLog(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string logFilePath, int locale, int flags)
        {
            int __lastError;
            nint __session_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __logFilePath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(logFilePath))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__logFilePath_native, locale, flags);
                    __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.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtArchiveExportedLog", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __session_native, ushort* __logFilePath_native, int __locale_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtClearLog(global::System.Diagnostics.Eventing.Reader.EventLogHandle session, string channelPath, string targetFilePath, int flags)
        {
            int __lastError;
            nint __session_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __session_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __session_native__marshaller.FromManaged(session);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __targetFilePath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(targetFilePath))
                fixed (void* __channelPath_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(channelPath))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __session_native = __session_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__session_native, (ushort*)__channelPath_native, (ushort*)__targetFilePath_native, flags);
                    __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.
                __session_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtClearLog", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __session_native, ushort* __channelPath_native, ushort* __targetFilePath_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtCreateRenderContext(int valuePathsCount, string[] valuePaths, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderContextFlags flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::System.IntPtr* __valuePaths_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<string, global::System.IntPtr>.ManagedToUnmanagedIn __valuePaths_native__marshaller = new();
            int __valuePaths_native__lastIndexMarshalled = 0;
            try
            {
                // Marshal - Convert managed data to native data.
                __valuePaths_native__marshaller.FromManaged(valuePaths, stackalloc global::System.IntPtr[global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<string, global::System.IntPtr>.ManagedToUnmanagedIn.BufferSize]);
                {
                    global::System.ReadOnlySpan<string> __valuePaths_native__managedSpan = __valuePaths_native__marshaller.GetManagedValuesSource();
                    global::System.Span<global::System.IntPtr> __valuePaths_native__nativeSpan = __valuePaths_native__marshaller.GetUnmanagedValuesDestination();
                    for (int __i0 = 0; __i0 < __valuePaths_native__managedSpan.Length; ++__i0, ++__valuePaths_native__lastIndexMarshalled)
                    {
                        ushort* __valuePaths_native__nativeSpan____i0_exactType = (ushort*)__valuePaths_native__nativeSpan[__i0];
                        __valuePaths_native__nativeSpan____i0_exactType = (ushort*)global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.ConvertToUnmanaged(__valuePaths_native__managedSpan[__i0]);
                        __valuePaths_native__nativeSpan[__i0] = (global::System.IntPtr)__valuePaths_native__nativeSpan____i0_exactType;
                    }
                }
 
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __valuePaths_native__unused = __valuePaths_native__marshaller)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __valuePaths_native = __valuePaths_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(valuePathsCount, __valuePaths_native, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                    _ = __valuePaths_native__lastIndexMarshalled;
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                {
                    global::System.ReadOnlySpan<global::System.IntPtr> __valuePaths_native__nativeSpan = __valuePaths_native__marshaller.GetUnmanagedValuesDestination();
                    for (int __i0 = 0; __i0 < __valuePaths_native__lastIndexMarshalled; ++__i0)
                    {
                        ushort* __valuePaths_native__nativeSpan____i0_exactType = (ushort*)__valuePaths_native__nativeSpan[__i0];
                        global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.Free(__valuePaths_native__nativeSpan____i0_exactType);
                    }
                }
 
                __valuePaths_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtCreateRenderContext", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(int __valuePathsCount_native, global::System.IntPtr* __valuePaths_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderContextFlags __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtRender(global::System.Diagnostics.Eventing.Reader.EventLogHandle context, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderFlags flags, int buffSize, char[] buffer, out int buffUsed, out int propCount)
        {
            int __lastError;
            buffUsed = default;
            propCount = default;
            nint __context_native = default;
            nint __eventHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __context_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                __context_native__marshaller.FromManaged(context);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __propCount_native = &propCount)
                fixed (int* __buffUsed_native = &buffUsed)
                fixed (void* __buffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(buffer))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    __context_native = __context_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__context_native, __eventHandle_native, flags, buffSize, (char*)__buffer_native, __buffUsed_native, __propCount_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.
                __eventHandle_native__marshaller.Free();
                __context_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtRender", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __context_native, nint __eventHandle_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderFlags __flags_native, int __buffSize_native, char* __buffer_native, int* __buffUsed_native, int* __propCount_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtRender(global::System.Diagnostics.Eventing.Reader.EventLogHandle context, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderFlags flags, int buffSize, nint buffer, out int buffUsed, out int propCount)
        {
            int __lastError;
            buffUsed = default;
            propCount = default;
            nint __context_native = default;
            nint __eventHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __context_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                __context_native__marshaller.FromManaged(context);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __propCount_native = &propCount)
                fixed (int* __buffUsed_native = &buffUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    __context_native = __context_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__context_native, __eventHandle_native, flags, buffSize, buffer, __buffUsed_native, __propCount_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.
                __eventHandle_native__marshaller.Free();
                __context_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtRender", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __context_native, nint __eventHandle_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtRenderFlags __flags_native, int __buffSize_native, nint __buffer_native, int* __buffUsed_native, int* __propCount_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtFormatMessage(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, uint messageId, int valueCount, global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant[] values, global::Microsoft.Win32.UnsafeNativeMethods.EvtFormatMessageFlags flags, int bufferSize, global::System.Span<char> buffer, out int bufferUsed)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            bufferUsed = default;
            nint __publisherMetadataHandle_native = default;
            nint __eventHandle_native = default;
            global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native* __values_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant, global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native>.ManagedToUnmanagedIn __values_native__marshaller = new();
            int __values_native__lastIndexMarshalled = 0;
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __publisherMetadataHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __values_native__marshaller.FromManaged(values, stackalloc global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native[global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant, global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native>.ManagedToUnmanagedIn.BufferSize]);
                {
                    global::System.ReadOnlySpan<global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant> __values_native__managedSpan = __values_native__marshaller.GetManagedValuesSource();
                    global::System.Span<global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native> __values_native__nativeSpan = __values_native__marshaller.GetUnmanagedValuesDestination();
                    for (int __i0 = 0; __i0 < __values_native__managedSpan.Length; ++__i0, ++__values_native__lastIndexMarshalled)
                    {
                        __values_native__nativeSpan[__i0] = global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.ConvertToUnmanaged(__values_native__managedSpan[__i0]);
                    }
                }
 
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                __publisherMetadataHandle_native__marshaller.FromManaged(publisherMetadataHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __bufferUsed_native = &bufferUsed)
                fixed (void* __buffer_native = &global::System.Runtime.InteropServices.Marshalling.SpanMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(buffer))
                fixed (void* __values_native__unused = __values_native__marshaller)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __values_native = __values_native__marshaller.ToUnmanaged();
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    __publisherMetadataHandle_native = __publisherMetadataHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__publisherMetadataHandle_native, __eventHandle_native, messageId, valueCount, __values_native, flags, bufferSize, (char*)__buffer_native, __bufferUsed_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    _ = __values_native__lastIndexMarshalled;
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                {
                    global::System.ReadOnlySpan<global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native> __values_native__nativeSpan = __values_native__marshaller.GetUnmanagedValuesDestination();
                    for (int __i0 = 0; __i0 < __values_native__lastIndexMarshalled; ++__i0)
                    {
                        global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Free(__values_native__nativeSpan[__i0]);
                    }
                }
 
                __values_native__marshaller.Free();
                __eventHandle_native__marshaller.Free();
                __publisherMetadataHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtFormatMessage", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, nint __eventHandle_native, uint __messageId_native, int __valueCount_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant.Marshaller.Native* __values_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtFormatMessageFlags __flags_native, int __bufferSize_native, char* __buffer_native, int* __bufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtFormatMessageBuffer(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, uint messageId, int valueCount, nint values, global::Microsoft.Win32.UnsafeNativeMethods.EvtFormatMessageFlags flags, int bufferSize, nint buffer, out int bufferUsed)
        {
            int __lastError;
            bufferUsed = default;
            nint __publisherMetadataHandle_native = default;
            nint __eventHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __publisherMetadataHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                __publisherMetadataHandle_native__marshaller.FromManaged(publisherMetadataHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __bufferUsed_native = &bufferUsed)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    __publisherMetadataHandle_native = __publisherMetadataHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__publisherMetadataHandle_native, __eventHandle_native, messageId, valueCount, values, flags, bufferSize, buffer, __bufferUsed_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.
                __eventHandle_native__marshaller.Free();
                __publisherMetadataHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtFormatMessage", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, nint __eventHandle_native, uint __messageId_native, int __valueCount_native, nint __values_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtFormatMessageFlags __flags_native, int __bufferSize_native, nint __buffer_native, int* __bufferUsed_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenSession(global::Microsoft.Win32.UnsafeNativeMethods.EvtLoginClass loginClass, ref global::Microsoft.Win32.UnsafeNativeMethods.EvtRpcLogin login, int timeout, int flags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.UnsafeNativeMethods.EvtRpcLogin.Marshaller.ValueMarshaller.Native __login_native = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::Microsoft.Win32.UnsafeNativeMethods.EvtRpcLogin.Marshaller.ValueMarshaller __login_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __login_native__marshaller.FromManaged(login);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __login_native = __login_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(loginClass, &__login_native, timeout, flags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                __login_native__marshaller.FromUnmanaged(__login_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
                login = __login_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __login_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtOpenSession", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(global::Microsoft.Win32.UnsafeNativeMethods.EvtLoginClass __loginClass_native, global::Microsoft.Win32.UnsafeNativeMethods.EvtRpcLogin.Marshaller.ValueMarshaller.Native* __login_native, int __timeout_native, int __flags_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtCreateBookmark(string bookmarkXml)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::System.Diagnostics.Eventing.Reader.EventLogHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __bookmarkXml_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(bookmarkXml))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke((ushort*)__bookmarkXml_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtCreateBookmark", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(ushort* __bookmarkXml_native);
        }
    }
}
namespace Microsoft.Win32
{
    internal static unsafe partial class UnsafeNativeMethods
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool EvtUpdateBookmark(global::System.Diagnostics.Eventing.Reader.EventLogHandle bookmark, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle)
        {
            int __lastError;
            nint __bookmark_native = default;
            nint __eventHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __eventHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Diagnostics.Eventing.Reader.EventLogHandle>.ManagedToUnmanagedIn __bookmark_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __eventHandle_native__marshaller.FromManaged(eventHandle);
                __bookmark_native__marshaller.FromManaged(bookmark);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __eventHandle_native = __eventHandle_native__marshaller.ToUnmanaged();
                    __bookmark_native = __bookmark_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__bookmark_native, __eventHandle_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.
                __eventHandle_native__marshaller.Free();
                __bookmark_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("wevtapi.dll", EntryPoint = "EvtUpdateBookmark", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bookmark_native, nint __eventHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CloseHandle(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("kernel32.dll", EntryPoint = "CloseHandle", 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]
        public static partial bool ClearEventLog(global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle hEventLog, string lpBackupFileName)
        {
            int __lastError;
            nint __hEventLog_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpBackupFileName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpBackupFileName))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, (ushort*)__lpBackupFileName_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.
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ClearEventLogW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, ushort* __lpBackupFileName_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 CloseEventLog(nint hEventLog)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hEventLog);
                __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 = "CloseEventLog", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_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 DeregisterEventSource(nint hEventLog)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hEventLog);
                __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 = "DeregisterEventSource", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_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 GetNumberOfEventLogRecords(global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle hEventLog, out int NumberOfRecords)
        {
            int __lastError;
            NumberOfRecords = default;
            nint __hEventLog_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __NumberOfRecords_native = &NumberOfRecords)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, __NumberOfRecords_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.
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetNumberOfEventLogRecords", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, int* __NumberOfRecords_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 GetOldestEventLogRecord(global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle hEventLog, out int OldestRecord)
        {
            int __lastError;
            OldestRecord = default;
            nint __hEventLog_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __OldestRecord_native = &OldestRecord)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, __OldestRecord_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.
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetOldestEventLogRecord", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, int* __OldestRecord_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 int LookupAccountSid(string lpSystemName, byte[] Sid, char* Name, ref int cchName, char* ReferencedDomainName, ref int cchReferencedDomainName, out int peUse)
        {
            int __lastError;
            peUse = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (int* __peUse_native = &peUse)
            fixed (int* __cchReferencedDomainName_native = &cchReferencedDomainName)
            fixed (int* __cchName_native = &cchName)
            fixed (void* __Sid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(Sid))
            fixed (void* __lpSystemName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSystemName))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__lpSystemName_native, (byte*)__Sid_native, Name, __cchName_native, ReferencedDomainName, __cchReferencedDomainName_native, __peUse_native);
                __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 = "LookupAccountSidW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __lpSystemName_native, byte* __Sid_native, char* __Name_native, int* __cchName_native, char* __ReferencedDomainName_native, int* __cchReferencedDomainName_native, int* __peUse_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 NotifyChangeEventLog(global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle hEventLog, global::Microsoft.Win32.SafeHandles.SafeWaitHandle hEvent)
        {
            int __lastError;
            nint __hEventLog_native = default;
            nint __hEvent_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeWaitHandle>.ManagedToUnmanagedIn __hEvent_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEvent_native__marshaller.FromManaged(hEvent);
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEvent_native = __hEvent_native__marshaller.ToUnmanaged();
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, __hEvent_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.
                __hEvent_native__marshaller.Free();
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "NotifyChangeEventLog", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, nint __hEvent_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 global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle OpenEventLog(string lpUNCServerName, string lpSourceName)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpSourceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSourceName))
                fixed (void* __lpUNCServerName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpUNCServerName))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke((ushort*)__lpUNCServerName_native, (ushort*)__lpSourceName_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenEventLogW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __lpUNCServerName_native, ushort* __lpSourceName_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 ReadEventLog(global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle hEventLog, int dwReadFlags, int dwRecordOffset, byte[] lpBuffer, int nNumberOfBytesRead, out int pnBytesRead, out int pnMinNumberOfBytesNeeded)
        {
            int __lastError;
            pnBytesRead = default;
            pnMinNumberOfBytesNeeded = default;
            nint __hEventLog_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogReadHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pnMinNumberOfBytesNeeded_native = &pnMinNumberOfBytesNeeded)
                fixed (int* __pnBytesRead_native = &pnBytesRead)
                fixed (void* __lpBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpBuffer))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, dwReadFlags, dwRecordOffset, (byte*)__lpBuffer_native, nNumberOfBytesRead, __pnBytesRead_native, __pnMinNumberOfBytesNeeded_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.
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ReadEventLogW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, int __dwReadFlags_native, int __dwRecordOffset_native, byte* __lpBuffer_native, int __nNumberOfBytesRead_native, int* __pnBytesRead_native, int* __pnMinNumberOfBytesNeeded_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 global::Microsoft.Win32.SafeHandles.SafeEventLogWriteHandle RegisterEventSource(string lpUNCServerName, string lpSourceName)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeEventLogWriteHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogWriteHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpSourceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSourceName))
                fixed (void* __lpUNCServerName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpUNCServerName))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke((ushort*)__lpUNCServerName_native, (ushort*)__lpSourceName_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegisterEventSourceW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __lpUNCServerName_native, ushort* __lpSourceName_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 ReportEvent(global::Microsoft.Win32.SafeHandles.SafeEventLogWriteHandle hEventLog, short wType, ushort wcategory, uint dwEventID, byte[] lpUserSid, short wNumStrings, int dwDataSize, nint lpStrings, byte[] lpRawData)
        {
            int __lastError;
            nint __hEventLog_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeEventLogWriteHandle>.ManagedToUnmanagedIn __hEventLog_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hEventLog_native__marshaller.FromManaged(hEventLog);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpRawData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpRawData))
                fixed (void* __lpUserSid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpUserSid))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hEventLog_native = __hEventLog_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hEventLog_native, wType, wcategory, dwEventID, (byte*)__lpUserSid_native, wNumStrings, dwDataSize, lpStrings, (byte*)__lpRawData_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.
                __hEventLog_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ReportEventW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hEventLog_native, short __wType_native, ushort __wcategory_native, uint __dwEventID_native, byte* __lpUserSid_native, short __wNumStrings_native, int __dwDataSize_native, nint __lpStrings_native, byte* __lpRawData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial int FormatMessage(int dwFlags, global::Microsoft.Win32.SafeHandles.SafeLibraryHandle lpSource, uint dwMessageId, int dwLanguageId, char[] lpBuffer, int nSize, nint[] arguments)
        {
            int __lastError;
            nint __lpSource_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedIn __lpSource_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpSource_native__marshaller.FromManaged(lpSource);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __arguments_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<nint, nint>.ManagedToUnmanagedIn.GetPinnableReference(arguments))
                fixed (void* __lpBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(lpBuffer))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpSource_native = __lpSource_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(dwFlags, __lpSource_native, dwMessageId, dwLanguageId, (char*)__lpBuffer_native, nSize, (nint*)__arguments_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpSource_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FormatMessageW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(int __dwFlags_native, nint __lpSource_native, uint __dwMessageId_native, int __dwLanguageId_native, char* __lpBuffer_native, int __nSize_native, nint* __arguments_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool FreeLibrary(nint hModule)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hModule);
                __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("kernel32.dll", EntryPoint = "FreeLibrary", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hModule_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial global::Microsoft.Win32.SafeHandles.SafeLibraryHandle LoadLibraryExW(string lpwLibFileName, nint hFile, uint dwFlags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeLibraryHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpwLibFileName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpwLibFileName))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke((ushort*)__lpwLibFileName_native, hFile, dwFlags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "LoadLibraryExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __lpwLibFileName_native, nint __hFile_native, uint __dwFlags_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int WaitForSingleObject(global::Microsoft.Win32.SafeHandles.SafeWaitHandle handle, int timeout)
        {
            int __lastError;
            nint __handle_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeWaitHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__handle_native, timeout);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "WaitForSingleObject", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native, int __timeout_native);
        }
    }
}