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

HttpReadFragmentFromCache

関数
キャッシュから応答フラグメントを読み取る。
DLLHTTPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD HttpReadFragmentFromCache(
    HANDLE RequestQueueHandle,
    LPCWSTR UrlPrefix,
    HTTP_BYTE_RANGE* ByteRange,   // optional
    void* Buffer,
    DWORD BufferLength,
    DWORD* BytesRead,   // optional
    OVERLAPPED* Overlapped   // optional
);

パラメーター

名前方向
RequestQueueHandleHANDLEin
UrlPrefixLPCWSTRin
ByteRangeHTTP_BYTE_RANGE*inoptional
Buffervoid*out
BufferLengthDWORDin
BytesReadDWORD*outoptional
OverlappedOVERLAPPED*inoutoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD HttpReadFragmentFromCache(
    HANDLE RequestQueueHandle,
    LPCWSTR UrlPrefix,
    HTTP_BYTE_RANGE* ByteRange,   // optional
    void* Buffer,
    DWORD BufferLength,
    DWORD* BytesRead,   // optional
    OVERLAPPED* Overlapped   // optional
);
[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpReadFragmentFromCache(
    IntPtr RequestQueueHandle,   // HANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string UrlPrefix,   // LPCWSTR
    IntPtr ByteRange,   // HTTP_BYTE_RANGE* optional
    IntPtr Buffer,   // void* out
    uint BufferLength,   // DWORD
    IntPtr BytesRead,   // DWORD* optional, out
    IntPtr Overlapped   // OVERLAPPED* optional, in/out
);
<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpReadFragmentFromCache(
    RequestQueueHandle As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPWStr)> UrlPrefix As String,   ' LPCWSTR
    ByteRange As IntPtr,   ' HTTP_BYTE_RANGE* optional
    Buffer As IntPtr,   ' void* out
    BufferLength As UInteger,   ' DWORD
    BytesRead As IntPtr,   ' DWORD* optional, out
    Overlapped As IntPtr   ' OVERLAPPED* optional, in/out
) As UInteger
End Function
' RequestQueueHandle : HANDLE
' UrlPrefix : LPCWSTR
' ByteRange : HTTP_BYTE_RANGE* optional
' Buffer : void* out
' BufferLength : DWORD
' BytesRead : DWORD* optional, out
' Overlapped : OVERLAPPED* optional, in/out
Declare PtrSafe Function HttpReadFragmentFromCache Lib "httpapi" ( _
    ByVal RequestQueueHandle As LongPtr, _
    ByVal UrlPrefix As LongPtr, _
    ByVal ByteRange As LongPtr, _
    ByVal Buffer As LongPtr, _
    ByVal BufferLength As Long, _
    ByVal BytesRead As LongPtr, _
    ByVal Overlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HttpReadFragmentFromCache = ctypes.windll.httpapi.HttpReadFragmentFromCache
HttpReadFragmentFromCache.restype = wintypes.DWORD
HttpReadFragmentFromCache.argtypes = [
    wintypes.HANDLE,  # RequestQueueHandle : HANDLE
    wintypes.LPCWSTR,  # UrlPrefix : LPCWSTR
    ctypes.c_void_p,  # ByteRange : HTTP_BYTE_RANGE* optional
    ctypes.POINTER(None),  # Buffer : void* out
    wintypes.DWORD,  # BufferLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # BytesRead : DWORD* optional, out
    ctypes.c_void_p,  # Overlapped : OVERLAPPED* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('HTTPAPI.dll')
HttpReadFragmentFromCache = Fiddle::Function.new(
  lib['HttpReadFragmentFromCache'],
  [
    Fiddle::TYPE_VOIDP,  # RequestQueueHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # UrlPrefix : LPCWSTR
    Fiddle::TYPE_VOIDP,  # ByteRange : HTTP_BYTE_RANGE* optional
    Fiddle::TYPE_VOIDP,  # Buffer : void* out
    -Fiddle::TYPE_INT,  # BufferLength : DWORD
    Fiddle::TYPE_VOIDP,  # BytesRead : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # Overlapped : OVERLAPPED* optional, in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "httpapi")]
extern "system" {
    fn HttpReadFragmentFromCache(
        RequestQueueHandle: *mut core::ffi::c_void,  // HANDLE
        UrlPrefix: *const u16,  // LPCWSTR
        ByteRange: *mut HTTP_BYTE_RANGE,  // HTTP_BYTE_RANGE* optional
        Buffer: *mut (),  // void* out
        BufferLength: u32,  // DWORD
        BytesRead: *mut u32,  // DWORD* optional, out
        Overlapped: *mut OVERLAPPED  // OVERLAPPED* optional, in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpReadFragmentFromCache(IntPtr RequestQueueHandle, [MarshalAs(UnmanagedType.LPWStr)] string UrlPrefix, IntPtr ByteRange, IntPtr Buffer, uint BufferLength, IntPtr BytesRead, IntPtr Overlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpReadFragmentFromCache' -Namespace Win32 -PassThru
# $api::HttpReadFragmentFromCache(RequestQueueHandle, UrlPrefix, ByteRange, Buffer, BufferLength, BytesRead, Overlapped)
#uselib "HTTPAPI.dll"
#func global HttpReadFragmentFromCache "HttpReadFragmentFromCache" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; HttpReadFragmentFromCache RequestQueueHandle, UrlPrefix, varptr(ByteRange), Buffer, BufferLength, varptr(BytesRead), varptr(Overlapped)   ; 戻り値は stat
; RequestQueueHandle : HANDLE -> "sptr"
; UrlPrefix : LPCWSTR -> "sptr"
; ByteRange : HTTP_BYTE_RANGE* optional -> "sptr"
; Buffer : void* out -> "sptr"
; BufferLength : DWORD -> "sptr"
; BytesRead : DWORD* optional, out -> "sptr"
; Overlapped : OVERLAPPED* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "HTTPAPI.dll"
#cfunc global HttpReadFragmentFromCache "HttpReadFragmentFromCache" sptr, wstr, var, sptr, int, var, var
; res = HttpReadFragmentFromCache(RequestQueueHandle, UrlPrefix, ByteRange, Buffer, BufferLength, BytesRead, Overlapped)
; RequestQueueHandle : HANDLE -> "sptr"
; UrlPrefix : LPCWSTR -> "wstr"
; ByteRange : HTTP_BYTE_RANGE* optional -> "var"
; Buffer : void* out -> "sptr"
; BufferLength : DWORD -> "int"
; BytesRead : DWORD* optional, out -> "var"
; Overlapped : OVERLAPPED* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD HttpReadFragmentFromCache(HANDLE RequestQueueHandle, LPCWSTR UrlPrefix, HTTP_BYTE_RANGE* ByteRange, void* Buffer, DWORD BufferLength, DWORD* BytesRead, OVERLAPPED* Overlapped)
#uselib "HTTPAPI.dll"
#cfunc global HttpReadFragmentFromCache "HttpReadFragmentFromCache" intptr, wstr, var, intptr, int, var, var
; res = HttpReadFragmentFromCache(RequestQueueHandle, UrlPrefix, ByteRange, Buffer, BufferLength, BytesRead, Overlapped)
; RequestQueueHandle : HANDLE -> "intptr"
; UrlPrefix : LPCWSTR -> "wstr"
; ByteRange : HTTP_BYTE_RANGE* optional -> "var"
; Buffer : void* out -> "intptr"
; BufferLength : DWORD -> "int"
; BytesRead : DWORD* optional, out -> "var"
; Overlapped : OVERLAPPED* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
	procHttpReadFragmentFromCache = httpapi.NewProc("HttpReadFragmentFromCache")
)

// RequestQueueHandle (HANDLE), UrlPrefix (LPCWSTR), ByteRange (HTTP_BYTE_RANGE* optional), Buffer (void* out), BufferLength (DWORD), BytesRead (DWORD* optional, out), Overlapped (OVERLAPPED* optional, in/out)
r1, _, err := procHttpReadFragmentFromCache.Call(
	uintptr(RequestQueueHandle),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(UrlPrefix))),
	uintptr(ByteRange),
	uintptr(Buffer),
	uintptr(BufferLength),
	uintptr(BytesRead),
	uintptr(Overlapped),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function HttpReadFragmentFromCache(
  RequestQueueHandle: THandle;   // HANDLE
  UrlPrefix: PWideChar;   // LPCWSTR
  ByteRange: Pointer;   // HTTP_BYTE_RANGE* optional
  Buffer: Pointer;   // void* out
  BufferLength: DWORD;   // DWORD
  BytesRead: Pointer;   // DWORD* optional, out
  Overlapped: Pointer   // OVERLAPPED* optional, in/out
): DWORD; stdcall;
  external 'HTTPAPI.dll' name 'HttpReadFragmentFromCache';
result := DllCall("HTTPAPI\HttpReadFragmentFromCache"
    , "Ptr", RequestQueueHandle   ; HANDLE
    , "WStr", UrlPrefix   ; LPCWSTR
    , "Ptr", ByteRange   ; HTTP_BYTE_RANGE* optional
    , "Ptr", Buffer   ; void* out
    , "UInt", BufferLength   ; DWORD
    , "Ptr", BytesRead   ; DWORD* optional, out
    , "Ptr", Overlapped   ; OVERLAPPED* optional, in/out
    , "UInt")   ; return: DWORD
●HttpReadFragmentFromCache(RequestQueueHandle, UrlPrefix, ByteRange, Buffer, BufferLength, BytesRead, Overlapped) = DLL("HTTPAPI.dll", "dword HttpReadFragmentFromCache(void*, char*, void*, void*, dword, void*, void*)")
# 呼び出し: HttpReadFragmentFromCache(RequestQueueHandle, UrlPrefix, ByteRange, Buffer, BufferLength, BytesRead, Overlapped)
# RequestQueueHandle : HANDLE -> "void*"
# UrlPrefix : LPCWSTR -> "char*"
# ByteRange : HTTP_BYTE_RANGE* optional -> "void*"
# Buffer : void* out -> "void*"
# BufferLength : DWORD -> "dword"
# BytesRead : DWORD* optional, out -> "void*"
# Overlapped : OVERLAPPED* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。