Win32 API 日本語リファレンス
ホームNetworking.WinInet › HttpWebSocketCompleteUpgrade

HttpWebSocketCompleteUpgrade

関数
HTTPからWebSocketへのアップグレードを完了する。
DLLWININET.dll呼出規約winapi

シグネチャ

// WININET.dll
#include <windows.h>

void* HttpWebSocketCompleteUpgrade(
    void* hRequest,
    UINT_PTR dwContext
);

パラメーター

名前方向
hRequestvoid*in
dwContextUINT_PTRin

戻り値の型: void*

各言語での呼び出し定義

// WININET.dll
#include <windows.h>

void* HttpWebSocketCompleteUpgrade(
    void* hRequest,
    UINT_PTR dwContext
);
[DllImport("WININET.dll", ExactSpelling = true)]
static extern IntPtr HttpWebSocketCompleteUpgrade(
    IntPtr hRequest,   // void*
    UIntPtr dwContext   // UINT_PTR
);
<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function HttpWebSocketCompleteUpgrade(
    hRequest As IntPtr,   ' void*
    dwContext As UIntPtr   ' UINT_PTR
) As IntPtr
End Function
' hRequest : void*
' dwContext : UINT_PTR
Declare PtrSafe Function HttpWebSocketCompleteUpgrade Lib "wininet" ( _
    ByVal hRequest As LongPtr, _
    ByVal dwContext As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HttpWebSocketCompleteUpgrade = ctypes.windll.wininet.HttpWebSocketCompleteUpgrade
HttpWebSocketCompleteUpgrade.restype = ctypes.c_void_p
HttpWebSocketCompleteUpgrade.argtypes = [
    ctypes.POINTER(None),  # hRequest : void*
    ctypes.c_size_t,  # dwContext : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
HttpWebSocketCompleteUpgrade = Fiddle::Function.new(
  lib['HttpWebSocketCompleteUpgrade'],
  [
    Fiddle::TYPE_VOIDP,  # hRequest : void*
    Fiddle::TYPE_UINTPTR_T,  # dwContext : UINT_PTR
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "wininet")]
extern "system" {
    fn HttpWebSocketCompleteUpgrade(
        hRequest: *mut (),  // void*
        dwContext: usize  // UINT_PTR
    ) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WININET.dll")]
public static extern IntPtr HttpWebSocketCompleteUpgrade(IntPtr hRequest, UIntPtr dwContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_HttpWebSocketCompleteUpgrade' -Namespace Win32 -PassThru
# $api::HttpWebSocketCompleteUpgrade(hRequest, dwContext)
#uselib "WININET.dll"
#func global HttpWebSocketCompleteUpgrade "HttpWebSocketCompleteUpgrade" sptr, sptr
; HttpWebSocketCompleteUpgrade hRequest, dwContext   ; 戻り値は stat
; hRequest : void* -> "sptr"
; dwContext : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global HttpWebSocketCompleteUpgrade "HttpWebSocketCompleteUpgrade" sptr, sptr
; res = HttpWebSocketCompleteUpgrade(hRequest, dwContext)
; hRequest : void* -> "sptr"
; dwContext : UINT_PTR -> "sptr"
; void* HttpWebSocketCompleteUpgrade(void* hRequest, UINT_PTR dwContext)
#uselib "WININET.dll"
#cfunc global HttpWebSocketCompleteUpgrade "HttpWebSocketCompleteUpgrade" intptr, intptr
; res = HttpWebSocketCompleteUpgrade(hRequest, dwContext)
; hRequest : void* -> "intptr"
; dwContext : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procHttpWebSocketCompleteUpgrade = wininet.NewProc("HttpWebSocketCompleteUpgrade")
)

// hRequest (void*), dwContext (UINT_PTR)
r1, _, err := procHttpWebSocketCompleteUpgrade.Call(
	uintptr(hRequest),
	uintptr(dwContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function HttpWebSocketCompleteUpgrade(
  hRequest: Pointer;   // void*
  dwContext: NativeUInt   // UINT_PTR
): Pointer; stdcall;
  external 'WININET.dll' name 'HttpWebSocketCompleteUpgrade';
result := DllCall("WININET\HttpWebSocketCompleteUpgrade"
    , "Ptr", hRequest   ; void*
    , "UPtr", dwContext   ; UINT_PTR
    , "Ptr")   ; return: void*
●HttpWebSocketCompleteUpgrade(hRequest, dwContext) = DLL("WININET.dll", "void* HttpWebSocketCompleteUpgrade(void*, int)")
# 呼び出し: HttpWebSocketCompleteUpgrade(hRequest, dwContext)
# hRequest : void* -> "void*"
# dwContext : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。