|
// ------------------------------------------------------------------------------
// <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>
internal static partial class PInvoke
{
/// <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="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);
/// <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>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="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="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="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);
/// <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);
/// <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);
/// <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>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="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="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);
/// <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="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);
/// <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);
}
}
|