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

UnlockUrlCacheEntryFileA

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

シグネチャ

// WININET.dll  (ANSI / -A)
#include <windows.h>

BOOL UnlockUrlCacheEntryFileA(
    LPCSTR lpszUrlName,
    DWORD dwReserved   // optional
);

パラメーター

名前方向
lpszUrlNameLPCSTRin
dwReservedDWORDoptional

戻り値の型: BOOL

各言語での呼び出し定義

// WININET.dll  (ANSI / -A)
#include <windows.h>

BOOL UnlockUrlCacheEntryFileA(
    LPCSTR lpszUrlName,
    DWORD dwReserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool UnlockUrlCacheEntryFileA(
    [MarshalAs(UnmanagedType.LPStr)] string lpszUrlName,   // LPCSTR
    uint dwReserved   // DWORD optional
);
<DllImport("WININET.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function UnlockUrlCacheEntryFileA(
    <MarshalAs(UnmanagedType.LPStr)> lpszUrlName As String,   ' LPCSTR
    dwReserved As UInteger   ' DWORD optional
) As Boolean
End Function
' lpszUrlName : LPCSTR
' dwReserved : DWORD optional
Declare PtrSafe Function UnlockUrlCacheEntryFileA Lib "wininet" ( _
    ByVal lpszUrlName As String, _
    ByVal dwReserved As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UnlockUrlCacheEntryFileA = ctypes.windll.wininet.UnlockUrlCacheEntryFileA
UnlockUrlCacheEntryFileA.restype = wintypes.BOOL
UnlockUrlCacheEntryFileA.argtypes = [
    wintypes.LPCSTR,  # lpszUrlName : LPCSTR
    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')
UnlockUrlCacheEntryFileA = Fiddle::Function.new(
  lib['UnlockUrlCacheEntryFileA'],
  [
    Fiddle::TYPE_VOIDP,  # lpszUrlName : LPCSTR
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn UnlockUrlCacheEntryFileA(
        lpszUrlName: *const u8,  // LPCSTR
        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.Ansi, SetLastError = true)]
public static extern bool UnlockUrlCacheEntryFileA([MarshalAs(UnmanagedType.LPStr)] string lpszUrlName, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_UnlockUrlCacheEntryFileA' -Namespace Win32 -PassThru
# $api::UnlockUrlCacheEntryFileA(lpszUrlName, dwReserved)
#uselib "WININET.dll"
#func global UnlockUrlCacheEntryFileA "UnlockUrlCacheEntryFileA" sptr, sptr
; UnlockUrlCacheEntryFileA lpszUrlName, dwReserved   ; 戻り値は stat
; lpszUrlName : LPCSTR -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global UnlockUrlCacheEntryFileA "UnlockUrlCacheEntryFileA" str, int
; res = UnlockUrlCacheEntryFileA(lpszUrlName, dwReserved)
; lpszUrlName : LPCSTR -> "str"
; dwReserved : DWORD optional -> "int"
; BOOL UnlockUrlCacheEntryFileA(LPCSTR lpszUrlName, DWORD dwReserved)
#uselib "WININET.dll"
#cfunc global UnlockUrlCacheEntryFileA "UnlockUrlCacheEntryFileA" str, int
; res = UnlockUrlCacheEntryFileA(lpszUrlName, dwReserved)
; lpszUrlName : LPCSTR -> "str"
; dwReserved : DWORD optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procUnlockUrlCacheEntryFileA = wininet.NewProc("UnlockUrlCacheEntryFileA")
)

// lpszUrlName (LPCSTR), dwReserved (DWORD optional)
r1, _, err := procUnlockUrlCacheEntryFileA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszUrlName))),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UnlockUrlCacheEntryFileA(
  lpszUrlName: PAnsiChar;   // LPCSTR
  dwReserved: DWORD   // DWORD optional
): BOOL; stdcall;
  external 'WININET.dll' name 'UnlockUrlCacheEntryFileA';
result := DllCall("WININET\UnlockUrlCacheEntryFileA"
    , "AStr", lpszUrlName   ; LPCSTR
    , "UInt", dwReserved   ; DWORD optional
    , "Int")   ; return: BOOL
●UnlockUrlCacheEntryFileA(lpszUrlName, dwReserved) = DLL("WININET.dll", "bool UnlockUrlCacheEntryFileA(char*, dword)")
# 呼び出し: UnlockUrlCacheEntryFileA(lpszUrlName, dwReserved)
# lpszUrlName : LPCSTR -> "char*"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。