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

CfCreatePlaceholders

関数
指定ディレクトリにプレースホルダーファイルを作成する。
DLLcldapi.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT CfCreatePlaceholders(
    LPCWSTR BaseDirectoryPath,
    CF_PLACEHOLDER_CREATE_INFO* PlaceholderArray,
    DWORD PlaceholderCount,
    CF_CREATE_FLAGS CreateFlags,
    DWORD* EntriesProcessed   // optional
);

パラメーター

名前方向
BaseDirectoryPathLPCWSTRin
PlaceholderArrayCF_PLACEHOLDER_CREATE_INFO*inout
PlaceholderCountDWORDin
CreateFlagsCF_CREATE_FLAGSin
EntriesProcessedDWORD*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CfCreatePlaceholders(
    LPCWSTR BaseDirectoryPath,
    CF_PLACEHOLDER_CREATE_INFO* PlaceholderArray,
    DWORD PlaceholderCount,
    CF_CREATE_FLAGS CreateFlags,
    DWORD* EntriesProcessed   // optional
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfCreatePlaceholders(
    [MarshalAs(UnmanagedType.LPWStr)] string BaseDirectoryPath,   // LPCWSTR
    IntPtr PlaceholderArray,   // CF_PLACEHOLDER_CREATE_INFO* in/out
    uint PlaceholderCount,   // DWORD
    int CreateFlags,   // CF_CREATE_FLAGS
    IntPtr EntriesProcessed   // DWORD* optional, out
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfCreatePlaceholders(
    <MarshalAs(UnmanagedType.LPWStr)> BaseDirectoryPath As String,   ' LPCWSTR
    PlaceholderArray As IntPtr,   ' CF_PLACEHOLDER_CREATE_INFO* in/out
    PlaceholderCount As UInteger,   ' DWORD
    CreateFlags As Integer,   ' CF_CREATE_FLAGS
    EntriesProcessed As IntPtr   ' DWORD* optional, out
) As Integer
End Function
' BaseDirectoryPath : LPCWSTR
' PlaceholderArray : CF_PLACEHOLDER_CREATE_INFO* in/out
' PlaceholderCount : DWORD
' CreateFlags : CF_CREATE_FLAGS
' EntriesProcessed : DWORD* optional, out
Declare PtrSafe Function CfCreatePlaceholders Lib "cldapi" ( _
    ByVal BaseDirectoryPath As LongPtr, _
    ByVal PlaceholderArray As LongPtr, _
    ByVal PlaceholderCount As Long, _
    ByVal CreateFlags As Long, _
    ByVal EntriesProcessed As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfCreatePlaceholders = ctypes.windll.cldapi.CfCreatePlaceholders
CfCreatePlaceholders.restype = ctypes.c_int
CfCreatePlaceholders.argtypes = [
    wintypes.LPCWSTR,  # BaseDirectoryPath : LPCWSTR
    ctypes.c_void_p,  # PlaceholderArray : CF_PLACEHOLDER_CREATE_INFO* in/out
    wintypes.DWORD,  # PlaceholderCount : DWORD
    ctypes.c_int,  # CreateFlags : CF_CREATE_FLAGS
    ctypes.POINTER(wintypes.DWORD),  # EntriesProcessed : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfCreatePlaceholders = cldapi.NewProc("CfCreatePlaceholders")
)

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