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

UrlCacheRetrieveEntryStream

関数
指定URLのキャッシュエントリストリームを取得する。
DLLWININET.dll呼出規約winapi

シグネチャ

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

DWORD UrlCacheRetrieveEntryStream(
    void* hAppCache,   // optional
    LPCWSTR pcwszUrl,
    BOOL fRandomRead,
    URLCACHE_ENTRY_INFO* pCacheEntryInfo,
    void** phEntryStream
);

パラメーター

名前方向
hAppCachevoid*inoptional
pcwszUrlLPCWSTRin
fRandomReadBOOLin
pCacheEntryInfoURLCACHE_ENTRY_INFO*out
phEntryStreamvoid**out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD UrlCacheRetrieveEntryStream(
    void* hAppCache,   // optional
    LPCWSTR pcwszUrl,
    BOOL fRandomRead,
    URLCACHE_ENTRY_INFO* pCacheEntryInfo,
    void** phEntryStream
);
[DllImport("WININET.dll", ExactSpelling = true)]
static extern uint UrlCacheRetrieveEntryStream(
    IntPtr hAppCache,   // void* optional
    [MarshalAs(UnmanagedType.LPWStr)] string pcwszUrl,   // LPCWSTR
    bool fRandomRead,   // BOOL
    IntPtr pCacheEntryInfo,   // URLCACHE_ENTRY_INFO* out
    IntPtr phEntryStream   // void** out
);
<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function UrlCacheRetrieveEntryStream(
    hAppCache As IntPtr,   ' void* optional
    <MarshalAs(UnmanagedType.LPWStr)> pcwszUrl As String,   ' LPCWSTR
    fRandomRead As Boolean,   ' BOOL
    pCacheEntryInfo As IntPtr,   ' URLCACHE_ENTRY_INFO* out
    phEntryStream As IntPtr   ' void** out
) As UInteger
End Function
' hAppCache : void* optional
' pcwszUrl : LPCWSTR
' fRandomRead : BOOL
' pCacheEntryInfo : URLCACHE_ENTRY_INFO* out
' phEntryStream : void** out
Declare PtrSafe Function UrlCacheRetrieveEntryStream Lib "wininet" ( _
    ByVal hAppCache As LongPtr, _
    ByVal pcwszUrl As LongPtr, _
    ByVal fRandomRead As Long, _
    ByVal pCacheEntryInfo As LongPtr, _
    ByVal phEntryStream As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UrlCacheRetrieveEntryStream = ctypes.windll.wininet.UrlCacheRetrieveEntryStream
UrlCacheRetrieveEntryStream.restype = wintypes.DWORD
UrlCacheRetrieveEntryStream.argtypes = [
    ctypes.POINTER(None),  # hAppCache : void* optional
    wintypes.LPCWSTR,  # pcwszUrl : LPCWSTR
    wintypes.BOOL,  # fRandomRead : BOOL
    ctypes.c_void_p,  # pCacheEntryInfo : URLCACHE_ENTRY_INFO* out
    ctypes.c_void_p,  # phEntryStream : void** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procUrlCacheRetrieveEntryStream = wininet.NewProc("UrlCacheRetrieveEntryStream")
)

// hAppCache (void* optional), pcwszUrl (LPCWSTR), fRandomRead (BOOL), pCacheEntryInfo (URLCACHE_ENTRY_INFO* out), phEntryStream (void** out)
r1, _, err := procUrlCacheRetrieveEntryStream.Call(
	uintptr(hAppCache),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcwszUrl))),
	uintptr(fRandomRead),
	uintptr(pCacheEntryInfo),
	uintptr(phEntryStream),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function UrlCacheRetrieveEntryStream(
  hAppCache: Pointer;   // void* optional
  pcwszUrl: PWideChar;   // LPCWSTR
  fRandomRead: BOOL;   // BOOL
  pCacheEntryInfo: Pointer;   // URLCACHE_ENTRY_INFO* out
  phEntryStream: Pointer   // void** out
): DWORD; stdcall;
  external 'WININET.dll' name 'UrlCacheRetrieveEntryStream';
result := DllCall("WININET\UrlCacheRetrieveEntryStream"
    , "Ptr", hAppCache   ; void* optional
    , "WStr", pcwszUrl   ; LPCWSTR
    , "Int", fRandomRead   ; BOOL
    , "Ptr", pCacheEntryInfo   ; URLCACHE_ENTRY_INFO* out
    , "Ptr", phEntryStream   ; void** out
    , "UInt")   ; return: DWORD
●UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream) = DLL("WININET.dll", "dword UrlCacheRetrieveEntryStream(void*, char*, bool, void*, void*)")
# 呼び出し: UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream)
# hAppCache : void* optional -> "void*"
# pcwszUrl : LPCWSTR -> "char*"
# fRandomRead : BOOL -> "bool"
# pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> "void*"
# phEntryStream : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。