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

WofIsExternalFile

関数
ファイルがWOF外部ファイルかどうかを判定する。
DLLWOFUTIL.dll呼出規約winapi

シグネチャ

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

HRESULT WofIsExternalFile(
    LPCWSTR FilePath,
    BOOL* IsExternalFile,   // optional
    DWORD* Provider,   // optional
    void* ExternalFileInfo,   // optional
    DWORD* BufferLength   // optional
);

パラメーター

名前方向
FilePathLPCWSTRin
IsExternalFileBOOL*outoptional
ProviderDWORD*outoptional
ExternalFileInfovoid*outoptional
BufferLengthDWORD*inoutoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WofIsExternalFile(
    LPCWSTR FilePath,
    BOOL* IsExternalFile,   // optional
    DWORD* Provider,   // optional
    void* ExternalFileInfo,   // optional
    DWORD* BufferLength   // optional
);
[DllImport("WOFUTIL.dll", ExactSpelling = true)]
static extern int WofIsExternalFile(
    [MarshalAs(UnmanagedType.LPWStr)] string FilePath,   // LPCWSTR
    IntPtr IsExternalFile,   // BOOL* optional, out
    IntPtr Provider,   // DWORD* optional, out
    IntPtr ExternalFileInfo,   // void* optional, out
    IntPtr BufferLength   // DWORD* optional, in/out
);
<DllImport("WOFUTIL.dll", ExactSpelling:=True)>
Public Shared Function WofIsExternalFile(
    <MarshalAs(UnmanagedType.LPWStr)> FilePath As String,   ' LPCWSTR
    IsExternalFile As IntPtr,   ' BOOL* optional, out
    Provider As IntPtr,   ' DWORD* optional, out
    ExternalFileInfo As IntPtr,   ' void* optional, out
    BufferLength As IntPtr   ' DWORD* optional, in/out
) As Integer
End Function
' FilePath : LPCWSTR
' IsExternalFile : BOOL* optional, out
' Provider : DWORD* optional, out
' ExternalFileInfo : void* optional, out
' BufferLength : DWORD* optional, in/out
Declare PtrSafe Function WofIsExternalFile Lib "wofutil" ( _
    ByVal FilePath As LongPtr, _
    ByVal IsExternalFile As LongPtr, _
    ByVal Provider As LongPtr, _
    ByVal ExternalFileInfo As LongPtr, _
    ByVal BufferLength As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WofIsExternalFile = ctypes.windll.wofutil.WofIsExternalFile
WofIsExternalFile.restype = ctypes.c_int
WofIsExternalFile.argtypes = [
    wintypes.LPCWSTR,  # FilePath : LPCWSTR
    ctypes.c_void_p,  # IsExternalFile : BOOL* optional, out
    ctypes.POINTER(wintypes.DWORD),  # Provider : DWORD* optional, out
    ctypes.POINTER(None),  # ExternalFileInfo : void* optional, out
    ctypes.POINTER(wintypes.DWORD),  # BufferLength : DWORD* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WOFUTIL.dll')
WofIsExternalFile = Fiddle::Function.new(
  lib['WofIsExternalFile'],
  [
    Fiddle::TYPE_VOIDP,  # FilePath : LPCWSTR
    Fiddle::TYPE_VOIDP,  # IsExternalFile : BOOL* optional, out
    Fiddle::TYPE_VOIDP,  # Provider : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # ExternalFileInfo : void* optional, out
    Fiddle::TYPE_VOIDP,  # BufferLength : DWORD* optional, in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wofutil")]
extern "system" {
    fn WofIsExternalFile(
        FilePath: *const u16,  // LPCWSTR
        IsExternalFile: *mut i32,  // BOOL* optional, out
        Provider: *mut u32,  // DWORD* optional, out
        ExternalFileInfo: *mut (),  // void* optional, out
        BufferLength: *mut u32  // DWORD* optional, in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WOFUTIL.dll")]
public static extern int WofIsExternalFile([MarshalAs(UnmanagedType.LPWStr)] string FilePath, IntPtr IsExternalFile, IntPtr Provider, IntPtr ExternalFileInfo, IntPtr BufferLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WOFUTIL_WofIsExternalFile' -Namespace Win32 -PassThru
# $api::WofIsExternalFile(FilePath, IsExternalFile, Provider, ExternalFileInfo, BufferLength)
#uselib "WOFUTIL.dll"
#func global WofIsExternalFile "WofIsExternalFile" sptr, sptr, sptr, sptr, sptr
; WofIsExternalFile FilePath, IsExternalFile, varptr(Provider), ExternalFileInfo, varptr(BufferLength)   ; 戻り値は stat
; FilePath : LPCWSTR -> "sptr"
; IsExternalFile : BOOL* optional, out -> "sptr"
; Provider : DWORD* optional, out -> "sptr"
; ExternalFileInfo : void* optional, out -> "sptr"
; BufferLength : DWORD* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WOFUTIL.dll"
#cfunc global WofIsExternalFile "WofIsExternalFile" wstr, int, var, sptr, var
; res = WofIsExternalFile(FilePath, IsExternalFile, Provider, ExternalFileInfo, BufferLength)
; FilePath : LPCWSTR -> "wstr"
; IsExternalFile : BOOL* optional, out -> "int"
; Provider : DWORD* optional, out -> "var"
; ExternalFileInfo : void* optional, out -> "sptr"
; BufferLength : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WofIsExternalFile(LPCWSTR FilePath, BOOL* IsExternalFile, DWORD* Provider, void* ExternalFileInfo, DWORD* BufferLength)
#uselib "WOFUTIL.dll"
#cfunc global WofIsExternalFile "WofIsExternalFile" wstr, int, var, intptr, var
; res = WofIsExternalFile(FilePath, IsExternalFile, Provider, ExternalFileInfo, BufferLength)
; FilePath : LPCWSTR -> "wstr"
; IsExternalFile : BOOL* optional, out -> "int"
; Provider : DWORD* optional, out -> "var"
; ExternalFileInfo : void* optional, out -> "intptr"
; BufferLength : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wofutil = windows.NewLazySystemDLL("WOFUTIL.dll")
	procWofIsExternalFile = wofutil.NewProc("WofIsExternalFile")
)

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