File: _generated\658\LibraryImports.g.cs
Web Access
Project: src\winforms\src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj (System.Windows.Forms.Primitives)
// <auto-generated/>
namespace System.Windows.Forms.Animation
{
    internal static partial class HighPrecisionTimer
    {
        private static partial class NativeMethods
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.38206")]
            [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
            internal static partial global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle CreateWaitableTimerEx(nint timerAttributes, string timerName, uint flags, uint desiredAccess)
            {
                unsafe
                {
                    int __lastError;
                    bool __invokeSucceeded = default;
                    global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle __retVal = default;
                    nint __retVal_native = default;
                    // Setup - Perform required setup.
                    global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
                    try
                    {
                        // Pin - Pin data in preparation for calling the P/Invoke.
                        fixed (void* __timerName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(timerName))
                        {
                            global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                            __retVal_native = __PInvoke(timerAttributes, (ushort*)__timerName_native, flags, desiredAccess);
                            __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 = "CreateWaitableTimerExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                    static extern unsafe nint __PInvoke(nint __timerAttributes_native, ushort* __timerName_native, uint __flags_native, uint __desiredAccess_native);
                }
            }
        }
    }
}
namespace System.Windows.Forms.Animation
{
    internal static partial class HighPrecisionTimer
    {
        private static partial class NativeMethods
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.38206")]
            [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
            internal static partial bool SetWaitableTimer(global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle timer, in long dueTime, int period, nint completionRoutine, nint argumentToCompletionRoutine, bool resume)
            {
                unsafe
                {
                    int __lastError;
                    nint __timer_native = default;
                    int __resume_native = default;
                    bool __retVal = default;
                    int __retVal_native = default;
                    // Setup - Perform required setup.
                    global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle>.ManagedToUnmanagedIn __timer_native__marshaller = new();
                    try
                    {
                        // Marshal - Convert managed data to native data.
                        __resume_native = (int)(resume ? 1 : 0);
                        __timer_native__marshaller.FromManaged(timer);
                        // Pin - Pin data in preparation for calling the P/Invoke.
                        fixed (long* __dueTime_native = &dueTime)
                        {
                            // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                            __timer_native = __timer_native__marshaller.ToUnmanaged();
                            global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                            __retVal_native = __PInvoke(__timer_native, __dueTime_native, period, completionRoutine, argumentToCompletionRoutine, __resume_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.
                        __timer_native__marshaller.Free();
                    }
 
                    global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                    return __retVal;
                    // Local P/Invoke
                    [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "SetWaitableTimer", ExactSpelling = true)]
                    static extern unsafe int __PInvoke(nint __timer_native, long* __dueTime_native, int __period_native, nint __completionRoutine_native, nint __argumentToCompletionRoutine_native, int __resume_native);
                }
            }
        }
    }
}
namespace System.Windows.Forms.Animation
{
    internal static partial class HighPrecisionTimer
    {
        private static partial class NativeMethods
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.38206")]
            [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
            internal static partial uint WaitForSingleObject(global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle handle, uint milliseconds)
            {
                unsafe
                {
                    int __lastError;
                    nint __handle_native = default;
                    uint __retVal = default;
                    // Setup - Perform required setup.
                    global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Windows.Forms.Animation.HighPrecisionTimer.SafeWaitableTimerHandle>.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, milliseconds);
                            __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 uint __PInvoke(nint __handle_native, uint __milliseconds_native);
                }
            }
        }
    }
}
namespace System.Windows.Forms.Animation
{
    internal static partial class HighPrecisionTimer
    {
        private static partial class NativeMethods
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.38206")]
            [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
            internal static partial bool CloseHandle(nint handle)
            {
                unsafe
                {
                    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);
                }
            }
        }
    }
}