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

HttpOpenDependencyHandle

関数
HTTPリクエストの依存ハンドルを開く。
DLLWININET.dll呼出規約winapi

シグネチャ

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

DWORD HttpOpenDependencyHandle(
    void* hRequestHandle,
    BOOL fBackground,
    void** phDependencyHandle
);

パラメーター

名前方向説明
hRequestHandlevoid*in依存関係を開く対象のHTTPリクエストハンドル。
fBackgroundBOOLinバックグラウンド処理として扱うかを示すBOOL。TRUEで背景優先。
phDependencyHandlevoid**out生成された依存関係ハンドルを受け取るvoid*ポインタへのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD HttpOpenDependencyHandle(
    void* hRequestHandle,
    BOOL fBackground,
    void** phDependencyHandle
);
[DllImport("WININET.dll", ExactSpelling = true)]
static extern uint HttpOpenDependencyHandle(
    IntPtr hRequestHandle,   // void*
    bool fBackground,   // BOOL
    IntPtr phDependencyHandle   // void** out
);
<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function HttpOpenDependencyHandle(
    hRequestHandle As IntPtr,   ' void*
    fBackground As Boolean,   ' BOOL
    phDependencyHandle As IntPtr   ' void** out
) As UInteger
End Function
' hRequestHandle : void*
' fBackground : BOOL
' phDependencyHandle : void** out
Declare PtrSafe Function HttpOpenDependencyHandle Lib "wininet" ( _
    ByVal hRequestHandle As LongPtr, _
    ByVal fBackground As Long, _
    ByVal phDependencyHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HttpOpenDependencyHandle = ctypes.windll.wininet.HttpOpenDependencyHandle
HttpOpenDependencyHandle.restype = wintypes.DWORD
HttpOpenDependencyHandle.argtypes = [
    ctypes.POINTER(None),  # hRequestHandle : void*
    wintypes.BOOL,  # fBackground : BOOL
    ctypes.c_void_p,  # phDependencyHandle : void** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procHttpOpenDependencyHandle = wininet.NewProc("HttpOpenDependencyHandle")
)

// hRequestHandle (void*), fBackground (BOOL), phDependencyHandle (void** out)
r1, _, err := procHttpOpenDependencyHandle.Call(
	uintptr(hRequestHandle),
	uintptr(fBackground),
	uintptr(phDependencyHandle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function HttpOpenDependencyHandle(
  hRequestHandle: Pointer;   // void*
  fBackground: BOOL;   // BOOL
  phDependencyHandle: Pointer   // void** out
): DWORD; stdcall;
  external 'WININET.dll' name 'HttpOpenDependencyHandle';
result := DllCall("WININET\HttpOpenDependencyHandle"
    , "Ptr", hRequestHandle   ; void*
    , "Int", fBackground   ; BOOL
    , "Ptr", phDependencyHandle   ; void** out
    , "UInt")   ; return: DWORD
●HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle) = DLL("WININET.dll", "dword HttpOpenDependencyHandle(void*, bool, void*)")
# 呼び出し: HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle)
# hRequestHandle : void* -> "void*"
# fBackground : BOOL -> "bool"
# phDependencyHandle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "wininet" fn HttpOpenDependencyHandle(
    hRequestHandle: ?*anyopaque, // void*
    fBackground: i32, // BOOL
    phDependencyHandle: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) u32;
proc HttpOpenDependencyHandle(
    hRequestHandle: pointer,  # void*
    fBackground: int32,  # BOOL
    phDependencyHandle: pointer  # void** out
): uint32 {.importc: "HttpOpenDependencyHandle", stdcall, dynlib: "WININET.dll".}
pragma(lib, "wininet");
extern(Windows)
uint HttpOpenDependencyHandle(
    void* hRequestHandle,   // void*
    int fBackground,   // BOOL
    void** phDependencyHandle   // void** out
);
ccall((:HttpOpenDependencyHandle, "WININET.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Int32, Ptr{Cvoid}),
      hRequestHandle, fBackground, phDependencyHandle)
# hRequestHandle : void* -> Ptr{Cvoid}
# fBackground : BOOL -> Int32
# phDependencyHandle : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t HttpOpenDependencyHandle(
    void* hRequestHandle,
    int32_t fBackground,
    void** phDependencyHandle);
]]
local wininet = ffi.load("wininet")
-- wininet.HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle)
-- hRequestHandle : void*
-- fBackground : BOOL
-- phDependencyHandle : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const HttpOpenDependencyHandle = lib.func('__stdcall', 'HttpOpenDependencyHandle', 'uint32_t', ['void *', 'int32_t', 'void *']);
// HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle)
// hRequestHandle : void* -> 'void *'
// fBackground : BOOL -> 'int32_t'
// phDependencyHandle : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WININET.dll", {
  HttpOpenDependencyHandle: { parameters: ["pointer", "i32", "pointer"], result: "u32" },
});
// lib.symbols.HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle)
// hRequestHandle : void* -> "pointer"
// fBackground : BOOL -> "i32"
// phDependencyHandle : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t HttpOpenDependencyHandle(
    void* hRequestHandle,
    int32_t fBackground,
    void** phDependencyHandle);
