ホーム › Networking.WinInet › UrlCacheRetrieveEntryStream
UrlCacheRetrieveEntryStream
関数指定URLのキャッシュエントリストリームを取得する。
シグネチャ
// WININET.dll
#include <windows.h>
DWORD UrlCacheRetrieveEntryStream(
void* hAppCache, // optional
LPCWSTR pcwszUrl,
BOOL fRandomRead,
URLCACHE_ENTRY_INFO* pCacheEntryInfo,
void** phEntryStream
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hAppCache | void* | inoptional | 対象のアプリケーションキャッシュハンドル。NULLでグローバルキャッシュ。 |
| pcwszUrl | LPCWSTR | in | 取り出すエントリのURLを示すUnicode文字列。 |
| fRandomRead | BOOL | in | ランダムアクセス読み取りを行うかを示すBOOL。TRUEでランダム読み取り。 |
| pCacheEntryInfo | URLCACHE_ENTRY_INFO* | out | 取得したエントリ情報を受け取るURLCACHE_ENTRY_INFO構造体へのポインタ。 |
| phEntryStream | void** | out | 取り出したエントリストリームのハンドルを受け取るvoid*ポインタへのポインタ。 |
戻り値の型: 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 方式にも切替可。#uselib "WININET.dll" #cfunc global UrlCacheRetrieveEntryStream "UrlCacheRetrieveEntryStream" sptr, wstr, int, sptr, sptr ; res = UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, varptr(pCacheEntryInfo), phEntryStream) ; hAppCache : void* optional -> "sptr" ; pcwszUrl : LPCWSTR -> "wstr" ; fRandomRead : BOOL -> "int" ; pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> "sptr" ; phEntryStream : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; DWORD UrlCacheRetrieveEntryStream(void* hAppCache, LPCWSTR pcwszUrl, BOOL fRandomRead, URLCACHE_ENTRY_INFO* pCacheEntryInfo, void** phEntryStream) #uselib "WININET.dll" #cfunc global UrlCacheRetrieveEntryStream "UrlCacheRetrieveEntryStream" intptr, wstr, int, intptr, intptr ; res = UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, varptr(pCacheEntryInfo), phEntryStream) ; hAppCache : void* optional -> "intptr" ; pcwszUrl : LPCWSTR -> "wstr" ; fRandomRead : BOOL -> "int" ; pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> "intptr" ; phEntryStream : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // DWORDfunction 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)。const std = @import("std");
extern "wininet" fn UrlCacheRetrieveEntryStream(
hAppCache: ?*anyopaque, // void* optional
pcwszUrl: [*c]const u16, // LPCWSTR
fRandomRead: i32, // BOOL
pCacheEntryInfo: [*c]URLCACHE_ENTRY_INFO, // URLCACHE_ENTRY_INFO* out
phEntryStream: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) u32;proc UrlCacheRetrieveEntryStream(
hAppCache: pointer, # void* optional
pcwszUrl: WideCString, # LPCWSTR
fRandomRead: int32, # BOOL
pCacheEntryInfo: ptr URLCACHE_ENTRY_INFO, # URLCACHE_ENTRY_INFO* out
phEntryStream: pointer # void** out
): uint32 {.importc: "UrlCacheRetrieveEntryStream", stdcall, dynlib: "WININET.dll".}pragma(lib, "wininet");
extern(Windows)
uint UrlCacheRetrieveEntryStream(
void* hAppCache, // void* optional
const(wchar)* pcwszUrl, // LPCWSTR
int fRandomRead, // BOOL
URLCACHE_ENTRY_INFO* pCacheEntryInfo, // URLCACHE_ENTRY_INFO* out
void** phEntryStream // void** out
);ccall((:UrlCacheRetrieveEntryStream, "WININET.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Cwstring, Int32, Ptr{URLCACHE_ENTRY_INFO}, Ptr{Cvoid}),
hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream)
# hAppCache : void* optional -> Ptr{Cvoid}
# pcwszUrl : LPCWSTR -> Cwstring
# fRandomRead : BOOL -> Int32
# pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> Ptr{URLCACHE_ENTRY_INFO}
# phEntryStream : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t UrlCacheRetrieveEntryStream(
void* hAppCache,
const uint16_t* pcwszUrl,
int32_t fRandomRead,
void* pCacheEntryInfo,
void** phEntryStream);
]]
local wininet = ffi.load("wininet")
-- wininet.UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream)
-- hAppCache : void* optional
-- pcwszUrl : LPCWSTR
-- fRandomRead : BOOL
-- pCacheEntryInfo : URLCACHE_ENTRY_INFO* out
-- phEntryStream : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const UrlCacheRetrieveEntryStream = lib.func('__stdcall', 'UrlCacheRetrieveEntryStream', 'uint32_t', ['void *', 'str16', 'int32_t', 'void *', 'void *']);
// UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream)
// hAppCache : void* optional -> 'void *'
// pcwszUrl : LPCWSTR -> 'str16'
// fRandomRead : BOOL -> 'int32_t'
// pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> 'void *'
// phEntryStream : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WININET.dll", {
UrlCacheRetrieveEntryStream: { parameters: ["pointer", "buffer", "i32", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream)
// hAppCache : void* optional -> "pointer"
// pcwszUrl : LPCWSTR -> "buffer"
// fRandomRead : BOOL -> "i32"
// pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> "pointer"
// phEntryStream : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t UrlCacheRetrieveEntryStream(
void* hAppCache,
const uint16_t* pcwszUrl,
int32_t fRandomRead,
void* pCacheEntryInfo,
void** phEntryStream);
C, "WININET.dll");
// $ffi->UrlCacheRetrieveEntryStream(hAppCache, pcwszUrl, fRandomRead, pCacheEntryInfo, phEntryStream);
// hAppCache : void* optional
// pcwszUrl : LPCWSTR
// fRandomRead : BOOL
// pCacheEntryInfo : URLCACHE_ENTRY_INFO* out
// phEntryStream : 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 UrlCacheRetrieveEntryStream(
Pointer hAppCache, // void* optional
WString pcwszUrl, // LPCWSTR
boolean fRandomRead, // BOOL
Pointer pCacheEntryInfo, // URLCACHE_ENTRY_INFO* out
Pointer phEntryStream // void** out
);
}@[Link("wininet")]
lib LibWININET
fun UrlCacheRetrieveEntryStream = UrlCacheRetrieveEntryStream(
hAppCache : Void*, # void* optional
pcwszUrl : UInt16*, # LPCWSTR
fRandomRead : Int32, # BOOL
pCacheEntryInfo : URLCACHE_ENTRY_INFO*, # URLCACHE_ENTRY_INFO* out
phEntryStream : 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 UrlCacheRetrieveEntryStreamNative = Uint32 Function(Pointer<Void>, Pointer<Utf16>, Int32, Pointer<Void>, Pointer<Void>);
typedef UrlCacheRetrieveEntryStreamDart = int Function(Pointer<Void>, Pointer<Utf16>, int, Pointer<Void>, Pointer<Void>);
final UrlCacheRetrieveEntryStream = DynamicLibrary.open('WININET.dll')
.lookupFunction<UrlCacheRetrieveEntryStreamNative, UrlCacheRetrieveEntryStreamDart>('UrlCacheRetrieveEntryStream');
// hAppCache : void* optional -> Pointer<Void>
// pcwszUrl : LPCWSTR -> Pointer<Utf16>
// fRandomRead : BOOL -> Int32
// pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> Pointer<Void>
// phEntryStream : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "UrlCacheRetrieveEntryStream"
c_UrlCacheRetrieveEntryStream :: Ptr () -> CWString -> CInt -> Ptr () -> Ptr () -> IO Word32
-- hAppCache : void* optional -> Ptr ()
-- pcwszUrl : LPCWSTR -> CWString
-- fRandomRead : BOOL -> CInt
-- pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> Ptr ()
-- phEntryStream : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let urlcacheretrieveentrystream =
foreign "UrlCacheRetrieveEntryStream"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* hAppCache : void* optional -> (ptr void) *)
(* pcwszUrl : LPCWSTR -> (ptr uint16_t) *)
(* fRandomRead : BOOL -> int32_t *)
(* pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> (ptr void) *)
(* phEntryStream : 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 ("UrlCacheRetrieveEntryStream" url-cache-retrieve-entry-stream :convention :stdcall) :uint32
(h-app-cache :pointer) ; void* optional
(pcwsz-url (:string :encoding :utf-16le)) ; LPCWSTR
(f-random-read :int32) ; BOOL
(p-cache-entry-info :pointer) ; URLCACHE_ENTRY_INFO* out
(ph-entry-stream :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $UrlCacheRetrieveEntryStream = Win32::API::More->new('WININET',
'DWORD UrlCacheRetrieveEntryStream(LPVOID hAppCache, LPCWSTR pcwszUrl, BOOL fRandomRead, LPVOID pCacheEntryInfo, LPVOID phEntryStream)');
# my $ret = $UrlCacheRetrieveEntryStream->Call($hAppCache, $pcwszUrl, $fRandomRead, $pCacheEntryInfo, $phEntryStream);
# hAppCache : void* optional -> LPVOID
# pcwszUrl : LPCWSTR -> LPCWSTR
# fRandomRead : BOOL -> BOOL
# pCacheEntryInfo : URLCACHE_ENTRY_INFO* out -> LPVOID
# phEntryStream : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。