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

UnlockUrlCacheEntryFileW

関数
ロックしたURLキャッシュエントリファイルを解放する(Unicode版)。
DLLWININET.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

// WININET.dll  (Unicode / -W)
#include <windows.h>

BOOL UnlockUrlCacheEntryFileW(
    LPCWSTR lpszUrlName,
    DWORD dwReserved   // optional
);

パラメーター

名前方向
lpszUrlNameLPCWSTRin
dwReservedDWORDoptional

戻り値の型: BOOL

各言語での呼び出し定義

// WININET.dll  (Unicode / -W)
#include <windows.h>

BOOL UnlockUrlCacheEntryFileW(
    LPCWSTR lpszUrlName,
    DWORD dwReserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool UnlockUrlCacheEntryFileW(
    [MarshalAs(UnmanagedType.LPWStr)] string lpszUrlName,   // LPCWSTR
    uint dwReserved   // DWORD optional
);
<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function UnlockUrlCacheEntryFileW(
    <MarshalAs(UnmanagedType.LPWStr)> lpszUrlName As String,   ' LPCWSTR
    dwReserved As UInteger   ' DWORD optional
) As Boolean
End Function
' lpszUrlName : LPCWSTR
' dwReserved : DWORD optional
Declare PtrSafe Function UnlockUrlCacheEntryFileW Lib "wininet" ( _
    ByVal lpszUrlName As LongPtr, _
    ByVal dwReserved 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

UnlockUrlCacheEntryFileW = ctypes.windll.wininet.UnlockUrlCacheEntryFileW
UnlockUrlCacheEntryFileW.restype = wintypes.BOOL
UnlockUrlCacheEntryFileW.argtypes = [
    wintypes.LPCWSTR,  # lpszUrlName : LPCWSTR
    wintypes.DWORD,  # dwReserved : DWORD optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
UnlockUrlCacheEntryFileW = Fiddle::Function.new(
  lib['UnlockUrlCacheEntryFileW'],
  [
    Fiddle::TYPE_VOIDP,  # lpszUrlName : LPCWSTR
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "wininet")]
extern "system" {
    fn UnlockUrlCacheEntryFileW(
        lpszUrlName: *const u16,  // LPCWSTR
        dwReserved: u32  // DWORD optional
    ) -> 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 UnlockUrlCacheEntryFileW([MarshalAs(UnmanagedType.LPWStr)] string lpszUrlName, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_UnlockUrlCacheEntryFileW' -Namespace Win32 -PassThru
# $api::UnlockUrlCacheEntryFileW(lpszUrlName, dwReserved)
#uselib "WININET.dll"
#func global UnlockUrlCacheEntryFileW "UnlockUrlCacheEntryFileW" wptr, wptr
; UnlockUrlCacheEntryFileW lpszUrlName, dwReserved   ; 戻り値は stat
; lpszUrlName : LPCWSTR -> "wptr"
; dwReserved : DWORD optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global UnlockUrlCacheEntryFileW "UnlockUrlCacheEntryFileW" wstr, int
; res = UnlockUrlCacheEntryFileW(lpszUrlName, dwReserved)
; lpszUrlName : LPCWSTR -> "wstr"
; dwReserved : DWORD optional -> "int"
; BOOL UnlockUrlCacheEntryFileW(LPCWSTR lpszUrlName, DWORD dwReserved)
#uselib "WININET.dll"
#cfunc global UnlockUrlCacheEntryFileW "UnlockUrlCacheEntryFileW" wstr, int
; res = UnlockUrlCacheEntryFileW(lpszUrlName, dwReserved)
; lpszUrlName : LPCWSTR -> "wstr"
; dwReserved : DWORD optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procUnlockUrlCacheEntryFileW = wininet.NewProc("UnlockUrlCacheEntryFileW")
)

// lpszUrlName (LPCWSTR), dwReserved (DWORD optional)
r1, _, err := procUnlockUrlCacheEntryFileW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszUrlName))),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UnlockUrlCacheEntryFileW(
  lpszUrlName: PWideChar;   // LPCWSTR
  dwReserved: DWORD   // DWORD optional
): BOOL; stdcall;
  external 'WININET.dll' name 'UnlockUrlCacheEntryFileW';
result := DllCall("WININET\UnlockUrlCacheEntryFileW"
    , "WStr", lpszUrlName   ; LPCWSTR
    , "UInt", dwReserved   ; DWORD optional
    , "Int")   ; return: BOOL
●UnlockUrlCacheEntryFileW(lpszUrlName, dwReserved) = DLL("WININET.dll", "bool UnlockUrlCacheEntryFileW(char*, dword)")
# 呼び出し: UnlockUrlCacheEntryFileW(lpszUrlName, dwReserved)
# lpszUrlName : LPCWSTR -> "char*"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。