ホーム › Networking.HttpServer › HttpCreateServerSession
HttpCreateServerSession
関数HTTPサーバーセッションを作成する。
シグネチャ
// HTTPAPI.dll
#include <windows.h>
DWORD HttpCreateServerSession(
HTTPAPI_VERSION Version,
ULONGLONG* ServerSessionId,
DWORD Reserved // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Version | HTTPAPI_VERSION | in |
| ServerSessionId | ULONGLONG* | out |
| Reserved | DWORD | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// HTTPAPI.dll
#include <windows.h>
DWORD HttpCreateServerSession(
HTTPAPI_VERSION Version,
ULONGLONG* ServerSessionId,
DWORD Reserved // optional
);[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpCreateServerSession(
HTTPAPI_VERSION Version, // HTTPAPI_VERSION
out ulong ServerSessionId, // ULONGLONG* out
uint Reserved // DWORD optional
);<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpCreateServerSession(
Version As HTTPAPI_VERSION, ' HTTPAPI_VERSION
<Out> ByRef ServerSessionId As ULong, ' ULONGLONG* out
Reserved As UInteger ' DWORD optional
) As UInteger
End Function' Version : HTTPAPI_VERSION
' ServerSessionId : ULONGLONG* out
' Reserved : DWORD optional
Declare PtrSafe Function HttpCreateServerSession Lib "httpapi" ( _
ByVal Version As LongPtr, _
ByRef ServerSessionId As LongLong, _
ByVal Reserved As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HttpCreateServerSession = ctypes.windll.httpapi.HttpCreateServerSession
HttpCreateServerSession.restype = wintypes.DWORD
HttpCreateServerSession.argtypes = [
HTTPAPI_VERSION, # Version : HTTPAPI_VERSION
ctypes.POINTER(ctypes.c_ulonglong), # ServerSessionId : ULONGLONG* out
wintypes.DWORD, # Reserved : DWORD optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HTTPAPI.dll')
HttpCreateServerSession = Fiddle::Function.new(
lib['HttpCreateServerSession'],
[
Fiddle::TYPE_VOIDP, # Version : HTTPAPI_VERSION
Fiddle::TYPE_VOIDP, # ServerSessionId : ULONGLONG* out
-Fiddle::TYPE_INT, # Reserved : DWORD optional
],
-Fiddle::TYPE_INT)#[link(name = "httpapi")]
extern "system" {
fn HttpCreateServerSession(
Version: HTTPAPI_VERSION, // HTTPAPI_VERSION
ServerSessionId: *mut u64, // ULONGLONG* out
Reserved: u32 // DWORD optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpCreateServerSession(HTTPAPI_VERSION Version, out ulong ServerSessionId, uint Reserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpCreateServerSession' -Namespace Win32 -PassThru
# $api::HttpCreateServerSession(Version, ServerSessionId, Reserved)#uselib "HTTPAPI.dll"
#func global HttpCreateServerSession "HttpCreateServerSession" sptr, sptr, sptr
; HttpCreateServerSession Version, varptr(ServerSessionId), Reserved ; 戻り値は stat
; Version : HTTPAPI_VERSION -> "sptr"
; ServerSessionId : ULONGLONG* out -> "sptr"
; Reserved : DWORD optional -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "HTTPAPI.dll" #cfunc global HttpCreateServerSession "HttpCreateServerSession" int, var, int ; res = HttpCreateServerSession(Version, ServerSessionId, Reserved) ; Version : HTTPAPI_VERSION -> "int" ; ServerSessionId : ULONGLONG* out -> "var" ; Reserved : DWORD optional -> "int" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "HTTPAPI.dll" #cfunc global HttpCreateServerSession "HttpCreateServerSession" int, sptr, int ; res = HttpCreateServerSession(Version, varptr(ServerSessionId), Reserved) ; Version : HTTPAPI_VERSION -> "int" ; ServerSessionId : ULONGLONG* out -> "sptr" ; Reserved : DWORD optional -> "int" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD HttpCreateServerSession(HTTPAPI_VERSION Version, ULONGLONG* ServerSessionId, DWORD Reserved) #uselib "HTTPAPI.dll" #cfunc global HttpCreateServerSession "HttpCreateServerSession" int, var, int ; res = HttpCreateServerSession(Version, ServerSessionId, Reserved) ; Version : HTTPAPI_VERSION -> "int" ; ServerSessionId : ULONGLONG* out -> "var" ; Reserved : DWORD optional -> "int" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD HttpCreateServerSession(HTTPAPI_VERSION Version, ULONGLONG* ServerSessionId, DWORD Reserved) #uselib "HTTPAPI.dll" #cfunc global HttpCreateServerSession "HttpCreateServerSession" int, intptr, int ; res = HttpCreateServerSession(Version, varptr(ServerSessionId), Reserved) ; Version : HTTPAPI_VERSION -> "int" ; ServerSessionId : ULONGLONG* out -> "intptr" ; Reserved : DWORD optional -> "int" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
procHttpCreateServerSession = httpapi.NewProc("HttpCreateServerSession")
)
// Version (HTTPAPI_VERSION), ServerSessionId (ULONGLONG* out), Reserved (DWORD optional)
r1, _, err := procHttpCreateServerSession.Call(
uintptr(Version),
uintptr(ServerSessionId),
uintptr(Reserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction HttpCreateServerSession(
Version: HTTPAPI_VERSION; // HTTPAPI_VERSION
ServerSessionId: Pointer; // ULONGLONG* out
Reserved: DWORD // DWORD optional
): DWORD; stdcall;
external 'HTTPAPI.dll' name 'HttpCreateServerSession';result := DllCall("HTTPAPI\HttpCreateServerSession"
, "Ptr", Version ; HTTPAPI_VERSION
, "Ptr", ServerSessionId ; ULONGLONG* out
, "UInt", Reserved ; DWORD optional
, "UInt") ; return: DWORD●HttpCreateServerSession(Version, ServerSessionId, Reserved) = DLL("HTTPAPI.dll", "dword HttpCreateServerSession(void*, void*, dword)")
# 呼び出し: HttpCreateServerSession(Version, ServerSessionId, Reserved)
# Version : HTTPAPI_VERSION -> "void*"
# ServerSessionId : ULONGLONG* out -> "void*"
# Reserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。