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