ホーム › Networking.WinInet › GetUrlCacheEntryInfoExW
GetUrlCacheEntryInfoExW
関数リダイレクト対応でURLキャッシュエントリ情報を取得する(Unicode版)。
シグネチャ
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL GetUrlCacheEntryInfoExW(
LPCWSTR lpszUrl,
INTERNET_CACHE_ENTRY_INFOW* lpCacheEntryInfo, // optional
DWORD* lpcbCacheEntryInfo, // optional
LPWSTR lpszRedirectUrl, // optional
DWORD* lpcbRedirectUrl, // optional
void* lpReserved, // optional
DWORD dwFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpszUrl | LPCWSTR | in |
| lpCacheEntryInfo | INTERNET_CACHE_ENTRY_INFOW* | inoutoptional |
| lpcbCacheEntryInfo | DWORD* | inoutoptional |
| lpszRedirectUrl | LPWSTR | optional |
| lpcbRedirectUrl | DWORD* | optional |
| lpReserved | void* | optional |
| dwFlags | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL GetUrlCacheEntryInfoExW(
LPCWSTR lpszUrl,
INTERNET_CACHE_ENTRY_INFOW* lpCacheEntryInfo, // optional
DWORD* lpcbCacheEntryInfo, // optional
LPWSTR lpszRedirectUrl, // optional
DWORD* lpcbRedirectUrl, // optional
void* lpReserved, // optional
DWORD dwFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool GetUrlCacheEntryInfoExW(
[MarshalAs(UnmanagedType.LPWStr)] string lpszUrl, // LPCWSTR
IntPtr lpCacheEntryInfo, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
IntPtr lpcbCacheEntryInfo, // DWORD* optional, in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszRedirectUrl, // LPWSTR optional
IntPtr lpcbRedirectUrl, // DWORD* optional
IntPtr lpReserved, // void* optional
uint dwFlags // DWORD
);<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetUrlCacheEntryInfoExW(
<MarshalAs(UnmanagedType.LPWStr)> lpszUrl As String, ' LPCWSTR
lpCacheEntryInfo As IntPtr, ' INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo As IntPtr, ' DWORD* optional, in/out
<MarshalAs(UnmanagedType.LPWStr)> lpszRedirectUrl As System.Text.StringBuilder, ' LPWSTR optional
lpcbRedirectUrl As IntPtr, ' DWORD* optional
lpReserved As IntPtr, ' void* optional
dwFlags As UInteger ' DWORD
) As Boolean
End Function' lpszUrl : LPCWSTR
' lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
' lpcbCacheEntryInfo : DWORD* optional, in/out
' lpszRedirectUrl : LPWSTR optional
' lpcbRedirectUrl : DWORD* optional
' lpReserved : void* optional
' dwFlags : DWORD
Declare PtrSafe Function GetUrlCacheEntryInfoExW Lib "wininet" ( _
ByVal lpszUrl As LongPtr, _
ByVal lpCacheEntryInfo As LongPtr, _
ByVal lpcbCacheEntryInfo As LongPtr, _
ByVal lpszRedirectUrl As LongPtr, _
ByVal lpcbRedirectUrl As LongPtr, _
ByVal lpReserved As LongPtr, _
ByVal dwFlags As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetUrlCacheEntryInfoExW = ctypes.windll.wininet.GetUrlCacheEntryInfoExW
GetUrlCacheEntryInfoExW.restype = wintypes.BOOL
GetUrlCacheEntryInfoExW.argtypes = [
wintypes.LPCWSTR, # lpszUrl : LPCWSTR
ctypes.c_void_p, # lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
ctypes.POINTER(wintypes.DWORD), # lpcbCacheEntryInfo : DWORD* optional, in/out
wintypes.LPWSTR, # lpszRedirectUrl : LPWSTR optional
ctypes.POINTER(wintypes.DWORD), # lpcbRedirectUrl : DWORD* optional
ctypes.POINTER(None), # lpReserved : void* optional
wintypes.DWORD, # dwFlags : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
GetUrlCacheEntryInfoExW = Fiddle::Function.new(
lib['GetUrlCacheEntryInfoExW'],
[
Fiddle::TYPE_VOIDP, # lpszUrl : LPCWSTR
Fiddle::TYPE_VOIDP, # lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
Fiddle::TYPE_VOIDP, # lpcbCacheEntryInfo : DWORD* optional, in/out
Fiddle::TYPE_VOIDP, # lpszRedirectUrl : LPWSTR optional
Fiddle::TYPE_VOIDP, # lpcbRedirectUrl : DWORD* optional
Fiddle::TYPE_VOIDP, # lpReserved : void* optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wininet")]
extern "system" {
fn GetUrlCacheEntryInfoExW(
lpszUrl: *const u16, // LPCWSTR
lpCacheEntryInfo: *mut INTERNET_CACHE_ENTRY_INFOW, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: *mut u32, // DWORD* optional, in/out
lpszRedirectUrl: *mut u16, // LPWSTR optional
lpcbRedirectUrl: *mut u32, // DWORD* optional
lpReserved: *mut (), // void* optional
dwFlags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool GetUrlCacheEntryInfoExW([MarshalAs(UnmanagedType.LPWStr)] string lpszUrl, IntPtr lpCacheEntryInfo, IntPtr lpcbCacheEntryInfo, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszRedirectUrl, IntPtr lpcbRedirectUrl, IntPtr lpReserved, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_GetUrlCacheEntryInfoExW' -Namespace Win32 -PassThru
# $api::GetUrlCacheEntryInfoExW(lpszUrl, lpCacheEntryInfo, lpcbCacheEntryInfo, lpszRedirectUrl, lpcbRedirectUrl, lpReserved, dwFlags)#uselib "WININET.dll"
#func global GetUrlCacheEntryInfoExW "GetUrlCacheEntryInfoExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; GetUrlCacheEntryInfoExW lpszUrl, varptr(lpCacheEntryInfo), varptr(lpcbCacheEntryInfo), varptr(lpszRedirectUrl), varptr(lpcbRedirectUrl), lpReserved, dwFlags ; 戻り値は stat
; lpszUrl : LPCWSTR -> "wptr"
; lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "wptr"
; lpcbCacheEntryInfo : DWORD* optional, in/out -> "wptr"
; lpszRedirectUrl : LPWSTR optional -> "wptr"
; lpcbRedirectUrl : DWORD* optional -> "wptr"
; lpReserved : void* optional -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WININET.dll" #cfunc global GetUrlCacheEntryInfoExW "GetUrlCacheEntryInfoExW" wstr, var, var, var, var, sptr, int ; res = GetUrlCacheEntryInfoExW(lpszUrl, lpCacheEntryInfo, lpcbCacheEntryInfo, lpszRedirectUrl, lpcbRedirectUrl, lpReserved, dwFlags) ; lpszUrl : LPCWSTR -> "wstr" ; lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "var" ; lpcbCacheEntryInfo : DWORD* optional, in/out -> "var" ; lpszRedirectUrl : LPWSTR optional -> "var" ; lpcbRedirectUrl : DWORD* optional -> "var" ; lpReserved : void* optional -> "sptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WININET.dll" #cfunc global GetUrlCacheEntryInfoExW "GetUrlCacheEntryInfoExW" wstr, sptr, sptr, sptr, sptr, sptr, int ; res = GetUrlCacheEntryInfoExW(lpszUrl, varptr(lpCacheEntryInfo), varptr(lpcbCacheEntryInfo), varptr(lpszRedirectUrl), varptr(lpcbRedirectUrl), lpReserved, dwFlags) ; lpszUrl : LPCWSTR -> "wstr" ; lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "sptr" ; lpcbCacheEntryInfo : DWORD* optional, in/out -> "sptr" ; lpszRedirectUrl : LPWSTR optional -> "sptr" ; lpcbRedirectUrl : DWORD* optional -> "sptr" ; lpReserved : void* optional -> "sptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetUrlCacheEntryInfoExW(LPCWSTR lpszUrl, INTERNET_CACHE_ENTRY_INFOW* lpCacheEntryInfo, DWORD* lpcbCacheEntryInfo, LPWSTR lpszRedirectUrl, DWORD* lpcbRedirectUrl, void* lpReserved, DWORD dwFlags) #uselib "WININET.dll" #cfunc global GetUrlCacheEntryInfoExW "GetUrlCacheEntryInfoExW" wstr, var, var, var, var, intptr, int ; res = GetUrlCacheEntryInfoExW(lpszUrl, lpCacheEntryInfo, lpcbCacheEntryInfo, lpszRedirectUrl, lpcbRedirectUrl, lpReserved, dwFlags) ; lpszUrl : LPCWSTR -> "wstr" ; lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "var" ; lpcbCacheEntryInfo : DWORD* optional, in/out -> "var" ; lpszRedirectUrl : LPWSTR optional -> "var" ; lpcbRedirectUrl : DWORD* optional -> "var" ; lpReserved : void* optional -> "intptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetUrlCacheEntryInfoExW(LPCWSTR lpszUrl, INTERNET_CACHE_ENTRY_INFOW* lpCacheEntryInfo, DWORD* lpcbCacheEntryInfo, LPWSTR lpszRedirectUrl, DWORD* lpcbRedirectUrl, void* lpReserved, DWORD dwFlags) #uselib "WININET.dll" #cfunc global GetUrlCacheEntryInfoExW "GetUrlCacheEntryInfoExW" wstr, intptr, intptr, intptr, intptr, intptr, int ; res = GetUrlCacheEntryInfoExW(lpszUrl, varptr(lpCacheEntryInfo), varptr(lpcbCacheEntryInfo), varptr(lpszRedirectUrl), varptr(lpcbRedirectUrl), lpReserved, dwFlags) ; lpszUrl : LPCWSTR -> "wstr" ; lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "intptr" ; lpcbCacheEntryInfo : DWORD* optional, in/out -> "intptr" ; lpszRedirectUrl : LPWSTR optional -> "intptr" ; lpcbRedirectUrl : DWORD* optional -> "intptr" ; lpReserved : void* optional -> "intptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procGetUrlCacheEntryInfoExW = wininet.NewProc("GetUrlCacheEntryInfoExW")
)
// lpszUrl (LPCWSTR), lpCacheEntryInfo (INTERNET_CACHE_ENTRY_INFOW* optional, in/out), lpcbCacheEntryInfo (DWORD* optional, in/out), lpszRedirectUrl (LPWSTR optional), lpcbRedirectUrl (DWORD* optional), lpReserved (void* optional), dwFlags (DWORD)
r1, _, err := procGetUrlCacheEntryInfoExW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszUrl))),
uintptr(lpCacheEntryInfo),
uintptr(lpcbCacheEntryInfo),
uintptr(lpszRedirectUrl),
uintptr(lpcbRedirectUrl),
uintptr(lpReserved),
uintptr(dwFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetUrlCacheEntryInfoExW(
lpszUrl: PWideChar; // LPCWSTR
lpCacheEntryInfo: Pointer; // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: Pointer; // DWORD* optional, in/out
lpszRedirectUrl: PWideChar; // LPWSTR optional
lpcbRedirectUrl: Pointer; // DWORD* optional
lpReserved: Pointer; // void* optional
dwFlags: DWORD // DWORD
): BOOL; stdcall;
external 'WININET.dll' name 'GetUrlCacheEntryInfoExW';result := DllCall("WININET\GetUrlCacheEntryInfoExW"
, "WStr", lpszUrl ; LPCWSTR
, "Ptr", lpCacheEntryInfo ; INTERNET_CACHE_ENTRY_INFOW* optional, in/out
, "Ptr", lpcbCacheEntryInfo ; DWORD* optional, in/out
, "Ptr", lpszRedirectUrl ; LPWSTR optional
, "Ptr", lpcbRedirectUrl ; DWORD* optional
, "Ptr", lpReserved ; void* optional
, "UInt", dwFlags ; DWORD
, "Int") ; return: BOOL●GetUrlCacheEntryInfoExW(lpszUrl, lpCacheEntryInfo, lpcbCacheEntryInfo, lpszRedirectUrl, lpcbRedirectUrl, lpReserved, dwFlags) = DLL("WININET.dll", "bool GetUrlCacheEntryInfoExW(char*, void*, void*, char*, void*, void*, dword)")
# 呼び出し: GetUrlCacheEntryInfoExW(lpszUrl, lpCacheEntryInfo, lpcbCacheEntryInfo, lpszRedirectUrl, lpcbRedirectUrl, lpReserved, dwFlags)
# lpszUrl : LPCWSTR -> "char*"
# lpCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "void*"
# lpcbCacheEntryInfo : DWORD* optional, in/out -> "void*"
# lpszRedirectUrl : LPWSTR optional -> "char*"
# lpcbRedirectUrl : DWORD* optional -> "void*"
# lpReserved : void* optional -> "void*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。