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