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

HttpSetServerSessionProperty

関数
サーバーセッションのプロパティを設定する。
DLLHTTPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD HttpSetServerSessionProperty(
    ULONGLONG ServerSessionId,
    HTTP_SERVER_PROPERTY Property,
    void* PropertyInformation,
    DWORD PropertyInformationLength
);

パラメーター

名前方向
ServerSessionIdULONGLONGin
PropertyHTTP_SERVER_PROPERTYin
PropertyInformationvoid*in
PropertyInformationLengthDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD HttpSetServerSessionProperty(
    ULONGLONG ServerSessionId,
    HTTP_SERVER_PROPERTY Property,
    void* PropertyInformation,
    DWORD PropertyInformationLength
);
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpSetServerSessionProperty(
    ulong ServerSessionId,   // ULONGLONG
    int Property,   // HTTP_SERVER_PROPERTY
    IntPtr PropertyInformation,   // void*
    uint PropertyInformationLength   // DWORD
);
<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpSetServerSessionProperty(
    ServerSessionId As ULong,   ' ULONGLONG
    [Property] As Integer,   ' HTTP_SERVER_PROPERTY
    PropertyInformation As IntPtr,   ' void*
    PropertyInformationLength As UInteger   ' DWORD
) As UInteger
End Function
' ServerSessionId : ULONGLONG
' Property : HTTP_SERVER_PROPERTY
' PropertyInformation : void*
' PropertyInformationLength : DWORD
Declare PtrSafe Function HttpSetServerSessionProperty Lib "httpapi" ( _
    ByVal ServerSessionId 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

HttpSetServerSessionProperty = ctypes.windll.httpapi.HttpSetServerSessionProperty
HttpSetServerSessionProperty.restype = wintypes.DWORD
HttpSetServerSessionProperty.argtypes = [
    ctypes.c_ulonglong,  # ServerSessionId : 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')
HttpSetServerSessionProperty = Fiddle::Function.new(
  lib['HttpSetServerSessionProperty'],
  [
    -Fiddle::TYPE_LONG_LONG,  # ServerSessionId : 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 HttpSetServerSessionProperty(
        ServerSessionId: 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 HttpSetServerSessionProperty(ulong ServerSessionId, int Property, IntPtr PropertyInformation, uint PropertyInformationLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpSetServerSessionProperty' -Namespace Win32 -PassThru
# $api::HttpSetServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength)
#uselib "HTTPAPI.dll"
#func global HttpSetServerSessionProperty "HttpSetServerSessionProperty" sptr, sptr, sptr, sptr
; HttpSetServerSessionProperty ServerSessionId, Property, PropertyInformation, PropertyInformationLength   ; 戻り値は stat
; ServerSessionId : 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 HttpSetServerSessionProperty "HttpSetServerSessionProperty" int64, int, sptr, int
; res = HttpSetServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength)
; ServerSessionId : ULONGLONG -> "int64"
; Property : HTTP_SERVER_PROPERTY -> "int"
; PropertyInformation : void* -> "sptr"
; PropertyInformationLength : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; DWORD HttpSetServerSessionProperty(ULONGLONG ServerSessionId, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength)
#uselib "HTTPAPI.dll"
#cfunc global HttpSetServerSessionProperty "HttpSetServerSessionProperty" int64, int, intptr, int
; res = HttpSetServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength)
; ServerSessionId : 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")
	procHttpSetServerSessionProperty = httpapi.NewProc("HttpSetServerSessionProperty")
)

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