ホーム › Networking.HttpServer › HttpSetUrlGroupProperty
HttpSetUrlGroupProperty
関数URLグループのプロパティを設定する。
シグネチャ
// HTTPAPI.dll
#include <windows.h>
DWORD HttpSetUrlGroupProperty(
ULONGLONG UrlGroupId,
HTTP_SERVER_PROPERTY Property,
void* PropertyInformation,
DWORD PropertyInformationLength
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UrlGroupId | ULONGLONG | in | プロパティを設定する対象の URL Group の ID です。 | ||||||||||||||||||
| Property | HTTP_SERVER_PROPERTY | in | 変更または設定するプロパティの種類を表す HTTP_SERVER_PROPERTY 列挙体のメンバーです。次のいずれかを指定できます。
| ||||||||||||||||||
| PropertyInformation | void* | in | プロパティ情報を格納するバッファーへのポインターです。 pPropertyInformation は、設定するプロパティに応じて、次のいずれかのプロパティ情報構造体を指します。
| ||||||||||||||||||
| PropertyInformationLength | DWORD | in | pPropertyInformation パラメーターが指すバッファーの長さ (バイト単位) です。 |
戻り値の型: DWORD
公式ドキュメント
指定した URL Group に新しいプロパティを設定するか、既存のプロパティを変更します。
戻り値
関数が成功した場合は NO_ERROR を返します。
関数が失敗した場合は、次のいずれかのエラーコードを返します。
| 値 | 意味 |
|---|---|
|
Property パラメーターに指定したプロパティの種類が URL Groups でサポートされていません。
pPropertyInformation パラメーターが NULL です。 PropertyInformationLength パラメーターが 0 です。 UrlGroupId パラメーターに有効なサーバーセッションが含まれていません。 アプリケーションに URL Group のプロパティを設定する権限がありません。URL Group を作成したアプリケーションのみがプロパティを設定できます。 |
解説(Remarks)
URL Group の作成後、リクエストを受信するにはリクエストキューと関連付ける必要があります。URL Group をリクエストキューと関連付けるには、アプリケーションが HttpServerBindingProperty プロパティを指定して HttpSetUrlGroupProperty を呼び出します。このプロパティが設定されていない場合、URL Group に一致するリクエストはリクエストキューに配信されず、HTTP Server API は 503 応答を生成します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// HTTPAPI.dll
#include <windows.h>
DWORD HttpSetUrlGroupProperty(
ULONGLONG UrlGroupId,
HTTP_SERVER_PROPERTY Property,
void* PropertyInformation,
DWORD PropertyInformationLength
);[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpSetUrlGroupProperty(
ulong UrlGroupId, // ULONGLONG
int Property, // HTTP_SERVER_PROPERTY
IntPtr PropertyInformation, // void*
uint PropertyInformationLength // DWORD
);<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpSetUrlGroupProperty(
UrlGroupId As ULong, ' ULONGLONG
[Property] As Integer, ' HTTP_SERVER_PROPERTY
PropertyInformation As IntPtr, ' void*
PropertyInformationLength As UInteger ' DWORD
) As UInteger
End Function' UrlGroupId : ULONGLONG
' Property : HTTP_SERVER_PROPERTY
' PropertyInformation : void*
' PropertyInformationLength : DWORD
Declare PtrSafe Function HttpSetUrlGroupProperty Lib "httpapi" ( _
ByVal UrlGroupId As LongLong, _
ByVal Property As Long, _
ByVal PropertyInformation As LongPtr, _
ByVal PropertyInformationLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HttpSetUrlGroupProperty = ctypes.windll.httpapi.HttpSetUrlGroupProperty
HttpSetUrlGroupProperty.restype = wintypes.DWORD
HttpSetUrlGroupProperty.argtypes = [
ctypes.c_ulonglong, # UrlGroupId : ULONGLONG
ctypes.c_int, # Property : HTTP_SERVER_PROPERTY
ctypes.POINTER(None), # PropertyInformation : void*
wintypes.DWORD, # PropertyInformationLength : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HTTPAPI.dll')
HttpSetUrlGroupProperty = Fiddle::Function.new(
lib['HttpSetUrlGroupProperty'],
[
-Fiddle::TYPE_LONG_LONG, # UrlGroupId : ULONGLONG
Fiddle::TYPE_INT, # Property : HTTP_SERVER_PROPERTY
Fiddle::TYPE_VOIDP, # PropertyInformation : void*
-Fiddle::TYPE_INT, # PropertyInformationLength : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "httpapi")]
extern "system" {
fn HttpSetUrlGroupProperty(
UrlGroupId: u64, // ULONGLONG
Property: i32, // HTTP_SERVER_PROPERTY
PropertyInformation: *mut (), // void*
PropertyInformationLength: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpSetUrlGroupProperty(ulong UrlGroupId, int Property, IntPtr PropertyInformation, uint PropertyInformationLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpSetUrlGroupProperty' -Namespace Win32 -PassThru
# $api::HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)#uselib "HTTPAPI.dll"
#func global HttpSetUrlGroupProperty "HttpSetUrlGroupProperty" sptr, sptr, sptr, sptr
; HttpSetUrlGroupProperty UrlGroupId, Property, PropertyInformation, PropertyInformationLength ; 戻り値は stat
; UrlGroupId : ULONGLONG -> "sptr"
; Property : HTTP_SERVER_PROPERTY -> "sptr"
; PropertyInformation : void* -> "sptr"
; PropertyInformationLength : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "HTTPAPI.dll"
#cfunc global HttpSetUrlGroupProperty "HttpSetUrlGroupProperty" int64, int, sptr, int
; res = HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
; UrlGroupId : ULONGLONG -> "int64"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* -> "sptr"
; PropertyInformationLength : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; DWORD HttpSetUrlGroupProperty(ULONGLONG UrlGroupId, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength)
#uselib "HTTPAPI.dll"
#cfunc global HttpSetUrlGroupProperty "HttpSetUrlGroupProperty" int64, int, intptr, int
; res = HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
; UrlGroupId : ULONGLONG -> "int64"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* -> "intptr"
; PropertyInformationLength : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
procHttpSetUrlGroupProperty = httpapi.NewProc("HttpSetUrlGroupProperty")
)
// UrlGroupId (ULONGLONG), Property (HTTP_SERVER_PROPERTY), PropertyInformation (void*), PropertyInformationLength (DWORD)
r1, _, err := procHttpSetUrlGroupProperty.Call(
uintptr(UrlGroupId),
uintptr(Property),
uintptr(PropertyInformation),
uintptr(PropertyInformationLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction HttpSetUrlGroupProperty(
UrlGroupId: UInt64; // ULONGLONG
Property: Integer; // HTTP_SERVER_PROPERTY
PropertyInformation: Pointer; // void*
PropertyInformationLength: DWORD // DWORD
): DWORD; stdcall;
external 'HTTPAPI.dll' name 'HttpSetUrlGroupProperty';result := DllCall("HTTPAPI\HttpSetUrlGroupProperty"
, "Int64", UrlGroupId ; ULONGLONG
, "Int", Property ; HTTP_SERVER_PROPERTY
, "Ptr", PropertyInformation ; void*
, "UInt", PropertyInformationLength ; DWORD
, "UInt") ; return: DWORD●HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength) = DLL("HTTPAPI.dll", "dword HttpSetUrlGroupProperty(qword, int, void*, dword)")
# 呼び出し: HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
# UrlGroupId : ULONGLONG -> "qword"
# Property : HTTP_SERVER_PROPERTY -> "int"
# PropertyInformation : void* -> "void*"
# PropertyInformationLength : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "httpapi" fn HttpSetUrlGroupProperty(
UrlGroupId: u64, // ULONGLONG
Property: i32, // HTTP_SERVER_PROPERTY
PropertyInformation: ?*anyopaque, // void*
PropertyInformationLength: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;proc HttpSetUrlGroupProperty(
UrlGroupId: uint64, # ULONGLONG
Property: int32, # HTTP_SERVER_PROPERTY
PropertyInformation: pointer, # void*
PropertyInformationLength: uint32 # DWORD
): uint32 {.importc: "HttpSetUrlGroupProperty", stdcall, dynlib: "HTTPAPI.dll".}pragma(lib, "httpapi");
extern(Windows)
uint HttpSetUrlGroupProperty(
ulong UrlGroupId, // ULONGLONG
int Property, // HTTP_SERVER_PROPERTY
void* PropertyInformation, // void*
uint PropertyInformationLength // DWORD
);ccall((:HttpSetUrlGroupProperty, "HTTPAPI.dll"), stdcall, UInt32,
(UInt64, Int32, Ptr{Cvoid}, UInt32),
UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
# UrlGroupId : ULONGLONG -> UInt64
# Property : HTTP_SERVER_PROPERTY -> Int32
# PropertyInformation : void* -> Ptr{Cvoid}
# PropertyInformationLength : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t HttpSetUrlGroupProperty(
uint64_t UrlGroupId,
int32_t Property,
void* PropertyInformation,
uint32_t PropertyInformationLength);
]]
local httpapi = ffi.load("httpapi")
-- httpapi.HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
-- UrlGroupId : ULONGLONG
-- Property : HTTP_SERVER_PROPERTY
-- PropertyInformation : void*
-- PropertyInformationLength : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('HTTPAPI.dll');
const HttpSetUrlGroupProperty = lib.func('__stdcall', 'HttpSetUrlGroupProperty', 'uint32_t', ['uint64_t', 'int32_t', 'void *', 'uint32_t']);
// HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
// UrlGroupId : ULONGLONG -> 'uint64_t'
// Property : HTTP_SERVER_PROPERTY -> 'int32_t'
// PropertyInformation : void* -> 'void *'
// PropertyInformationLength : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("HTTPAPI.dll", {
HttpSetUrlGroupProperty: { parameters: ["u64", "i32", "pointer", "u32"], result: "u32" },
});
// lib.symbols.HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength)
// UrlGroupId : ULONGLONG -> "u64"
// Property : HTTP_SERVER_PROPERTY -> "i32"
// PropertyInformation : void* -> "pointer"
// PropertyInformationLength : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t HttpSetUrlGroupProperty(
uint64_t UrlGroupId,
int32_t Property,
void* PropertyInformation,
uint32_t PropertyInformationLength);
C, "HTTPAPI.dll");
// $ffi->HttpSetUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength);
// UrlGroupId : ULONGLONG
// Property : HTTP_SERVER_PROPERTY
// PropertyInformation : void*
// PropertyInformationLength : DWORD
// 構造体/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 HttpSetUrlGroupProperty(
long UrlGroupId, // ULONGLONG
int Property, // HTTP_SERVER_PROPERTY
Pointer PropertyInformation, // void*
int PropertyInformationLength // DWORD
);
}@[Link("httpapi")]
lib LibHTTPAPI
fun HttpSetUrlGroupProperty = HttpSetUrlGroupProperty(
UrlGroupId : UInt64, # ULONGLONG
Property : Int32, # HTTP_SERVER_PROPERTY
PropertyInformation : Void*, # void*
PropertyInformationLength : UInt32 # DWORD
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HttpSetUrlGroupPropertyNative = Uint32 Function(Uint64, Int32, Pointer<Void>, Uint32);
typedef HttpSetUrlGroupPropertyDart = int Function(int, int, Pointer<Void>, int);
final HttpSetUrlGroupProperty = DynamicLibrary.open('HTTPAPI.dll')
.lookupFunction<HttpSetUrlGroupPropertyNative, HttpSetUrlGroupPropertyDart>('HttpSetUrlGroupProperty');
// UrlGroupId : ULONGLONG -> Uint64
// Property : HTTP_SERVER_PROPERTY -> Int32
// PropertyInformation : void* -> Pointer<Void>
// PropertyInformationLength : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HttpSetUrlGroupProperty(
UrlGroupId: UInt64; // ULONGLONG
Property: Integer; // HTTP_SERVER_PROPERTY
PropertyInformation: Pointer; // void*
PropertyInformationLength: DWORD // DWORD
): DWORD; stdcall;
external 'HTTPAPI.dll' name 'HttpSetUrlGroupProperty';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HttpSetUrlGroupProperty"
c_HttpSetUrlGroupProperty :: Word64 -> Int32 -> Ptr () -> Word32 -> IO Word32
-- UrlGroupId : ULONGLONG -> Word64
-- Property : HTTP_SERVER_PROPERTY -> Int32
-- PropertyInformation : void* -> Ptr ()
-- PropertyInformationLength : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let httpseturlgroupproperty =
foreign "HttpSetUrlGroupProperty"
(uint64_t @-> int32_t @-> (ptr void) @-> uint32_t @-> returning uint32_t)
(* UrlGroupId : ULONGLONG -> uint64_t *)
(* Property : HTTP_SERVER_PROPERTY -> int32_t *)
(* PropertyInformation : void* -> (ptr void) *)
(* PropertyInformationLength : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library httpapi (t "HTTPAPI.dll"))
(cffi:use-foreign-library httpapi)
(cffi:defcfun ("HttpSetUrlGroupProperty" http-set-url-group-property :convention :stdcall) :uint32
(url-group-id :uint64) ; ULONGLONG
(property :int32) ; HTTP_SERVER_PROPERTY
(property-information :pointer) ; void*
(property-information-length :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HttpSetUrlGroupProperty = Win32::API::More->new('HTTPAPI',
'DWORD HttpSetUrlGroupProperty(UINT64 UrlGroupId, int Property, LPVOID PropertyInformation, DWORD PropertyInformationLength)');
# my $ret = $HttpSetUrlGroupProperty->Call($UrlGroupId, $Property, $PropertyInformation, $PropertyInformationLength);
# UrlGroupId : ULONGLONG -> UINT64
# Property : HTTP_SERVER_PROPERTY -> int
# PropertyInformation : void* -> LPVOID
# PropertyInformationLength : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f HttpAddUrlToUrlGroup — URLグループにURLを追加する。
- f HttpCloseUrlGroup — URLグループを閉じて解放する。
- f HttpCreateUrlGroup — サーバーセッションにURLグループを作成する。
- f HttpQueryUrlGroupProperty — URLグループのプロパティを取得する。
- f HttpRemoveUrlFromUrlGroup — URLグループからURLを削除する。