ホーム › Networking.WinHttp › WinHttpWebSocketCompleteUpgrade
WinHttpWebSocketCompleteUpgrade
関数HTTP要求からWebSocket接続への昇格を完了する。
シグネチャ
// WINHTTP.dll
#include <windows.h>
void* WinHttpWebSocketCompleteUpgrade(
void* hRequest,
UINT_PTR pContext // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hRequest | void* | in |
| pContext | UINT_PTR | inoptional |
戻り値の型: void*
各言語での呼び出し定義
// WINHTTP.dll
#include <windows.h>
void* WinHttpWebSocketCompleteUpgrade(
void* hRequest,
UINT_PTR pContext // optional
);[DllImport("WINHTTP.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr WinHttpWebSocketCompleteUpgrade(
IntPtr hRequest, // void*
UIntPtr pContext // UINT_PTR optional
);<DllImport("WINHTTP.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function WinHttpWebSocketCompleteUpgrade(
hRequest As IntPtr, ' void*
pContext As UIntPtr ' UINT_PTR optional
) As IntPtr
End Function' hRequest : void*
' pContext : UINT_PTR optional
Declare PtrSafe Function WinHttpWebSocketCompleteUpgrade Lib "winhttp" ( _
ByVal hRequest As LongPtr, _
ByVal pContext As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WinHttpWebSocketCompleteUpgrade = ctypes.windll.winhttp.WinHttpWebSocketCompleteUpgrade
WinHttpWebSocketCompleteUpgrade.restype = ctypes.c_void_p
WinHttpWebSocketCompleteUpgrade.argtypes = [
ctypes.POINTER(None), # hRequest : void*
ctypes.c_size_t, # pContext : UINT_PTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINHTTP.dll')
WinHttpWebSocketCompleteUpgrade = Fiddle::Function.new(
lib['WinHttpWebSocketCompleteUpgrade'],
[
Fiddle::TYPE_VOIDP, # hRequest : void*
Fiddle::TYPE_UINTPTR_T, # pContext : UINT_PTR optional
],
Fiddle::TYPE_VOIDP)#[link(name = "winhttp")]
extern "system" {
fn WinHttpWebSocketCompleteUpgrade(
hRequest: *mut (), // void*
pContext: usize // UINT_PTR optional
) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINHTTP.dll", SetLastError = true)]
public static extern IntPtr WinHttpWebSocketCompleteUpgrade(IntPtr hRequest, UIntPtr pContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINHTTP_WinHttpWebSocketCompleteUpgrade' -Namespace Win32 -PassThru
# $api::WinHttpWebSocketCompleteUpgrade(hRequest, pContext)#uselib "WINHTTP.dll"
#func global WinHttpWebSocketCompleteUpgrade "WinHttpWebSocketCompleteUpgrade" sptr, sptr
; WinHttpWebSocketCompleteUpgrade hRequest, pContext ; 戻り値は stat
; hRequest : void* -> "sptr"
; pContext : UINT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WINHTTP.dll"
#cfunc global WinHttpWebSocketCompleteUpgrade "WinHttpWebSocketCompleteUpgrade" sptr, sptr
; res = WinHttpWebSocketCompleteUpgrade(hRequest, pContext)
; hRequest : void* -> "sptr"
; pContext : UINT_PTR optional -> "sptr"; void* WinHttpWebSocketCompleteUpgrade(void* hRequest, UINT_PTR pContext)
#uselib "WINHTTP.dll"
#cfunc global WinHttpWebSocketCompleteUpgrade "WinHttpWebSocketCompleteUpgrade" intptr, intptr
; res = WinHttpWebSocketCompleteUpgrade(hRequest, pContext)
; hRequest : void* -> "intptr"
; pContext : UINT_PTR optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winhttp = windows.NewLazySystemDLL("WINHTTP.dll")
procWinHttpWebSocketCompleteUpgrade = winhttp.NewProc("WinHttpWebSocketCompleteUpgrade")
)
// hRequest (void*), pContext (UINT_PTR optional)
r1, _, err := procWinHttpWebSocketCompleteUpgrade.Call(
uintptr(hRequest),
uintptr(pContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void*function WinHttpWebSocketCompleteUpgrade(
hRequest: Pointer; // void*
pContext: NativeUInt // UINT_PTR optional
): Pointer; stdcall;
external 'WINHTTP.dll' name 'WinHttpWebSocketCompleteUpgrade';result := DllCall("WINHTTP\WinHttpWebSocketCompleteUpgrade"
, "Ptr", hRequest ; void*
, "UPtr", pContext ; UINT_PTR optional
, "Ptr") ; return: void*●WinHttpWebSocketCompleteUpgrade(hRequest, pContext) = DLL("WINHTTP.dll", "void* WinHttpWebSocketCompleteUpgrade(void*, int)")
# 呼び出し: WinHttpWebSocketCompleteUpgrade(hRequest, pContext)
# hRequest : void* -> "void*"
# pContext : UINT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。