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

UrlCacheGetEntryInfo

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

シグネチャ

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

DWORD UrlCacheGetEntryInfo(
    void* hAppCache,   // optional
    LPCWSTR pcwszUrl,
    URLCACHE_ENTRY_INFO* pCacheEntryInfo   // optional
);

パラメーター

名前方向
hAppCachevoid*inoptional
pcwszUrlLPCWSTRin
pCacheEntryInfoURLCACHE_ENTRY_INFO*outoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

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

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

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procUrlCacheGetEntryInfo = wininet.NewProc("UrlCacheGetEntryInfo")
)

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