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

CfGetPlaceholderInfo

関数
プレースホルダーの指定種別の情報を取得する。
DLLcldapi.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT CfGetPlaceholderInfo(
    HANDLE FileHandle,
    CF_PLACEHOLDER_INFO_CLASS InfoClass,
    void* InfoBuffer,
    DWORD InfoBufferLength,
    DWORD* ReturnedLength   // optional
);

パラメーター

名前型方向説明
FileHandleHANDLEin情報を照会するプレースホルダーへのハンドル。ファイルハンドルを受け取るほとんどのクラウドファイル API とは異なり、この API はファイルを一切変更しません。そのため、ファイルハンドルには READ_ATTRIBUTES アクセスのみが必要です。
InfoClassCF_PLACEHOLDER_INFO_CLASSinプレースホルダー情報。CF_PLACEHOLDER_STANDARD_INFO または CF_PLACEHOLDER_BASIC_INFO のいずれかを設定できます。
InfoBuffervoid*outプレースホルダーに関する情報を受け取るバッファーへのポインター。
InfoBufferLengthDWORDinInfoBuffer の長さ (バイト単位)。要求されたすべての情報を格納するのにバッファーが十分な大きさでない場合、この API はバッファーに収まる分のデータのみを返し、呼び出しは HRESULT_FROM_WIN32(ERROR_MORE_DATA) で失敗します。
ReturnedLengthDWORD*outoptionalInfoBuffer に返されたバイト数。

戻り値の型: HRESULT

公式ドキュメント

プレースホルダーのファイルまたはフォルダーのさまざまな特性を取得します。

戻り値

この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。

解説(Remarks)

プレースホルダー情報には次の属性が含まれます。

属性 説明
OnDiskDataSize ディスク上の合計バイト数。
ValidatedDataSize クラウドと同期している合計バイト数。
ModifiedDataSize ローカルで上書きまたは追加された、すなわちクラウドと同期していない合計バイト数。
PropertiesSize すべてのプロパティ BLOB によって使用されているディスク上の合計バイト数。
PinState 詳細については CfSetPinState を参照してください。
InSyncState 詳細については CfSetInSyncState を参照してください。
FileId ファイルまたはディレクトリを一意に識別する、ボリューム全体で有効な 64 ビットの不揮発性の番号。
SyncRootFileId プレースホルダー情報の照会対象となるファイルが存在する同期ルートディレクトリのファイル ID。
FileIdentity プレースホルダーの作成時に同期プロバイダーからプラットフォームに提供された不透明な BLOB。ファイル ID 情報は、すべての同期プロバイダーのコールバックに提供されます。
FileIdentityLength ファイル ID 情報の長さ (バイト単位)。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

