Win32 API 日本語リファレンス
ホームNetworkManagement.P2P › PeerDistClientFlushContent

PeerDistClientFlushContent

関数
クライアントキャッシュ内のコンテンツを破棄する。
DLLPeerDist.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

DWORD PeerDistClientFlushContent(
    INT_PTR hPeerDist,
    PEERDIST_CONTENT_TAG* pContentTag,
    HANDLE hCompletionPort,   // optional
    UINT_PTR ulCompletionKey,   // optional
    OVERLAPPED* lpOverlapped
);

パラメーター

名前方向説明
hPeerDistINT_PTRin対象のPeerDistセッションのハンドル。
pContentTagPEERDIST_CONTENT_TAG*inフラッシュ対象のコンテンツを識別するPEERDIST_CONTENT_TAG構造体へのポインタ。
hCompletionPortHANDLEinoptional非同期完了通知を受け取る完了ポートのハンドル。
ulCompletionKeyUINT_PTRinoptional完了パケットに関連付ける完了キー。
lpOverlappedOVERLAPPED*in非同期操作に使用するOVERLAPPED構造体へのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PeerDistClientFlushContent(
    INT_PTR hPeerDist,
    PEERDIST_CONTENT_TAG* pContentTag,
    HANDLE hCompletionPort,   // optional
    UINT_PTR ulCompletionKey,   // optional
    OVERLAPPED* lpOverlapped
);
[DllImport("PeerDist.dll", ExactSpelling = true)]
static extern uint PeerDistClientFlushContent(
    IntPtr hPeerDist,   // INT_PTR
    IntPtr pContentTag,   // PEERDIST_CONTENT_TAG*
    IntPtr hCompletionPort,   // HANDLE optional
    UIntPtr ulCompletionKey,   // UINT_PTR optional
    IntPtr lpOverlapped   // OVERLAPPED*
);
<DllImport("PeerDist.dll", ExactSpelling:=True)>
Public Shared Function PeerDistClientFlushContent(
    hPeerDist As IntPtr,   ' INT_PTR
    pContentTag As IntPtr,   ' PEERDIST_CONTENT_TAG*
    hCompletionPort As IntPtr,   ' HANDLE optional
    ulCompletionKey As UIntPtr,   ' UINT_PTR optional
    lpOverlapped As IntPtr   ' OVERLAPPED*
) As UInteger
End Function
' hPeerDist : INT_PTR
' pContentTag : PEERDIST_CONTENT_TAG*
' hCompletionPort : HANDLE optional
' ulCompletionKey : UINT_PTR optional
' lpOverlapped : OVERLAPPED*
Declare PtrSafe Function PeerDistClientFlushContent Lib "peerdist" ( _
    ByVal hPeerDist As LongPtr, _
    ByVal pContentTag As LongPtr, _
    ByVal hCompletionPort As LongPtr, _
    ByVal ulCompletionKey As LongPtr, _
    ByVal lpOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerDistClientFlushContent = ctypes.windll.peerdist.PeerDistClientFlushContent
PeerDistClientFlushContent.restype = wintypes.DWORD
PeerDistClientFlushContent.argtypes = [
    ctypes.c_ssize_t,  # hPeerDist : INT_PTR
    ctypes.c_void_p,  # pContentTag : PEERDIST_CONTENT_TAG*
    wintypes.HANDLE,  # hCompletionPort : HANDLE optional
    ctypes.c_size_t,  # ulCompletionKey : UINT_PTR optional
    ctypes.c_void_p,  # lpOverlapped : OVERLAPPED*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('PeerDist.dll')
PeerDistClientFlushContent = Fiddle::Function.new(
  lib['PeerDistClientFlushContent'],
  [
    Fiddle::TYPE_INTPTR_T,  # hPeerDist : INT_PTR
    Fiddle::TYPE_VOIDP,  # pContentTag : PEERDIST_CONTENT_TAG*
    Fiddle::TYPE_VOIDP,  # hCompletionPort : HANDLE optional
    Fiddle::TYPE_UINTPTR_T,  # ulCompletionKey : UINT_PTR optional
    Fiddle::TYPE_VOIDP,  # lpOverlapped : OVERLAPPED*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "peerdist")]
extern "system" {
    fn PeerDistClientFlushContent(
        hPeerDist: isize,  // INT_PTR
        pContentTag: *mut PEERDIST_CONTENT_TAG,  // PEERDIST_CONTENT_TAG*
        hCompletionPort: *mut core::ffi::c_void,  // HANDLE optional
        ulCompletionKey: usize,  // UINT_PTR optional
        lpOverlapped: *mut OVERLAPPED  // OVERLAPPED*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("PeerDist.dll")]
public static extern uint PeerDistClientFlushContent(IntPtr hPeerDist, IntPtr pContentTag, IntPtr hCompletionPort, UIntPtr ulCompletionKey, IntPtr lpOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PeerDist_PeerDistClientFlushContent' -Namespace Win32 -PassThru
# $api::PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
#uselib "PeerDist.dll"
#func global PeerDistClientFlushContent "PeerDistClientFlushContent" sptr, sptr, sptr, sptr, sptr
; PeerDistClientFlushContent hPeerDist, varptr(pContentTag), hCompletionPort, ulCompletionKey, varptr(lpOverlapped)   ; 戻り値は stat
; hPeerDist : INT_PTR -> "sptr"
; pContentTag : PEERDIST_CONTENT_TAG* -> "sptr"
; hCompletionPort : HANDLE optional -> "sptr"
; ulCompletionKey : UINT_PTR optional -> "sptr"
; lpOverlapped : OVERLAPPED* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "PeerDist.dll"
#cfunc global PeerDistClientFlushContent "PeerDistClientFlushContent" sptr, var, sptr, sptr, var
; res = PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
; hPeerDist : INT_PTR -> "sptr"
; pContentTag : PEERDIST_CONTENT_TAG* -> "var"
; hCompletionPort : HANDLE optional -> "sptr"
; ulCompletionKey : UINT_PTR optional -> "sptr"
; lpOverlapped : OVERLAPPED* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD PeerDistClientFlushContent(INT_PTR hPeerDist, PEERDIST_CONTENT_TAG* pContentTag, HANDLE hCompletionPort, UINT_PTR ulCompletionKey, OVERLAPPED* lpOverlapped)
#uselib "PeerDist.dll"
#cfunc global PeerDistClientFlushContent "PeerDistClientFlushContent" intptr, var, intptr, intptr, var
; res = PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
; hPeerDist : INT_PTR -> "intptr"
; pContentTag : PEERDIST_CONTENT_TAG* -> "var"
; hCompletionPort : HANDLE optional -> "intptr"
; ulCompletionKey : UINT_PTR optional -> "intptr"
; lpOverlapped : OVERLAPPED* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	peerdist = windows.NewLazySystemDLL("PeerDist.dll")
	procPeerDistClientFlushContent = peerdist.NewProc("PeerDistClientFlushContent")
)

// hPeerDist (INT_PTR), pContentTag (PEERDIST_CONTENT_TAG*), hCompletionPort (HANDLE optional), ulCompletionKey (UINT_PTR optional), lpOverlapped (OVERLAPPED*)
r1, _, err := procPeerDistClientFlushContent.Call(
	uintptr(hPeerDist),
	uintptr(pContentTag),
	uintptr(hCompletionPort),
	uintptr(ulCompletionKey),
	uintptr(lpOverlapped),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PeerDistClientFlushContent(
  hPeerDist: NativeInt;   // INT_PTR
  pContentTag: Pointer;   // PEERDIST_CONTENT_TAG*
  hCompletionPort: THandle;   // HANDLE optional
  ulCompletionKey: NativeUInt;   // UINT_PTR optional
  lpOverlapped: Pointer   // OVERLAPPED*
): DWORD; stdcall;
  external 'PeerDist.dll' name 'PeerDistClientFlushContent';
result := DllCall("PeerDist\PeerDistClientFlushContent"
    , "Ptr", hPeerDist   ; INT_PTR
    , "Ptr", pContentTag   ; PEERDIST_CONTENT_TAG*
    , "Ptr", hCompletionPort   ; HANDLE optional
    , "UPtr", ulCompletionKey   ; UINT_PTR optional
    , "Ptr", lpOverlapped   ; OVERLAPPED*
    , "UInt")   ; return: DWORD
●PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped) = DLL("PeerDist.dll", "dword PeerDistClientFlushContent(int, void*, void*, int, void*)")
# 呼び出し: PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
# hPeerDist : INT_PTR -> "int"
# pContentTag : PEERDIST_CONTENT_TAG* -> "void*"
# hCompletionPort : HANDLE optional -> "void*"
# ulCompletionKey : UINT_PTR optional -> "int"
# lpOverlapped : OVERLAPPED* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "peerdist" fn PeerDistClientFlushContent(
    hPeerDist: isize, // INT_PTR
    pContentTag: [*c]PEERDIST_CONTENT_TAG, // PEERDIST_CONTENT_TAG*
    hCompletionPort: ?*anyopaque, // HANDLE optional
    ulCompletionKey: usize, // UINT_PTR optional
    lpOverlapped: [*c]OVERLAPPED // OVERLAPPED*
) callconv(std.os.windows.WINAPI) u32;
proc PeerDistClientFlushContent(
    hPeerDist: int,  # INT_PTR
    pContentTag: ptr PEERDIST_CONTENT_TAG,  # PEERDIST_CONTENT_TAG*
    hCompletionPort: pointer,  # HANDLE optional
    ulCompletionKey: uint,  # UINT_PTR optional
    lpOverlapped: ptr OVERLAPPED  # OVERLAPPED*
): uint32 {.importc: "PeerDistClientFlushContent", stdcall, dynlib: "PeerDist.dll".}
pragma(lib, "peerdist");
extern(Windows)
uint PeerDistClientFlushContent(
    ptrdiff_t hPeerDist,   // INT_PTR
    PEERDIST_CONTENT_TAG* pContentTag,   // PEERDIST_CONTENT_TAG*
    void* hCompletionPort,   // HANDLE optional
    size_t ulCompletionKey,   // UINT_PTR optional
    OVERLAPPED* lpOverlapped   // OVERLAPPED*
);
ccall((:PeerDistClientFlushContent, "PeerDist.dll"), stdcall, UInt32,
      (Int, Ptr{PEERDIST_CONTENT_TAG}, Ptr{Cvoid}, Csize_t, Ptr{OVERLAPPED}),
      hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
# hPeerDist : INT_PTR -> Int
# pContentTag : PEERDIST_CONTENT_TAG* -> Ptr{PEERDIST_CONTENT_TAG}
# hCompletionPort : HANDLE optional -> Ptr{Cvoid}
# ulCompletionKey : UINT_PTR optional -> Csize_t
# lpOverlapped : OVERLAPPED* -> Ptr{OVERLAPPED}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t PeerDistClientFlushContent(
    intptr_t hPeerDist,
    void* pContentTag,
    void* hCompletionPort,
    uintptr_t ulCompletionKey,
    void* lpOverlapped);
]]
local peerdist = ffi.load("peerdist")
-- peerdist.PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
-- hPeerDist : INT_PTR
-- pContentTag : PEERDIST_CONTENT_TAG*
-- hCompletionPort : HANDLE optional
-- ulCompletionKey : UINT_PTR optional
-- lpOverlapped : OVERLAPPED*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('PeerDist.dll');
const PeerDistClientFlushContent = lib.func('__stdcall', 'PeerDistClientFlushContent', 'uint32_t', ['intptr_t', 'void *', 'void *', 'uintptr_t', 'void *']);
// PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
// hPeerDist : INT_PTR -> 'intptr_t'
// pContentTag : PEERDIST_CONTENT_TAG* -> 'void *'
// hCompletionPort : HANDLE optional -> 'void *'
// ulCompletionKey : UINT_PTR optional -> 'uintptr_t'
// lpOverlapped : OVERLAPPED* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("PeerDist.dll", {
  PeerDistClientFlushContent: { parameters: ["isize", "pointer", "pointer", "usize", "pointer"], result: "u32" },
});
// lib.symbols.PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped)
// hPeerDist : INT_PTR -> "isize"
// pContentTag : PEERDIST_CONTENT_TAG* -> "pointer"
// hCompletionPort : HANDLE optional -> "pointer"
// ulCompletionKey : UINT_PTR optional -> "usize"
// lpOverlapped : OVERLAPPED* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t PeerDistClientFlushContent(
    intptr_t hPeerDist,
    void* pContentTag,
    void* hCompletionPort,
    size_t ulCompletionKey,
    void* lpOverlapped);
