Win32 API 日本語リファレンス
ホームNetworking.HttpServer › HttpSetRequestQueueProperty

HttpSetRequestQueueProperty

関数
リクエストキューのプロパティを設定する。
DLLHTTPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// HTTPAPI.dll
#include <windows.h>

DWORD HttpSetRequestQueueProperty(
    HANDLE RequestQueueHandle,
    HTTP_SERVER_PROPERTY Property,
    void* PropertyInformation,
    DWORD PropertyInformationLength,
    DWORD Reserved1,   // optional
    void* Reserved2   // optional
);

パラメーター

名前方向説明
RequestQueueHandleHANDLEinプロパティを設定する対象のリクエストキューへのハンドル。リクエストキューは HttpCreateRequestQueue 関数の呼び出しによって作成され、そのハンドルが返されます。
PropertyHTTP_SERVER_PROPERTYin

設定するプロパティの種類を表す HTTP_SERVER_PROPERTY 列挙体のメンバー。次のいずれかを指定する必要があります。

Property 意味
HttpServer503VerbosityProperty
リクエストキューに対して生成される 503 応答の現在の詳細レベルを変更または設定します。
HttpServerQueueLengthProperty
リクエストキュー内の未処理リクエスト数の上限を変更または設定します。
HttpServerStateProperty
リクエストキューの状態を変更または設定します。状態はアクティブまたは非アクティブのいずれかである必要があります。
PropertyInformationvoid*in

プロパティ情報を格納するバッファーへのポインター。

pPropertyInformation は、設定するプロパティに応じて次のいずれかのプロパティ情報型を指します。

Property 構成型
HttpServerStateProperty HTTP_ENABLED_STATE 列挙体
HttpServerQueueLengthProperty ULONG
HttpServer503VerbosityProperty HTTP_503_RESPONSE_VERBOSITY 列挙体
PropertyInformationLengthDWORDinpPropertyInformation パラメーターが指すバッファーの長さ(バイト単位)。
Reserved1DWORDoptional予約済み。ゼロである必要があります。
Reserved2void*optional予約済み。NULL である必要があります。

戻り値の型: DWORD

公式ドキュメント

指定したハンドルで識別されるリクエストキューに対して、新しいプロパティを設定するか、既存のプロパティを変更します。

戻り値

関数が成功した場合は NO_ERROR を返します。

関数が失敗した場合は、次のいずれかのエラーコードを返します。

意味
ERROR_INVALID_PARAMETER
Reserved パラメーターがゼロでないか、pReserved パラメーターが NULL ではありません。

Property パラメーターで指定されたプロパティの種類がリクエストキューでサポートされていません。

pPropertyInformation パラメーターが NULL です。

PropertyInformationLength パラメーターがゼロです。

アプリケーションにリクエストキューのプロパティを設定する権限がありません。プロパティを設定できるのは、リクエストキューを作成したアプリケーションのみです。

ERROR_NOT_SUPPORTED
リクエストキューへのハンドルが HTTP バージョン 1.0 のハンドルです。プロパティ管理は HTTP バージョン 2.0 以降のリクエストキューでのみサポートされます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// HTTPAPI.dll
#include <windows.h>

