ホーム › Networking.HttpServer › HttpQueryServerSessionProperty
HttpQueryServerSessionProperty
関数サーバーセッションのプロパティを取得する。
シグネチャ
// HTTPAPI.dll
#include <windows.h>
DWORD HttpQueryServerSessionProperty(
ULONGLONG ServerSessionId,
HTTP_SERVER_PROPERTY Property,
void* PropertyInformation, // optional
DWORD PropertyInformationLength,
DWORD* ReturnLength // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ServerSessionId | ULONGLONG | in |
| Property | HTTP_SERVER_PROPERTY | in |
| PropertyInformation | void* | outoptional |
| PropertyInformationLength | DWORD | in |
| ReturnLength | DWORD* | outoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// HTTPAPI.dll
#include <windows.h>
DWORD HttpQueryServerSessionProperty(
ULONGLONG ServerSessionId,
HTTP_SERVER_PROPERTY Property,
void* PropertyInformation, // optional
DWORD PropertyInformationLength,
DWORD* ReturnLength // optional
);[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpQueryServerSessionProperty(
ulong ServerSessionId, // 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 HttpQueryServerSessionProperty(
ServerSessionId 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' ServerSessionId : ULONGLONG
' Property : HTTP_SERVER_PROPERTY
' PropertyInformation : void* optional, out
' PropertyInformationLength : DWORD
' ReturnLength : DWORD* optional, out
Declare PtrSafe Function HttpQueryServerSessionProperty Lib "httpapi" ( _
ByVal ServerSessionId 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
HttpQueryServerSessionProperty = ctypes.windll.httpapi.HttpQueryServerSessionProperty
HttpQueryServerSessionProperty.restype = wintypes.DWORD
HttpQueryServerSessionProperty.argtypes = [
ctypes.c_ulonglong, # ServerSessionId : 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')
HttpQueryServerSessionProperty = Fiddle::Function.new(
lib['HttpQueryServerSessionProperty'],
[
-Fiddle::TYPE_LONG_LONG, # ServerSessionId : 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 HttpQueryServerSessionProperty(
ServerSessionId: 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 HttpQueryServerSessionProperty(ulong ServerSessionId, int Property, IntPtr PropertyInformation, uint PropertyInformationLength, IntPtr ReturnLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpQueryServerSessionProperty' -Namespace Win32 -PassThru
# $api::HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, ReturnLength)#uselib "HTTPAPI.dll"
#func global HttpQueryServerSessionProperty "HttpQueryServerSessionProperty" sptr, sptr, sptr, sptr, sptr
; HttpQueryServerSessionProperty ServerSessionId, Property, PropertyInformation, PropertyInformationLength, varptr(ReturnLength) ; 戻り値は stat
; ServerSessionId : 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 HttpQueryServerSessionProperty "HttpQueryServerSessionProperty" int64, int, sptr, int, var ; res = HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, ReturnLength) ; ServerSessionId : 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 は未対応)。#uselib "HTTPAPI.dll" #cfunc global HttpQueryServerSessionProperty "HttpQueryServerSessionProperty" int64, int, sptr, int, sptr ; res = HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, varptr(ReturnLength)) ; ServerSessionId : ULONGLONG -> "int64" ; Property : HTTP_SERVER_PROPERTY -> "int" ; PropertyInformation : void* optional, out -> "sptr" ; PropertyInformationLength : DWORD -> "int" ; ReturnLength : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; DWORD HttpQueryServerSessionProperty(ULONGLONG ServerSessionId, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength, DWORD* ReturnLength) #uselib "HTTPAPI.dll" #cfunc global HttpQueryServerSessionProperty "HttpQueryServerSessionProperty" int64, int, intptr, int, var ; res = HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, ReturnLength) ; ServerSessionId : ULONGLONG -> "int64" ; Property : HTTP_SERVER_PROPERTY -> "int" ; PropertyInformation : void* optional, out -> "intptr" ; PropertyInformationLength : DWORD -> "int" ; ReturnLength : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD HttpQueryServerSessionProperty(ULONGLONG ServerSessionId, HTTP_SERVER_PROPERTY Property, void* PropertyInformation, DWORD PropertyInformationLength, DWORD* ReturnLength) #uselib "HTTPAPI.dll" #cfunc global HttpQueryServerSessionProperty "HttpQueryServerSessionProperty" int64, int, intptr, int, intptr ; res = HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, varptr(ReturnLength)) ; ServerSessionId : ULONGLONG -> "int64" ; Property : HTTP_SERVER_PROPERTY -> "int" ; PropertyInformation : void* optional, out -> "intptr" ; PropertyInformationLength : DWORD -> "int" ; ReturnLength : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
procHttpQueryServerSessionProperty = httpapi.NewProc("HttpQueryServerSessionProperty")
)
// ServerSessionId (ULONGLONG), Property (HTTP_SERVER_PROPERTY), PropertyInformation (void* optional, out), PropertyInformationLength (DWORD), ReturnLength (DWORD* optional, out)
r1, _, err := procHttpQueryServerSessionProperty.Call(
uintptr(ServerSessionId),
uintptr(Property),
uintptr(PropertyInformation),
uintptr(PropertyInformationLength),
uintptr(ReturnLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction HttpQueryServerSessionProperty(
ServerSessionId: 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 'HttpQueryServerSessionProperty';result := DllCall("HTTPAPI\HttpQueryServerSessionProperty"
, "Int64", ServerSessionId ; ULONGLONG
, "Int", Property ; HTTP_SERVER_PROPERTY
, "Ptr", PropertyInformation ; void* optional, out
, "UInt", PropertyInformationLength ; DWORD
, "Ptr", ReturnLength ; DWORD* optional, out
, "UInt") ; return: DWORD●HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, ReturnLength) = DLL("HTTPAPI.dll", "dword HttpQueryServerSessionProperty(qword, int, void*, dword, void*)")
# 呼び出し: HttpQueryServerSessionProperty(ServerSessionId, Property, PropertyInformation, PropertyInformationLength, ReturnLength)
# ServerSessionId : 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)。