C, "PeerDist.dll");
// $ffi->PeerDistClientFlushContent(hPeerDist, pContentTag, hCompletionPort, ulCompletionKey, lpOverlapped);
// hPeerDist : INT_PTR
// pContentTag : PEERDIST_CONTENT_TAG*
// hCompletionPort : HANDLE optional
// ulCompletionKey : UINT_PTR optional
// lpOverlapped : OVERLAPPED*
// 構造体/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 Peerdist extends StdCallLibrary {
    Peerdist INSTANCE = Native.load("peerdist", Peerdist.class);
    int PeerDistClientFlushContent(
        long hPeerDist,   // INT_PTR
        Pointer pContentTag,   // PEERDIST_CONTENT_TAG*
        Pointer hCompletionPort,   // HANDLE optional
        long ulCompletionKey,   // UINT_PTR optional
        Pointer lpOverlapped   // OVERLAPPED*
    );
}
@[Link("peerdist")]
lib LibPeerDist
  fun PeerDistClientFlushContent = PeerDistClientFlushContent(
    hPeerDist : LibC::SSizeT,   # INT_PTR
    pContentTag : PEERDIST_CONTENT_TAG*,   # PEERDIST_CONTENT_TAG*
    hCompletionPort : Void*,   # HANDLE optional
    ulCompletionKey : LibC::SizeT,   # UINT_PTR optional
    lpOverlapped : OVERLAPPED*   # OVERLAPPED*
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PeerDistClientFlushContentNative = Uint32 Function(IntPtr, Pointer<Void>, Pointer<Void>, UintPtr, Pointer<Void>);
typedef PeerDistClientFlushContentDart = int Function(int, Pointer<Void>, Pointer<Void>, int, Pointer<Void>);
final PeerDistClientFlushContent = DynamicLibrary.open('PeerDist.dll')
    .lookupFunction<PeerDistClientFlushContentNative, PeerDistClientFlushContentDart>('PeerDistClientFlushContent');
// hPeerDist : INT_PTR -> IntPtr
// pContentTag : PEERDIST_CONTENT_TAG* -> Pointer<Void>
// hCompletionPort : HANDLE optional -> Pointer<Void>
// ulCompletionKey : UINT_PTR optional -> UintPtr
// lpOverlapped : OVERLAPPED* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PeerDistClientFlushContent(
  hPeerDist: NativeInt;   // INT_PTR
  pContentTag: Pointer;   // PEERDIST_CONTENT_TAG*
  hCompletionPort: THandle;   // HANDLE optional
  ulCompletionKey: NativeUInt;   // UINT_PTR optional
  lpOverlapped: Pointer   // OVERLAPPED*
): DWORD; stdcall;
  external 'PeerDist.dll' name 'PeerDistClientFlushContent';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PeerDistClientFlushContent"
  c_PeerDistClientFlushContent :: CIntPtr -> Ptr () -> Ptr () -> CUIntPtr -> Ptr () -> IO Word32
