File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\runtime\src\libraries\System.Net.Http.WinHttpHandler\src\System.Net.Http.WinHttpHandler.csproj (System.Net.Http.WinHttpHandler)
// <auto-generated/>
internal static partial class Interop
{
    internal static partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static unsafe partial global::Interop.Crypt32.CERT_CONTEXT* CertEnumCertificatesInStore(nint hCertStore, global::Interop.Crypt32.CERT_CONTEXT* pPrevCertContext)
        {
            unsafe
            {
                int __lastError;
                global::Interop.Crypt32.CERT_CONTEXT* __retVal;
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(hCertStore, pPrevCertContext);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertEnumCertificatesInStore", ExactSpelling = true)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe global::Interop.Crypt32.CERT_CONTEXT* __PInvoke(nint __hCertStore_native, global::Interop.Crypt32.CERT_CONTEXT* __pPrevCertContext_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertFreeCertificateContext(nint pCertContext)
        {
            unsafe
            {
                int __lastError;
                bool __retVal;
                int __retVal_native;
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(pCertContext);
                    __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("crypt32.dll", EntryPoint = "CertFreeCertificateContext", ExactSpelling = true)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __pCertContext_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertVerifyCertificateChainPolicy(nint pszPolicyOID, global::Microsoft.Win32.SafeHandles.SafeX509ChainHandle pChainContext, ref global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA pPolicyPara, ref global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS pPolicyStatus)
        {
            unsafe
            {
                int __lastError;
                nint __pChainContext_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509ChainHandle>.ManagedToUnmanagedIn __pChainContext_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __pChainContext_native__marshaller.FromManaged(pChainContext);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS* __pPolicyStatus_native = &pPolicyStatus)
                    fixed (global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA* __pPolicyPara_native = &pPolicyPara)
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __pChainContext_native = __pChainContext_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(pszPolicyOID, __pChainContext_native, __pPolicyPara_native, __pPolicyStatus_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.
                    __pChainContext_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertVerifyCertificateChainPolicy", ExactSpelling = true)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __pszPolicyOID_native, nint __pChainContext_native, global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA* __pPolicyPara_native, global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS* __pPolicyStatus_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        private static unsafe partial int FormatMessage(int dwFlags, nint lpSource, uint dwMessageId, int dwLanguageId, void* lpBuffer, int nSize, nint arguments)
        {
            unsafe
            {
                int __lastError;
                int __retVal;
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, arguments);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FormatMessageW", ExactSpelling = true)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(int __dwFlags_native, nint __lpSource_native, uint __dwMessageId_native, int __dwLanguageId_native, void* __lpBuffer_native, int __nSize_native, nint __arguments_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nint GetModuleHandle(string moduleName)
        {
            unsafe
            {
                int __lastError;
                nint __retVal;
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __moduleName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(moduleName))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke((ushort*)__moduleName_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("kernel32.dll", EntryPoint = "GetModuleHandleW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe nint __PInvoke(ushort* __moduleName_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial global::Interop.WinHttp.SafeWinHttpHandle WinHttpOpen(nint userAgent, uint accessType, string proxyName, string proxyBypass, int flags)
        {
            unsafe
            {
                int __lastError;
                bool __invokeSucceeded = default;
                global::Interop.WinHttp.SafeWinHttpHandle __retVal = default;
                nint __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
                try
                {
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (void* __proxyBypass_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(proxyBypass))
                    fixed (void* __proxyName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(proxyName))
                    {
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(userAgent, accessType, (ushort*)__proxyName_native, (ushort*)__proxyBypass_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();
                    }
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpOpen", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe nint __PInvoke(nint __userAgent_native, uint __accessType_native, ushort* __proxyName_native, ushort* __proxyBypass_native, int __flags_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpCloseHandle(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("winhttp.dll", EntryPoint = "WinHttpCloseHandle", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial global::Interop.WinHttp.SafeWinHttpHandle WinHttpConnect(global::Interop.WinHttp.SafeWinHttpHandle sessionHandle, string serverName, ushort serverPort, uint reserved)
        {
            unsafe
            {
                int __lastError;
                bool __invokeSucceeded = default;
                nint __sessionHandle_native = default;
                global::Interop.WinHttp.SafeWinHttpHandle __retVal = default;
                nint __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __sessionHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __sessionHandle_native__marshaller.FromManaged(sessionHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (void* __serverName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serverName))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __sessionHandle_native = __sessionHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__sessionHandle_native, (ushort*)__serverName_native, serverPort, reserved);
                        __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.
                    __sessionHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpConnect", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe nint __PInvoke(nint __sessionHandle_native, ushort* __serverName_native, ushort __serverPort_native, uint __reserved_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial global::Interop.WinHttp.SafeWinHttpHandle WinHttpOpenRequest(global::Interop.WinHttp.SafeWinHttpHandle connectHandle, string verb, string objectName, string version, string referrer, string acceptTypes, uint flags)
        {
            unsafe
            {
                int __lastError;
                bool __invokeSucceeded = default;
                nint __connectHandle_native = default;
                global::Interop.WinHttp.SafeWinHttpHandle __retVal = default;
                nint __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __connectHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __connectHandle_native__marshaller.FromManaged(connectHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (void* __acceptTypes_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(acceptTypes))
                    fixed (void* __referrer_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(referrer))
                    fixed (void* __version_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(version))
                    fixed (void* __objectName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(objectName))
                    fixed (void* __verb_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(verb))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __connectHandle_native = __connectHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__connectHandle_native, (ushort*)__verb_native, (ushort*)__objectName_native, (ushort*)__version_native, (ushort*)__referrer_native, (ushort*)__acceptTypes_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.
                    __connectHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpOpenRequest", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe nint __PInvoke(nint __connectHandle_native, ushort* __verb_native, ushort* __objectName_native, ushort* __version_native, ushort* __referrer_native, ushort* __acceptTypes_native, uint __flags_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpAddRequestHeaders(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, global::System.Text.StringBuilder headers, uint headersLength, uint modifiers)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                void* __headers_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __headers_native = (void*)global::Interop.WinHttp.SimpleStringBufferMarshaller.ConvertToUnmanaged(headers);
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, __headers_native, headersLength, modifiers);
                        __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.
                    global::Interop.WinHttp.SimpleStringBufferMarshaller.Free(__headers_native);
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpAddRequestHeaders", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, void* __headers_native, uint __headersLength_native, uint __modifiers_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpAddRequestHeaders(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, string headers, uint headersLength, uint modifiers)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (void* __headers_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(headers))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, (ushort*)__headers_native, headersLength, modifiers);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpAddRequestHeaders", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, ushort* __headers_native, uint __headersLength_native, uint __modifiers_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpSendRequest(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, nint headers, uint headersLength, nint optional, uint optionalLength, uint totalLength, nint context)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, headers, headersLength, optional, optionalLength, totalLength, context);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpSendRequest", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, nint __headers_native, uint __headersLength_native, nint __optional_native, uint __optionalLength_native, uint __totalLength_native, nint __context_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpReceiveResponse(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, nint reserved)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, reserved);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpReceiveResponse", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, nint __reserved_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryDataAvailable(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, nint parameterIgnoredAndShouldBeNullForAsync)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, parameterIgnoredAndShouldBeNullForAsync);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpQueryDataAvailable", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, nint __parameterIgnoredAndShouldBeNullForAsync_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpReadData(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, nint buffer, uint bufferSize, nint parameterIgnoredAndShouldBeNullForAsync)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, buffer, bufferSize, parameterIgnoredAndShouldBeNullForAsync);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpReadData", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, nint __buffer_native, uint __bufferSize_native, nint __parameterIgnoredAndShouldBeNullForAsync_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryHeaders(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, uint infoLevel, string name, nint buffer, ref uint bufferLength, ref uint index)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __index_native = &index)
                    fixed (uint* __bufferLength_native = &bufferLength)
                    fixed (void* __name_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(name))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, infoLevel, (ushort*)__name_native, buffer, __bufferLength_native, __index_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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpQueryHeaders", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, uint __infoLevel_native, ushort* __name_native, nint __buffer_native, uint* __bufferLength_native, uint* __index_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryHeaders(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, uint infoLevel, string name, ref uint number, ref uint bufferLength, nint index)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __bufferLength_native = &bufferLength)
                    fixed (uint* __number_native = &number)
                    fixed (void* __name_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(name))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, infoLevel, (ushort*)__name_native, __number_native, __bufferLength_native, index);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpQueryHeaders", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, uint __infoLevel_native, ushort* __name_native, uint* __number_native, uint* __bufferLength_native, nint __index_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryOption(global::Interop.WinHttp.SafeWinHttpHandle handle, uint option, ref nint buffer, ref uint bufferSize)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __handle_native__marshaller.FromManaged(handle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __bufferSize_native = &bufferSize)
                    fixed (nint* __buffer_native = &buffer)
                    {
                        // 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, option, __buffer_native, __bufferSize_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("winhttp.dll", EntryPoint = "WinHttpQueryOption", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, uint __option_native, nint* __buffer_native, uint* __bufferSize_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryOption(global::Interop.WinHttp.SafeWinHttpHandle handle, uint option, nint buffer, ref uint bufferSize)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __handle_native__marshaller.FromManaged(handle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __bufferSize_native = &bufferSize)
                    {
                        // 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, option, buffer, __bufferSize_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("winhttp.dll", EntryPoint = "WinHttpQueryOption", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, uint __option_native, nint __buffer_native, uint* __bufferSize_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryOption(global::Interop.WinHttp.SafeWinHttpHandle handle, uint option, ref uint buffer, ref uint bufferSize)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __handle_native__marshaller.FromManaged(handle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __bufferSize_native = &bufferSize)
                    fixed (uint* __buffer_native = &buffer)
                    {
                        // 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, option, __buffer_native, __bufferSize_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("winhttp.dll", EntryPoint = "WinHttpQueryOption", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, uint __option_native, uint* __buffer_native, uint* __bufferSize_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpWriteData(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, nint buffer, uint bufferSize, nint parameterIgnoredAndShouldBeNullForAsync)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, buffer, bufferSize, parameterIgnoredAndShouldBeNullForAsync);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpWriteData", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, nint __buffer_native, uint __bufferSize_native, nint __parameterIgnoredAndShouldBeNullForAsync_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpSetOption(global::Interop.WinHttp.SafeWinHttpHandle handle, uint option, ref uint optionData, uint optionLength)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __handle_native__marshaller.FromManaged(handle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __optionData_native = &optionData)
                    {
                        // 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, option, __optionData_native, optionLength);
                        __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("winhttp.dll", EntryPoint = "WinHttpSetOption", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, uint __option_native, uint* __optionData_native, uint __optionLength_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpSetOption(global::Interop.WinHttp.SafeWinHttpHandle handle, uint option, nint optionData, uint optionLength)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.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, option, optionData, optionLength);
                        __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("winhttp.dll", EntryPoint = "WinHttpSetOption", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, uint __option_native, nint __optionData_native, uint __optionLength_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpSetCredentials(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, uint authTargets, uint authScheme, string userName, string password, nint reserved)
        {
            unsafe
            {
                int __lastError;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (void* __password_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(password))
                    fixed (void* __userName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(userName))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, authTargets, authScheme, (ushort*)__userName_native, (ushort*)__password_native, reserved);
                        __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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpSetCredentials", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, uint __authTargets_native, uint __authScheme_native, ushort* __userName_native, ushort* __password_native, nint __reserved_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpQueryAuthSchemes(global::Interop.WinHttp.SafeWinHttpHandle requestHandle, out uint supportedSchemes, out uint firstScheme, out uint authTarget)
        {
            unsafe
            {
                int __lastError;
                supportedSchemes = default;
                firstScheme = default;
                authTarget = default;
                nint __requestHandle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __requestHandle_native__marshaller.FromManaged(requestHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (uint* __authTarget_native = &authTarget)
                    fixed (uint* __firstScheme_native = &firstScheme)
                    fixed (uint* __supportedSchemes_native = &supportedSchemes)
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __requestHandle_native = __requestHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__requestHandle_native, __supportedSchemes_native, __firstScheme_native, __authTarget_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.
                    __requestHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpQueryAuthSchemes", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __requestHandle_native, uint* __supportedSchemes_native, uint* __firstScheme_native, uint* __authTarget_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpSetTimeouts(global::Interop.WinHttp.SafeWinHttpHandle handle, int resolveTimeout, int connectTimeout, int sendTimeout, int receiveTimeout)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.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, resolveTimeout, connectTimeout, sendTimeout, receiveTimeout);
                        __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("winhttp.dll", EntryPoint = "WinHttpSetTimeouts", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __handle_native, int __resolveTimeout_native, int __connectTimeout_native, int __sendTimeout_native, int __receiveTimeout_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpGetIEProxyConfigForCurrentUser(out global::Interop.WinHttp.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig)
        {
            unsafe
            {
                int __lastError;
                proxyConfig = default;
                bool __retVal;
                int __retVal_native;
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.WinHttp.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* __proxyConfig_native = &proxyConfig)
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__proxyConfig_native);
                    __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("winhttp.dll", EntryPoint = "WinHttpGetIEProxyConfigForCurrentUser", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(global::Interop.WinHttp.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* __proxyConfig_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool WinHttpGetProxyForUrl(global::Interop.WinHttp.SafeWinHttpHandle sessionHandle, string url, ref global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions, out global::Interop.WinHttp.WINHTTP_PROXY_INFO proxyInfo)
        {
            unsafe
            {
                int __lastError;
                proxyInfo = default;
                nint __sessionHandle_native = default;
                global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Native __autoProxyOptions_native = default;
                bool __retVal = default;
                int __retVal_native = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __sessionHandle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __autoProxyOptions_native = global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.ConvertToUnmanaged(autoProxyOptions);
                    __sessionHandle_native__marshaller.FromManaged(sessionHandle);
                    // Pin - Pin data in preparation for calling the P/Invoke.
                    fixed (global::Interop.WinHttp.WINHTTP_PROXY_INFO* __proxyInfo_native = &proxyInfo)
                    fixed (void* __url_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(url))
                    {
                        // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                        __sessionHandle_native = __sessionHandle_native__marshaller.ToUnmanaged();
                        global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                        __retVal_native = __PInvoke(__sessionHandle_native, (ushort*)__url_native, &__autoProxyOptions_native, __proxyInfo_native);
                        __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                    }
 
                    // Unmarshal - Convert native data to managed data.
                    __retVal = __retVal_native != 0;
                    autoProxyOptions = global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.ConvertToManaged(__autoProxyOptions_native);
                }
                finally
                {
                    // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                    global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Free(__autoProxyOptions_native);
                    __sessionHandle_native__marshaller.Free();
                }
 
                global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
                return __retVal;
                // Local P/Invoke
                [global::System.Runtime.InteropServices.DllImportAttribute("winhttp.dll", EntryPoint = "WinHttpGetProxyForUrl", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe int __PInvoke(nint __sessionHandle_native, ushort* __url_native, global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Native* __autoProxyOptions_native, global::Interop.WinHttp.WINHTTP_PROXY_INFO* __proxyInfo_native);
            }
        }
    }
}
internal static partial class Interop
{
    internal static partial class WinHttp
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.41101")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint WinHttpSetStatusCallback(global::Interop.WinHttp.SafeWinHttpHandle handle, global::Interop.WinHttp.WINHTTP_STATUS_CALLBACK callback, uint notificationFlags, nint reserved)
        {
            unsafe
            {
                int __lastError;
                nint __handle_native = default;
                nint __callback_native = default;
                nint __retVal = default;
                // Setup - Perform required setup.
                global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.WinHttp.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
                try
                {
                    // Marshal - Convert managed data to native data.
                    __callback_native = callback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback) : default;
                    __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, __callback_native, notificationFlags, reserved);
                        __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                    }
 
                    // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
                    global::System.GC.KeepAlive(callback);
                }
                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("winhttp.dll", EntryPoint = "WinHttpSetStatusCallback", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
                [global::System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((global::System.Runtime.InteropServices.DllImportSearchPath)2048)]
                static extern unsafe nint __PInvoke(nint __handle_native, nint __callback_native, uint __notificationFlags_native, nint __reserved_native);
            }
        }
    }
}