HRESULT CfGetPlaceholderInfo(
    HANDLE FileHandle,
    CF_PLACEHOLDER_INFO_CLASS InfoClass,
    void* InfoBuffer,
    DWORD InfoBufferLength,
    DWORD* ReturnedLength   // optional
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfGetPlaceholderInfo(
    IntPtr FileHandle,   // HANDLE
    int InfoClass,   // CF_PLACEHOLDER_INFO_CLASS
    IntPtr InfoBuffer,   // void* out
    uint InfoBufferLength,   // DWORD
    IntPtr ReturnedLength   // DWORD* optional, out
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfGetPlaceholderInfo(
    FileHandle As IntPtr,   ' HANDLE
    InfoClass As Integer,   ' CF_PLACEHOLDER_INFO_CLASS
    InfoBuffer As IntPtr,   ' void* out
    InfoBufferLength As UInteger,   ' DWORD
    ReturnedLength As IntPtr   ' DWORD* optional, out
) As Integer
End Function
' FileHandle : HANDLE
' InfoClass : CF_PLACEHOLDER_INFO_CLASS
' InfoBuffer : void* out
' InfoBufferLength : DWORD
' ReturnedLength : DWORD* optional, out
Declare PtrSafe Function CfGetPlaceholderInfo Lib "cldapi" ( _
    ByVal FileHandle As LongPtr, _
    ByVal InfoClass As Long, _
    ByVal InfoBuffer As LongPtr, _
    ByVal InfoBufferLength As Long, _
    ByVal ReturnedLength As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfGetPlaceholderInfo = ctypes.windll.cldapi.CfGetPlaceholderInfo
CfGetPlaceholderInfo.restype = ctypes.c_int
CfGetPlaceholderInfo.argtypes = [
    wintypes.HANDLE,  # FileHandle : HANDLE
    ctypes.c_int,  # InfoClass : CF_PLACEHOLDER_INFO_CLASS
    ctypes.POINTER(None),  # InfoBuffer : void* out
    wintypes.DWORD,  # InfoBufferLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # ReturnedLength : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('cldapi.dll')
CfGetPlaceholderInfo = Fiddle::Function.new(
  lib['CfGetPlaceholderInfo'],
  [
    Fiddle::TYPE_VOIDP,  # FileHandle : HANDLE
    Fiddle::TYPE_INT,  # InfoClass : CF_PLACEHOLDER_INFO_CLASS
    Fiddle::TYPE_VOIDP,  # InfoBuffer : void* out
    -Fiddle::TYPE_INT,  # InfoBufferLength : DWORD
    Fiddle::TYPE_VOIDP,  # ReturnedLength : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "cldapi")]
extern "system" {
    fn CfGetPlaceholderInfo(
        FileHandle: *mut core::ffi::c_void,  // HANDLE
        InfoClass: i32,  // CF_PLACEHOLDER_INFO_CLASS
        InfoBuffer: *mut (),  // void* out
        InfoBufferLength: u32,  // DWORD
        ReturnedLength: *mut u32  // DWORD* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfGetPlaceholderInfo(IntPtr FileHandle, int InfoClass, IntPtr InfoBuffer, uint InfoBufferLength, IntPtr ReturnedLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfGetPlaceholderInfo' -Namespace Win32 -PassThru
# $api::CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
#uselib "cldapi.dll"
#func global CfGetPlaceholderInfo "CfGetPlaceholderInfo" sptr, sptr, sptr, sptr, sptr
; CfGetPlaceholderInfo FileHandle, InfoClass, InfoBuffer, InfoBufferLength, varptr(ReturnedLength)   ; 戻り値は stat
; FileHandle : HANDLE -> "sptr"
; InfoClass : CF_PLACEHOLDER_INFO_CLASS -> "sptr"
; InfoBuffer : void* out -> "sptr"
; InfoBufferLength : DWORD -> "sptr"
; ReturnedLength : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "cldapi.dll"
#cfunc global CfGetPlaceholderInfo "CfGetPlaceholderInfo" sptr, int, sptr, int, var
; res = CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
; FileHandle : HANDLE -> "sptr"
; InfoClass : CF_PLACEHOLDER_INFO_CLASS -> "int"
; InfoBuffer : void* out -> "sptr"
; InfoBufferLength : DWORD -> "int"
; ReturnedLength : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT CfGetPlaceholderInfo(HANDLE FileHandle, CF_PLACEHOLDER_INFO_CLASS InfoClass, void* InfoBuffer, DWORD InfoBufferLength, DWORD* ReturnedLength)
#uselib "cldapi.dll"
#cfunc global CfGetPlaceholderInfo "CfGetPlaceholderInfo" intptr, int, intptr, int, var
; res = CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
; FileHandle : HANDLE -> "intptr"
; InfoClass : CF_PLACEHOLDER_INFO_CLASS -> "int"
; InfoBuffer : void* out -> "intptr"
; InfoBufferLength : DWORD -> "int"
; ReturnedLength : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfGetPlaceholderInfo = cldapi.NewProc("CfGetPlaceholderInfo")
)

// FileHandle (HANDLE), InfoClass (CF_PLACEHOLDER_INFO_CLASS), InfoBuffer (void* out), InfoBufferLength (DWORD), ReturnedLength (DWORD* optional, out)
r1, _, err := procCfGetPlaceholderInfo.Call(
	uintptr(FileHandle),
	uintptr(InfoClass),
	uintptr(InfoBuffer),
	uintptr(InfoBufferLength),
	uintptr(ReturnedLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CfGetPlaceholderInfo(
  FileHandle: THandle;   // HANDLE
  InfoClass: Integer;   // CF_PLACEHOLDER_INFO_CLASS
  InfoBuffer: Pointer;   // void* out
  InfoBufferLength: DWORD;   // DWORD
  ReturnedLength: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'cldapi.dll' name 'CfGetPlaceholderInfo';
result := DllCall("cldapi\CfGetPlaceholderInfo"
    , "Ptr", FileHandle   ; HANDLE
    , "Int", InfoClass   ; CF_PLACEHOLDER_INFO_CLASS
    , "Ptr", InfoBuffer   ; void* out
    , "UInt", InfoBufferLength   ; DWORD
    , "Ptr", ReturnedLength   ; DWORD* optional, out
    , "Int")   ; return: HRESULT
●CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength) = DLL("cldapi.dll", "int CfGetPlaceholderInfo(void*, int, void*, dword, void*)")
# 呼び出し: CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
# FileHandle : HANDLE -> "void*"
# InfoClass : CF_PLACEHOLDER_INFO_CLASS -> "int"
# InfoBuffer : void* out -> "void*"
# InfoBufferLength : DWORD -> "dword"
# ReturnedLength : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "cldapi" fn CfGetPlaceholderInfo(
    FileHandle: ?*anyopaque, // HANDLE
    InfoClass: i32, // CF_PLACEHOLDER_INFO_CLASS
    InfoBuffer: ?*anyopaque, // void* out
    InfoBufferLength: u32, // DWORD
    ReturnedLength: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) i32;
proc CfGetPlaceholderInfo(
    FileHandle: pointer,  # HANDLE
    InfoClass: int32,  # CF_PLACEHOLDER_INFO_CLASS
    InfoBuffer: pointer,  # void* out
    InfoBufferLength: uint32,  # DWORD
    ReturnedLength: ptr uint32  # DWORD* optional, out
): int32 {.importc: "CfGetPlaceholderInfo", stdcall, dynlib: "cldapi.dll".}
pragma(lib, "cldapi");
extern(Windows)
int CfGetPlaceholderInfo(
    void* FileHandle,   // HANDLE
    int InfoClass,   // CF_PLACEHOLDER_INFO_CLASS
    void* InfoBuffer,   // void* out
    uint InfoBufferLength,   // DWORD
    uint* ReturnedLength   // DWORD* optional, out
);
ccall((:CfGetPlaceholderInfo, "cldapi.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Int32, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
      FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
# FileHandle : HANDLE -> Ptr{Cvoid}
# InfoClass : CF_PLACEHOLDER_INFO_CLASS -> Int32
# InfoBuffer : void* out -> Ptr{Cvoid}
# InfoBufferLength : DWORD -> UInt32
# ReturnedLength : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t CfGetPlaceholderInfo(
    void* FileHandle,
    int32_t InfoClass,
    void* InfoBuffer,
    uint32_t InfoBufferLength,
    uint32_t* ReturnedLength);
]]
local cldapi = ffi.load("cldapi")
-- cldapi.CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
-- FileHandle : HANDLE
-- InfoClass : CF_PLACEHOLDER_INFO_CLASS
-- InfoBuffer : void* out
-- InfoBufferLength : DWORD
-- ReturnedLength : DWORD* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('cldapi.dll');
const CfGetPlaceholderInfo = lib.func('__stdcall', 'CfGetPlaceholderInfo', 'int32_t', ['void *', 'int32_t', 'void *', 'uint32_t', 'uint32_t *']);
// CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
// FileHandle : HANDLE -> 'void *'
// InfoClass : CF_PLACEHOLDER_INFO_CLASS -> 'int32_t'
// InfoBuffer : void* out -> 'void *'
// InfoBufferLength : DWORD -> 'uint32_t'
// ReturnedLength : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("cldapi.dll", {
  CfGetPlaceholderInfo: { parameters: ["pointer", "i32", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
// FileHandle : HANDLE -> "pointer"
// InfoClass : CF_PLACEHOLDER_INFO_CLASS -> "i32"
// InfoBuffer : void* out -> "pointer"
// InfoBufferLength : DWORD -> "u32"
// ReturnedLength : DWORD* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t CfGetPlaceholderInfo(
    void* FileHandle,
    int32_t InfoClass,
    void* InfoBuffer,
    uint32_t InfoBufferLength,
    uint32_t* ReturnedLength);
C, "cldapi.dll");
// $ffi->CfGetPlaceholderInfo(FileHandle, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength);
// FileHandle : HANDLE
// InfoClass : CF_PLACEHOLDER_INFO_CLASS
// InfoBuffer : void* out
// InfoBufferLength : DWORD
// ReturnedLength : 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 CfGetPlaceholderInfo(
        Pointer FileHandle,   // HANDLE
        int InfoClass,   // CF_PLACEHOLDER_INFO_CLASS
        Pointer InfoBuffer,   // void* out
        int InfoBufferLength,   // DWORD
        IntByReference ReturnedLength   // DWORD* optional, out
    );
}
@[Link("cldapi")]
lib Libcldapi
  fun CfGetPlaceholderInfo = CfGetPlaceholderInfo(
    FileHandle : Void*,   # HANDLE
    InfoClass : Int32,   # CF_PLACEHOLDER_INFO_CLASS
    InfoBuffer : Void*,   # void* out
    InfoBufferLength : UInt32,   # DWORD
    ReturnedLength : 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 CfGetPlaceholderInfoNative = Int32 Function(Pointer<Void>, Int32, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef CfGetPlaceholderInfoDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>);
final CfGetPlaceholderInfo = DynamicLibrary.open('cldapi.dll')
    .lookupFunction<CfGetPlaceholderInfoNative, CfGetPlaceholderInfoDart>('CfGetPlaceholderInfo');
// FileHandle : HANDLE -> Pointer<Void>
// InfoClass : CF_PLACEHOLDER_INFO_CLASS -> Int32
// InfoBuffer : void* out -> Pointer<Void>
// InfoBufferLength : DWORD -> Uint32
// ReturnedLength : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CfGetPlaceholderInfo(
  FileHandle: THandle;   // HANDLE
  InfoClass: Integer;   // CF_PLACEHOLDER_INFO_CLASS
  InfoBuffer: Pointer;   // void* out
  InfoBufferLength: DWORD;   // DWORD
  ReturnedLength: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'cldapi.dll' name 'CfGetPlaceholderInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CfGetPlaceholderInfo"
  c_CfGetPlaceholderInfo :: Ptr () -> Int32 -> Ptr () -> Word32 -> Ptr Word32 -> IO Int32
-- FileHandle : HANDLE -> Ptr ()
-- InfoClass : CF_PLACEHOLDER_INFO_CLASS -> Int32
-- InfoBuffer : void* out -> Ptr ()
-- InfoBufferLength : DWORD -> Word32
-- ReturnedLength : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let cfgetplaceholderinfo =
  foreign "CfGetPlaceholderInfo"
    ((ptr void) @-> int32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* FileHandle : HANDLE -> (ptr void) *)
(* InfoClass : CF_PLACEHOLDER_INFO_CLASS -> int32_t *)
(* InfoBuffer : void* out -> (ptr void) *)
(* InfoBufferLength : DWORD -> uint32_t *)
(* ReturnedLength : 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 ("CfGetPlaceholderInfo" cf-get-placeholder-info :convention :stdcall) :int32
  (file-handle :pointer)   ; HANDLE
  (info-class :int32)   ; CF_PLACEHOLDER_INFO_CLASS
  (info-buffer :pointer)   ; void* out
  (info-buffer-length :uint32)   ; DWORD
  (returned-length :pointer))   ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CfGetPlaceholderInfo = Win32::API::More->new('cldapi',
    'int CfGetPlaceholderInfo(HANDLE FileHandle, int InfoClass, LPVOID InfoBuffer, DWORD InfoBufferLength, LPVOID ReturnedLength)');
# my $ret = $CfGetPlaceholderInfo->Call($FileHandle, $InfoClass, $InfoBuffer, $InfoBufferLength, $ReturnedLength);
# FileHandle : HANDLE -> HANDLE
# InfoClass : CF_PLACEHOLDER_INFO_CLASS -> int
# InfoBuffer : void* out -> LPVOID
# InfoBufferLength : DWORD -> DWORD
# ReturnedLength : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型