-- hPeerDist : INT_PTR -> CIntPtr
-- pContentTag : PEERDIST_CONTENT_TAG* -> Ptr ()
-- hCompletionPort : HANDLE optional -> Ptr ()
-- ulCompletionKey : UINT_PTR optional -> CUIntPtr
-- lpOverlapped : OVERLAPPED* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let peerdistclientflushcontent =
  foreign "PeerDistClientFlushContent"
    (intptr_t @-> (ptr void) @-> (ptr void) @-> size_t @-> (ptr void) @-> returning uint32_t)
(* hPeerDist : INT_PTR -> intptr_t *)
(* pContentTag : PEERDIST_CONTENT_TAG* -> (ptr void) *)
(* hCompletionPort : HANDLE optional -> (ptr void) *)
(* ulCompletionKey : UINT_PTR optional -> size_t *)
(* lpOverlapped : OVERLAPPED* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library peerdist (t "PeerDist.dll"))
(cffi:use-foreign-library peerdist)

(cffi:defcfun ("PeerDistClientFlushContent" peer-dist-client-flush-content :convention :stdcall) :uint32
  (h-peer-dist :int64)   ; INT_PTR
  (p-content-tag :pointer)   ; PEERDIST_CONTENT_TAG*
  (h-completion-port :pointer)   ; HANDLE optional
  (ul-completion-key :uint64)   ; UINT_PTR optional
  (lp-overlapped :pointer))   ; OVERLAPPED*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PeerDistClientFlushContent = Win32::API::More->new('PeerDist',
    'DWORD PeerDistClientFlushContent(LPARAM hPeerDist, LPVOID pContentTag, HANDLE hCompletionPort, WPARAM ulCompletionKey, LPVOID lpOverlapped)');
# my $ret = $PeerDistClientFlushContent->Call($hPeerDist, $pContentTag, $hCompletionPort, $ulCompletionKey, $lpOverlapped);
# hPeerDist : INT_PTR -> LPARAM
# pContentTag : PEERDIST_CONTENT_TAG* -> LPVOID
# hCompletionPort : HANDLE optional -> HANDLE
# ulCompletionKey : UINT_PTR optional -> WPARAM
# lpOverlapped : OVERLAPPED* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型