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

CfExecute

関数
クラウドファイル操作を同期プロバイダーから実行する。
DLLcldapi.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT CfExecute(
    const CF_OPERATION_INFO* OpInfo,
    CF_OPERATION_PARAMETERS* OpParams
);

パラメーター

名前方向
OpInfoCF_OPERATION_INFO*in
OpParamsCF_OPERATION_PARAMETERS*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CfExecute(
    const CF_OPERATION_INFO* OpInfo,
    CF_OPERATION_PARAMETERS* OpParams
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfExecute(
    IntPtr OpInfo,   // CF_OPERATION_INFO*
    IntPtr OpParams   // CF_OPERATION_PARAMETERS* in/out
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfExecute(
    OpInfo As IntPtr,   ' CF_OPERATION_INFO*
    OpParams As IntPtr   ' CF_OPERATION_PARAMETERS* in/out
) As Integer
End Function
' OpInfo : CF_OPERATION_INFO*
' OpParams : CF_OPERATION_PARAMETERS* in/out
Declare PtrSafe Function CfExecute Lib "cldapi" ( _
    ByVal OpInfo As LongPtr, _
    ByVal OpParams As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfExecute = ctypes.windll.cldapi.CfExecute
CfExecute.restype = ctypes.c_int
CfExecute.argtypes = [
    ctypes.c_void_p,  # OpInfo : CF_OPERATION_INFO*
    ctypes.c_void_p,  # OpParams : CF_OPERATION_PARAMETERS* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfExecute = cldapi.NewProc("CfExecute")
)

// OpInfo (CF_OPERATION_INFO*), OpParams (CF_OPERATION_PARAMETERS* in/out)
r1, _, err := procCfExecute.Call(
	uintptr(OpInfo),
	uintptr(OpParams),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CfExecute(
  OpInfo: Pointer;   // CF_OPERATION_INFO*
  OpParams: Pointer   // CF_OPERATION_PARAMETERS* in/out
): Integer; stdcall;
  external 'cldapi.dll' name 'CfExecute';
result := DllCall("cldapi\CfExecute"
    , "Ptr", OpInfo   ; CF_OPERATION_INFO*
    , "Ptr", OpParams   ; CF_OPERATION_PARAMETERS* in/out
    , "Int")   ; return: HRESULT
●CfExecute(OpInfo, OpParams) = DLL("cldapi.dll", "int CfExecute(void*, void*)")
# 呼び出し: CfExecute(OpInfo, OpParams)
# OpInfo : CF_OPERATION_INFO* -> "void*"
# OpParams : CF_OPERATION_PARAMETERS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。