Win32 API 日本語リファレンス
ホームStorage.FileSystem › RemoveBindLink

RemoveBindLink

関数
指定した仮想パスのバインドリンクを削除する。
DLLBINDFLTAPI.dll呼出規約winapi

シグネチャ

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

HRESULT RemoveBindLink(
    LPCWSTR virtualPath
);

パラメーター

名前方向
virtualPathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RemoveBindLink(
    LPCWSTR virtualPath
);
[DllImport("BINDFLTAPI.dll", ExactSpelling = true)]
static extern int RemoveBindLink(
    [MarshalAs(UnmanagedType.LPWStr)] string virtualPath   // LPCWSTR
);
<DllImport("BINDFLTAPI.dll", ExactSpelling:=True)>
Public Shared Function RemoveBindLink(
    <MarshalAs(UnmanagedType.LPWStr)> virtualPath As String   ' LPCWSTR
) As Integer
End Function
' virtualPath : LPCWSTR
Declare PtrSafe Function RemoveBindLink Lib "bindfltapi" ( _
    ByVal virtualPath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RemoveBindLink = ctypes.windll.bindfltapi.RemoveBindLink
RemoveBindLink.restype = ctypes.c_int
RemoveBindLink.argtypes = [
    wintypes.LPCWSTR,  # virtualPath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('BINDFLTAPI.dll')
RemoveBindLink = Fiddle::Function.new(
  lib['RemoveBindLink'],
  [
    Fiddle::TYPE_VOIDP,  # virtualPath : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "bindfltapi")]
extern "system" {
    fn RemoveBindLink(
        virtualPath: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("BINDFLTAPI.dll")]
public static extern int RemoveBindLink([MarshalAs(UnmanagedType.LPWStr)] string virtualPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BINDFLTAPI_RemoveBindLink' -Namespace Win32 -PassThru
# $api::RemoveBindLink(virtualPath)
#uselib "BINDFLTAPI.dll"
#func global RemoveBindLink "RemoveBindLink" sptr
; RemoveBindLink virtualPath   ; 戻り値は stat
; virtualPath : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "BINDFLTAPI.dll"
#cfunc global RemoveBindLink "RemoveBindLink" wstr
; res = RemoveBindLink(virtualPath)
; virtualPath : LPCWSTR -> "wstr"
; HRESULT RemoveBindLink(LPCWSTR virtualPath)
#uselib "BINDFLTAPI.dll"
#cfunc global RemoveBindLink "RemoveBindLink" wstr
; res = RemoveBindLink(virtualPath)
; virtualPath : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	bindfltapi = windows.NewLazySystemDLL("BINDFLTAPI.dll")
	procRemoveBindLink = bindfltapi.NewProc("RemoveBindLink")
)

// virtualPath (LPCWSTR)
r1, _, err := procRemoveBindLink.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(virtualPath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RemoveBindLink(
  virtualPath: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'BINDFLTAPI.dll' name 'RemoveBindLink';
result := DllCall("BINDFLTAPI\RemoveBindLink"
    , "WStr", virtualPath   ; LPCWSTR
    , "Int")   ; return: HRESULT
●RemoveBindLink(virtualPath) = DLL("BINDFLTAPI.dll", "int RemoveBindLink(char*)")
# 呼び出し: RemoveBindLink(virtualPath)
# virtualPath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。