DWORD HttpSetRequestQueueProperty(
    HANDLE RequestQueueHandle,
    HTTP_SERVER_PROPERTY Property,
    void* PropertyInformation,
    DWORD PropertyInformationLength,
    DWORD Reserved1,   // optional
    void* Reserved2   // optional
);
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpSetRequestQueueProperty(
    IntPtr RequestQueueHandle,   // HANDLE
    int Property,   // HTTP_SERVER_PROPERTY
    IntPtr PropertyInformation,   // void*
    uint PropertyInformationLength,   // DWORD
    uint Reserved1,   // DWORD optional
    IntPtr Reserved2   // void* optional
);
<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpSetRequestQueueProperty(
    RequestQueueHandle As IntPtr,   ' HANDLE
    [Property] As Integer,   ' HTTP_SERVER_PROPERTY
    PropertyInformation As IntPtr,   ' void*
    PropertyInformationLength As UInteger,   ' DWORD
    Reserved1 As UInteger,   ' DWORD optional
    Reserved2 As IntPtr   ' void* optional
) As UInteger
End Function
' RequestQueueHandle : HANDLE
' Property : HTTP_SERVER_PROPERTY
' PropertyInformation : void*
' PropertyInformationLength : DWORD
' Reserved1 : DWORD optional
' Reserved2 : void* optional
Declare PtrSafe Function HttpSetRequestQueueProperty Lib "httpapi" ( _
    ByVal RequestQueueHandle As LongPtr, _
    ByVal Property As Long, _
    ByVal PropertyInformation As LongPtr, _
    ByVal PropertyInformationLength As Long, _
    ByVal Reserved1 As Long, _
    ByVal Reserved2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HttpSetRequestQueueProperty = ctypes.windll.httpapi.HttpSetRequestQueueProperty
HttpSetRequestQueueProperty.restype = wintypes.DWORD
HttpSetRequestQueueProperty.argtypes = [
    wintypes.HANDLE,  # RequestQueueHandle : HANDLE
    ctypes.c_int,  # Property : HTTP_SERVER_PROPERTY
    ctypes.POINTER(None),  # PropertyInformation : void*
    wintypes.DWORD,  # PropertyInformationLength : DWORD
    wintypes.DWORD,  # Reserved1 : DWORD optional
    ctypes.POINTER(None),  # Reserved2 : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('HTTPAPI.dll')
HttpSetRequestQueueProperty = Fiddle::Function.new(
  lib['HttpSetRequestQueueProperty'],
  [
    Fiddle::TYPE_VOIDP,  # RequestQueueHandle : HANDLE
    Fiddle::TYPE_INT,  # Property : HTTP_SERVER_PROPERTY
    Fiddle::TYPE_VOIDP,  # PropertyInformation : void*
    -Fiddle::TYPE_INT,  # PropertyInformationLength : DWORD
    -Fiddle::TYPE_INT,  # Reserved1 : DWORD optional
    Fiddle::TYPE_VOIDP,  # Reserved2 : void* optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "httpapi")]
extern "system" {
    fn HttpSetRequestQueueProperty(
        RequestQueueHandle: *mut core::ffi::c_void,  // HANDLE
        Property: i32,  // HTTP_SERVER_PROPERTY
        PropertyInformation: *mut (),  // void*
        PropertyInformationLength: u32,  // DWORD
        Reserved1: u32,  // DWORD optional
        Reserved2: *mut ()  // void* optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpSetRequestQueueProperty(IntPtr RequestQueueHandle, int Property, IntPtr PropertyInformation, uint PropertyInformationLength, uint Reserved1, IntPtr Reserved2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpSetRequestQueueProperty' -Namespace Win32 -PassThru
# $api::HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
#uselib "HTTPAPI.dll"
#func global HttpSetRequestQueueProperty "HttpSetRequestQueueProperty" sptr, sptr, sptr, sptr, sptr, sptr
; HttpSetRequestQueueProperty RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2   ; 戻り値は stat
; RequestQueueHandle : HANDLE -> "sptr"
; Property : HTTP_SERVER_PROPERTY -> "sptr"
; PropertyInformation : void* -> "sptr"
; PropertyInformationLength : DWORD -> "sptr"
; Reserved1 : DWORD optional -> "sptr"
; Reserved2 : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "HTTPAPI.dll"
#cfunc global HttpSetRequestQueueProperty "HttpSetRequestQueueProperty" sptr, int, sptr, int, int, sptr
; res = HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
; RequestQueueHandle : HANDLE -> "sptr"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* -> "sptr"
; PropertyInformationLength : DWORD -> "int"
; Reserved1 : DWORD optional -> "int"
; Reserved2 : void* optional -> "sptr"
; DWORD HttpSetRequestQueueProperty(HANDLE RequestQueueHandle, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength, DWORD Reserved1, void* Reserved2)
#uselib "HTTPAPI.dll"
#cfunc global HttpSetRequestQueueProperty "HttpSetRequestQueueProperty" intptr, int, intptr, int, int, intptr
; res = HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
; RequestQueueHandle : HANDLE -> "intptr"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* -> "intptr"
; PropertyInformationLength : DWORD -> "int"
; Reserved1 : DWORD optional -> "int"
; Reserved2 : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
	procHttpSetRequestQueueProperty = httpapi.NewProc("HttpSetRequestQueueProperty")
)

// RequestQueueHandle (HANDLE), Property (HTTP_SERVER_PROPERTY), PropertyInformation (void*), PropertyInformationLength (DWORD), Reserved1 (DWORD optional), Reserved2 (void* optional)
r1, _, err := procHttpSetRequestQueueProperty.Call(
	uintptr(RequestQueueHandle),
	uintptr(Property),
	uintptr(PropertyInformation),
	uintptr(PropertyInformationLength),
	uintptr(Reserved1),
	uintptr(Reserved2),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function HttpSetRequestQueueProperty(
  RequestQueueHandle: THandle;   // HANDLE
  Property: Integer;   // HTTP_SERVER_PROPERTY
  PropertyInformation: Pointer;   // void*
  PropertyInformationLength: DWORD;   // DWORD
  Reserved1: DWORD;   // DWORD optional
  Reserved2: Pointer   // void* optional
): DWORD; stdcall;
  external 'HTTPAPI.dll' name 'HttpSetRequestQueueProperty';
result := DllCall("HTTPAPI\HttpSetRequestQueueProperty"
    , "Ptr", RequestQueueHandle   ; HANDLE
    , "Int", Property   ; HTTP_SERVER_PROPERTY
    , "Ptr", PropertyInformation   ; void*
    , "UInt", PropertyInformationLength   ; DWORD
    , "UInt", Reserved1   ; DWORD optional
    , "Ptr", Reserved2   ; void* optional
    , "UInt")   ; return: DWORD
●HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2) = DLL("HTTPAPI.dll", "dword HttpSetRequestQueueProperty(void*, int, void*, dword, dword, void*)")
# 呼び出し: HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
# RequestQueueHandle : HANDLE -> "void*"
# Property : HTTP_SERVER_PROPERTY -> "int"
# PropertyInformation : void* -> "void*"
# PropertyInformationLength : DWORD -> "dword"
# Reserved1 : DWORD optional -> "dword"
# Reserved2 : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "httpapi" fn HttpSetRequestQueueProperty(
    RequestQueueHandle: ?*anyopaque, // HANDLE
    Property: i32, // HTTP_SERVER_PROPERTY
    PropertyInformation: ?*anyopaque, // void*
    PropertyInformationLength: u32, // DWORD
    Reserved1: u32, // DWORD optional
    Reserved2: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) u32;
proc HttpSetRequestQueueProperty(
    RequestQueueHandle: pointer,  # HANDLE
    Property: int32,  # HTTP_SERVER_PROPERTY
    PropertyInformation: pointer,  # void*
    PropertyInformationLength: uint32,  # DWORD
    Reserved1: uint32,  # DWORD optional
    Reserved2: pointer  # void* optional
): uint32 {.importc: "HttpSetRequestQueueProperty", stdcall, dynlib: "HTTPAPI.dll".}
pragma(lib, "httpapi");
extern(Windows)
uint HttpSetRequestQueueProperty(
    void* RequestQueueHandle,   // HANDLE
    int Property,   // HTTP_SERVER_PROPERTY
    void* PropertyInformation,   // void*
    uint PropertyInformationLength,   // DWORD
    uint Reserved1,   // DWORD optional
    void* Reserved2   // void* optional
);
ccall((:HttpSetRequestQueueProperty, "HTTPAPI.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Int32, Ptr{Cvoid}, UInt32, UInt32, Ptr{Cvoid}),
      RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
# RequestQueueHandle : HANDLE -> Ptr{Cvoid}
# Property : HTTP_SERVER_PROPERTY -> Int32
# PropertyInformation : void* -> Ptr{Cvoid}
# PropertyInformationLength : DWORD -> UInt32
# Reserved1 : DWORD optional -> UInt32
# Reserved2 : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t HttpSetRequestQueueProperty(
    void* RequestQueueHandle,
    int32_t Property,
    void* PropertyInformation,
    uint32_t PropertyInformationLength,
    uint32_t Reserved1,
    void* Reserved2);
]]
local httpapi = ffi.load("httpapi")
-- httpapi.HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
-- RequestQueueHandle : HANDLE
-- Property : HTTP_SERVER_PROPERTY
-- PropertyInformation : void*
-- PropertyInformationLength : DWORD
-- Reserved1 : DWORD optional
-- Reserved2 : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('HTTPAPI.dll');
const HttpSetRequestQueueProperty = lib.func('__stdcall', 'HttpSetRequestQueueProperty', 'uint32_t', ['void *', 'int32_t', 'void *', 'uint32_t', 'uint32_t', 'void *']);
// HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
// RequestQueueHandle : HANDLE -> 'void *'
// Property : HTTP_SERVER_PROPERTY -> 'int32_t'
// PropertyInformation : void* -> 'void *'
// PropertyInformationLength : DWORD -> 'uint32_t'
// Reserved1 : DWORD optional -> 'uint32_t'
// Reserved2 : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("HTTPAPI.dll", {
  HttpSetRequestQueueProperty: { parameters: ["pointer", "i32", "pointer", "u32", "u32", "pointer"], result: "u32" },
});
// lib.symbols.HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2)
// RequestQueueHandle : HANDLE -> "pointer"
// Property : HTTP_SERVER_PROPERTY -> "i32"
// PropertyInformation : void* -> "pointer"
// PropertyInformationLength : DWORD -> "u32"
// Reserved1 : DWORD optional -> "u32"
// Reserved2 : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t HttpSetRequestQueueProperty(
    void* RequestQueueHandle,
    int32_t Property,
    void* PropertyInformation,
    uint32_t PropertyInformationLength,
    uint32_t Reserved1,
    void* Reserved2);
