ホーム › Storage.CloudFilters › CfGetPlaceholderRangeInfoForHydration
CfGetPlaceholderRangeInfoForHydration
関数実体化処理向けにプレースホルダー範囲情報を取得する。
シグネチャ
// cldapi.dll
#include <windows.h>
HRESULT CfGetPlaceholderRangeInfoForHydration(
CF_CONNECTION_KEY ConnectionKey,
LONGLONG TransferKey,
LONGLONG FileId,
CF_PLACEHOLDER_RANGE_INFO_CLASS InfoClass,
LONGLONG StartingOffset,
LONGLONG RangeLength,
void* InfoBuffer,
DWORD InfoBufferSize,
DWORD* InfoBufferWritten // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ConnectionKey | CF_CONNECTION_KEY | in | 操作を行う接続を識別するCF_CONNECTION_KEY。 |
| TransferKey | LONGLONG | in | 対象ファイルの転送キー。コールバック内のハイドレート要求で得た値を渡す。 |
| FileId | LONGLONG | in | 対象ファイルを識別するファイルID。 |
| InfoClass | CF_PLACEHOLDER_RANGE_INFO_CLASS | in | 取得する範囲情報の種別を示すCF_PLACEHOLDER_RANGE_INFO_CLASS列挙値。 |
| StartingOffset | LONGLONG | in | 問い合わせる範囲の開始バイトオフセット。 |
| RangeLength | LONGLONG | in | 問い合わせる範囲のバイト長。 |
| InfoBuffer | void* | out | 取得した範囲情報を受け取るバッファへのポインタ。出力用。 |
| InfoBufferSize | DWORD | in | InfoBufferのバイト単位のサイズ。 |
| InfoBufferWritten | DWORD* | outoptional | 実際に書き込まれたバイト数を受け取るDWORDへのポインタ。出力用。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// cldapi.dll
#include <windows.h>
HRESULT CfGetPlaceholderRangeInfoForHydration(
CF_CONNECTION_KEY ConnectionKey,
LONGLONG TransferKey,
LONGLONG FileId,
CF_PLACEHOLDER_RANGE_INFO_CLASS InfoClass,
LONGLONG StartingOffset,
LONGLONG RangeLength,
void* InfoBuffer,
DWORD InfoBufferSize,
DWORD* InfoBufferWritten // optional
);[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfGetPlaceholderRangeInfoForHydration(
long ConnectionKey, // CF_CONNECTION_KEY
long TransferKey, // LONGLONG
long FileId, // LONGLONG
int InfoClass, // CF_PLACEHOLDER_RANGE_INFO_CLASS
long StartingOffset, // LONGLONG
long RangeLength, // LONGLONG
IntPtr InfoBuffer, // void* out
uint InfoBufferSize, // DWORD
IntPtr InfoBufferWritten // DWORD* optional, out
);<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfGetPlaceholderRangeInfoForHydration(
ConnectionKey As Long, ' CF_CONNECTION_KEY
TransferKey As Long, ' LONGLONG
FileId As Long, ' LONGLONG
InfoClass As Integer, ' CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset As Long, ' LONGLONG
RangeLength As Long, ' LONGLONG
InfoBuffer As IntPtr, ' void* out
InfoBufferSize As UInteger, ' DWORD
InfoBufferWritten As IntPtr ' DWORD* optional, out
) As Integer
End Function' ConnectionKey : CF_CONNECTION_KEY
' TransferKey : LONGLONG
' FileId : LONGLONG
' InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS
' StartingOffset : LONGLONG
' RangeLength : LONGLONG
' InfoBuffer : void* out
' InfoBufferSize : DWORD
' InfoBufferWritten : DWORD* optional, out
Declare PtrSafe Function CfGetPlaceholderRangeInfoForHydration Lib "cldapi" ( _
ByVal ConnectionKey As LongLong, _
ByVal TransferKey As LongLong, _
ByVal FileId As LongLong, _
ByVal InfoClass As Long, _
ByVal StartingOffset As LongLong, _
ByVal RangeLength As LongLong, _
ByVal InfoBuffer As LongPtr, _
ByVal InfoBufferSize As Long, _
ByVal InfoBufferWritten As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CfGetPlaceholderRangeInfoForHydration = ctypes.windll.cldapi.CfGetPlaceholderRangeInfoForHydration
CfGetPlaceholderRangeInfoForHydration.restype = ctypes.c_int
CfGetPlaceholderRangeInfoForHydration.argtypes = [
ctypes.c_longlong, # ConnectionKey : CF_CONNECTION_KEY
ctypes.c_longlong, # TransferKey : LONGLONG
ctypes.c_longlong, # FileId : LONGLONG
ctypes.c_int, # InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS
ctypes.c_longlong, # StartingOffset : LONGLONG
ctypes.c_longlong, # RangeLength : LONGLONG
ctypes.POINTER(None), # InfoBuffer : void* out
wintypes.DWORD, # InfoBufferSize : DWORD
ctypes.POINTER(wintypes.DWORD), # InfoBufferWritten : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('cldapi.dll')
CfGetPlaceholderRangeInfoForHydration = Fiddle::Function.new(
lib['CfGetPlaceholderRangeInfoForHydration'],
[
Fiddle::TYPE_LONG_LONG, # ConnectionKey : CF_CONNECTION_KEY
Fiddle::TYPE_LONG_LONG, # TransferKey : LONGLONG
Fiddle::TYPE_LONG_LONG, # FileId : LONGLONG
Fiddle::TYPE_INT, # InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS
Fiddle::TYPE_LONG_LONG, # StartingOffset : LONGLONG
Fiddle::TYPE_LONG_LONG, # RangeLength : LONGLONG
Fiddle::TYPE_VOIDP, # InfoBuffer : void* out
-Fiddle::TYPE_INT, # InfoBufferSize : DWORD
Fiddle::TYPE_VOIDP, # InfoBufferWritten : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "cldapi")]
extern "system" {
fn CfGetPlaceholderRangeInfoForHydration(
ConnectionKey: i64, // CF_CONNECTION_KEY
TransferKey: i64, // LONGLONG
FileId: i64, // LONGLONG
InfoClass: i32, // CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset: i64, // LONGLONG
RangeLength: i64, // LONGLONG
InfoBuffer: *mut (), // void* out
InfoBufferSize: u32, // DWORD
InfoBufferWritten: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfGetPlaceholderRangeInfoForHydration(long ConnectionKey, long TransferKey, long FileId, int InfoClass, long StartingOffset, long RangeLength, IntPtr InfoBuffer, uint InfoBufferSize, IntPtr InfoBufferWritten);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfGetPlaceholderRangeInfoForHydration' -Namespace Win32 -PassThru
# $api::CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)#uselib "cldapi.dll"
#func global CfGetPlaceholderRangeInfoForHydration "CfGetPlaceholderRangeInfoForHydration" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CfGetPlaceholderRangeInfoForHydration ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, varptr(InfoBufferWritten) ; 戻り値は stat
; ConnectionKey : CF_CONNECTION_KEY -> "sptr"
; TransferKey : LONGLONG -> "sptr"
; FileId : LONGLONG -> "sptr"
; InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "sptr"
; StartingOffset : LONGLONG -> "sptr"
; RangeLength : LONGLONG -> "sptr"
; InfoBuffer : void* out -> "sptr"
; InfoBufferSize : DWORD -> "sptr"
; InfoBufferWritten : DWORD* optional, out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "cldapi.dll" #cfunc global CfGetPlaceholderRangeInfoForHydration "CfGetPlaceholderRangeInfoForHydration" int64, int64, int64, int, int64, int64, sptr, int, var ; res = CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten) ; ConnectionKey : CF_CONNECTION_KEY -> "int64" ; TransferKey : LONGLONG -> "int64" ; FileId : LONGLONG -> "int64" ; InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "int" ; StartingOffset : LONGLONG -> "int64" ; RangeLength : LONGLONG -> "int64" ; InfoBuffer : void* out -> "sptr" ; InfoBufferSize : DWORD -> "int" ; InfoBufferWritten : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "cldapi.dll" #cfunc global CfGetPlaceholderRangeInfoForHydration "CfGetPlaceholderRangeInfoForHydration" int64, int64, int64, int, int64, int64, sptr, int, sptr ; res = CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, varptr(InfoBufferWritten)) ; ConnectionKey : CF_CONNECTION_KEY -> "int64" ; TransferKey : LONGLONG -> "int64" ; FileId : LONGLONG -> "int64" ; InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "int" ; StartingOffset : LONGLONG -> "int64" ; RangeLength : LONGLONG -> "int64" ; InfoBuffer : void* out -> "sptr" ; InfoBufferSize : DWORD -> "int" ; InfoBufferWritten : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT CfGetPlaceholderRangeInfoForHydration(CF_CONNECTION_KEY ConnectionKey, LONGLONG TransferKey, LONGLONG FileId, CF_PLACEHOLDER_RANGE_INFO_CLASS InfoClass, LONGLONG StartingOffset, LONGLONG RangeLength, void* InfoBuffer, DWORD InfoBufferSize, DWORD* InfoBufferWritten) #uselib "cldapi.dll" #cfunc global CfGetPlaceholderRangeInfoForHydration "CfGetPlaceholderRangeInfoForHydration" int64, int64, int64, int, int64, int64, intptr, int, var ; res = CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten) ; ConnectionKey : CF_CONNECTION_KEY -> "int64" ; TransferKey : LONGLONG -> "int64" ; FileId : LONGLONG -> "int64" ; InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "int" ; StartingOffset : LONGLONG -> "int64" ; RangeLength : LONGLONG -> "int64" ; InfoBuffer : void* out -> "intptr" ; InfoBufferSize : DWORD -> "int" ; InfoBufferWritten : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT CfGetPlaceholderRangeInfoForHydration(CF_CONNECTION_KEY ConnectionKey, LONGLONG TransferKey, LONGLONG FileId, CF_PLACEHOLDER_RANGE_INFO_CLASS InfoClass, LONGLONG StartingOffset, LONGLONG RangeLength, void* InfoBuffer, DWORD InfoBufferSize, DWORD* InfoBufferWritten) #uselib "cldapi.dll" #cfunc global CfGetPlaceholderRangeInfoForHydration "CfGetPlaceholderRangeInfoForHydration" int64, int64, int64, int, int64, int64, intptr, int, intptr ; res = CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, varptr(InfoBufferWritten)) ; ConnectionKey : CF_CONNECTION_KEY -> "int64" ; TransferKey : LONGLONG -> "int64" ; FileId : LONGLONG -> "int64" ; InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "int" ; StartingOffset : LONGLONG -> "int64" ; RangeLength : LONGLONG -> "int64" ; InfoBuffer : void* out -> "intptr" ; InfoBufferSize : DWORD -> "int" ; InfoBufferWritten : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cldapi = windows.NewLazySystemDLL("cldapi.dll")
procCfGetPlaceholderRangeInfoForHydration = cldapi.NewProc("CfGetPlaceholderRangeInfoForHydration")
)
// ConnectionKey (CF_CONNECTION_KEY), TransferKey (LONGLONG), FileId (LONGLONG), InfoClass (CF_PLACEHOLDER_RANGE_INFO_CLASS), StartingOffset (LONGLONG), RangeLength (LONGLONG), InfoBuffer (void* out), InfoBufferSize (DWORD), InfoBufferWritten (DWORD* optional, out)
r1, _, err := procCfGetPlaceholderRangeInfoForHydration.Call(
uintptr(ConnectionKey),
uintptr(TransferKey),
uintptr(FileId),
uintptr(InfoClass),
uintptr(StartingOffset),
uintptr(RangeLength),
uintptr(InfoBuffer),
uintptr(InfoBufferSize),
uintptr(InfoBufferWritten),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CfGetPlaceholderRangeInfoForHydration(
ConnectionKey: Int64; // CF_CONNECTION_KEY
TransferKey: Int64; // LONGLONG
FileId: Int64; // LONGLONG
InfoClass: Integer; // CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset: Int64; // LONGLONG
RangeLength: Int64; // LONGLONG
InfoBuffer: Pointer; // void* out
InfoBufferSize: DWORD; // DWORD
InfoBufferWritten: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'cldapi.dll' name 'CfGetPlaceholderRangeInfoForHydration';result := DllCall("cldapi\CfGetPlaceholderRangeInfoForHydration"
, "Int64", ConnectionKey ; CF_CONNECTION_KEY
, "Int64", TransferKey ; LONGLONG
, "Int64", FileId ; LONGLONG
, "Int", InfoClass ; CF_PLACEHOLDER_RANGE_INFO_CLASS
, "Int64", StartingOffset ; LONGLONG
, "Int64", RangeLength ; LONGLONG
, "Ptr", InfoBuffer ; void* out
, "UInt", InfoBufferSize ; DWORD
, "Ptr", InfoBufferWritten ; DWORD* optional, out
, "Int") ; return: HRESULT●CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten) = DLL("cldapi.dll", "int CfGetPlaceholderRangeInfoForHydration(int64, int64, int64, int, int64, int64, void*, dword, void*)")
# 呼び出し: CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)
# ConnectionKey : CF_CONNECTION_KEY -> "int64"
# TransferKey : LONGLONG -> "int64"
# FileId : LONGLONG -> "int64"
# InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "int"
# StartingOffset : LONGLONG -> "int64"
# RangeLength : LONGLONG -> "int64"
# InfoBuffer : void* out -> "void*"
# InfoBufferSize : DWORD -> "dword"
# InfoBufferWritten : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "cldapi" fn CfGetPlaceholderRangeInfoForHydration(
ConnectionKey: i64, // CF_CONNECTION_KEY
TransferKey: i64, // LONGLONG
FileId: i64, // LONGLONG
InfoClass: i32, // CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset: i64, // LONGLONG
RangeLength: i64, // LONGLONG
InfoBuffer: ?*anyopaque, // void* out
InfoBufferSize: u32, // DWORD
InfoBufferWritten: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) i32;proc CfGetPlaceholderRangeInfoForHydration(
ConnectionKey: int64, # CF_CONNECTION_KEY
TransferKey: int64, # LONGLONG
FileId: int64, # LONGLONG
InfoClass: int32, # CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset: int64, # LONGLONG
RangeLength: int64, # LONGLONG
InfoBuffer: pointer, # void* out
InfoBufferSize: uint32, # DWORD
InfoBufferWritten: ptr uint32 # DWORD* optional, out
): int32 {.importc: "CfGetPlaceholderRangeInfoForHydration", stdcall, dynlib: "cldapi.dll".}pragma(lib, "cldapi");
extern(Windows)
int CfGetPlaceholderRangeInfoForHydration(
long ConnectionKey, // CF_CONNECTION_KEY
long TransferKey, // LONGLONG
long FileId, // LONGLONG
int InfoClass, // CF_PLACEHOLDER_RANGE_INFO_CLASS
long StartingOffset, // LONGLONG
long RangeLength, // LONGLONG
void* InfoBuffer, // void* out
uint InfoBufferSize, // DWORD
uint* InfoBufferWritten // DWORD* optional, out
);ccall((:CfGetPlaceholderRangeInfoForHydration, "cldapi.dll"), stdcall, Int32,
(Int64, Int64, Int64, Int32, Int64, Int64, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)
# ConnectionKey : CF_CONNECTION_KEY -> Int64
# TransferKey : LONGLONG -> Int64
# FileId : LONGLONG -> Int64
# InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> Int32
# StartingOffset : LONGLONG -> Int64
# RangeLength : LONGLONG -> Int64
# InfoBuffer : void* out -> Ptr{Cvoid}
# InfoBufferSize : DWORD -> UInt32
# InfoBufferWritten : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CfGetPlaceholderRangeInfoForHydration(
int64_t ConnectionKey,
int64_t TransferKey,
int64_t FileId,
int32_t InfoClass,
int64_t StartingOffset,
int64_t RangeLength,
void* InfoBuffer,
uint32_t InfoBufferSize,
uint32_t* InfoBufferWritten);
]]
local cldapi = ffi.load("cldapi")
-- cldapi.CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)
-- ConnectionKey : CF_CONNECTION_KEY
-- TransferKey : LONGLONG
-- FileId : LONGLONG
-- InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS
-- StartingOffset : LONGLONG
-- RangeLength : LONGLONG
-- InfoBuffer : void* out
-- InfoBufferSize : DWORD
-- InfoBufferWritten : DWORD* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('cldapi.dll');
const CfGetPlaceholderRangeInfoForHydration = lib.func('__stdcall', 'CfGetPlaceholderRangeInfoForHydration', 'int32_t', ['int64_t', 'int64_t', 'int64_t', 'int32_t', 'int64_t', 'int64_t', 'void *', 'uint32_t', 'uint32_t *']);
// CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)
// ConnectionKey : CF_CONNECTION_KEY -> 'int64_t'
// TransferKey : LONGLONG -> 'int64_t'
// FileId : LONGLONG -> 'int64_t'
// InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> 'int32_t'
// StartingOffset : LONGLONG -> 'int64_t'
// RangeLength : LONGLONG -> 'int64_t'
// InfoBuffer : void* out -> 'void *'
// InfoBufferSize : DWORD -> 'uint32_t'
// InfoBufferWritten : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("cldapi.dll", {
CfGetPlaceholderRangeInfoForHydration: { parameters: ["i64", "i64", "i64", "i32", "i64", "i64", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten)
// ConnectionKey : CF_CONNECTION_KEY -> "i64"
// TransferKey : LONGLONG -> "i64"
// FileId : LONGLONG -> "i64"
// InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> "i32"
// StartingOffset : LONGLONG -> "i64"
// RangeLength : LONGLONG -> "i64"
// InfoBuffer : void* out -> "pointer"
// InfoBufferSize : DWORD -> "u32"
// InfoBufferWritten : DWORD* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CfGetPlaceholderRangeInfoForHydration(
int64_t ConnectionKey,
int64_t TransferKey,
int64_t FileId,
int32_t InfoClass,
int64_t StartingOffset,
int64_t RangeLength,
void* InfoBuffer,
uint32_t InfoBufferSize,
uint32_t* InfoBufferWritten);
C, "cldapi.dll");
// $ffi->CfGetPlaceholderRangeInfoForHydration(ConnectionKey, TransferKey, FileId, InfoClass, StartingOffset, RangeLength, InfoBuffer, InfoBufferSize, InfoBufferWritten);
// ConnectionKey : CF_CONNECTION_KEY
// TransferKey : LONGLONG
// FileId : LONGLONG
// InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS
// StartingOffset : LONGLONG
// RangeLength : LONGLONG
// InfoBuffer : void* out
// InfoBufferSize : DWORD
// InfoBufferWritten : DWORD* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Cldapi extends StdCallLibrary {
Cldapi INSTANCE = Native.load("cldapi", Cldapi.class);
int CfGetPlaceholderRangeInfoForHydration(
long ConnectionKey, // CF_CONNECTION_KEY
long TransferKey, // LONGLONG
long FileId, // LONGLONG
int InfoClass, // CF_PLACEHOLDER_RANGE_INFO_CLASS
long StartingOffset, // LONGLONG
long RangeLength, // LONGLONG
Pointer InfoBuffer, // void* out
int InfoBufferSize, // DWORD
IntByReference InfoBufferWritten // DWORD* optional, out
);
}@[Link("cldapi")]
lib Libcldapi
fun CfGetPlaceholderRangeInfoForHydration = CfGetPlaceholderRangeInfoForHydration(
ConnectionKey : Int64, # CF_CONNECTION_KEY
TransferKey : Int64, # LONGLONG
FileId : Int64, # LONGLONG
InfoClass : Int32, # CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset : Int64, # LONGLONG
RangeLength : Int64, # LONGLONG
InfoBuffer : Void*, # void* out
InfoBufferSize : UInt32, # DWORD
InfoBufferWritten : UInt32* # DWORD* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CfGetPlaceholderRangeInfoForHydrationNative = Int32 Function(Int64, Int64, Int64, Int32, Int64, Int64, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef CfGetPlaceholderRangeInfoForHydrationDart = int Function(int, int, int, int, int, int, Pointer<Void>, int, Pointer<Uint32>);
final CfGetPlaceholderRangeInfoForHydration = DynamicLibrary.open('cldapi.dll')
.lookupFunction<CfGetPlaceholderRangeInfoForHydrationNative, CfGetPlaceholderRangeInfoForHydrationDart>('CfGetPlaceholderRangeInfoForHydration');
// ConnectionKey : CF_CONNECTION_KEY -> Int64
// TransferKey : LONGLONG -> Int64
// FileId : LONGLONG -> Int64
// InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> Int32
// StartingOffset : LONGLONG -> Int64
// RangeLength : LONGLONG -> Int64
// InfoBuffer : void* out -> Pointer<Void>
// InfoBufferSize : DWORD -> Uint32
// InfoBufferWritten : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CfGetPlaceholderRangeInfoForHydration(
ConnectionKey: Int64; // CF_CONNECTION_KEY
TransferKey: Int64; // LONGLONG
FileId: Int64; // LONGLONG
InfoClass: Integer; // CF_PLACEHOLDER_RANGE_INFO_CLASS
StartingOffset: Int64; // LONGLONG
RangeLength: Int64; // LONGLONG
InfoBuffer: Pointer; // void* out
InfoBufferSize: DWORD; // DWORD
InfoBufferWritten: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'cldapi.dll' name 'CfGetPlaceholderRangeInfoForHydration';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CfGetPlaceholderRangeInfoForHydration"
c_CfGetPlaceholderRangeInfoForHydration :: Int64 -> Int64 -> Int64 -> Int32 -> Int64 -> Int64 -> Ptr () -> Word32 -> Ptr Word32 -> IO Int32
-- ConnectionKey : CF_CONNECTION_KEY -> Int64
-- TransferKey : LONGLONG -> Int64
-- FileId : LONGLONG -> Int64
-- InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> Int32
-- StartingOffset : LONGLONG -> Int64
-- RangeLength : LONGLONG -> Int64
-- InfoBuffer : void* out -> Ptr ()
-- InfoBufferSize : DWORD -> Word32
-- InfoBufferWritten : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cfgetplaceholderrangeinfoforhydration =
foreign "CfGetPlaceholderRangeInfoForHydration"
(int64_t @-> int64_t @-> int64_t @-> int32_t @-> int64_t @-> int64_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* ConnectionKey : CF_CONNECTION_KEY -> int64_t *)
(* TransferKey : LONGLONG -> int64_t *)
(* FileId : LONGLONG -> int64_t *)
(* InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> int32_t *)
(* StartingOffset : LONGLONG -> int64_t *)
(* RangeLength : LONGLONG -> int64_t *)
(* InfoBuffer : void* out -> (ptr void) *)
(* InfoBufferSize : DWORD -> uint32_t *)
(* InfoBufferWritten : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library cldapi (t "cldapi.dll"))
(cffi:use-foreign-library cldapi)
(cffi:defcfun ("CfGetPlaceholderRangeInfoForHydration" cf-get-placeholder-range-info-for-hydration :convention :stdcall) :int32
(connection-key :int64) ; CF_CONNECTION_KEY
(transfer-key :int64) ; LONGLONG
(file-id :int64) ; LONGLONG
(info-class :int32) ; CF_PLACEHOLDER_RANGE_INFO_CLASS
(starting-offset :int64) ; LONGLONG
(range-length :int64) ; LONGLONG
(info-buffer :pointer) ; void* out
(info-buffer-size :uint32) ; DWORD
(info-buffer-written :pointer)) ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CfGetPlaceholderRangeInfoForHydration = Win32::API::More->new('cldapi',
'int CfGetPlaceholderRangeInfoForHydration(INT64 ConnectionKey, INT64 TransferKey, INT64 FileId, int InfoClass, INT64 StartingOffset, INT64 RangeLength, LPVOID InfoBuffer, DWORD InfoBufferSize, LPVOID InfoBufferWritten)');
# my $ret = $CfGetPlaceholderRangeInfoForHydration->Call($ConnectionKey, $TransferKey, $FileId, $InfoClass, $StartingOffset, $RangeLength, $InfoBuffer, $InfoBufferSize, $InfoBufferWritten);
# ConnectionKey : CF_CONNECTION_KEY -> INT64
# TransferKey : LONGLONG -> INT64
# FileId : LONGLONG -> INT64
# InfoClass : CF_PLACEHOLDER_RANGE_INFO_CLASS -> int
# StartingOffset : LONGLONG -> INT64
# RangeLength : LONGLONG -> INT64
# InfoBuffer : void* out -> LPVOID
# InfoBufferSize : DWORD -> DWORD
# InfoBufferWritten : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。