ホーム › Storage.FileSystem › WofSetFileDataLocation
WofSetFileDataLocation
関数WOFプロバイダーでファイルデータの格納先を設定する。
シグネチャ
// WOFUTIL.dll
#include <windows.h>
HRESULT WofSetFileDataLocation(
HANDLE FileHandle,
DWORD Provider,
void* ExternalFileInfo,
DWORD Length
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileHandle | HANDLE | in |
| Provider | DWORD | in |
| ExternalFileInfo | void* | in |
| Length | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// WOFUTIL.dll
#include <windows.h>
HRESULT WofSetFileDataLocation(
HANDLE FileHandle,
DWORD Provider,
void* ExternalFileInfo,
DWORD Length
);[DllImport("WOFUTIL.dll", ExactSpelling = true)]
static extern int WofSetFileDataLocation(
IntPtr FileHandle, // HANDLE
uint Provider, // DWORD
IntPtr ExternalFileInfo, // void*
uint Length // DWORD
);<DllImport("WOFUTIL.dll", ExactSpelling:=True)>
Public Shared Function WofSetFileDataLocation(
FileHandle As IntPtr, ' HANDLE
Provider As UInteger, ' DWORD
ExternalFileInfo As IntPtr, ' void*
Length As UInteger ' DWORD
) As Integer
End Function' FileHandle : HANDLE
' Provider : DWORD
' ExternalFileInfo : void*
' Length : DWORD
Declare PtrSafe Function WofSetFileDataLocation Lib "wofutil" ( _
ByVal FileHandle As LongPtr, _
ByVal Provider As Long, _
ByVal ExternalFileInfo As LongPtr, _
ByVal Length As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WofSetFileDataLocation = ctypes.windll.wofutil.WofSetFileDataLocation
WofSetFileDataLocation.restype = ctypes.c_int
WofSetFileDataLocation.argtypes = [
wintypes.HANDLE, # FileHandle : HANDLE
wintypes.DWORD, # Provider : DWORD
ctypes.POINTER(None), # ExternalFileInfo : void*
wintypes.DWORD, # Length : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WOFUTIL.dll')
WofSetFileDataLocation = Fiddle::Function.new(
lib['WofSetFileDataLocation'],
[
Fiddle::TYPE_VOIDP, # FileHandle : HANDLE
-Fiddle::TYPE_INT, # Provider : DWORD
Fiddle::TYPE_VOIDP, # ExternalFileInfo : void*
-Fiddle::TYPE_INT, # Length : DWORD
],
Fiddle::TYPE_INT)#[link(name = "wofutil")]
extern "system" {
fn WofSetFileDataLocation(
FileHandle: *mut core::ffi::c_void, // HANDLE
Provider: u32, // DWORD
ExternalFileInfo: *mut (), // void*
Length: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WOFUTIL.dll")]
public static extern int WofSetFileDataLocation(IntPtr FileHandle, uint Provider, IntPtr ExternalFileInfo, uint Length);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WOFUTIL_WofSetFileDataLocation' -Namespace Win32 -PassThru
# $api::WofSetFileDataLocation(FileHandle, Provider, ExternalFileInfo, Length)#uselib "WOFUTIL.dll"
#func global WofSetFileDataLocation "WofSetFileDataLocation" sptr, sptr, sptr, sptr
; WofSetFileDataLocation FileHandle, Provider, ExternalFileInfo, Length ; 戻り値は stat
; FileHandle : HANDLE -> "sptr"
; Provider : DWORD -> "sptr"
; ExternalFileInfo : void* -> "sptr"
; Length : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WOFUTIL.dll"
#cfunc global WofSetFileDataLocation "WofSetFileDataLocation" sptr, int, sptr, int
; res = WofSetFileDataLocation(FileHandle, Provider, ExternalFileInfo, Length)
; FileHandle : HANDLE -> "sptr"
; Provider : DWORD -> "int"
; ExternalFileInfo : void* -> "sptr"
; Length : DWORD -> "int"; HRESULT WofSetFileDataLocation(HANDLE FileHandle, DWORD Provider, void* ExternalFileInfo, DWORD Length)
#uselib "WOFUTIL.dll"
#cfunc global WofSetFileDataLocation "WofSetFileDataLocation" intptr, int, intptr, int
; res = WofSetFileDataLocation(FileHandle, Provider, ExternalFileInfo, Length)
; FileHandle : HANDLE -> "intptr"
; Provider : DWORD -> "int"
; ExternalFileInfo : void* -> "intptr"
; Length : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wofutil = windows.NewLazySystemDLL("WOFUTIL.dll")
procWofSetFileDataLocation = wofutil.NewProc("WofSetFileDataLocation")
)
// FileHandle (HANDLE), Provider (DWORD), ExternalFileInfo (void*), Length (DWORD)
r1, _, err := procWofSetFileDataLocation.Call(
uintptr(FileHandle),
uintptr(Provider),
uintptr(ExternalFileInfo),
uintptr(Length),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WofSetFileDataLocation(
FileHandle: THandle; // HANDLE
Provider: DWORD; // DWORD
ExternalFileInfo: Pointer; // void*
Length: DWORD // DWORD
): Integer; stdcall;
external 'WOFUTIL.dll' name 'WofSetFileDataLocation';result := DllCall("WOFUTIL\WofSetFileDataLocation"
, "Ptr", FileHandle ; HANDLE
, "UInt", Provider ; DWORD
, "Ptr", ExternalFileInfo ; void*
, "UInt", Length ; DWORD
, "Int") ; return: HRESULT●WofSetFileDataLocation(FileHandle, Provider, ExternalFileInfo, Length) = DLL("WOFUTIL.dll", "int WofSetFileDataLocation(void*, dword, void*, dword)")
# 呼び出し: WofSetFileDataLocation(FileHandle, Provider, ExternalFileInfo, Length)
# FileHandle : HANDLE -> "void*"
# Provider : DWORD -> "dword"
# ExternalFileInfo : void* -> "void*"
# Length : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。