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

CfReportProviderProgress2

関数
要求キー付きでプロバイダーの転送進捗を報告する。
DLLcldapi.dll呼出規約winapi

シグネチャ

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

HRESULT CfReportProviderProgress2(
    CF_CONNECTION_KEY ConnectionKey,
    LONGLONG TransferKey,
    LONGLONG RequestKey,
    LONGLONG ProviderProgressTotal,
    LONGLONG ProviderProgressCompleted,
    DWORD TargetSessionId
);

パラメーター

名前方向説明
ConnectionKeyCF_CONNECTION_KEYin進捗を報告する接続を識別するCF_CONNECTION_KEY。
TransferKeyLONGLONGin対象転送を識別する転送キー。
RequestKeyLONGLONGin個別の要求を識別する要求キー。複数要求を区別する。
ProviderProgressTotalLONGLONGin処理予定の総量を示す値。進捗率算出の分母となる。
ProviderProgressCompletedLONGLONGin現時点で完了した量を示す値。
TargetSessionIdDWORDin進捗通知の対象とするユーザーセッションのID。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CfReportProviderProgress2(
    CF_CONNECTION_KEY ConnectionKey,
    LONGLONG TransferKey,
    LONGLONG RequestKey,
    LONGLONG ProviderProgressTotal,
    LONGLONG ProviderProgressCompleted,
    DWORD TargetSessionId
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfReportProviderProgress2(
    long ConnectionKey,   // CF_CONNECTION_KEY
    long TransferKey,   // LONGLONG
    long RequestKey,   // LONGLONG
    long ProviderProgressTotal,   // LONGLONG
    long ProviderProgressCompleted,   // LONGLONG
    uint TargetSessionId   // DWORD
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfReportProviderProgress2(
    ConnectionKey As Long,   ' CF_CONNECTION_KEY
    TransferKey As Long,   ' LONGLONG
    RequestKey As Long,   ' LONGLONG
    ProviderProgressTotal As Long,   ' LONGLONG
    ProviderProgressCompleted As Long,   ' LONGLONG
    TargetSessionId As UInteger   ' DWORD
) As Integer
End Function
' ConnectionKey : CF_CONNECTION_KEY
' TransferKey : LONGLONG
' RequestKey : LONGLONG
' ProviderProgressTotal : LONGLONG
' ProviderProgressCompleted : LONGLONG
' TargetSessionId : DWORD
Declare PtrSafe Function CfReportProviderProgress2 Lib "cldapi" ( _
    ByVal ConnectionKey As LongLong, _
    ByVal TransferKey As LongLong, _
    ByVal RequestKey As LongLong, _
    ByVal ProviderProgressTotal As LongLong, _
    ByVal ProviderProgressCompleted As LongLong, _
    ByVal TargetSessionId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfReportProviderProgress2 = ctypes.windll.cldapi.CfReportProviderProgress2
CfReportProviderProgress2.restype = ctypes.c_int
CfReportProviderProgress2.argtypes = [
    ctypes.c_longlong,  # ConnectionKey : CF_CONNECTION_KEY
    ctypes.c_longlong,  # TransferKey : LONGLONG
    ctypes.c_longlong,  # RequestKey : LONGLONG
    ctypes.c_longlong,  # ProviderProgressTotal : LONGLONG
    ctypes.c_longlong,  # ProviderProgressCompleted : LONGLONG
    wintypes.DWORD,  # TargetSessionId : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('cldapi.dll')
CfReportProviderProgress2 = Fiddle::Function.new(
  lib['CfReportProviderProgress2'],
  [
    Fiddle::TYPE_LONG_LONG,  # ConnectionKey : CF_CONNECTION_KEY
    Fiddle::TYPE_LONG_LONG,  # TransferKey : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # RequestKey : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # ProviderProgressTotal : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # ProviderProgressCompleted : LONGLONG
    -Fiddle::TYPE_INT,  # TargetSessionId : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "cldapi")]
extern "system" {
    fn CfReportProviderProgress2(
        ConnectionKey: i64,  // CF_CONNECTION_KEY
        TransferKey: i64,  // LONGLONG
        RequestKey: i64,  // LONGLONG
        ProviderProgressTotal: i64,  // LONGLONG
        ProviderProgressCompleted: i64,  // LONGLONG
        TargetSessionId: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfReportProviderProgress2(long ConnectionKey, long TransferKey, long RequestKey, long ProviderProgressTotal, long ProviderProgressCompleted, uint TargetSessionId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfReportProviderProgress2' -Namespace Win32 -PassThru
# $api::CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
#uselib "cldapi.dll"
#func global CfReportProviderProgress2 "CfReportProviderProgress2" sptr, sptr, sptr, sptr, sptr, sptr
; CfReportProviderProgress2 ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId   ; 戻り値は stat
; ConnectionKey : CF_CONNECTION_KEY -> "sptr"
; TransferKey : LONGLONG -> "sptr"
; RequestKey : LONGLONG -> "sptr"
; ProviderProgressTotal : LONGLONG -> "sptr"
; ProviderProgressCompleted : LONGLONG -> "sptr"
; TargetSessionId : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "cldapi.dll"
#cfunc global CfReportProviderProgress2 "CfReportProviderProgress2" int64, int64, int64, int64, int64, int
; res = CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
; ConnectionKey : CF_CONNECTION_KEY -> "int64"
; TransferKey : LONGLONG -> "int64"
; RequestKey : LONGLONG -> "int64"
; ProviderProgressTotal : LONGLONG -> "int64"
; ProviderProgressCompleted : LONGLONG -> "int64"
; TargetSessionId : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT CfReportProviderProgress2(CF_CONNECTION_KEY ConnectionKey, LONGLONG TransferKey, LONGLONG RequestKey, LONGLONG ProviderProgressTotal, LONGLONG ProviderProgressCompleted, DWORD TargetSessionId)
#uselib "cldapi.dll"
#cfunc global CfReportProviderProgress2 "CfReportProviderProgress2" int64, int64, int64, int64, int64, int
; res = CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
; ConnectionKey : CF_CONNECTION_KEY -> "int64"
; TransferKey : LONGLONG -> "int64"
; RequestKey : LONGLONG -> "int64"
; ProviderProgressTotal : LONGLONG -> "int64"
; ProviderProgressCompleted : LONGLONG -> "int64"
; TargetSessionId : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfReportProviderProgress2 = cldapi.NewProc("CfReportProviderProgress2")
)

// ConnectionKey (CF_CONNECTION_KEY), TransferKey (LONGLONG), RequestKey (LONGLONG), ProviderProgressTotal (LONGLONG), ProviderProgressCompleted (LONGLONG), TargetSessionId (DWORD)
r1, _, err := procCfReportProviderProgress2.Call(
	uintptr(ConnectionKey),
	uintptr(TransferKey),
	uintptr(RequestKey),
	uintptr(ProviderProgressTotal),
	uintptr(ProviderProgressCompleted),
	uintptr(TargetSessionId),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CfReportProviderProgress2(
  ConnectionKey: Int64;   // CF_CONNECTION_KEY
  TransferKey: Int64;   // LONGLONG
  RequestKey: Int64;   // LONGLONG
  ProviderProgressTotal: Int64;   // LONGLONG
  ProviderProgressCompleted: Int64;   // LONGLONG
  TargetSessionId: DWORD   // DWORD
): Integer; stdcall;
  external 'cldapi.dll' name 'CfReportProviderProgress2';
result := DllCall("cldapi\CfReportProviderProgress2"
    , "Int64", ConnectionKey   ; CF_CONNECTION_KEY
    , "Int64", TransferKey   ; LONGLONG
    , "Int64", RequestKey   ; LONGLONG
    , "Int64", ProviderProgressTotal   ; LONGLONG
    , "Int64", ProviderProgressCompleted   ; LONGLONG
    , "UInt", TargetSessionId   ; DWORD
    , "Int")   ; return: HRESULT
●CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId) = DLL("cldapi.dll", "int CfReportProviderProgress2(int64, int64, int64, int64, int64, dword)")
# 呼び出し: CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
# ConnectionKey : CF_CONNECTION_KEY -> "int64"
# TransferKey : LONGLONG -> "int64"
# RequestKey : LONGLONG -> "int64"
# ProviderProgressTotal : LONGLONG -> "int64"
# ProviderProgressCompleted : LONGLONG -> "int64"
# TargetSessionId : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "cldapi" fn CfReportProviderProgress2(
    ConnectionKey: i64, // CF_CONNECTION_KEY
    TransferKey: i64, // LONGLONG
    RequestKey: i64, // LONGLONG
    ProviderProgressTotal: i64, // LONGLONG
    ProviderProgressCompleted: i64, // LONGLONG
    TargetSessionId: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc CfReportProviderProgress2(
    ConnectionKey: int64,  # CF_CONNECTION_KEY
    TransferKey: int64,  # LONGLONG
    RequestKey: int64,  # LONGLONG
    ProviderProgressTotal: int64,  # LONGLONG
    ProviderProgressCompleted: int64,  # LONGLONG
    TargetSessionId: uint32  # DWORD
): int32 {.importc: "CfReportProviderProgress2", stdcall, dynlib: "cldapi.dll".}
pragma(lib, "cldapi");
extern(Windows)
int CfReportProviderProgress2(
    long ConnectionKey,   // CF_CONNECTION_KEY
    long TransferKey,   // LONGLONG
    long RequestKey,   // LONGLONG
    long ProviderProgressTotal,   // LONGLONG
    long ProviderProgressCompleted,   // LONGLONG
    uint TargetSessionId   // DWORD
);
ccall((:CfReportProviderProgress2, "cldapi.dll"), stdcall, Int32,
      (Int64, Int64, Int64, Int64, Int64, UInt32),
      ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
# ConnectionKey : CF_CONNECTION_KEY -> Int64
# TransferKey : LONGLONG -> Int64
# RequestKey : LONGLONG -> Int64
# ProviderProgressTotal : LONGLONG -> Int64
# ProviderProgressCompleted : LONGLONG -> Int64
# TargetSessionId : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t CfReportProviderProgress2(
    int64_t ConnectionKey,
    int64_t TransferKey,
    int64_t RequestKey,
    int64_t ProviderProgressTotal,
    int64_t ProviderProgressCompleted,
    uint32_t TargetSessionId);
]]
local cldapi = ffi.load("cldapi")
-- cldapi.CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
-- ConnectionKey : CF_CONNECTION_KEY
-- TransferKey : LONGLONG
-- RequestKey : LONGLONG
-- ProviderProgressTotal : LONGLONG
-- ProviderProgressCompleted : LONGLONG
-- TargetSessionId : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('cldapi.dll');
const CfReportProviderProgress2 = lib.func('__stdcall', 'CfReportProviderProgress2', 'int32_t', ['int64_t', 'int64_t', 'int64_t', 'int64_t', 'int64_t', 'uint32_t']);
// CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
// ConnectionKey : CF_CONNECTION_KEY -> 'int64_t'
// TransferKey : LONGLONG -> 'int64_t'
// RequestKey : LONGLONG -> 'int64_t'
// ProviderProgressTotal : LONGLONG -> 'int64_t'
// ProviderProgressCompleted : LONGLONG -> 'int64_t'
// TargetSessionId : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("cldapi.dll", {
  CfReportProviderProgress2: { parameters: ["i64", "i64", "i64", "i64", "i64", "u32"], result: "i32" },
});
// lib.symbols.CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId)
// ConnectionKey : CF_CONNECTION_KEY -> "i64"
// TransferKey : LONGLONG -> "i64"
// RequestKey : LONGLONG -> "i64"
// ProviderProgressTotal : LONGLONG -> "i64"
// ProviderProgressCompleted : LONGLONG -> "i64"
// TargetSessionId : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t CfReportProviderProgress2(
    int64_t ConnectionKey,
    int64_t TransferKey,
    int64_t RequestKey,
    int64_t ProviderProgressTotal,
    int64_t ProviderProgressCompleted,
    uint32_t TargetSessionId);
C, "cldapi.dll");
// $ffi->CfReportProviderProgress2(ConnectionKey, TransferKey, RequestKey, ProviderProgressTotal, ProviderProgressCompleted, TargetSessionId);
// ConnectionKey : CF_CONNECTION_KEY
// TransferKey : LONGLONG
// RequestKey : LONGLONG
// ProviderProgressTotal : LONGLONG
// ProviderProgressCompleted : LONGLONG
// TargetSessionId : DWORD
// 構造体/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 CfReportProviderProgress2(
        long ConnectionKey,   // CF_CONNECTION_KEY
        long TransferKey,   // LONGLONG
        long RequestKey,   // LONGLONG
        long ProviderProgressTotal,   // LONGLONG
        long ProviderProgressCompleted,   // LONGLONG
        int TargetSessionId   // DWORD
    );
}
@[Link("cldapi")]
lib Libcldapi
  fun CfReportProviderProgress2 = CfReportProviderProgress2(
    ConnectionKey : Int64,   # CF_CONNECTION_KEY
    TransferKey : Int64,   # LONGLONG
    RequestKey : Int64,   # LONGLONG
    ProviderProgressTotal : Int64,   # LONGLONG
    ProviderProgressCompleted : Int64,   # LONGLONG
    TargetSessionId : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CfReportProviderProgress2Native = Int32 Function(Int64, Int64, Int64, Int64, Int64, Uint32);
typedef CfReportProviderProgress2Dart = int Function(int, int, int, int, int, int);
final CfReportProviderProgress2 = DynamicLibrary.open('cldapi.dll')
    .lookupFunction<CfReportProviderProgress2Native, CfReportProviderProgress2Dart>('CfReportProviderProgress2');
// ConnectionKey : CF_CONNECTION_KEY -> Int64
// TransferKey : LONGLONG -> Int64
// RequestKey : LONGLONG -> Int64
// ProviderProgressTotal : LONGLONG -> Int64
// ProviderProgressCompleted : LONGLONG -> Int64
// TargetSessionId : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CfReportProviderProgress2(
  ConnectionKey: Int64;   // CF_CONNECTION_KEY
  TransferKey: Int64;   // LONGLONG
  RequestKey: Int64;   // LONGLONG
  ProviderProgressTotal: Int64;   // LONGLONG
  ProviderProgressCompleted: Int64;   // LONGLONG
  TargetSessionId: DWORD   // DWORD
): Integer; stdcall;
  external 'cldapi.dll' name 'CfReportProviderProgress2';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CfReportProviderProgress2"
  c_CfReportProviderProgress2 :: Int64 -> Int64 -> Int64 -> Int64 -> Int64 -> Word32 -> IO Int32