C, "HTTPAPI.dll");
// $ffi->HttpSetRequestQueueProperty(RequestQueueHandle, Property, PropertyInformation, PropertyInformationLength, Reserved1, Reserved2);
// RequestQueueHandle : HANDLE
// Property : HTTP_SERVER_PROPERTY
// PropertyInformation : void*
// PropertyInformationLength : DWORD
// Reserved1 : DWORD optional
// Reserved2 : void* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Httpapi extends StdCallLibrary {
    Httpapi INSTANCE = Native.load("httpapi", Httpapi.class);
    int HttpSetRequestQueueProperty(
        Pointer RequestQueueHandle,   // HANDLE
        int Property,   // HTTP_SERVER_PROPERTY
        Pointer PropertyInformation,   // void*
        int PropertyInformationLength,   // DWORD
        int Reserved1,   // DWORD optional
        Pointer Reserved2   // void* optional
    );
}
@[Link("httpapi")]
lib LibHTTPAPI
  fun HttpSetRequestQueueProperty = HttpSetRequestQueueProperty(
    RequestQueueHandle : Void*,   # HANDLE
    Property : Int32,   # HTTP_SERVER_PROPERTY
    PropertyInformation : Void*,   # void*
    PropertyInformationLength : UInt32,   # DWORD
    Reserved1 : UInt32,   # DWORD optional
    Reserved2 : Void*   # void* optional
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef HttpSetRequestQueuePropertyNative = Uint32 Function(Pointer<Void>, Int32, Pointer<Void>, Uint32, Uint32, Pointer<Void>);
typedef HttpSetRequestQueuePropertyDart = int Function(Pointer<Void>, int, Pointer<Void>, int, int, Pointer<Void>);
final HttpSetRequestQueueProperty = DynamicLibrary.open('HTTPAPI.dll')
    .lookupFunction<HttpSetRequestQueuePropertyNative, HttpSetRequestQueuePropertyDart>('HttpSetRequestQueueProperty');
// RequestQueueHandle : HANDLE -> Pointer<Void>
// Property : HTTP_SERVER_PROPERTY -> Int32
// PropertyInformation : void* -> Pointer<Void>
// PropertyInformationLength : DWORD -> Uint32
// Reserved1 : DWORD optional -> Uint32
// Reserved2 : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HttpSetRequestQueueProperty(
  RequestQueueHandle: THandle;   // HANDLE
  Property: Integer;   // HTTP_SERVER_PROPERTY
  PropertyInformation: Pointer;   // void*
  PropertyInformationLength: DWORD;   // DWORD
  Reserved1: DWORD;   // DWORD optional
  Reserved2: Pointer   // void* optional
): DWORD; stdcall;
  external 'HTTPAPI.dll' name 'HttpSetRequestQueueProperty';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "HttpSetRequestQueueProperty"
  c_HttpSetRequestQueueProperty :: Ptr () -> Int32 -> Ptr () -> Word32 -> Word32 -> Ptr () -> IO Word32
