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

InternetUnlockRequestFile

関数
InternetLockRequestFileで取得したファイルロックを解除する。
DLLWININET.dll呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

BOOL InternetUnlockRequestFile(
    HANDLE hLockRequestInfo
);

パラメーター

名前方向
hLockRequestInfoHANDLEinout

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL InternetUnlockRequestFile(
    HANDLE hLockRequestInfo
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", SetLastError = true, ExactSpelling = true)]
static extern bool InternetUnlockRequestFile(
    IntPtr hLockRequestInfo   // HANDLE in/out
);
<DllImport("WININET.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function InternetUnlockRequestFile(
    hLockRequestInfo As IntPtr   ' HANDLE in/out
) As Boolean
End Function
' hLockRequestInfo : HANDLE in/out
Declare PtrSafe Function InternetUnlockRequestFile Lib "wininet" ( _
    ByVal hLockRequestInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

InternetUnlockRequestFile = ctypes.windll.wininet.InternetUnlockRequestFile
InternetUnlockRequestFile.restype = wintypes.BOOL
InternetUnlockRequestFile.argtypes = [
    wintypes.HANDLE,  # hLockRequestInfo : HANDLE in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
InternetUnlockRequestFile = Fiddle::Function.new(
  lib['InternetUnlockRequestFile'],
  [
    Fiddle::TYPE_VOIDP,  # hLockRequestInfo : HANDLE in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn InternetUnlockRequestFile(
        hLockRequestInfo: *mut core::ffi::c_void  // HANDLE in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", SetLastError = true)]
public static extern bool InternetUnlockRequestFile(IntPtr hLockRequestInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetUnlockRequestFile' -Namespace Win32 -PassThru
# $api::InternetUnlockRequestFile(hLockRequestInfo)
#uselib "WININET.dll"
#func global InternetUnlockRequestFile "InternetUnlockRequestFile" sptr
; InternetUnlockRequestFile hLockRequestInfo   ; 戻り値は stat
; hLockRequestInfo : HANDLE in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global InternetUnlockRequestFile "InternetUnlockRequestFile" sptr
; res = InternetUnlockRequestFile(hLockRequestInfo)
; hLockRequestInfo : HANDLE in/out -> "sptr"
; BOOL InternetUnlockRequestFile(HANDLE hLockRequestInfo)
#uselib "WININET.dll"
#cfunc global InternetUnlockRequestFile "InternetUnlockRequestFile" intptr
; res = InternetUnlockRequestFile(hLockRequestInfo)
; hLockRequestInfo : HANDLE in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procInternetUnlockRequestFile = wininet.NewProc("InternetUnlockRequestFile")
)

// hLockRequestInfo (HANDLE in/out)
r1, _, err := procInternetUnlockRequestFile.Call(
	uintptr(hLockRequestInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function InternetUnlockRequestFile(
  hLockRequestInfo: THandle   // HANDLE in/out
): BOOL; stdcall;
  external 'WININET.dll' name 'InternetUnlockRequestFile';
result := DllCall("WININET\InternetUnlockRequestFile"
    , "Ptr", hLockRequestInfo   ; HANDLE in/out
    , "Int")   ; return: BOOL
●InternetUnlockRequestFile(hLockRequestInfo) = DLL("WININET.dll", "bool InternetUnlockRequestFile(void*)")
# 呼び出し: InternetUnlockRequestFile(hLockRequestInfo)
# hLockRequestInfo : HANDLE in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。