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

HttpQueryUrlGroupProperty

関数
URLグループのプロパティを取得する。
DLLHTTPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD HttpQueryUrlGroupProperty(
    ULONGLONG UrlGroupId,
    HTTP_SERVER_PROPERTY Property,
    void* PropertyInformation,   // optional
    DWORD PropertyInformationLength,
    DWORD* ReturnLength   // optional
);

パラメーター

名前方向
UrlGroupIdULONGLONGin
PropertyHTTP_SERVER_PROPERTYin
PropertyInformationvoid*outoptional
PropertyInformationLengthDWORDin
ReturnLengthDWORD*outoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

HttpQueryUrlGroupProperty = ctypes.windll.httpapi.HttpQueryUrlGroupProperty
HttpQueryUrlGroupProperty.restype = wintypes.DWORD
HttpQueryUrlGroupProperty.argtypes = [
    ctypes.c_ulonglong,  # UrlGroupId : ULONGLONG
    ctypes.c_int,  # Property : HTTP_SERVER_PROPERTY
    ctypes.POINTER(None),  # PropertyInformation : void* optional, out
    wintypes.DWORD,  # PropertyInformationLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # ReturnLength : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('HTTPAPI.dll')
HttpQueryUrlGroupProperty = Fiddle::Function.new(
  lib['HttpQueryUrlGroupProperty'],
  [
    -Fiddle::TYPE_LONG_LONG,  # UrlGroupId : ULONGLONG
    Fiddle::TYPE_INT,  # Property : HTTP_SERVER_PROPERTY
    Fiddle::TYPE_VOIDP,  # PropertyInformation : void* optional, out
    -Fiddle::TYPE_INT,  # PropertyInformationLength : DWORD
    Fiddle::TYPE_VOIDP,  # ReturnLength : DWORD* optional, out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "httpapi")]
extern "system" {
    fn HttpQueryUrlGroupProperty(
        UrlGroupId: u64,  // ULONGLONG
        Property: i32,  // HTTP_SERVER_PROPERTY
        PropertyInformation: *mut (),  // void* optional, out
        PropertyInformationLength: u32,  // DWORD
        ReturnLength: *mut u32  // DWORD* optional, out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpQueryUrlGroupProperty(ulong UrlGroupId, int Property, IntPtr PropertyInformation, uint PropertyInformationLength, IntPtr ReturnLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpQueryUrlGroupProperty' -Namespace Win32 -PassThru
# $api::HttpQueryUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength, ReturnLength)
#uselib "HTTPAPI.dll"
#func global HttpQueryUrlGroupProperty "HttpQueryUrlGroupProperty" sptr, sptr, sptr, sptr, sptr
; HttpQueryUrlGroupProperty UrlGroupId, Property, PropertyInformation, PropertyInformationLength, varptr(ReturnLength)   ; 戻り値は stat
; UrlGroupId : ULONGLONG -> "sptr"
; Property : HTTP_SERVER_PROPERTY -> "sptr"
; PropertyInformation : void* optional, out -> "sptr"
; PropertyInformationLength : DWORD -> "sptr"
; ReturnLength : DWORD* optional, out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "HTTPAPI.dll"
#cfunc global HttpQueryUrlGroupProperty "HttpQueryUrlGroupProperty" int64, int, sptr, int, var
; res = HttpQueryUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength, ReturnLength)
; UrlGroupId : ULONGLONG -> "int64"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* optional, out -> "sptr"
; PropertyInformationLength : DWORD -> "int"
; ReturnLength : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; DWORD HttpQueryUrlGroupProperty(ULONGLONG UrlGroupId, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength, DWORD* ReturnLength)
#uselib "HTTPAPI.dll"
#cfunc global HttpQueryUrlGroupProperty "HttpQueryUrlGroupProperty" int64, int, intptr, int, var
; res = HttpQueryUrlGroupProperty(UrlGroupId, Property, PropertyInformation, PropertyInformationLength, ReturnLength)
; UrlGroupId : ULONGLONG -> "int64"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* optional, out -> "intptr"
; PropertyInformationLength : DWORD -> "int"
; ReturnLength : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
	procHttpQueryUrlGroupProperty = httpapi.NewProc("HttpQueryUrlGroupProperty")
)

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