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

PeerDistClientAddContentInformation

関数
クライアントにコンテンツ情報を追加する。
DLLPeerDist.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

DWORD PeerDistClientAddContentInformation(
    INT_PTR hPeerDist,
    INT_PTR hContentHandle,
    DWORD cbNumberOfBytes,
    BYTE* pBuffer,
    OVERLAPPED* lpOverlapped
);

パラメーター

名前方向
hPeerDistINT_PTRin
hContentHandleINT_PTRin
cbNumberOfBytesDWORDin
pBufferBYTE*in
lpOverlappedOVERLAPPED*in

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PeerDistClientAddContentInformation(
    INT_PTR hPeerDist,
    INT_PTR hContentHandle,
    DWORD cbNumberOfBytes,
    BYTE* pBuffer,
    OVERLAPPED* lpOverlapped
);
[DllImport("PeerDist.dll", ExactSpelling = true)]
static extern uint PeerDistClientAddContentInformation(
    IntPtr hPeerDist,   // INT_PTR
    IntPtr hContentHandle,   // INT_PTR
    uint cbNumberOfBytes,   // DWORD
    IntPtr pBuffer,   // BYTE*
    IntPtr lpOverlapped   // OVERLAPPED*
);
<DllImport("PeerDist.dll", ExactSpelling:=True)>
Public Shared Function PeerDistClientAddContentInformation(
    hPeerDist As IntPtr,   ' INT_PTR
    hContentHandle As IntPtr,   ' INT_PTR
    cbNumberOfBytes As UInteger,   ' DWORD
    pBuffer As IntPtr,   ' BYTE*
    lpOverlapped As IntPtr   ' OVERLAPPED*
) As UInteger
End Function
' hPeerDist : INT_PTR
' hContentHandle : INT_PTR
' cbNumberOfBytes : DWORD
' pBuffer : BYTE*
' lpOverlapped : OVERLAPPED*
Declare PtrSafe Function PeerDistClientAddContentInformation Lib "peerdist" ( _
    ByVal hPeerDist As LongPtr, _
    ByVal hContentHandle As LongPtr, _
    ByVal cbNumberOfBytes As Long, _
    ByVal pBuffer 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

PeerDistClientAddContentInformation = ctypes.windll.peerdist.PeerDistClientAddContentInformation
PeerDistClientAddContentInformation.restype = wintypes.DWORD
PeerDistClientAddContentInformation.argtypes = [
    ctypes.c_ssize_t,  # hPeerDist : INT_PTR
    ctypes.c_ssize_t,  # hContentHandle : INT_PTR
    wintypes.DWORD,  # cbNumberOfBytes : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pBuffer : BYTE*
    ctypes.c_void_p,  # lpOverlapped : OVERLAPPED*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	peerdist = windows.NewLazySystemDLL("PeerDist.dll")
	procPeerDistClientAddContentInformation = peerdist.NewProc("PeerDistClientAddContentInformation")
)

// hPeerDist (INT_PTR), hContentHandle (INT_PTR), cbNumberOfBytes (DWORD), pBuffer (BYTE*), lpOverlapped (OVERLAPPED*)
r1, _, err := procPeerDistClientAddContentInformation.Call(
	uintptr(hPeerDist),
	uintptr(hContentHandle),
	uintptr(cbNumberOfBytes),
	uintptr(pBuffer),
	uintptr(lpOverlapped),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PeerDistClientAddContentInformation(
  hPeerDist: NativeInt;   // INT_PTR
  hContentHandle: NativeInt;   // INT_PTR
  cbNumberOfBytes: DWORD;   // DWORD
  pBuffer: Pointer;   // BYTE*
  lpOverlapped: Pointer   // OVERLAPPED*
): DWORD; stdcall;
  external 'PeerDist.dll' name 'PeerDistClientAddContentInformation';
result := DllCall("PeerDist\PeerDistClientAddContentInformation"
    , "Ptr", hPeerDist   ; INT_PTR
    , "Ptr", hContentHandle   ; INT_PTR
    , "UInt", cbNumberOfBytes   ; DWORD
    , "Ptr", pBuffer   ; BYTE*
    , "Ptr", lpOverlapped   ; OVERLAPPED*
    , "UInt")   ; return: DWORD
●PeerDistClientAddContentInformation(hPeerDist, hContentHandle, cbNumberOfBytes, pBuffer, lpOverlapped) = DLL("PeerDist.dll", "dword PeerDistClientAddContentInformation(int, int, dword, void*, void*)")
# 呼び出し: PeerDistClientAddContentInformation(hPeerDist, hContentHandle, cbNumberOfBytes, pBuffer, lpOverlapped)
# hPeerDist : INT_PTR -> "int"
# hContentHandle : INT_PTR -> "int"
# cbNumberOfBytes : DWORD -> "dword"
# pBuffer : BYTE* -> "void*"
# lpOverlapped : OVERLAPPED* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。