C, "WININET.dll");
// $ffi->HttpOpenDependencyHandle(hRequestHandle, fBackground, phDependencyHandle);
// hRequestHandle : void*
// fBackground : BOOL
// phDependencyHandle : void** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wininet extends StdCallLibrary {
    Wininet INSTANCE = Native.load("wininet", Wininet.class);
    int HttpOpenDependencyHandle(
        Pointer hRequestHandle,   // void*
        boolean fBackground,   // BOOL
        Pointer phDependencyHandle   // void** out
    );
}
@[Link("wininet")]
lib LibWININET
  fun HttpOpenDependencyHandle = HttpOpenDependencyHandle(
    hRequestHandle : Void*,   # void*
    fBackground : Int32,   # BOOL
    phDependencyHandle : Void**   # void** out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef HttpOpenDependencyHandleNative = Uint32 Function(Pointer<Void>, Int32, Pointer<Void>);
typedef HttpOpenDependencyHandleDart = int Function(Pointer<Void>, int, Pointer<Void>);
final HttpOpenDependencyHandle = DynamicLibrary.open('WININET.dll')
    .lookupFunction<HttpOpenDependencyHandleNative, HttpOpenDependencyHandleDart>('HttpOpenDependencyHandle');
// hRequestHandle : void* -> Pointer<Void>
// fBackground : BOOL -> Int32
// phDependencyHandle : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HttpOpenDependencyHandle(
  hRequestHandle: Pointer;   // void*
  fBackground: BOOL;   // BOOL
  phDependencyHandle: Pointer   // void** out
): DWORD; stdcall;
  external 'WININET.dll' name 'HttpOpenDependencyHandle';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "HttpOpenDependencyHandle"
  c_HttpOpenDependencyHandle :: Ptr () -> CInt -> Ptr () -> IO Word32
-- hRequestHandle : void* -> Ptr ()
-- fBackground : BOOL -> CInt
-- phDependencyHandle : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let httpopendependencyhandle =
  foreign "HttpOpenDependencyHandle"
    ((ptr void) @-> int32_t @-> (ptr void) @-> returning uint32_t)
(* hRequestHandle : void* -> (ptr void) *)
(* fBackground : BOOL -> int32_t *)
(* phDependencyHandle : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wininet (t "WININET.dll"))
(cffi:use-foreign-library wininet)

(cffi:defcfun ("HttpOpenDependencyHandle" http-open-dependency-handle :convention :stdcall) :uint32
  (h-request-handle :pointer)   ; void*
  (f-background :int32)   ; BOOL
  (ph-dependency-handle :pointer))   ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HttpOpenDependencyHandle = Win32::API::More->new('WININET',
    'DWORD HttpOpenDependencyHandle(LPVOID hRequestHandle, BOOL fBackground, LPVOID phDependencyHandle)');
# my $ret = $HttpOpenDependencyHandle->Call($hRequestHandle, $fBackground, $phDependencyHandle);
# hRequestHandle : void* -> LPVOID
# fBackground : BOOL -> BOOL
# phDependencyHandle : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。