-- ConnectionKey : CF_CONNECTION_KEY -> Int64
-- TransferKey : LONGLONG -> Int64
-- RequestKey : LONGLONG -> Int64
-- ProviderProgressTotal : LONGLONG -> Int64
-- ProviderProgressCompleted : LONGLONG -> Int64
-- TargetSessionId : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let cfreportproviderprogress2 =
  foreign "CfReportProviderProgress2"
    (int64_t @-> int64_t @-> int64_t @-> int64_t @-> int64_t @-> uint32_t @-> returning int32_t)
(* ConnectionKey : CF_CONNECTION_KEY -> int64_t *)
(* TransferKey : LONGLONG -> int64_t *)
(* RequestKey : LONGLONG -> int64_t *)
(* ProviderProgressTotal : LONGLONG -> int64_t *)
(* ProviderProgressCompleted : LONGLONG -> int64_t *)
(* TargetSessionId : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library cldapi (t "cldapi.dll"))
(cffi:use-foreign-library cldapi)

(cffi:defcfun ("CfReportProviderProgress2" cf-report-provider-progress2 :convention :stdcall) :int32
  (connection-key :int64)   ; CF_CONNECTION_KEY
  (transfer-key :int64)   ; LONGLONG
  (request-key :int64)   ; LONGLONG
  (provider-progress-total :int64)   ; LONGLONG
  (provider-progress-completed :int64)   ; LONGLONG
  (target-session-id :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CfReportProviderProgress2 = Win32::API::More->new('cldapi',
    'int CfReportProviderProgress2(INT64 ConnectionKey, INT64 TransferKey, INT64 RequestKey, INT64 ProviderProgressTotal, INT64 ProviderProgressCompleted, DWORD TargetSessionId)');
# my $ret = $CfReportProviderProgress2->Call($ConnectionKey, $TransferKey, $RequestKey, $ProviderProgressTotal, $ProviderProgressCompleted, $TargetSessionId);
# ConnectionKey : CF_CONNECTION_KEY -> INT64
# TransferKey : LONGLONG -> INT64
# RequestKey : LONGLONG -> INT64
# ProviderProgressTotal : LONGLONG -> INT64
# ProviderProgressCompleted : LONGLONG -> INT64
# TargetSessionId : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API