|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
/// <content>
/// Contains extern methods from "HTTPAPI.dll".
/// </content>
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.46-beta+dd815b2b9b")]
internal static partial class PInvoke
{
/// <summary>The HttpInitialize function initializes the HTTP Server API driver, starts it, if it has not already been started, and allocates data structures for the calling application to support response-queue creation and other operations.</summary>
/// <param name="Version">
/// <para>HTTP version. This parameter is an <a href="https://docs.microsoft.com/windows/win32/api/http/ns-http-httpapi_version">HTTPAPI_VERSION</a> structure. For the current version, declare an instance of the structure and set it to the pre-defined value **HTTPAPI_VERSION_1** before passing it to <b>HttpInitialize</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpinitialize#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags"></param>
/// <param name="pReserved">This parameter is reserved, and must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, then the return value is **NO_ERROR**. If the function fails, then the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Call <a href="https://docs.microsoft.com/windows/win32/api/http/nf-http-httpterminate">HttpTerminate</a> when the application completes. All the same flags that were passed to <b>HttpInitialize</b> in the <i>Flags</i> parameter must also be passed to <b>HttpTerminate</b>. An application can call <b>HttpInitialize</b> repeatedly, provided that each call to <b>HttpInitialize</b> is later matched by a corresponding call to <b>HttpTerminate</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpinitialize#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpInitialize(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, winmdroot.Networking.HttpServer.HTTP_INITIALIZE Flags, [Optional] void* pReserved);
/// <summary>Cleans up resources used by the HTTP Server API to process calls by an application.</summary>
/// <param name="Flags"></param>
/// <param name="pReserved">This parameter is reserved and must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is NO_ERROR. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Every call to <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpinitialize">HttpInitialize</a> should be matched by a corresponding call to <b>HttpTerminate</b>. For example, if you call <b>HttpInitialize</b> with HTTP_INITIALIZE_SERVER, you must call <b>HttpTerminate</b> with HTTP_INITIALIZE_SERVER. If you call <b>HttpInitialize</b> twice, once with HTTP_INITIALIZE_SERVER and the second time with HTTP_INITIALIZE_CONFIG, you can call <b>HttpTerminate</b> one time with both flags.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpterminate#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpTerminate(winmdroot.Networking.HttpServer.HTTP_INITIALIZE Flags, [Optional] void* pReserved);
/// <inheritdoc cref="HttpCreateHttpHandle(winmdroot.Foundation.HANDLE*, uint)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCreateHttpHandle(out Microsoft.Win32.SafeHandles.SafeFileHandle RequestQueueHandle)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
uint __result = PInvoke.HttpCreateHttpHandle(&RequestQueueHandleLocal, default);
RequestQueueHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(RequestQueueHandleLocal, ownsHandle: true);
return __result;
}
/// <summary>Creates an HTTP request queue for the calling application and returns a handle to it.</summary>
/// <param name="RequestQueueHandle">A pointer to a variable that receives a handle to the request queue.</param>
/// <param name="Reserved">Reserved. This parameter must be zero.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The request queue enables the calling application to receive requests for particular URLs. The calling application uses the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurl">HttpAddUrl</a> function to specify the URL for which it should receive requests. An application should use a single request queue to receive requests. Using multiple request queues from a single process does not increase response time or throughput. When an application has finished receiving requests, it should call the <a href="https://docs.microsoft.com/windows/desktop/api/handleapi/nf-handleapi-closehandle">CloseHandle</a> function to close the handle.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreatehttphandle#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpCreateHttpHandle(winmdroot.Foundation.HANDLE* RequestQueueHandle, uint Reserved);
/// <inheritdoc cref="HttpCreateRequestQueue(winmdroot.Networking.HttpServer.HTTPAPI_VERSION, winmdroot.Foundation.PCWSTR, winmdroot.Security.SECURITY_ATTRIBUTES*, uint, winmdroot.Foundation.HANDLE*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCreateRequestQueue(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, string Name, winmdroot.Security.SECURITY_ATTRIBUTES? SecurityAttributes, uint Flags, out Microsoft.Win32.SafeHandles.SafeFileHandle RequestQueueHandle)
{
fixed (char* NameLocal = Name)
{
winmdroot.Security.SECURITY_ATTRIBUTES SecurityAttributesLocal = SecurityAttributes ?? default(winmdroot.Security.SECURITY_ATTRIBUTES);
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
uint __result = PInvoke.HttpCreateRequestQueue(Version, NameLocal, SecurityAttributes.HasValue ? &SecurityAttributesLocal : null, Flags, &RequestQueueHandleLocal);
RequestQueueHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(RequestQueueHandleLocal, ownsHandle: true);
return __result;
}
}
/// <summary>Creates a new request queue or opens an existing request queue.</summary>
/// <param name="Version">
/// <para>An HTTPAPI_VERSION structure indicating the request queue version. For version 2.0, declare an instance of the structure and set it to the predefined value HTTPAPI_VERSION_2 before passing it to <b>HttpCreateRequestQueue</b>. The version must be 2.0; <b>HttpCreateRequestQueue</b> does not support version 1.0 request queues.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreaterequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Name">
/// <para>The name of the request queue. The length, in bytes, cannot exceed MAX_PATH. The optional name parameter allows other processes to access the request queue by name.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreaterequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="SecurityAttributes">
/// <para>A pointer to the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa379560(v=vs.85)">SECURITY_ATTRIBUTES</a> structure that contains the access permissions for the request queue. This parameter must be <b>NULL</b> when opening an existing request queue.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreaterequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>The flags parameter defines the scope of the request queue. This parameter can be one or more of the following: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreaterequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestQueueHandle">A pointer to a variable that receives a handle to the request queue. This parameter must contain a valid pointer; it cannot be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The HTTP Server API supports existing applications using the version 1.0 request queues, however, new development with the HTTP Server API should use <b>HttpCreateRequestQueue</b> to create request queues; <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> should not be used. The version 2.0 API are only compatible with the version 2.0 request queues created by <b>HttpCreateRequestQueue</b>. The HTTP version 2 request queues require manual configuration; the application must create the URL Groups and associate one or more URL Group with the request queue by calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpseturlgroupproperty">HttpSetUrlGroupProperty</a> with the <b>HttpServerBindingProperty</b>. The application configures the request queue by calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsetrequestqueueproperty">HttpSetRequestQueueProperty</a> with the desired configuration in the <i>Property</i> parameter. For more information about creating and configuring URL groups, see <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreateurlgroup">HttpCreateUrlGroup</a> and <b>HttpSetUrlGroupProperty</b>. Security attributes may be supplied in <i>pSecurityAttributes</i> parameter only when the request queue is created. Only the application that creates the request queue can set Access Control Lists (ACLs) on the request queue handle to allow processes (other than the creator application) permission to open, receive requests, and send responses on the request queue handle. By default, applications are not allowed to open a request queue unless they have been granted permission in the ACL. The creator process can optionally use the <b>HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER</b> flag to indicate that it does not want to receive http requests. <b>HttpCreateRequestQueue</b> allows applications to open an existing request queue with the <b>HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING</b> flag and retrieve the handle to the request queue. Non-controller applications can use this handle to perform HTTP I/O operations. Only the application that creates the request queue can set properties on it by calling the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsetrequestqueueproperty">HttpSetRequestQueueProperty</a>. The handle to the request queue created by <b>HttpCreateRequestQueue</b> must be closed by calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcloserequestqueue">HttpCloseRequestQueue</a> before the application terminates or when the session is no longer required. Applications must call <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpinitialize">HttpInitialize</a> prior to calling <b>HttpCreateRequestQueue</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreaterequestqueue#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpCreateRequestQueue(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, winmdroot.Foundation.PCWSTR Name, [Optional] winmdroot.Security.SECURITY_ATTRIBUTES* SecurityAttributes, uint Flags, winmdroot.Foundation.HANDLE* RequestQueueHandle);
/// <inheritdoc cref="HttpCloseRequestQueue(winmdroot.Foundation.HANDLE)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCloseRequestQueue(SafeHandle RequestQueueHandle)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpCloseRequestQueue(RequestQueueHandleLocal);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Closes the handle to the specified request queue created by HttpCreateRequestQueue.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue that is closed. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcloserequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>Applications should not call <a href="https://docs.microsoft.com/windows/desktop/api/handleapi/nf-handleapi-closehandle">CloseHandle</a> on the request queue handle; instead, they should call <b>HttpCloseRequestQueue</b> to ensure that all the resources are released.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpCloseRequestQueue(winmdroot.Foundation.HANDLE RequestQueueHandle);
/// <inheritdoc cref="HttpSetRequestQueueProperty(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY, void*, uint, uint, void*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpSetRequestQueueProperty(SafeHandle RequestQueueHandle, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, void* PropertyInformation, uint PropertyInformationLength)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpSetRequestQueueProperty(RequestQueueHandleLocal, Property, PropertyInformation, PropertyInformationLength, default, default);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Sets a new property or modifies an existing property on the request queue identified by the specified handle.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue on which the property is set. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration describing the property type that is set. This must be one of the following: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that contains the property information. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <param name="Reserved1">Reserved. Must be zero.</param>
/// <param name="Reserved2">Reserved. Must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestqueueproperty">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpSetRequestQueueProperty(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, void* PropertyInformation, uint PropertyInformationLength, uint Reserved1, [Optional] void* Reserved2);
/// <inheritdoc cref="HttpQueryRequestQueueProperty(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY, void*, uint, uint, uint*, void*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpQueryRequestQueueProperty(SafeHandle RequestQueueHandle, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, void* PropertyInformation, uint PropertyInformationLength, uint* ReturnLength)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpQueryRequestQueueProperty(RequestQueueHandleLocal, Property, PropertyInformation, PropertyInformationLength, default, ReturnLength, default);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Queries a property of the request queue identified by the specified handle.</summary>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration that describes the property type that is set. This can be one of the following: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that receives the property information. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <param name="Reserved1">Reserved. Must be zero.</param>
/// <param name="ReturnLength">
/// <para>The number, in bytes, returned in the <i>pPropertyInformation</i> buffer if not <b>NULL</b>. If the output buffer is too small, the call fails with a return value of <b>ERROR_MORE_DATA</b>. The value pointed to by <i>pReturnLength</i> can be used to determine the minimum length of the buffer required for the call to succeed.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryrequestqueueproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Reserved2">This parameter is reserved and must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryrequestqueueproperty">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpQueryRequestQueueProperty(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, [Optional] void* PropertyInformation, uint PropertyInformationLength, uint Reserved1, [Optional] uint* ReturnLength, [Optional] void* Reserved2);
/// <inheritdoc cref="HttpSetRequestProperty(winmdroot.Foundation.HANDLE, ulong, winmdroot.Networking.HttpServer.HTTP_REQUEST_PROPERTY, void*, uint, global::System.Threading.NativeOverlapped*)"/>
internal static unsafe uint HttpSetRequestProperty(SafeHandle RequestQueueHandle, ulong Id, winmdroot.Networking.HttpServer.HTTP_REQUEST_PROPERTY PropertyId, void* Input, uint InputPropertySize, in global::System.Threading.NativeOverlapped Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (global::System.Threading.NativeOverlapped* OverlappedLocal = &Overlapped)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpSetRequestProperty(RequestQueueHandleLocal, Id, PropertyId, Input, InputPropertySize, OverlappedLocal);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Sets a new property or modifies an existing property on the specified request.</summary>
/// <param name="RequestQueueHandle">The handle to the request queue on which the request was received. A request queue is created and its handle returned by a call to the [HttpCreateRequestQueue](/windows/desktop/api/http/nf-http-httpcreaterequestqueue) function.</param>
/// <param name="Id">The opaque ID of the request. This ID is located in the *RequestId* member of the [HTTP\_REQUEST](/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)) structure returned by [HttpReceiveHttpRequest](/windows/win32/api/http/nf-http-httpreceivehttprequest).</param>
/// <param name="PropertyId">
/// <para>A member of the [HTTP\_REQUEST\_PROPERTY](/windows/desktop/api/http/ne-http-http_request_property) enumeration describing the property type that is set. This must be one of the following: | **Property** | **Meaning** | | HttpRequestPropertyStreamError | Sets a stream error on the request. |</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Input">
/// <para>A pointer to the buffer that contains the property information. It must point to one of the following property information types based on the property that is set. | **Property** | **Configuration Type** | | HttpRequestPropertyStreamError | [HTTP\_REQUEST\_PROPERTY\_STREAM\_ERROR](/windows/win32/api/http/ns-http-http_request_property_stream_error) structure |</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="InputPropertySize">The length, in bytes, of the buffer pointed to by the *Input* parameter.</param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set *pOverlapped* to point to an [OVERLAPPED](/windows/desktop/api/minwinbase/ns-minwinbase-overlapped) structure; for synchronous calls, set it to **NULL**. A synchronous call blocks until the operation is complete, whereas an asynchronous call immediately returns **ERROR\_IO\_PENDING** and the calling application then uses [GetOverlappedResult](/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult) or I/O completion ports to determine when the operation is completed. For more information about using [OVERLAPPED](/windows/desktop/api/minwinbase/ns-minwinbase-overlapped) structures for synchronization, see [Synchronization and Overlapped Input and Output](/windows/desktop/Sync/synchronization-and-overlapped-input-and-output).</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns **ERROR\_SUCCESS**. If the function fails, it returns a [system error code](/windows/desktop/Debug/system-error-codes).</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetrequestproperty">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern unsafe uint HttpSetRequestProperty(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong Id, winmdroot.Networking.HttpServer.HTTP_REQUEST_PROPERTY PropertyId, [Optional] void* Input, uint InputPropertySize, global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpShutdownRequestQueue(winmdroot.Foundation.HANDLE)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpShutdownRequestQueue(SafeHandle RequestQueueHandle)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpShutdownRequestQueue(RequestQueueHandleLocal);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Stops queuing requests for the specified request queue process.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue that is shut down. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpshutdownrequestqueue#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><b>HttpShutdownRequestQueue</b> cancels outstanding requests and stops all processing on the request queue process. The following steps are performed when this function is called:</para>
/// <para></para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpshutdownrequestqueue#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpShutdownRequestQueue(winmdroot.Foundation.HANDLE RequestQueueHandle);
/// <inheritdoc cref="HttpReceiveClientCertificate(winmdroot.Foundation.HANDLE, ulong, uint, winmdroot.Networking.HttpServer.HTTP_SSL_CLIENT_CERT_INFO*, uint, uint*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpReceiveClientCertificate(SafeHandle RequestQueueHandle, ulong ConnectionId, uint Flags, out winmdroot.Networking.HttpServer.HTTP_SSL_CLIENT_CERT_INFO SslClientCertInfo, uint SslClientCertInfoSize, uint* BytesReceived, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_SSL_CLIENT_CERT_INFO* SslClientCertInfoLocal = &SslClientCertInfo)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpReceiveClientCertificate(RequestQueueHandleLocal, ConnectionId, Flags, SslClientCertInfoLocal, SslClientCertInfoSize, BytesReceived, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>The HttpReceiveClientCertificate function is used by a server application to retrieve a client SSL certificate or channel binding token (CBT).</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue with which the specified SSL client or CBT is associated. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ConnectionId">
/// <para>A value that identifies the connection to the client. This value is obtained from the <b>ConnectionId</b> element of an <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure filled in by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceivehttprequest">HttpReceiveHttpRequest</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>A value that modifies the behavior of the <b>HttpReceiveClientCertificate</b> function </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="SslClientCertInfo">
/// <para>If the <i>Flags</i> parameter is 0, then this parameter points to an <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_ssl_client_cert_info">HTTP_SSL_CLIENT_CERT_INFO</a> structure into which the function writes the requested client certificate information. The buffer pointed to by the <i>pSslClientCertInfo</i> should be sufficiently large enough to hold the <b>HTTP_SSL_CLIENT_CERT_INFO</b> structure plus the value of the <b>CertEncodedSize</b> member of this structure. If the <i>Flags</i> parameter is <b>HTTP_RECEIVE_SECURE_CHANNEL_TOKEN</b>, then this parameter points to an <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_request_channel_bind_status">HTTP_REQUEST_CHANNEL_BIND_STATUS</a> structure into which the function writes the requested CBT information. The buffer pointed to by the <i>pSslClientCertInfo</i> should be sufficiently large enough to hold the <b>HTTP_REQUEST_CHANNEL_BIND_STATUS</b> structure plus the value of the <b>ChannelTokenSize</b> member of this structure.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="SslClientCertInfoSize">The size, in bytes, of the buffer pointed to by the <i>pSslClientCertInfo</i> parameter.</param>
/// <param name="BytesReceived">
/// <para>An optional pointer to a variable that receives the number of bytes to be written to the structure pointed to by <i>pSslClientCertInfo</i>. If not used, set it to <b>NULL</b>.</para>
/// <para>When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesReceived</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesReceived</i> must contain a valid memory address, and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure, or for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until the client certificate is retrieved, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see the section <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para></para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The behavior of the <b>HttpReceiveClientCertificate</b> function varies based on whether a client SSL certificate or a channel binding token is requested. In the case of a synchronous call to the <b>HttpReceiveClientCertificate</b> function , the number of bytes received is returned in the value pointed to by the <i>pBytesReceived</i> parameter. In the case of an asynchronous call to the <b>HttpReceiveClientCertificate</b> function, the number of bytes received is returned by the standard mechanisms used for asynchronous calls. The <i>lpNumberOfBytesTransferred</i> parameter returned by the <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> function contains the number of bytes received.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiveclientcertificate#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpReceiveClientCertificate(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong ConnectionId, uint Flags, winmdroot.Networking.HttpServer.HTTP_SSL_CLIENT_CERT_INFO* SslClientCertInfo, uint SslClientCertInfoSize, [Optional] uint* BytesReceived, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpCreateServerSession(winmdroot.Networking.HttpServer.HTTPAPI_VERSION, ulong*, uint)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCreateServerSession(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, out ulong ServerSessionId)
{
fixed (ulong* ServerSessionIdLocal = &ServerSessionId)
{
uint __result = PInvoke.HttpCreateServerSession(Version, ServerSessionIdLocal, default);
return __result;
}
}
/// <summary>Creates a server session for the specified version.</summary>
/// <param name="Version">
/// <para>An HTTPAPI_VERSION structure that indicates the version of the server session. For version 2.0, declare an instance of the structure and set it to the predefined value <b>HTTPAPI_VERSION_2</b> before passing it to <b>HttpCreateServerSession</b>. The version must be 2.0; <b>HttpCreateServerSession</b> does not support version 1.0 request queues.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreateserversession#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ServerSessionId">A pointer to the variable that receives the ID of the server session.</param>
/// <param name="Reserved">Reserved. Must be zero.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Server sessions own a set of URL Groups. They are top-level configuration containers for configuration information that applies to all of the URL Groups created under them. For more information about configuring a server session, see <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsetserversessionproperty">HttpSetServerSessionProperty</a>. The HTTP Server API does not support asynchronous I/O for server sessions. When the server session is no longer required, or before the application terminates, application must delete the server session by calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcloseserversession">HttpCloseServerSession</a>. When a server session is deleted all of the associated URL Groups are also automatically deleted.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreateserversession#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpCreateServerSession(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, ulong* ServerSessionId, uint Reserved);
/// <summary>Deletes the server session identified by the server session ID.</summary>
/// <param name="ServerSessionId">The ID of the server session that is closed.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it can return one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>Applications must call <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcloseurlgroup">HttpCloseUrlGroup</a> before calling <b>HttpCloseServerSession</b> to close the all the URL Groups associated with the server session.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpCloseServerSession(ulong ServerSessionId);
/// <summary>Queries a server property on the specified server session.</summary>
/// <param name="ServerSessionId">The server session for which the property setting is returned.</param>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration that describes the property type that is queried. This can be one of the following. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserversessionproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that receives the property data. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserversessionproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <param name="ReturnLength">
/// <para>The number, in bytes, returned in the <i>pPropertyInformation</i> buffer. If the output buffer is too small, the call fails with a return value of <b>ERROR_MORE_DATA</b>. The value pointed to by <i>pReturnLength</i> can be used to determine the minimum length of the buffer required for the call to succeed.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserversessionproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Querying the <b>HttpServerLoggingProperty</b> is not supported. The <i>pPropertyInformation</i> parameter points to the configuration structure for the property type that is queried. The <i>PropertyInformationLength</i> parameter specifies the size, in bytes, of the configuration structure. For example, when querying the <b>HttpServerTimeoutsProperty</b> the <i>pPropertyInformation</i> parameter must point to a buffer that is at least the size of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_timeout_limit_info">HTTP_TIMEOUT_LIMIT_INFO</a> structure. To specify the HttpServerQosProperty property in the <i>pPropertyInformation</i> parameter, set <b>QosType</b> to <b>HttpQosSettingTypeBandwidth</b> inside the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_qos_setting_info">HTTP_QOS_SETTING_INFO</a> structure, and pass a pointer to this structure in the parameter.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserversessionproperty#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpQueryServerSessionProperty(ulong ServerSessionId, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, [Optional] void* PropertyInformation, uint PropertyInformationLength, [Optional] uint* ReturnLength);
/// <summary>Sets a new server session property or modifies an existing property on the specified server session.</summary>
/// <param name="ServerSessionId">The server session for which the property is set.</param>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration that describes the property type that is set. This can be one of the following. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetserversessionproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that contains the property data. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetserversessionproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Server sessions are top level configuration containers for configuration data that applies to all of the URL groups created under them. The server session is created with <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreateserversession">HttpCreateServerSession</a>. The <i>pPropertyInformation</i> parameter points to the configuration structure for the property type that is set. The <i>PropertyInformationLength</i> parameter specifies the size, in bytes, of the configuration structure. For example, when setting the <b>HttpServerTimeoutsProperty</b> the <i>pPropertyInformation</i> parameter must point to a buffer that is at least equal to the size of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_timeout_limit_info">HTTP_TIMEOUT_LIMIT_INFO</a> structure.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetserversessionproperty#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpSetServerSessionProperty(ulong ServerSessionId, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, void* PropertyInformation, uint PropertyInformationLength);
/// <inheritdoc cref="HttpAddUrl(winmdroot.Foundation.HANDLE, winmdroot.Foundation.PCWSTR, void*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpAddUrl(SafeHandle RequestQueueHandle, string FullyQualifiedUrl)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (char* FullyQualifiedUrlLocal = FullyQualifiedUrl)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpAddUrl(RequestQueueHandleLocal, FullyQualifiedUrlLocal, default);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Registers a given URL so that requests that match it are routed to a specified HTTP Server API request queue.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue to which requests for the specified URL are to be routed. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddurl#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="FullyQualifiedUrl">
/// <para>A pointer to a Unicode string that contains a properly formed <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix string</a> that identifies the URL to be registered.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddurl#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Reserved">Reserved; must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>As stated in the <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix Strings</a> topic, the scheme specification of the UrlPrefix to be registered must be either lower-case "http" or lower-case "https". No other substring is valid. Also, it is not possible to register URLs having different schemes on the same port. That is, "http" and "https" schemes cannot coexist on a port. Also be aware that <b>HttpAddUrl</b> registers any UrlPrefix passed to it as long as the string is well-formed. Any validation of existence, accessibility, ownership, or other characteristic of the specified URL namespace must be handled by the application. To release the resources allocated as a result of the registration performed by <b>HttpAddUrl</b>, make a matching call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpremoveurl">HttpRemoveUrl</a> function when your application has finished with the namespace involved.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddurl#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpAddUrl(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.PCWSTR FullyQualifiedUrl, [Optional] void* Reserved);
/// <inheritdoc cref="HttpRemoveUrl(winmdroot.Foundation.HANDLE, winmdroot.Foundation.PCWSTR)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpRemoveUrl(SafeHandle RequestQueueHandle, string FullyQualifiedUrl)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (char* FullyQualifiedUrlLocal = FullyQualifiedUrl)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpRemoveUrl(RequestQueueHandleLocal, FullyQualifiedUrlLocal);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Causes the system to stop routing requests that match a specified UrlPrefix string to a specified request queue.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue from which the URL registration is to be removed. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurl#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="FullyQualifiedUrl">
/// <para>A pointer to a <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix string</a> registered to the specified request queue. This string must be identical to the one passed to <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurl">HttpAddUrl</a> to register the UrlPrefix; even a nomenclature change in an IPv6 address is not accepted.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurl#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurl">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpRemoveUrl(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.PCWSTR FullyQualifiedUrl);
/// <inheritdoc cref="HttpCreateUrlGroup(ulong, ulong*, uint)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCreateUrlGroup(ulong ServerSessionId, out ulong pUrlGroupId)
{
fixed (ulong* pUrlGroupIdLocal = &pUrlGroupId)
{
uint __result = PInvoke.HttpCreateUrlGroup(ServerSessionId, pUrlGroupIdLocal, default);
return __result;
}
}
/// <summary>Creates a URL Group under the specified server session.</summary>
/// <param name="ServerSessionId">The identifier of the server session under which the URL Group is created.</param>
/// <param name="pUrlGroupId">A pointer to the variable that receives the ID of the URL Group.</param>
/// <param name="Reserved">Reserved. Must be zero.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>URL Groups are configuration containers for a set of URLs. They are created under the server session and inherit the configuration settings of the server session. When a configuration parameter is set on the URL Group, it overrides the configuration set on the server session. For more information about the setting configurations for the URL Group, see <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpseturlgroupproperty">HttpSetUrlGroupProperty</a>. After the URL group is created it must be associated with a request queue to receive requests. To associate the URL Group with a request queue, the application calls <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpseturlgroupproperty">HttpSetUrlGroupProperty</a> with the <b>HttpServerBindingProperty</b> property. If this property is not set, matching requests for the URL Group are not delivered to a request queue and the HTTP Server API generates a 503 response. The URL Group association with a request queue is dynamic. The association with the servers session cannot be changed until either the server session or the URL Group is deleted. When a server session is deleted all of the associated URL Groups are also automatically closed. The URL Group is initially created as an empty group. URLs must be added to the group by calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurltourlgroup">HttpAddUrlToUrlGroup</a>. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpcreateurlgroup#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpCreateUrlGroup(ulong ServerSessionId, ulong* pUrlGroupId, uint Reserved);
/// <summary>Closes the URL Group identified by the URL Group ID.</summary>
/// <param name="UrlGroupId">The ID of the URL Group that is deleted.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>Applications must call <b>HttpCloseUrlGroup</b> before calling <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcloseserversession">HttpCloseServerSession</a> to close the all URL Groups associated with the server session.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpCloseUrlGroup(ulong UrlGroupId);
/// <inheritdoc cref="HttpAddUrlToUrlGroup(ulong, winmdroot.Foundation.PCWSTR, ulong, uint)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpAddUrlToUrlGroup(ulong UrlGroupId, string pFullyQualifiedUrl, ulong UrlContext)
{
fixed (char* pFullyQualifiedUrlLocal = pFullyQualifiedUrl)
{
uint __result = PInvoke.HttpAddUrlToUrlGroup(UrlGroupId, pFullyQualifiedUrlLocal, UrlContext, default);
return __result;
}
}
/// <summary>Adds the specified URL to the URL Group identified by the URL Group ID.</summary>
/// <param name="UrlGroupId">The group ID for the URL group to which requests for the specified URL are routed. The URL group is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreateurlgroup">HttpCreateUrlGroup</a> function.</param>
/// <param name="pFullyQualifiedUrl">A pointer to a Unicode string that contains a properly formed <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix String</a> that identifies the URL to be registered. If you are not running as an administrator, specify a port number greater than 1024, otherwise you may get an ERROR_ACCESS_DENIED error.</param>
/// <param name="UrlContext">The context that is associated with the URL registered in this call. The URL context is returned in the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure with every request received on the URL specified in the <i>pFullyQualifiedUrl</i> parameter.</param>
/// <param name="Reserved">Reserved. Must be zero.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b> If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The HTTP Server API supports existing applications using version 1.0 URL registrations, however, new development with the HTTP Server API should use <b>HttpAddUrlToUrlGroup</b>; <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurl">HttpAddUrl</a> should not be used. An application can add multiple URLs to a URL group using repeated calls to <b>HttpAddUrlToUrlGroup</b>. Requests that match the specified URL are routed to the request queue associated with the URL group. For more information about how the HTTP Server API matches request URLs to registered URLs, see <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix Strings</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddurltourlgroup#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpAddUrlToUrlGroup(ulong UrlGroupId, winmdroot.Foundation.PCWSTR pFullyQualifiedUrl, ulong UrlContext, uint Reserved);
/// <inheritdoc cref="HttpRemoveUrlFromUrlGroup(ulong, winmdroot.Foundation.PCWSTR, uint)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpRemoveUrlFromUrlGroup(ulong UrlGroupId, string pFullyQualifiedUrl, uint Flags)
{
fixed (char* pFullyQualifiedUrlLocal = pFullyQualifiedUrl)
{
uint __result = PInvoke.HttpRemoveUrlFromUrlGroup(UrlGroupId, pFullyQualifiedUrlLocal, Flags);
return __result;
}
}
/// <summary>Removes the specified URL from the group identified by the URL Group ID.</summary>
/// <param name="UrlGroupId">The ID of the URL group from which the URL specified in <i>pFullyQualifiedUrl</i> is removed.</param>
/// <param name="pFullyQualifiedUrl">
/// <para>A pointer to a Unicode string that contains a properly formed <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix String</a> that identifies the URL to be removed. When <b>HTTP_URL_FLAG_REMOVE_ALL</b> is passed in the <i>Flags</i> parameter, all of the existing URL registrations for the URL Group identified in <i>UrlGroupId</i> are removed from the group. In this case, <i>pFullyQualifiedUrl</i> must be <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurlfromurlgroup#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>The URL flags qualifying the URL that is removed. This can be one of the following flags: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurlfromurlgroup#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns NO_ERROR. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The HTTP Server API supports existing applications using the version 1.0 URL registrations, however, new development with the HTTP Server API should use <b>HttpRemoveUrlFromUrlGroup</b>; do not use <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpremoveurl">HttpRemoveUrl</a>. Applications should remove the URL added to the group by <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurltourlgroup">HttpAddUrlToUrlGroup</a>, when the URL is no longer required.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpremoveurlfromurlgroup#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern uint HttpRemoveUrlFromUrlGroup(ulong UrlGroupId, winmdroot.Foundation.PCWSTR pFullyQualifiedUrl, uint Flags);
/// <summary>Sets a new property or modifies an existing property on the specified URL Group.</summary>
/// <param name="UrlGroupId">The ID of the URL Group for which the property is set.</param>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration that describes the property type that is modified or set. This can be one of the following: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpseturlgroupproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that contains the property information. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpseturlgroupproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>After the URL Group is created it must be associated with a request queue to receive requests. To associate the URL Group with a request queue, the application calls <b>HttpSetUrlGroupProperty</b> with the <b>HttpServerBindingProperty</b> property. If this property is not set, matching requests for the URL Group are not delivered to a request queue and the HTTP Server API generates a 503 response.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpSetUrlGroupProperty(ulong UrlGroupId, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, void* PropertyInformation, uint PropertyInformationLength);
/// <summary>Queries a property on the specified URL Group.</summary>
/// <param name="UrlGroupId">The ID of the URL Group for which the property setting is returned.</param>
/// <param name="Property">
/// <para>A member of the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_server_property">HTTP_SERVER_PROPERTY</a> enumeration that describes the property type that is queried. This can be one of the following: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryurlgroupproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformation">
/// <para>A pointer to the buffer that receives the property information. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryurlgroupproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInformationLength">The length, in bytes, of the buffer pointed to by the <i>pPropertyInformation</i> parameter.</param>
/// <param name="ReturnLength">
/// <para>The size, in bytes, returned in the <i>pPropertyInformation</i> buffer. If the output buffer is too small, the call fails with a return value of <b>ERROR_MORE_DATA</b>. The value pointed to by <i>pReturnLength</i> can be used to determine the minimum length of the buffer required for the call to succeed.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryurlgroupproperty#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>Querying the <b>HttpServerLoggingProperty</b> is not supported.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpQueryUrlGroupProperty(ulong UrlGroupId, winmdroot.Networking.HttpServer.HTTP_SERVER_PROPERTY Property, [Optional] void* PropertyInformation, uint PropertyInformationLength, [Optional] uint* ReturnLength);
/// <inheritdoc cref="HttpPrepareUrl(void*, uint, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PWSTR*)"/>
[SupportedOSPlatform("windows8.0")]
internal static unsafe uint HttpPrepareUrl(string Url, out winmdroot.Foundation.PWSTR PreparedUrl)
{
fixed (winmdroot.Foundation.PWSTR* PreparedUrlLocal = &PreparedUrl)
{
fixed (char* UrlLocal = Url)
{
uint __result = PInvoke.HttpPrepareUrl(default, default, UrlLocal, PreparedUrlLocal);
return __result;
}
}
}
/// <summary>Parses, analyzes, and normalizes a non-normalized Unicode or punycode URL so it is safe and valid to use in other HTTP functions.</summary>
/// <param name="Reserved">Reserved. Must be <b>NULL</b>.</param>
/// <param name="Flags">Reserved. Must be zero.</param>
/// <param name="Url">A pointer to a string that represents the non-normalized Unicode or punycode URL to prepare.</param>
/// <param name="PreparedUrl">
/// <para>On successful output, a pointer to a string that represents the normalized URL. <div class="alert"><b>Note</b> Free <i>PreparedUrl</i> using <a href="https://docs.microsoft.com/windows/desktop/api/heapapi/nf-heapapi-heapfree">HeapFree</a>.</div> <div> </div></para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpprepareurl#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>ERROR_SUCCESS</b>. If the function fails, it returns one of the following or a <a href="https://docs.microsoft.com/windows/desktop/Debug/system-error-codes">system error code</a> defined in WinError.h.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpprepareurl">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows8.0")]
internal static extern unsafe uint HttpPrepareUrl([Optional] void* Reserved, uint Flags, winmdroot.Foundation.PCWSTR Url, winmdroot.Foundation.PWSTR* PreparedUrl);
/// <inheritdoc cref="HttpReceiveHttpRequest(winmdroot.Foundation.HANDLE, ulong, winmdroot.Networking.HttpServer.HTTP_RECEIVE_HTTP_REQUEST_FLAGS, winmdroot.Networking.HttpServer.HTTP_REQUEST_V2*, uint, uint*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpReceiveHttpRequest(SafeHandle RequestQueueHandle, ulong RequestId, winmdroot.Networking.HttpServer.HTTP_RECEIVE_HTTP_REQUEST_FLAGS Flags, out winmdroot.Networking.HttpServer.HTTP_REQUEST_V2 RequestBuffer, uint RequestBufferLength, uint* BytesReturned, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_REQUEST_V2* RequestBufferLocal = &RequestBuffer)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpReceiveHttpRequest(RequestQueueHandleLocal, RequestId, Flags, RequestBufferLocal, RequestBufferLength, BytesReturned, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Retrieves the next available HTTP request from the specified request queue either synchronously or asynchronously.</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue from which to retrieve the next available request. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestId">
/// <para>On the first call to retrieve a request, this parameter should be <b>HTTP_NULL_ID</b>. Then, if more than one call is required to retrieve the entire request, <b>HttpReceiveHttpRequest</b> or <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceiverequestentitybody">HttpReceiveRequestEntityBody</a> can be called with <i>RequestID</i> set to the value returned in the <b>RequestId</b> member of the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure pointed to by <i>pRequestBuffer</i>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags"></param>
/// <param name="RequestBuffer">
/// <para>A pointer to a buffer into which the function copies an <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure and entity body for the HTTP request. <b>HTTP_REQUEST.RequestId</b> contains the identifier for this HTTP request, which the application can use in subsequent calls <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceiverequestentitybody">HttpReceiveRequestEntityBody</a>, <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendhttpresponse">HttpSendHttpResponse</a>, or <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendresponseentitybody">HttpSendResponseEntityBody</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestBufferLength">Size, in bytes, of the <i>pRequestBuffer</i> buffer.</param>
/// <param name="BytesReturned">
/// <para>Optional. A pointer to a variable that receives the size, in bytes, of the entity body, or of the remaining part of the entity body.</para>
/// <para>When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesReceived</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesReceived</i> must contain a valid memory address, and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until a request has arrived in the specified queue and some or all of it has been retrieved, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function is being used asynchronously, a return value of <b>ERROR_IO_PENDING</b> indicates that the next request is not yet ready and will be retrieved later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>More than one call can be required to retrieve a given request. When the <i>Flags</i> parameter is set to zero, for example, <b>HttpReceiveHttpRequest</b> only copies the request header structure into the buffer, and does not attempt to copy any of the entity body. In this case, the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceiverequestentitybody">HttpReceiveRequestEntityBody</a> function can be used to retrieve the entity body, or a second call can be made to <b>HttpReceiveHttpRequest</b>. Alternatively, the buffer provided by the application may be insufficiently large to receive all or part of the request. To be sure of receiving at least part of the request, it is recommended that an application provide at least a buffer of 4 KB, which accommodates most HTTP requests. Alternately, authentication headers, parsed as unknown headers, can add up to 12 KB to that, so if authentication/authorization is used, a buffer size of at least 16 KB is recommended. If <b>HttpReceiveHttpRequest</b> returns <b>ERROR_MORE_DATA</b>, the application continues to make additional calls, identifying the request in each additional call by passing in the <b>HTTP_REQUEST.RequestId</b> value returned by the first call until <b>ERROR_HANDLE_EOF</b> is returned. <div class="alert"><b>Note</b> The application must examine all relevant request headers, including content-negotiation headers if used, and fail the request as appropriate based on the header content. <b>HttpReceiveHttpRequest</b> ensures only that the header line is properly terminated and does not contain illegal characters.</div> <div> </div></para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceivehttprequest#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpReceiveHttpRequest(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, winmdroot.Networking.HttpServer.HTTP_RECEIVE_HTTP_REQUEST_FLAGS Flags, winmdroot.Networking.HttpServer.HTTP_REQUEST_V2* RequestBuffer, uint RequestBufferLength, [Optional] uint* BytesReturned, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpReceiveRequestEntityBody(winmdroot.Foundation.HANDLE, ulong, uint, void*, uint, uint*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpReceiveRequestEntityBody(SafeHandle RequestQueueHandle, ulong RequestId, uint Flags, void* EntityBuffer, uint EntityBufferLength, uint* BytesReturned, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpReceiveRequestEntityBody(RequestQueueHandleLocal, RequestId, Flags, EntityBuffer, EntityBufferLength, BytesReturned, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Receives additional entity body data for a specified HTTP request.</summary>
/// <param name="RequestQueueHandle">
/// <para>The handle to the request queue from which to retrieve the specified entity body data. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestId">
/// <para>The identifier of the HTTP request that contains the retrieved entity body. This value is returned in the <b>RequestId</b> member of the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceivehttprequest">HttpReceiveHttpRequest</a> function. This value cannot be <b>HTTP_NULL_ID</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>This parameter can be the following flag value. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>This parameter is reserved and must be zero. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="EntityBuffer">A pointer to a buffer that receives entity-body data.</param>
/// <param name="EntityBufferLength">The size, in bytes, of the buffer pointed to by the <i>pBuffer</i> parameter.</param>
/// <param name="BytesReturned">
/// <para>Optional. A pointer to a variables that receives the size, in bytes, of the entity body data returned in the <i>pBuffer</i> buffer.</para>
/// <para>When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesReceived</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesReceived</i> must contain a valid memory address, and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until the entity-body data has been retrieved, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function is used asynchronously, a return value of <b>ERROR_IO_PENDING</b> indicates that the next request is not yet ready and is retrieved later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>To retrieve an entire entity body, an application is expected to call <b>HttpReceiveRequestEntityBody</b>, passing in new buffers, until the function returns <b>ERROR_HANDLE_EOF</b>. As long as a buffer full of entity-body data is copied successfully and there is still more entity-body data waiting to be retrieved, the function returns <b>NO_ERROR</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreceiverequestentitybody#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpReceiveRequestEntityBody(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, uint Flags, void* EntityBuffer, uint EntityBufferLength, [Optional] uint* BytesReturned, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpSendHttpResponse(winmdroot.Foundation.HANDLE, ulong, uint, winmdroot.Networking.HttpServer.HTTP_RESPONSE_V2*, winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY*, uint*, void*, uint, global::System.Threading.NativeOverlapped*, winmdroot.Networking.HttpServer.HTTP_LOG_DATA*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpSendHttpResponse(SafeHandle RequestQueueHandle, ulong RequestId, uint Flags, in winmdroot.Networking.HttpServer.HTTP_RESPONSE_V2 HttpResponse, winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY? CachePolicy, uint* BytesSent, global::System.Threading.NativeOverlapped? Overlapped, winmdroot.Networking.HttpServer.HTTP_LOG_DATA? LogData)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_RESPONSE_V2* HttpResponseLocal = &HttpResponse)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY CachePolicyLocal = CachePolicy ?? default(winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY);
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
winmdroot.Networking.HttpServer.HTTP_LOG_DATA LogDataLocal = LogData ?? default(winmdroot.Networking.HttpServer.HTTP_LOG_DATA);
uint __result = PInvoke.HttpSendHttpResponse(RequestQueueHandleLocal, RequestId, Flags, HttpResponseLocal, CachePolicy.HasValue ? &CachePolicyLocal : null, BytesSent, default, default, Overlapped.HasValue ? &OverlappedLocal : null, LogData.HasValue ? &LogDataLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Sends an HTTP response to the specified HTTP request.</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue from which the specified request was retrieved. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestId">
/// <para>An identifier of the HTTP request to which this response corresponds. This value is returned in the <b>RequestId</b> member of the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceivehttprequest">HttpReceiveHttpRequest</a> function. This value cannot be <b>HTTP_NULL_ID</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>This parameter can be a combination of some of the following flag values. Those that are mutually exclusive are marked accordingly. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="HttpResponse">
/// <para>A pointer to an <a href="https://docs.microsoft.com/windows/desktop/Http/http-response">HTTP_RESPONSE</a> structure that defines the HTTP response.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="CachePolicy">
/// <para>A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_cache_policy">HTTP_CACHE_POLICY</a> structure used to cache the response. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>This parameter is reserved and must be <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="BytesSent">
/// <para>Optional. A pointer to a variable that receives the number, in bytes, sent if the function operates synchronously. When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesSent</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesSent</i> must contain a valid memory address and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Reserved1">This parameter is reserved and must be <b>NULL</b>.</param>
/// <param name="Reserved2">This parameter is reserved and must be zero.</param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set to <b>NULL</b>. A synchronous call blocks until all response data specified in the <i>pHttpResponse</i> parameter is sent, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="LogData">
/// <para>A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_log_data">HTTP_LOG_DATA</a> structure used to log the response. Pass a pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_log_fields_data">HTTP_LOG_FIELDS_DATA</a> structure and cast it to <b>PHTTP_LOG_DATA</b>. Be aware that even when logging is enabled on a URL Group, or server session, the response will not be logged unless the application supplies the log fields data structure. <b>Windows Server 2003 and Windows XP with SP2: </b>This parameter is reserved and must be <b>NULL</b>. <b>Windows Vista and Windows Server 2008: </b>This parameter is new for Windows Vista, and Windows Server 2008</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the function returns <b>NO_ERROR</b>. If the function is used asynchronously, a return value of <b>ERROR_IO_PENDING</b> indicates that the next request is not yet ready and is retrieved later through normal overlapped I/O completion mechanisms. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The <b>HttpSendHttpResponse</b> function is used to create and send a response header, and the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendresponseentitybody">HttpSendResponseEntityBody</a> function can be used to send entity-body data as required. If neither a content-length header nor a transfer-encoding header is included with the response, the application must indicate the end of the response by explicitly closing the connection by using the <b>HTTP_SEND_RESPONSE_DISCONNECT</b> flag. If an application specifies a "Server:" header in a response, using the <b>HttpHeaderServer</b> identifier in the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_known_header">HTTP_KNOWN_HEADER</a> structure, that specified value is placed as the first part of the header, followed by a space and then "Microsoft-HTTPAPI/1.0". If no server header is specified, <b>HttpSendHttpResponse</b> supplies "Microsoft-HTTPAPI/1.0" as the server header. <div class="alert"><b>Note</b> The <b>HttpSendHttpResponse</b> and <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendresponseentitybody">HttpSendResponseEntityBody</a> function must not be called simultaneously from different threads on the same <i>RequestId</i>.</div> <div> </div></para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendhttpresponse#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpSendHttpResponse(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, uint Flags, winmdroot.Networking.HttpServer.HTTP_RESPONSE_V2* HttpResponse, [Optional] winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY* CachePolicy, [Optional] uint* BytesSent, [Optional] void* Reserved1, uint Reserved2, [Optional] global::System.Threading.NativeOverlapped* Overlapped, [Optional] winmdroot.Networking.HttpServer.HTTP_LOG_DATA* LogData);
/// <inheritdoc cref="HttpSendResponseEntityBody(winmdroot.Foundation.HANDLE, ulong, uint, ushort, winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK*, uint*, void*, uint, global::System.Threading.NativeOverlapped*, winmdroot.Networking.HttpServer.HTTP_LOG_DATA*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpSendResponseEntityBody(SafeHandle RequestQueueHandle, ulong RequestId, uint Flags, Span<winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK> EntityChunks, uint* BytesSent, global::System.Threading.NativeOverlapped? Overlapped, winmdroot.Networking.HttpServer.HTTP_LOG_DATA? LogData)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK* EntityChunksLocal = EntityChunks)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
winmdroot.Networking.HttpServer.HTTP_LOG_DATA LogDataLocal = LogData ?? default(winmdroot.Networking.HttpServer.HTTP_LOG_DATA);
uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, BytesSent, default, default, Overlapped.HasValue ? &OverlappedLocal : null, LogData.HasValue ? &LogDataLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Sends entity-body data associated with an HTTP response.</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue from which the specified request was retrieved. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestId">
/// <para>An identifier of the HTTP request to which this response corresponds. This value is returned in the <b>RequestId</b> member of the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceivehttprequest">HttpReceiveHttpRequest</a> function. It cannot be <b>HTTP_NULL_ID</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">
/// <para>A parameter that can include one of the following mutually exclusive flag values. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="EntityChunkCount">A number of structures in the array pointed to by <i>pEntityChunks</i>. This count cannot exceed 9999.</param>
/// <param name="EntityChunks">
/// <para>A pointer to an array of <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_data_chunk">HTTP_DATA_CHUNK</a> structures to be sent as entity-body data.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="BytesSent">
/// <para>Optional. A pointer to a variable that receives the number, in bytes, sent if the function operates synchronously. When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesSent</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesSent</i> must contain a valid memory address, and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Reserved1">This parameter is reserved and must be <b>NULL</b>.</param>
/// <param name="Reserved2">This parameter is reserved and must be zero.</param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>. A synchronous call blocks until all response data specified in the <i>pEntityChunks</i> parameter is sent, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="LogData">
/// <para>A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_log_data">HTTP_LOG_DATA</a> structure used to log the response. Pass a pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_log_fields_data">HTTP_LOG_FIELDS_DATA</a> structure and cast it to <b>PHTTP_LOG_DATA</b>. Be aware that even when logging is enabled on a URL Group, or server session, the response will not be logged unless the application supplies the log fields data structure. <b>Windows Server 2003 and Windows XP with SP2: </b>This parameter is reserved and must be <b>NULL</b>. <b>Windows Vista and Windows Server 2008: </b>This parameter is new for Windows Vista, and Windows Server 2008</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function is used asynchronously, a return value of <b>ERROR_IO_PENDING</b> indicates that the next request is not yet ready and is retrieved later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>If neither a Content-length header nor a Transfer-encoding header is included in the response headers, the application must indicate the end of the response by explicitly closing the connection using the <b>HTTP_SEND_RESPONSE_DISCONNECT</b> flag. <div class="alert"><b>Note</b> <b>HttpSendResponseEntityBody</b> (or <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendhttpresponse">HttpSendHttpResponse</a>) and <b>HttpSendResponseEntityBody</b> must not be called simultaneously from different threads on the same <i>RequestId</i>.</div> <div> </div></para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsendresponseentitybody#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpSendResponseEntityBody(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, uint Flags, ushort EntityChunkCount, [Optional] winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK* EntityChunks, [Optional] uint* BytesSent, [Optional] void* Reserved1, uint Reserved2, [Optional] global::System.Threading.NativeOverlapped* Overlapped, [Optional] winmdroot.Networking.HttpServer.HTTP_LOG_DATA* LogData);
/// <inheritdoc cref="HttpDeclarePush(winmdroot.Foundation.HANDLE, ulong, winmdroot.Networking.HttpServer.HTTP_VERB, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCSTR, winmdroot.Networking.HttpServer.HTTP_REQUEST_HEADERS*)"/>
[SupportedOSPlatform("windows10.0.10240")]
internal static unsafe uint HttpDeclarePush(SafeHandle RequestQueueHandle, ulong RequestId, winmdroot.Networking.HttpServer.HTTP_VERB Verb, string Path, string Query, winmdroot.Networking.HttpServer.HTTP_REQUEST_HEADERS? Headers)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (byte* QueryLocal = Query is object ? global::System.Text.Encoding.Default.GetBytes(Query) : null)
{
fixed (char* PathLocal = Path)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
winmdroot.Networking.HttpServer.HTTP_REQUEST_HEADERS HeadersLocal = Headers ?? default(winmdroot.Networking.HttpServer.HTTP_REQUEST_HEADERS);
uint __result = PInvoke.HttpDeclarePush(RequestQueueHandleLocal, RequestId, Verb, PathLocal, new winmdroot.Foundation.PCSTR (QueryLocal), Headers.HasValue ? &HeadersLocal : null);
return __result;
}
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Declares a resource-to-subresource relationship to use for an HTTP server push. HTTP.sys then performs an HTTP 2.0 server push for the given resource, if the underlying protocol, connection, client, and policies allow the push operation.</summary>
/// <param name="RequestQueueHandle">The handle to an HTTP.sys request queue that the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function returned.</param>
/// <param name="RequestId">The opaque identifier of the request that is declaring the push operation. The request must be from the specified queue handle.</param>
/// <param name="Verb">The HTTP verb to use for the push operation. The HTTP.sys push operation only supports <b>HttpVerbGET</b> and <b>HttpVerbHEAD</b>.</param>
/// <param name="Path">The path portion of the URL for the resource being pushed.</param>
/// <param name="Query">The query portion of the URL for the resource being pushed. This string should not include the leading question mark (?).</param>
/// <param name="Headers">
/// <para>The request headers for the push operation. You should not provide a Host header, because HTTP.sys automatically generates the correct Host information. HTTP.sys does not support cross-origin push operations, so HTTP.sys enforces and generates Host information that matches the original client-initiated request. The push request is not allowed to have an entity body, so you cannot include a non-zero Content-Length header or any Transfer-Encoding header.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdeclarepush#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns a <a href="https://docs.microsoft.com/windows/desktop/Debug/system-error-codes">system error code</a> defined in WinError.h.</para>
/// </returns>
/// <remarks>
/// <para>You should call <b>HttpDeclarePush</b> before you send any response bytes that would cause the client to discover the subresource itself. Failure to observe this order results in a race between the server that is pushing the resource and the client that is retrieving the resources, which can waste bandwidth. The server application should only use <b>HttpDeclarePush</b> to push resources that the server application is highly confident are needed and not already cached by the client. If the server application pushes other resources, unnecessary use of bandwidth and CPU may occur.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdeclarepush#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows10.0.10240")]
internal static extern unsafe uint HttpDeclarePush(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, winmdroot.Networking.HttpServer.HTTP_VERB Verb, winmdroot.Foundation.PCWSTR Path, winmdroot.Foundation.PCSTR Query, [Optional] winmdroot.Networking.HttpServer.HTTP_REQUEST_HEADERS* Headers);
/// <inheritdoc cref="HttpWaitForDisconnect(winmdroot.Foundation.HANDLE, ulong, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpWaitForDisconnect(SafeHandle RequestQueueHandle, ulong ConnectionId, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpWaitForDisconnect(RequestQueueHandleLocal, ConnectionId, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Notifies the application when the connection to an HTTP client is broken for any reason.</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue that handles requests from the specified connection. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordisconnect#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ConnectionId">
/// <para>Identifier for the connection to the client computer. This value is returned in the <b>ConnectionID</b> member of the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)">HTTP_REQUEST</a> structure by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpreceivehttprequest">HttpReceiveHttpRequest</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordisconnect#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until the connection is broken, whereas an asynchronous call immediately returns ERROR_IO_PENDING and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordisconnect#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is NO_ERROR. If the function is used asynchronously, a return value of ERROR_IO_PENDING indicates that the next request is not yet ready and is retrieved later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordisconnect">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpWaitForDisconnect(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong ConnectionId, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpWaitForDisconnectEx(winmdroot.Foundation.HANDLE, ulong, uint, global::System.Threading.NativeOverlapped*)"/>
internal static unsafe uint HttpWaitForDisconnectEx(SafeHandle RequestQueueHandle, ulong ConnectionId, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpWaitForDisconnectEx(RequestQueueHandleLocal, ConnectionId, default, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>This function is an extension to HttpWaitForDisconnect.</summary>
/// <param name="RequestQueueHandle"></param>
/// <param name="ConnectionId"></param>
/// <param name="Reserved"></param>
/// <param name="Overlapped"></param>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordisconnectex">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern unsafe uint HttpWaitForDisconnectEx(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong ConnectionId, uint Reserved, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpCancelHttpRequest(winmdroot.Foundation.HANDLE, ulong, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpCancelHttpRequest(SafeHandle RequestQueueHandle, ulong RequestId, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpCancelHttpRequest(RequestQueueHandleLocal, RequestId, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>The HttpCancelHttpRequest function cancels a specified reqest.</summary>
/// <param name="RequestQueueHandle">A handle to the request queue from which the request came.</param>
/// <param name="RequestId">The ID of the request to be canceled.</param>
/// <param name="Overlapped">For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>.</param>
/// <returns>If the function succeeds, it returns <b>NO_ERROR</b>.</returns>
/// <remarks>When the **HttpCancelHttpRequest** function is used to cancel a request, the underlying transport connection used for the request will be closed.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpCancelHttpRequest(winmdroot.Foundation.HANDLE RequestQueueHandle, ulong RequestId, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpWaitForDemandStart(winmdroot.Foundation.HANDLE, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpWaitForDemandStart(SafeHandle RequestQueueHandle, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpWaitForDemandStart(RequestQueueHandleLocal, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Waits for the arrival of a new request that can be served by a new request queue process.</summary>
/// <param name="RequestQueueHandle">
/// <para>A handle to the request queue on which demand start is registered. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordemandstart#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure; for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until a request has arrived in the specified queue, whereas an asynchronous call immediately returns <b>ERROR_IO_PENDING</b> and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordemandstart#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, it returns <b>NO_ERROR</b>. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Only the controller process can call <b>HttpWaitForDemandStart</b> to register a demand start notification. The controller process is the process that created the request queue and indicated that it is a controller process by passing the <b>HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER</b> flag. If a process other than the controlling process calls <b>HttpWaitForDemandStart</b>, the HTTP Server API returns <b>ERROR_INVALID_ID_AUTHORITY</b>. <b>HttpWaitForDemandStart</b> completes when a new request arrives for the specified request queue. At this time, a controller process can use this API to start a new worker process to server pending requests. Delayed start of the worker process allows applications to avoid consuming resources until they are required. The HTTP Server API allows only one outstanding notification registered on a request queue at any time. The HTTP Server API does not enforce limitations on the number of times that <b>HttpWaitForDemandStart</b> can be called on the same request queue consecutively. There is no limit on the number of outstanding processes that are working on the same request queue. The HTTP Server API supports canceling asynchronous <b>HttpWaitForDemandStart</b> calls. Applications can use <a href="https://docs.microsoft.com/windows/desktop/FileIO/cancelioex-func">CancelIoEx</a> with the overlapped structure supplied in the <i>pOverlapped</i> parameter, to cancel an outstanding <b>HttpWaitForDemandStart</b> call.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpwaitfordemandstart#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpWaitForDemandStart(winmdroot.Foundation.HANDLE RequestQueueHandle, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <summary>Checks whether a particular feature is supported.</summary>
/// <param name="FeatureId">
/// <para>Type: \_In\_ **[HTTP_FEATURE_ID](./ne-http-http_feature_id.md)** The identifier of the feature.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpisfeaturesupported#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>`TRUE` if the feature is supported, otherwise `FALSE`.</returns>
/// <remarks></remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern winmdroot.Foundation.BOOL HttpIsFeatureSupported(winmdroot.Networking.HttpServer.HTTP_FEATURE_ID FeatureId);
/// <inheritdoc cref="HttpDelegateRequestEx(winmdroot.Foundation.HANDLE, winmdroot.Foundation.HANDLE, ulong, ulong, uint, winmdroot.Networking.HttpServer.HTTP_DELEGATE_REQUEST_PROPERTY_INFO*)"/>
internal static unsafe uint HttpDelegateRequestEx(SafeHandle RequestQueueHandle, SafeHandle DelegateQueueHandle, ulong RequestId, ulong DelegateUrlGroupId, uint PropertyInfoSetSize, in winmdroot.Networking.HttpServer.HTTP_DELEGATE_REQUEST_PROPERTY_INFO PropertyInfoSet)
{
bool RequestQueueHandleAddRef = false;
bool DelegateQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_DELEGATE_REQUEST_PROPERTY_INFO* PropertyInfoSetLocal = &PropertyInfoSet)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
winmdroot.Foundation.HANDLE DelegateQueueHandleLocal;
if (DelegateQueueHandle is object)
{
DelegateQueueHandle.DangerousAddRef(ref DelegateQueueHandleAddRef);
DelegateQueueHandleLocal = (winmdroot.Foundation.HANDLE)DelegateQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(DelegateQueueHandle));
uint __result = PInvoke.HttpDelegateRequestEx(RequestQueueHandleLocal, DelegateQueueHandleLocal, RequestId, DelegateUrlGroupId, PropertyInfoSetSize, PropertyInfoSetLocal);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
if (DelegateQueueHandleAddRef)
DelegateQueueHandle.DangerousRelease();
}
}
/// <summary>Delegates a request from the source request queue to the target request queue.</summary>
/// <param name="RequestQueueHandle">
/// <para>Type: \_In\_ **[HANDLE](/windows/win32/winprog/windows-data-types)** A handle to the source request queue.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="DelegateQueueHandle">
/// <para>Type: \_In\_ **[HANDLE](/windows/win32/winprog/windows-data-types)** A handle to the target request queue.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestId">
/// <para>Type: \_In\_ **HTTP_REQUEST_ID** A unique request ID received with [HttpReceiveHttpRequest](/windows/win32/api/http/nf-http-httpreceivehttprequest).</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="DelegateUrlGroupId">
/// <para>Type: \_In\_ **HTTP_URL_GROUP_ID** The url group id of the target url group.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInfoSetSize">
/// <para>Type: \_In\_ **[ULONG](/windows/win32/winprog/windows-data-types)** The number of entries in the *PropertyInfoSet* array.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="PropertyInfoSet">
/// <para>Type: \_In\_ [**PHTTP_DELEGATE_REQUEST_PROPERTY_INFO](/windows/win32/api/http/ns-http-http_delegate_request_property_info)** An array of properties to be set on request when delegating.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdelegaterequestex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>A **[ULONG](/windows/win32/winprog/windows-data-types)** containing an [NTSTATUS](/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) completion status.</returns>
/// <remarks></remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern unsafe uint HttpDelegateRequestEx(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.HANDLE DelegateQueueHandle, ulong RequestId, ulong DelegateUrlGroupId, uint PropertyInfoSetSize, winmdroot.Networking.HttpServer.HTTP_DELEGATE_REQUEST_PROPERTY_INFO* PropertyInfoSet);
/// <inheritdoc cref="HttpFindUrlGroupId(winmdroot.Foundation.PCWSTR, winmdroot.Foundation.HANDLE, ulong*)"/>
internal static unsafe uint HttpFindUrlGroupId(string FullyQualifiedUrl, SafeHandle RequestQueueHandle, out ulong UrlGroupId)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (ulong* UrlGroupIdLocal = &UrlGroupId)
{
fixed (char* FullyQualifiedUrlLocal = FullyQualifiedUrl)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
uint __result = PInvoke.HttpFindUrlGroupId(FullyQualifiedUrlLocal, RequestQueueHandleLocal, UrlGroupIdLocal);
return __result;
}
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Retrieves a URL group ID for a URL and a request queue.</summary>
/// <param name="FullyQualifiedUrl">
/// <para>Type: \_In\_ **[PCWSTR](/windows/win32/winprog/windows-data-types)** The URL whose URL group to query.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpfindurlgroupid#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="RequestQueueHandle">
/// <para>Type: \_In\_ **[HANDLE](/windows/win32/winprog/windows-data-types)** The request queue associated with the URL group.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpfindurlgroupid#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="UrlGroupId">
/// <para>Type: \_Out\_ **PHTTP_URL_GROUP_ID** The matching URL group ID.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpfindurlgroupid#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>A **[ULONG](/windows/win32/winprog/windows-data-types)** containing an [NTSTATUS](/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) completion status.</returns>
/// <remarks></remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern unsafe uint HttpFindUrlGroupId(winmdroot.Foundation.PCWSTR FullyQualifiedUrl, winmdroot.Foundation.HANDLE RequestQueueHandle, ulong* UrlGroupId);
/// <inheritdoc cref="HttpFlushResponseCache(winmdroot.Foundation.HANDLE, winmdroot.Foundation.PCWSTR, uint, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpFlushResponseCache(SafeHandle RequestQueueHandle, string UrlPrefix, uint Flags, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (char* UrlPrefixLocal = UrlPrefix)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpFlushResponseCache(RequestQueueHandleLocal, UrlPrefixLocal, Flags, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>Removes from the HTTP Server API cache associated with a given request queue all response fragments that have a name whose site portion matches a specified UrlPrefix.</summary>
/// <param name="RequestQueueHandle">
/// <para>Handle to the request queue with which this cache is associated. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpflushresponsecache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="UrlPrefix">
/// <para>Pointer to a <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix string</a> to match against the site portion of fragment names. The application must previously have called <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddurl">HttpAddUrl</a> to add this UrlPrefix or a valid prefix of it to the request queue in question, and then called <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddfragmenttocache">HttpAddFragmentToCache</a> to cache the associated response fragment.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpflushresponsecache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Flags">This parameter can contain the following flag:</param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure, or for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until the cache operation is complete, whereas an asynchronous call immediately returns ERROR_IO_PENDING and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpflushresponsecache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is NO_ERROR. If the function is used asynchronously, a return value of ERROR_IO_PENDING indicates that the cache request is queued and completes later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpflushresponsecache">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpFlushResponseCache(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.PCWSTR UrlPrefix, uint Flags, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpAddFragmentToCache(winmdroot.Foundation.HANDLE, winmdroot.Foundation.PCWSTR, winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK*, winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpAddFragmentToCache(SafeHandle RequestQueueHandle, string UrlPrefix, in winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK DataChunk, in winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY CachePolicy, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY* CachePolicyLocal = &CachePolicy)
{
fixed (winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK* DataChunkLocal = &DataChunk)
{
fixed (char* UrlPrefixLocal = UrlPrefix)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpAddFragmentToCache(RequestQueueHandleLocal, UrlPrefixLocal, DataChunkLocal, CachePolicyLocal, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
}
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>The HttpAddFragmentToCache function caches a data fragment with a specified name by which it can be retrieved, or updates data cached under a specified name.</summary>
/// <param name="RequestQueueHandle">
/// <para>Handle to the request queue with which this cache is associated. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="UrlPrefix">
/// <para>Pointer to a <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix string</a> that the application uses in subsequent calls to <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpsendhttpresponse">HttpSendHttpResponse</a> to identify this cache entry. The application must have called <b>HttpAddUrl</b> previously with the same handle as in the <i>ReqQueueHandle</i> parameter, and with either this identical UrlPrefix string or a valid prefix of it. Like any UrlPrefix, this string must take the form "scheme://host:port/relativeURI"; for example, `http://www.mysite.com:80/image1.gif`.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="DataChunk">
/// <para>Pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_data_chunk">HTTP_DATA_CHUNK</a> structure that specifies an entity body data block to cache under the name pointed to by <i>pUrlPrefix</i>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="CachePolicy">
/// <para>Pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_cache_policy">HTTP_CACHE_POLICY</a> structure that specifies how this data fragment should be cached.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure, or for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks the calling thread until the cache operation is complete, whereas an asynchronous call immediately returns ERROR_IO_PENDING and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is NO_ERROR. If the function is used asynchronously, a return value of ERROR_IO_PENDING indicates that the cache request is queued and will complete later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpaddfragmenttocache">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpAddFragmentToCache(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.PCWSTR UrlPrefix, winmdroot.Networking.HttpServer.HTTP_DATA_CHUNK* DataChunk, winmdroot.Networking.HttpServer.HTTP_CACHE_POLICY* CachePolicy, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpReadFragmentFromCache(winmdroot.Foundation.HANDLE, winmdroot.Foundation.PCWSTR, winmdroot.Networking.HttpServer.HTTP_BYTE_RANGE*, void*, uint, uint*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpReadFragmentFromCache(SafeHandle RequestQueueHandle, string UrlPrefix, winmdroot.Networking.HttpServer.HTTP_BYTE_RANGE? ByteRange, void* Buffer, uint BufferLength, uint* BytesRead, global::System.Threading.NativeOverlapped? Overlapped)
{
bool RequestQueueHandleAddRef = false;
try
{
fixed (char* UrlPrefixLocal = UrlPrefix)
{
winmdroot.Foundation.HANDLE RequestQueueHandleLocal;
if (RequestQueueHandle is object)
{
RequestQueueHandle.DangerousAddRef(ref RequestQueueHandleAddRef);
RequestQueueHandleLocal = (winmdroot.Foundation.HANDLE)RequestQueueHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(RequestQueueHandle));
winmdroot.Networking.HttpServer.HTTP_BYTE_RANGE ByteRangeLocal = ByteRange ?? default(winmdroot.Networking.HttpServer.HTTP_BYTE_RANGE);
global::System.Threading.NativeOverlapped OverlappedLocal = Overlapped ?? default(global::System.Threading.NativeOverlapped);
uint __result = PInvoke.HttpReadFragmentFromCache(RequestQueueHandleLocal, UrlPrefixLocal, ByteRange.HasValue ? &ByteRangeLocal : null, Buffer, BufferLength, BytesRead, Overlapped.HasValue ? &OverlappedLocal : null);
return __result;
}
}
finally
{
if (RequestQueueHandleAddRef)
RequestQueueHandle.DangerousRelease();
}
}
/// <summary>The HttpReadFragmentFromCache function retrieves a response fragment having a specified name from the HTTP Server API cache.</summary>
/// <param name="RequestQueueHandle">
/// <para>Handle to the request queue with which the specified response fragment is associated. A request queue is created and its handle returned by a call to the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreaterequestqueue">HttpCreateRequestQueue</a> function. <b>Windows Server 2003 with SP1 and Windows XP with SP2: </b>The handle to the request queue is created by the <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpcreatehttphandle">HttpCreateHttpHandle</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreadfragmentfromcache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="UrlPrefix">Pointer to a <a href="https://docs.microsoft.com/windows/desktop/Http/urlprefix-strings">UrlPrefix string</a> that contains the name of the fragment to be retrieved. This must match a UrlPrefix string used in a previous successful call to <a href="https://docs.microsoft.com/windows/desktop/api/http/nf-http-httpaddfragmenttocache">HttpAddFragmentToCache</a>.</param>
/// <param name="ByteRange">
/// <para>Optional pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/http/ns-http-http_byte_range">HTTP_BYTE_RANGE</a> structure that indicates a starting offset in the specified fragment and byte-count to be returned. <b>NULL</b> if not used, in which case the entire fragment is returned.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreadfragmentfromcache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Buffer">Pointer to a buffer into which the function copies the requested fragment.</param>
/// <param name="BufferLength">Size, in bytes, of the <i>pBuffer</i> buffer.</param>
/// <param name="BytesRead">
/// <para>Optional pointer to a variable that receives the number of bytes to be written into the output buffer. If <i>BufferLength</i> is less than this number, the call fails with a return of ERROR_INSUFFICIENT_BUFFER, and the value pointed to by <i>pBytesRead</i> can be used to determine the minimum length of buffer required for the call to succeed.</para>
/// <para>When making an asynchronous call using <i>pOverlapped</i>, set <i>pBytesRead</i> to <b>NULL</b>. Otherwise, when <i>pOverlapped</i> is set to <b>NULL</b>, <i>pBytesRead</i> must contain a valid memory address, and not be set to <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreadfragmentfromcache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="Overlapped">
/// <para>For asynchronous calls, set <i>pOverlapped</i> to point to an <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structure, or for synchronous calls, set it to <b>NULL</b>.</para>
/// <para>A synchronous call blocks until the cache operation is complete, whereas an asynchronous call immediately returns ERROR_IO_PENDING and the calling application then uses <a href="https://docs.microsoft.com/windows/desktop/api/ioapiset/nf-ioapiset-getoverlappedresult">GetOverlappedResult</a> or I/O completion ports to determine when the operation is completed. For more information about using <a href="https://docs.microsoft.com/windows/desktop/api/minwinbase/ns-minwinbase-overlapped">OVERLAPPED</a> structures for synchronization, see <a href="https://docs.microsoft.com/windows/desktop/Sync/synchronization-and-overlapped-input-and-output">Synchronization and Overlapped Input and Output</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreadfragmentfromcache#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is NO_ERROR. If the function is used asynchronously, a return value of ERROR_IO_PENDING indicates that the cache request is queued and completes later through normal overlapped I/O completion mechanisms. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpreadfragmentfromcache">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpReadFragmentFromCache(winmdroot.Foundation.HANDLE RequestQueueHandle, winmdroot.Foundation.PCWSTR UrlPrefix, [Optional] winmdroot.Networking.HttpServer.HTTP_BYTE_RANGE* ByteRange, void* Buffer, uint BufferLength, [Optional] uint* BytesRead, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpSetServiceConfiguration(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID, void*, uint, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows5.1.2600")]
internal static unsafe uint HttpSetServiceConfiguration(winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* pConfigInformation, uint ConfigInformationLength)
{
uint __result = PInvoke.HttpSetServiceConfiguration(default, ConfigId, pConfigInformation, ConfigInformationLength, default);
return __result;
}
/// <summary>Creates and sets a configuration record for the HTTP Server API configuration store.</summary>
/// <param name="ServiceHandle">Reserved. Must be zero.</param>
/// <param name="ConfigId"></param>
/// <param name="pConfigInformation">
/// <para>A pointer to a buffer that contains the appropriate data to specify the type of record to be set. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ConfigInformationLength">Size, in bytes, of the <i>pConfigInformation</i> buffer.</param>
/// <param name="pOverlapped">This parameter is reserved and must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>The configuration parameters set with <b>HttpSetServiceConfiguration</b> are applied to all the HTTP Server API applications on the machine, and persist when the HTTP Server API shuts down, or when the computer is restarted.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.1.2600")]
internal static extern unsafe uint HttpSetServiceConfiguration(winmdroot.Foundation.HANDLE ServiceHandle, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* pConfigInformation, uint ConfigInformationLength, [Optional] global::System.Threading.NativeOverlapped* pOverlapped);
/// <inheritdoc cref="HttpUpdateServiceConfiguration(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID, void*, uint, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows10.0.15063")]
internal static unsafe uint HttpUpdateServiceConfiguration(winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* ConfigInfo, uint ConfigInfoLength)
{
uint __result = PInvoke.HttpUpdateServiceConfiguration(default, ConfigId, ConfigInfo, ConfigInfoLength, default);
return __result;
}
/// <summary>Updates atomically a service configuration parameter that specifies a Transport Layer Security (TLS) certificate in a configuration record within the HTTP Server API configuration store.</summary>
/// <param name="Handle">Reserved and must be <b>NULL</b>.</param>
/// <param name="ConfigId"></param>
/// <param name="ConfigInfo">
/// <para>A pointer to a buffer that contains the appropriate data to specify the type of record to update. The following table shows the type of data the buffer contains for the different possible values of the <i>ConfigId</i> parameter. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpupdateserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ConfigInfoLength">The size, in bytes, of the <i>ConfigInfo</i> buffer.</param>
/// <param name="Overlapped">Reserved and must be <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>ERROR_SUCCESS</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>The configuration parameters that you update with <b>HttpUpdateServiceConfiguration</b> are applied to all the HTTP Server API applications on the machine, and persist when the HTTP Server API shuts down, or when the computer is restarted.</remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows10.0.15063")]
internal static extern unsafe uint HttpUpdateServiceConfiguration(winmdroot.Foundation.HANDLE Handle, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* ConfigInfo, uint ConfigInfoLength, [Optional] global::System.Threading.NativeOverlapped* Overlapped);
/// <inheritdoc cref="HttpDeleteServiceConfiguration(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID, void*, uint, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpDeleteServiceConfiguration(winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* pConfigInformation, uint ConfigInformationLength)
{
uint __result = PInvoke.HttpDeleteServiceConfiguration(default, ConfigId, pConfigInformation, ConfigInformationLength, default);
return __result;
}
/// <summary>Deletes specified data, such as IP addresses or SSL Certificates, from the HTTP Server API configuration store, one record at a time.</summary>
/// <param name="ServiceHandle">This parameter is reserved and must be zero.</param>
/// <param name="ConfigId">
/// <para>Type of configuration. This parameter is one of the values in the <a href="https://docs.microsoft.com/windows/desktop/api/http/ne-http-http_service_config_id">HTTP_SERVICE_CONFIG_ID</a> enumeration. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdeleteserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="pConfigInformation">
/// <para>Pointer to a buffer that contains data required for the type of configuration specified in the <i>ConfigId</i> parameter. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdeleteserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ConfigInformationLength">Size, in bytes, of the <i>pConfigInformation</i> buffer.</param>
/// <param name="pOverlapped">Reserved for future asynchronous operation. This parameter must be set to <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the function returns NO_ERROR. If the function fails, it returns one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpdeleteserviceconfiguration">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpDeleteServiceConfiguration(winmdroot.Foundation.HANDLE ServiceHandle, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* pConfigInformation, uint ConfigInformationLength, [Optional] global::System.Threading.NativeOverlapped* pOverlapped);
/// <inheritdoc cref="HttpQueryServiceConfiguration(winmdroot.Foundation.HANDLE, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID, void*, uint, void*, uint, uint*, global::System.Threading.NativeOverlapped*)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe uint HttpQueryServiceConfiguration(winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, void* pInput, uint InputLength, void* pOutput, uint OutputLength, uint* pReturnLength)
{
uint __result = PInvoke.HttpQueryServiceConfiguration(default, ConfigId, pInput, InputLength, pOutput, OutputLength, pReturnLength, default);
return __result;
}
/// <summary>Retrieves one or more HTTP Server API configuration records.</summary>
/// <param name="ServiceHandle">Reserved. Must be zero.</param>
/// <param name="ConfigId"></param>
/// <param name="pInput">
/// <para>A pointer to a structure whose contents further define the query and of the type that correlates with <i>ConfigId</i> in the following table. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="InputLength">Size, in bytes, of the <i>pInputConfigInfo</i> buffer.</param>
/// <param name="pOutput">
/// <para>A pointer to a buffer in which the query results are returned. The type of this buffer correlates with <i>ConfigId</i>. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserviceconfiguration#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="OutputLength">Size, in bytes, of the <i>pOutputConfigInfo</i> buffer.</param>
/// <param name="pReturnLength">A pointer to a variable that receives the number of bytes to be written in the output buffer. If the output buffer is too small, the call fails with a return value of <b>ERROR_INSUFFICIENT_BUFFER</b>. The value pointed to by <i>pReturnLength</i> can be used to determine the minimum length the buffer requires for the call to succeed.</param>
/// <param name="pOverlapped">Reserved for asynchronous operation and must be set to <b>NULL</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NO_ERROR</b>. If the function fails, the return value is one of the following error codes. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/http/nf-http-httpqueryserviceconfiguration">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern unsafe uint HttpQueryServiceConfiguration(winmdroot.Foundation.HANDLE ServiceHandle, winmdroot.Networking.HttpServer.HTTP_SERVICE_CONFIG_ID ConfigId, [Optional] void* pInput, uint InputLength, [Optional] void* pOutput, uint OutputLength, [Optional] uint* pReturnLength, [Optional] global::System.Threading.NativeOverlapped* pOverlapped);
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern unsafe uint HttpGetExtension(winmdroot.Networking.HttpServer.HTTPAPI_VERSION Version, uint Extension, void* Buffer, uint BufferSize);
}
}
|