-- RequestQueueHandle : HANDLE -> Ptr ()
-- Property : HTTP_SERVER_PROPERTY -> Int32
-- PropertyInformation : void* -> Ptr ()
-- PropertyInformationLength : DWORD -> Word32
-- Reserved1 : DWORD optional -> Word32
-- Reserved2 : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let httpsetrequestqueueproperty =
  foreign "HttpSetRequestQueueProperty"
    ((ptr void) @-> int32_t @-> (ptr void) @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning uint32_t)
(* RequestQueueHandle : HANDLE -> (ptr void) *)
(* Property : HTTP_SERVER_PROPERTY -> int32_t *)
(* PropertyInformation : void* -> (ptr void) *)
(* PropertyInformationLength : DWORD -> uint32_t *)
(* Reserved1 : DWORD optional -> uint32_t *)
(* Reserved2 : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library httpapi (t "HTTPAPI.dll"))
(cffi:use-foreign-library httpapi)

(cffi:defcfun ("HttpSetRequestQueueProperty" http-set-request-queue-property :convention :stdcall) :uint32
  (request-queue-handle :pointer)   ; HANDLE
  (property :int32)   ; HTTP_SERVER_PROPERTY
  (property-information :pointer)   ; void*
  (property-information-length :uint32)   ; DWORD
  (reserved1 :uint32)   ; DWORD optional
  (reserved2 :pointer))   ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HttpSetRequestQueueProperty = Win32::API::More->new('HTTPAPI',
    'DWORD HttpSetRequestQueueProperty(HANDLE RequestQueueHandle, int Property, LPVOID PropertyInformation, DWORD PropertyInformationLength, DWORD Reserved1, LPVOID Reserved2)');
# my $ret = $HttpSetRequestQueueProperty->Call($RequestQueueHandle, $Property, $PropertyInformation, $PropertyInformationLength, $Reserved1, $Reserved2);
# RequestQueueHandle : HANDLE -> HANDLE
# Property : HTTP_SERVER_PROPERTY -> int
# PropertyInformation : void* -> LPVOID
# PropertyInformationLength : DWORD -> DWORD
# Reserved1 : DWORD optional -> DWORD
# Reserved2 : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型