FindFirstUrlCacheEntryExW
関数シグネチャ
// WININET.dll (Unicode / -W)
#include <windows.h>
HANDLE FindFirstUrlCacheEntryExW(
LPCWSTR lpszUrlSearchPattern, // optional
DWORD dwFlags,
DWORD dwFilter,
LONGLONG GroupId,
INTERNET_CACHE_ENTRY_INFOW* lpFirstCacheEntryInfo, // optional
DWORD* lpcbCacheEntryInfo,
void* lpGroupAttributes, // optional
DWORD* lpcbGroupAttributes, // optional
void* lpReserved // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| lpszUrlSearchPattern | LPCWSTR | inoptional | 検索するソース名のパターンを含む文字列へのポインター。このパラメーターには "cookie:"、"visited:"、または NULL のいずれかのみを設定できます。cookie を列挙するには "cookie:" を、キャッシュ内の URL 履歴エントリを列挙するには "visited:" をこのパラメーターに設定します。このパラメーターが NULL の場合、FindFirstUrlCacheEntryEx はキャッシュ内のすべてのコンテンツエントリを返します。 | ||||||||||||||||||
| dwFlags | DWORD | in | 列挙を制御します。現在実装されているフラグはありません。このパラメーターは 0 に設定する必要があります。 | ||||||||||||||||||
| dwFilter | DWORD | in | キャッシュエントリの種類とそのプロパティを示すビットマスク。キャッシュエントリの種類には、履歴エントリ (URLHISTORY_CACHE_ENTRY)、cookie エントリ (COOKIE_CACHE_ENTRY)、および通常のキャッシュコンテンツ (NORMAL_CACHE_ENTRY) が含まれます。 このパラメーターには、以下のプロパティフラグおよびキャッシュ種別フラグを 0 個以上指定できます。
| ||||||||||||||||||
| GroupId | LONGLONG | in | 列挙対象とするキャッシュグループの ID。グループ化されていないすべてのエントリを列挙するには、このパラメーターを 0 に設定します。 | ||||||||||||||||||
| lpFirstCacheEntryInfo | INTERNET_CACHE_ENTRY_INFOW* | inoutoptional | キャッシュエントリ情報を受け取る INTERNET_CACHE_ENTRY_INFO 構造体へのポインター。 | ||||||||||||||||||
| lpcbCacheEntryInfo | DWORD* | inout | lpFirstCacheEntryInfo パラメーターが参照する構造体のサイズ (バイト単位) を示す変数へのポインター。 | ||||||||||||||||||
| lpGroupAttributes | void* | optional | このパラメーターは予約されており、NULL を指定する必要があります。 | ||||||||||||||||||
| lpcbGroupAttributes | DWORD* | optional | このパラメーターは予約されており、NULL を指定する必要があります。 | ||||||||||||||||||
| lpReserved | void* | optional | このパラメーターは予約されており、NULL を指定する必要があります。 |
戻り値の型: HANDLE
公式ドキュメント
インターネットキャッシュのフィルター付き列挙を開始します。(Unicode)
戻り値
成功した場合は有効なハンドルを、それ以外の場合は NULL を返します。具体的なエラー情報を取得するには、 GetLastError を呼び出します。一致するファイルが見つからなかった場合、 GetLastError は ERROR_NO_MORE_FILES を返します。
解説(Remarks)
FindFirstUrlCacheEntryEx から返されるハンドルは、以降の FindNextUrlCacheEntryEx へのすべての呼び出しで使用されます。列挙の終了時には、アプリケーションは FindCloseUrlCache を呼び出す必要があります。
WinINet API の他のすべての側面と同様に、この関数を DllMain やグローバルオブジェクトのコンストラクター/デストラクター内から安全に呼び出すことはできません。
wininet.h ヘッダーは、FindFirstUrlCacheEntryEx を、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義しています。エンコーディング中立のエイリアスの使用と、エンコーディング中立でないコードを混在させると、コンパイルエラーや実行時エラーを引き起こす不一致につながる可能性があります。詳細については、関数プロトタイプの規約 を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// WININET.dll (Unicode / -W)
#include <windows.h>
HANDLE FindFirstUrlCacheEntryExW(
LPCWSTR lpszUrlSearchPattern, // optional
DWORD dwFlags,
DWORD dwFilter,
LONGLONG GroupId,
INTERNET_CACHE_ENTRY_INFOW* lpFirstCacheEntryInfo, // optional
DWORD* lpcbCacheEntryInfo,
void* lpGroupAttributes, // optional
DWORD* lpcbGroupAttributes, // optional
void* lpReserved // optional
);[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr FindFirstUrlCacheEntryExW(
[MarshalAs(UnmanagedType.LPWStr)] string lpszUrlSearchPattern, // LPCWSTR optional
uint dwFlags, // DWORD
uint dwFilter, // DWORD
long GroupId, // LONGLONG
IntPtr lpFirstCacheEntryInfo, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
ref uint lpcbCacheEntryInfo, // DWORD* in/out
IntPtr lpGroupAttributes, // void* optional
IntPtr lpcbGroupAttributes, // DWORD* optional
IntPtr lpReserved // void* optional
);<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FindFirstUrlCacheEntryExW(
<MarshalAs(UnmanagedType.LPWStr)> lpszUrlSearchPattern As String, ' LPCWSTR optional
dwFlags As UInteger, ' DWORD
dwFilter As UInteger, ' DWORD
GroupId As Long, ' LONGLONG
lpFirstCacheEntryInfo As IntPtr, ' INTERNET_CACHE_ENTRY_INFOW* optional, in/out
ByRef lpcbCacheEntryInfo As UInteger, ' DWORD* in/out
lpGroupAttributes As IntPtr, ' void* optional
lpcbGroupAttributes As IntPtr, ' DWORD* optional
lpReserved As IntPtr ' void* optional
) As IntPtr
End Function' lpszUrlSearchPattern : LPCWSTR optional
' dwFlags : DWORD
' dwFilter : DWORD
' GroupId : LONGLONG
' lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
' lpcbCacheEntryInfo : DWORD* in/out
' lpGroupAttributes : void* optional
' lpcbGroupAttributes : DWORD* optional
' lpReserved : void* optional
Declare PtrSafe Function FindFirstUrlCacheEntryExW Lib "wininet" ( _
ByVal lpszUrlSearchPattern As LongPtr, _
ByVal dwFlags As Long, _
ByVal dwFilter As Long, _
ByVal GroupId As LongLong, _
ByVal lpFirstCacheEntryInfo As LongPtr, _
ByRef lpcbCacheEntryInfo As Long, _
ByVal lpGroupAttributes As LongPtr, _
ByVal lpcbGroupAttributes As LongPtr, _
ByVal lpReserved As LongPtr) As LongPtr
' 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
FindFirstUrlCacheEntryExW = ctypes.windll.wininet.FindFirstUrlCacheEntryExW
FindFirstUrlCacheEntryExW.restype = ctypes.c_void_p
FindFirstUrlCacheEntryExW.argtypes = [
wintypes.LPCWSTR, # lpszUrlSearchPattern : LPCWSTR optional
wintypes.DWORD, # dwFlags : DWORD
wintypes.DWORD, # dwFilter : DWORD
ctypes.c_longlong, # GroupId : LONGLONG
ctypes.c_void_p, # lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
ctypes.POINTER(wintypes.DWORD), # lpcbCacheEntryInfo : DWORD* in/out
ctypes.POINTER(None), # lpGroupAttributes : void* optional
ctypes.POINTER(wintypes.DWORD), # lpcbGroupAttributes : DWORD* optional
ctypes.POINTER(None), # lpReserved : void* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
FindFirstUrlCacheEntryExW = Fiddle::Function.new(
lib['FindFirstUrlCacheEntryExW'],
[
Fiddle::TYPE_VOIDP, # lpszUrlSearchPattern : LPCWSTR optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
-Fiddle::TYPE_INT, # dwFilter : DWORD
Fiddle::TYPE_LONG_LONG, # GroupId : LONGLONG
Fiddle::TYPE_VOIDP, # lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
Fiddle::TYPE_VOIDP, # lpcbCacheEntryInfo : DWORD* in/out
Fiddle::TYPE_VOIDP, # lpGroupAttributes : void* optional
Fiddle::TYPE_VOIDP, # lpcbGroupAttributes : DWORD* optional
Fiddle::TYPE_VOIDP, # lpReserved : void* optional
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wininet")]
extern "system" {
fn FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern: *const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
dwFilter: u32, // DWORD
GroupId: i64, // LONGLONG
lpFirstCacheEntryInfo: *mut INTERNET_CACHE_ENTRY_INFOW, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: *mut u32, // DWORD* in/out
lpGroupAttributes: *mut (), // void* optional
lpcbGroupAttributes: *mut u32, // DWORD* optional
lpReserved: *mut () // void* optional
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr FindFirstUrlCacheEntryExW([MarshalAs(UnmanagedType.LPWStr)] string lpszUrlSearchPattern, uint dwFlags, uint dwFilter, long GroupId, IntPtr lpFirstCacheEntryInfo, ref uint lpcbCacheEntryInfo, IntPtr lpGroupAttributes, IntPtr lpcbGroupAttributes, IntPtr lpReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_FindFirstUrlCacheEntryExW' -Namespace Win32 -PassThru
# $api::FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)#uselib "WININET.dll"
#func global FindFirstUrlCacheEntryExW "FindFirstUrlCacheEntryExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; FindFirstUrlCacheEntryExW lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, varptr(lpFirstCacheEntryInfo), varptr(lpcbCacheEntryInfo), lpGroupAttributes, varptr(lpcbGroupAttributes), lpReserved ; 戻り値は stat
; lpszUrlSearchPattern : LPCWSTR optional -> "wptr"
; dwFlags : DWORD -> "wptr"
; dwFilter : DWORD -> "wptr"
; GroupId : LONGLONG -> "wptr"
; lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "wptr"
; lpcbCacheEntryInfo : DWORD* in/out -> "wptr"
; lpGroupAttributes : void* optional -> "wptr"
; lpcbGroupAttributes : DWORD* optional -> "wptr"
; lpReserved : void* optional -> "wptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll" #cfunc global FindFirstUrlCacheEntryExW "FindFirstUrlCacheEntryExW" wstr, int, int, int64, var, var, sptr, var, sptr ; res = FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved) ; lpszUrlSearchPattern : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; dwFilter : DWORD -> "int" ; GroupId : LONGLONG -> "int64" ; lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "var" ; lpcbCacheEntryInfo : DWORD* in/out -> "var" ; lpGroupAttributes : void* optional -> "sptr" ; lpcbGroupAttributes : DWORD* optional -> "var" ; lpReserved : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "WININET.dll" #cfunc global FindFirstUrlCacheEntryExW "FindFirstUrlCacheEntryExW" wstr, int, int, int64, sptr, sptr, sptr, sptr, sptr ; res = FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, varptr(lpFirstCacheEntryInfo), varptr(lpcbCacheEntryInfo), lpGroupAttributes, varptr(lpcbGroupAttributes), lpReserved) ; lpszUrlSearchPattern : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; dwFilter : DWORD -> "int" ; GroupId : LONGLONG -> "int64" ; lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "sptr" ; lpcbCacheEntryInfo : DWORD* in/out -> "sptr" ; lpGroupAttributes : void* optional -> "sptr" ; lpcbGroupAttributes : DWORD* optional -> "sptr" ; lpReserved : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HANDLE FindFirstUrlCacheEntryExW(LPCWSTR lpszUrlSearchPattern, DWORD dwFlags, DWORD dwFilter, LONGLONG GroupId, INTERNET_CACHE_ENTRY_INFOW* lpFirstCacheEntryInfo, DWORD* lpcbCacheEntryInfo, void* lpGroupAttributes, DWORD* lpcbGroupAttributes, void* lpReserved) #uselib "WININET.dll" #cfunc global FindFirstUrlCacheEntryExW "FindFirstUrlCacheEntryExW" wstr, int, int, int64, var, var, intptr, var, intptr ; res = FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved) ; lpszUrlSearchPattern : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; dwFilter : DWORD -> "int" ; GroupId : LONGLONG -> "int64" ; lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "var" ; lpcbCacheEntryInfo : DWORD* in/out -> "var" ; lpGroupAttributes : void* optional -> "intptr" ; lpcbGroupAttributes : DWORD* optional -> "var" ; lpReserved : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HANDLE FindFirstUrlCacheEntryExW(LPCWSTR lpszUrlSearchPattern, DWORD dwFlags, DWORD dwFilter, LONGLONG GroupId, INTERNET_CACHE_ENTRY_INFOW* lpFirstCacheEntryInfo, DWORD* lpcbCacheEntryInfo, void* lpGroupAttributes, DWORD* lpcbGroupAttributes, void* lpReserved) #uselib "WININET.dll" #cfunc global FindFirstUrlCacheEntryExW "FindFirstUrlCacheEntryExW" wstr, int, int, int64, intptr, intptr, intptr, intptr, intptr ; res = FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, varptr(lpFirstCacheEntryInfo), varptr(lpcbCacheEntryInfo), lpGroupAttributes, varptr(lpcbGroupAttributes), lpReserved) ; lpszUrlSearchPattern : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; dwFilter : DWORD -> "int" ; GroupId : LONGLONG -> "int64" ; lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "intptr" ; lpcbCacheEntryInfo : DWORD* in/out -> "intptr" ; lpGroupAttributes : void* optional -> "intptr" ; lpcbGroupAttributes : DWORD* optional -> "intptr" ; lpReserved : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procFindFirstUrlCacheEntryExW = wininet.NewProc("FindFirstUrlCacheEntryExW")
)
// lpszUrlSearchPattern (LPCWSTR optional), dwFlags (DWORD), dwFilter (DWORD), GroupId (LONGLONG), lpFirstCacheEntryInfo (INTERNET_CACHE_ENTRY_INFOW* optional, in/out), lpcbCacheEntryInfo (DWORD* in/out), lpGroupAttributes (void* optional), lpcbGroupAttributes (DWORD* optional), lpReserved (void* optional)
r1, _, err := procFindFirstUrlCacheEntryExW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszUrlSearchPattern))),
uintptr(dwFlags),
uintptr(dwFilter),
uintptr(GroupId),
uintptr(lpFirstCacheEntryInfo),
uintptr(lpcbCacheEntryInfo),
uintptr(lpGroupAttributes),
uintptr(lpcbGroupAttributes),
uintptr(lpReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
dwFilter: DWORD; // DWORD
GroupId: Int64; // LONGLONG
lpFirstCacheEntryInfo: Pointer; // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: Pointer; // DWORD* in/out
lpGroupAttributes: Pointer; // void* optional
lpcbGroupAttributes: Pointer; // DWORD* optional
lpReserved: Pointer // void* optional
): THandle; stdcall;
external 'WININET.dll' name 'FindFirstUrlCacheEntryExW';result := DllCall("WININET\FindFirstUrlCacheEntryExW"
, "WStr", lpszUrlSearchPattern ; LPCWSTR optional
, "UInt", dwFlags ; DWORD
, "UInt", dwFilter ; DWORD
, "Int64", GroupId ; LONGLONG
, "Ptr", lpFirstCacheEntryInfo ; INTERNET_CACHE_ENTRY_INFOW* optional, in/out
, "Ptr", lpcbCacheEntryInfo ; DWORD* in/out
, "Ptr", lpGroupAttributes ; void* optional
, "Ptr", lpcbGroupAttributes ; DWORD* optional
, "Ptr", lpReserved ; void* optional
, "Ptr") ; return: HANDLE●FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved) = DLL("WININET.dll", "void* FindFirstUrlCacheEntryExW(char*, dword, dword, int64, void*, void*, void*, void*, void*)")
# 呼び出し: FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)
# lpszUrlSearchPattern : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# dwFilter : DWORD -> "dword"
# GroupId : LONGLONG -> "int64"
# lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "void*"
# lpcbCacheEntryInfo : DWORD* in/out -> "void*"
# lpGroupAttributes : void* optional -> "void*"
# lpcbGroupAttributes : DWORD* optional -> "void*"
# lpReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "wininet" fn FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern: [*c]const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
dwFilter: u32, // DWORD
GroupId: i64, // LONGLONG
lpFirstCacheEntryInfo: [*c]INTERNET_CACHE_ENTRY_INFOW, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: [*c]u32, // DWORD* in/out
lpGroupAttributes: ?*anyopaque, // void* optional
lpcbGroupAttributes: [*c]u32, // DWORD* optional
lpReserved: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) ?*anyopaque;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern: WideCString, # LPCWSTR optional
dwFlags: uint32, # DWORD
dwFilter: uint32, # DWORD
GroupId: int64, # LONGLONG
lpFirstCacheEntryInfo: ptr INTERNET_CACHE_ENTRY_INFOW, # INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: ptr uint32, # DWORD* in/out
lpGroupAttributes: pointer, # void* optional
lpcbGroupAttributes: ptr uint32, # DWORD* optional
lpReserved: pointer # void* optional
): pointer {.importc: "FindFirstUrlCacheEntryExW", stdcall, dynlib: "WININET.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "wininet");
extern(Windows)
void* FindFirstUrlCacheEntryExW(
const(wchar)* lpszUrlSearchPattern, // LPCWSTR optional
uint dwFlags, // DWORD
uint dwFilter, // DWORD
long GroupId, // LONGLONG
INTERNET_CACHE_ENTRY_INFOW* lpFirstCacheEntryInfo, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
uint* lpcbCacheEntryInfo, // DWORD* in/out
void* lpGroupAttributes, // void* optional
uint* lpcbGroupAttributes, // DWORD* optional
void* lpReserved // void* optional
);ccall((:FindFirstUrlCacheEntryExW, "WININET.dll"), stdcall, Ptr{Cvoid},
(Cwstring, UInt32, UInt32, Int64, Ptr{INTERNET_CACHE_ENTRY_INFOW}, Ptr{UInt32}, Ptr{Cvoid}, Ptr{UInt32}, Ptr{Cvoid}),
lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)
# lpszUrlSearchPattern : LPCWSTR optional -> Cwstring
# dwFlags : DWORD -> UInt32
# dwFilter : DWORD -> UInt32
# GroupId : LONGLONG -> Int64
# lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> Ptr{INTERNET_CACHE_ENTRY_INFOW}
# lpcbCacheEntryInfo : DWORD* in/out -> Ptr{UInt32}
# lpGroupAttributes : void* optional -> Ptr{Cvoid}
# lpcbGroupAttributes : DWORD* optional -> Ptr{UInt32}
# lpReserved : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
void* FindFirstUrlCacheEntryExW(
const uint16_t* lpszUrlSearchPattern,
uint32_t dwFlags,
uint32_t dwFilter,
int64_t GroupId,
void* lpFirstCacheEntryInfo,
uint32_t* lpcbCacheEntryInfo,
void* lpGroupAttributes,
uint32_t* lpcbGroupAttributes,
void* lpReserved);
]]
local wininet = ffi.load("wininet")
-- wininet.FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)
-- lpszUrlSearchPattern : LPCWSTR optional
-- dwFlags : DWORD
-- dwFilter : DWORD
-- GroupId : LONGLONG
-- lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
-- lpcbCacheEntryInfo : DWORD* in/out
-- lpGroupAttributes : void* optional
-- lpcbGroupAttributes : DWORD* optional
-- lpReserved : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const FindFirstUrlCacheEntryExW = lib.func('__stdcall', 'FindFirstUrlCacheEntryExW', 'void *', ['str16', 'uint32_t', 'uint32_t', 'int64_t', 'void *', 'uint32_t *', 'void *', 'uint32_t *', 'void *']);
// FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)
// lpszUrlSearchPattern : LPCWSTR optional -> 'str16'
// dwFlags : DWORD -> 'uint32_t'
// dwFilter : DWORD -> 'uint32_t'
// GroupId : LONGLONG -> 'int64_t'
// lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> 'void *'
// lpcbCacheEntryInfo : DWORD* in/out -> 'uint32_t *'
// lpGroupAttributes : void* optional -> 'void *'
// lpcbGroupAttributes : DWORD* optional -> 'uint32_t *'
// lpReserved : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WININET.dll", {
FindFirstUrlCacheEntryExW: { parameters: ["buffer", "u32", "u32", "i64", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved)
// lpszUrlSearchPattern : LPCWSTR optional -> "buffer"
// dwFlags : DWORD -> "u32"
// dwFilter : DWORD -> "u32"
// GroupId : LONGLONG -> "i64"
// lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> "pointer"
// lpcbCacheEntryInfo : DWORD* in/out -> "pointer"
// lpGroupAttributes : void* optional -> "pointer"
// lpcbGroupAttributes : DWORD* optional -> "pointer"
// lpReserved : void* optional -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* FindFirstUrlCacheEntryExW(
const uint16_t* lpszUrlSearchPattern,
uint32_t dwFlags,
uint32_t dwFilter,
int64_t GroupId,
void* lpFirstCacheEntryInfo,
uint32_t* lpcbCacheEntryInfo,
void* lpGroupAttributes,
uint32_t* lpcbGroupAttributes,
void* lpReserved);
C, "WININET.dll");
// $ffi->FindFirstUrlCacheEntryExW(lpszUrlSearchPattern, dwFlags, dwFilter, GroupId, lpFirstCacheEntryInfo, lpcbCacheEntryInfo, lpGroupAttributes, lpcbGroupAttributes, lpReserved);
// lpszUrlSearchPattern : LPCWSTR optional
// dwFlags : DWORD
// dwFilter : DWORD
// GroupId : LONGLONG
// lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out
// lpcbCacheEntryInfo : DWORD* in/out
// lpGroupAttributes : void* optional
// lpcbGroupAttributes : DWORD* optional
// lpReserved : void* optional
// 構造体/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, W32APIOptions.UNICODE_OPTIONS);
Pointer FindFirstUrlCacheEntryExW(
WString lpszUrlSearchPattern, // LPCWSTR optional
int dwFlags, // DWORD
int dwFilter, // DWORD
long GroupId, // LONGLONG
Pointer lpFirstCacheEntryInfo, // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
IntByReference lpcbCacheEntryInfo, // DWORD* in/out
Pointer lpGroupAttributes, // void* optional
IntByReference lpcbGroupAttributes, // DWORD* optional
Pointer lpReserved // void* optional
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("wininet")]
lib LibWININET
fun FindFirstUrlCacheEntryExW = FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern : UInt16*, # LPCWSTR optional
dwFlags : UInt32, # DWORD
dwFilter : UInt32, # DWORD
GroupId : Int64, # LONGLONG
lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW*, # INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo : UInt32*, # DWORD* in/out
lpGroupAttributes : Void*, # void* optional
lpcbGroupAttributes : UInt32*, # DWORD* optional
lpReserved : Void* # void* optional
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FindFirstUrlCacheEntryExWNative = Pointer<Void> Function(Pointer<Utf16>, Uint32, Uint32, Int64, Pointer<Void>, Pointer<Uint32>, Pointer<Void>, Pointer<Uint32>, Pointer<Void>);
typedef FindFirstUrlCacheEntryExWDart = Pointer<Void> Function(Pointer<Utf16>, int, int, int, Pointer<Void>, Pointer<Uint32>, Pointer<Void>, Pointer<Uint32>, Pointer<Void>);
final FindFirstUrlCacheEntryExW = DynamicLibrary.open('WININET.dll')
.lookupFunction<FindFirstUrlCacheEntryExWNative, FindFirstUrlCacheEntryExWDart>('FindFirstUrlCacheEntryExW');
// lpszUrlSearchPattern : LPCWSTR optional -> Pointer<Utf16>
// dwFlags : DWORD -> Uint32
// dwFilter : DWORD -> Uint32
// GroupId : LONGLONG -> Int64
// lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> Pointer<Void>
// lpcbCacheEntryInfo : DWORD* in/out -> Pointer<Uint32>
// lpGroupAttributes : void* optional -> Pointer<Void>
// lpcbGroupAttributes : DWORD* optional -> Pointer<Uint32>
// lpReserved : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FindFirstUrlCacheEntryExW(
lpszUrlSearchPattern: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
dwFilter: DWORD; // DWORD
GroupId: Int64; // LONGLONG
lpFirstCacheEntryInfo: Pointer; // INTERNET_CACHE_ENTRY_INFOW* optional, in/out
lpcbCacheEntryInfo: Pointer; // DWORD* in/out
lpGroupAttributes: Pointer; // void* optional
lpcbGroupAttributes: Pointer; // DWORD* optional
lpReserved: Pointer // void* optional
): THandle; stdcall;
external 'WININET.dll' name 'FindFirstUrlCacheEntryExW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FindFirstUrlCacheEntryExW"
c_FindFirstUrlCacheEntryExW :: CWString -> Word32 -> Word32 -> Int64 -> Ptr () -> Ptr Word32 -> Ptr () -> Ptr Word32 -> Ptr () -> IO (Ptr ())
-- lpszUrlSearchPattern : LPCWSTR optional -> CWString
-- dwFlags : DWORD -> Word32
-- dwFilter : DWORD -> Word32
-- GroupId : LONGLONG -> Int64
-- lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> Ptr ()
-- lpcbCacheEntryInfo : DWORD* in/out -> Ptr Word32
-- lpGroupAttributes : void* optional -> Ptr ()
-- lpcbGroupAttributes : DWORD* optional -> Ptr Word32
-- lpReserved : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let findfirsturlcacheentryexw =
foreign "FindFirstUrlCacheEntryExW"
((ptr uint16_t) @-> uint32_t @-> uint32_t @-> int64_t @-> (ptr void) @-> (ptr uint32_t) @-> (ptr void) @-> (ptr uint32_t) @-> (ptr void) @-> returning (ptr void))
(* lpszUrlSearchPattern : LPCWSTR optional -> (ptr uint16_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* dwFilter : DWORD -> uint32_t *)
(* GroupId : LONGLONG -> int64_t *)
(* lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> (ptr void) *)
(* lpcbCacheEntryInfo : DWORD* in/out -> (ptr uint32_t) *)
(* lpGroupAttributes : void* optional -> (ptr void) *)
(* lpcbGroupAttributes : DWORD* optional -> (ptr uint32_t) *)
(* lpReserved : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wininet (t "WININET.dll"))
(cffi:use-foreign-library wininet)
(cffi:defcfun ("FindFirstUrlCacheEntryExW" find-first-url-cache-entry-ex-w :convention :stdcall) :pointer
(lpsz-url-search-pattern (:string :encoding :utf-16le)) ; LPCWSTR optional
(dw-flags :uint32) ; DWORD
(dw-filter :uint32) ; DWORD
(group-id :int64) ; LONGLONG
(lp-first-cache-entry-info :pointer) ; INTERNET_CACHE_ENTRY_INFOW* optional, in/out
(lpcb-cache-entry-info :pointer) ; DWORD* in/out
(lp-group-attributes :pointer) ; void* optional
(lpcb-group-attributes :pointer) ; DWORD* optional
(lp-reserved :pointer)) ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FindFirstUrlCacheEntryExW = Win32::API::More->new('WININET',
'HANDLE FindFirstUrlCacheEntryExW(LPCWSTR lpszUrlSearchPattern, DWORD dwFlags, DWORD dwFilter, INT64 GroupId, LPVOID lpFirstCacheEntryInfo, LPVOID lpcbCacheEntryInfo, LPVOID lpGroupAttributes, LPVOID lpcbGroupAttributes, LPVOID lpReserved)');
# my $ret = $FindFirstUrlCacheEntryExW->Call($lpszUrlSearchPattern, $dwFlags, $dwFilter, $GroupId, $lpFirstCacheEntryInfo, $lpcbCacheEntryInfo, $lpGroupAttributes, $lpcbGroupAttributes, $lpReserved);
# lpszUrlSearchPattern : LPCWSTR optional -> LPCWSTR
# dwFlags : DWORD -> DWORD
# dwFilter : DWORD -> DWORD
# GroupId : LONGLONG -> INT64
# lpFirstCacheEntryInfo : INTERNET_CACHE_ENTRY_INFOW* optional, in/out -> LPVOID
# lpcbCacheEntryInfo : DWORD* in/out -> LPVOID
# lpGroupAttributes : void* optional -> LPVOID
# lpcbGroupAttributes : DWORD* optional -> LPVOID
# lpReserved : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
- f FindFirstUrlCacheEntryExA (ANSI版) — 条件指定でURLキャッシュエントリ列挙を開始する(ANSI版)。
- f FindFirstUrlCacheEntryW — URLキャッシュエントリの列挙を開始し最初の項目を取得する(Unicode版)。