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