ホーム › NetworkManagement.P2P › PeerDistClientBlockRead
PeerDistClientBlockRead
関数クライアントのコンテンツからブロック単位で読み取る。
シグネチャ
// PeerDist.dll
#include <windows.h>
DWORD PeerDistClientBlockRead(
INT_PTR hPeerDist,
INT_PTR hContentHandle,
DWORD cbMaxNumberOfBytes,
BYTE* pBuffer, // optional
DWORD dwTimeoutInMilliseconds,
OVERLAPPED* lpOverlapped
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hPeerDist | INT_PTR | in |
| hContentHandle | INT_PTR | in |
| cbMaxNumberOfBytes | DWORD | in |
| pBuffer | BYTE* | outoptional |
| dwTimeoutInMilliseconds | DWORD | in |
| lpOverlapped | OVERLAPPED* | in |
戻り値の型: DWORD
各言語での呼び出し定義
// PeerDist.dll
#include <windows.h>
DWORD PeerDistClientBlockRead(
INT_PTR hPeerDist,
INT_PTR hContentHandle,
DWORD cbMaxNumberOfBytes,
BYTE* pBuffer, // optional
DWORD dwTimeoutInMilliseconds,
OVERLAPPED* lpOverlapped
);[DllImport("PeerDist.dll", ExactSpelling = true)]
static extern uint PeerDistClientBlockRead(
IntPtr hPeerDist, // INT_PTR
IntPtr hContentHandle, // INT_PTR
uint cbMaxNumberOfBytes, // DWORD
IntPtr pBuffer, // BYTE* optional, out
uint dwTimeoutInMilliseconds, // DWORD
IntPtr lpOverlapped // OVERLAPPED*
);<DllImport("PeerDist.dll", ExactSpelling:=True)>
Public Shared Function PeerDistClientBlockRead(
hPeerDist As IntPtr, ' INT_PTR
hContentHandle As IntPtr, ' INT_PTR
cbMaxNumberOfBytes As UInteger, ' DWORD
pBuffer As IntPtr, ' BYTE* optional, out
dwTimeoutInMilliseconds As UInteger, ' DWORD
lpOverlapped As IntPtr ' OVERLAPPED*
) As UInteger
End Function' hPeerDist : INT_PTR
' hContentHandle : INT_PTR
' cbMaxNumberOfBytes : DWORD
' pBuffer : BYTE* optional, out
' dwTimeoutInMilliseconds : DWORD
' lpOverlapped : OVERLAPPED*
Declare PtrSafe Function PeerDistClientBlockRead Lib "peerdist" ( _
ByVal hPeerDist As LongPtr, _
ByVal hContentHandle As LongPtr, _
ByVal cbMaxNumberOfBytes As Long, _
ByVal pBuffer As LongPtr, _
ByVal dwTimeoutInMilliseconds As Long, _
ByVal lpOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PeerDistClientBlockRead = ctypes.windll.peerdist.PeerDistClientBlockRead
PeerDistClientBlockRead.restype = wintypes.DWORD
PeerDistClientBlockRead.argtypes = [
ctypes.c_ssize_t, # hPeerDist : INT_PTR
ctypes.c_ssize_t, # hContentHandle : INT_PTR
wintypes.DWORD, # cbMaxNumberOfBytes : DWORD
ctypes.POINTER(ctypes.c_ubyte), # pBuffer : BYTE* optional, out
wintypes.DWORD, # dwTimeoutInMilliseconds : DWORD
ctypes.c_void_p, # lpOverlapped : OVERLAPPED*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('PeerDist.dll')
PeerDistClientBlockRead = Fiddle::Function.new(
lib['PeerDistClientBlockRead'],
[
Fiddle::TYPE_INTPTR_T, # hPeerDist : INT_PTR
Fiddle::TYPE_INTPTR_T, # hContentHandle : INT_PTR
-Fiddle::TYPE_INT, # cbMaxNumberOfBytes : DWORD
Fiddle::TYPE_VOIDP, # pBuffer : BYTE* optional, out
-Fiddle::TYPE_INT, # dwTimeoutInMilliseconds : DWORD
Fiddle::TYPE_VOIDP, # lpOverlapped : OVERLAPPED*
],
-Fiddle::TYPE_INT)#[link(name = "peerdist")]
extern "system" {
fn PeerDistClientBlockRead(
hPeerDist: isize, // INT_PTR
hContentHandle: isize, // INT_PTR
cbMaxNumberOfBytes: u32, // DWORD
pBuffer: *mut u8, // BYTE* optional, out
dwTimeoutInMilliseconds: u32, // DWORD
lpOverlapped: *mut OVERLAPPED // OVERLAPPED*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("PeerDist.dll")]
public static extern uint PeerDistClientBlockRead(IntPtr hPeerDist, IntPtr hContentHandle, uint cbMaxNumberOfBytes, IntPtr pBuffer, uint dwTimeoutInMilliseconds, IntPtr lpOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PeerDist_PeerDistClientBlockRead' -Namespace Win32 -PassThru
# $api::PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, pBuffer, dwTimeoutInMilliseconds, lpOverlapped)#uselib "PeerDist.dll"
#func global PeerDistClientBlockRead "PeerDistClientBlockRead" sptr, sptr, sptr, sptr, sptr, sptr
; PeerDistClientBlockRead hPeerDist, hContentHandle, cbMaxNumberOfBytes, varptr(pBuffer), dwTimeoutInMilliseconds, varptr(lpOverlapped) ; 戻り値は stat
; hPeerDist : INT_PTR -> "sptr"
; hContentHandle : INT_PTR -> "sptr"
; cbMaxNumberOfBytes : DWORD -> "sptr"
; pBuffer : BYTE* optional, out -> "sptr"
; dwTimeoutInMilliseconds : DWORD -> "sptr"
; lpOverlapped : OVERLAPPED* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "PeerDist.dll" #cfunc global PeerDistClientBlockRead "PeerDistClientBlockRead" sptr, sptr, int, var, int, var ; res = PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, pBuffer, dwTimeoutInMilliseconds, lpOverlapped) ; hPeerDist : INT_PTR -> "sptr" ; hContentHandle : INT_PTR -> "sptr" ; cbMaxNumberOfBytes : DWORD -> "int" ; pBuffer : BYTE* optional, out -> "var" ; dwTimeoutInMilliseconds : DWORD -> "int" ; lpOverlapped : OVERLAPPED* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "PeerDist.dll" #cfunc global PeerDistClientBlockRead "PeerDistClientBlockRead" sptr, sptr, int, sptr, int, sptr ; res = PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, varptr(pBuffer), dwTimeoutInMilliseconds, varptr(lpOverlapped)) ; hPeerDist : INT_PTR -> "sptr" ; hContentHandle : INT_PTR -> "sptr" ; cbMaxNumberOfBytes : DWORD -> "int" ; pBuffer : BYTE* optional, out -> "sptr" ; dwTimeoutInMilliseconds : DWORD -> "int" ; lpOverlapped : OVERLAPPED* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD PeerDistClientBlockRead(INT_PTR hPeerDist, INT_PTR hContentHandle, DWORD cbMaxNumberOfBytes, BYTE* pBuffer, DWORD dwTimeoutInMilliseconds, OVERLAPPED* lpOverlapped) #uselib "PeerDist.dll" #cfunc global PeerDistClientBlockRead "PeerDistClientBlockRead" intptr, intptr, int, var, int, var ; res = PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, pBuffer, dwTimeoutInMilliseconds, lpOverlapped) ; hPeerDist : INT_PTR -> "intptr" ; hContentHandle : INT_PTR -> "intptr" ; cbMaxNumberOfBytes : DWORD -> "int" ; pBuffer : BYTE* optional, out -> "var" ; dwTimeoutInMilliseconds : DWORD -> "int" ; lpOverlapped : OVERLAPPED* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD PeerDistClientBlockRead(INT_PTR hPeerDist, INT_PTR hContentHandle, DWORD cbMaxNumberOfBytes, BYTE* pBuffer, DWORD dwTimeoutInMilliseconds, OVERLAPPED* lpOverlapped) #uselib "PeerDist.dll" #cfunc global PeerDistClientBlockRead "PeerDistClientBlockRead" intptr, intptr, int, intptr, int, intptr ; res = PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, varptr(pBuffer), dwTimeoutInMilliseconds, varptr(lpOverlapped)) ; hPeerDist : INT_PTR -> "intptr" ; hContentHandle : INT_PTR -> "intptr" ; cbMaxNumberOfBytes : DWORD -> "int" ; pBuffer : BYTE* optional, out -> "intptr" ; dwTimeoutInMilliseconds : DWORD -> "int" ; lpOverlapped : OVERLAPPED* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
peerdist = windows.NewLazySystemDLL("PeerDist.dll")
procPeerDistClientBlockRead = peerdist.NewProc("PeerDistClientBlockRead")
)
// hPeerDist (INT_PTR), hContentHandle (INT_PTR), cbMaxNumberOfBytes (DWORD), pBuffer (BYTE* optional, out), dwTimeoutInMilliseconds (DWORD), lpOverlapped (OVERLAPPED*)
r1, _, err := procPeerDistClientBlockRead.Call(
uintptr(hPeerDist),
uintptr(hContentHandle),
uintptr(cbMaxNumberOfBytes),
uintptr(pBuffer),
uintptr(dwTimeoutInMilliseconds),
uintptr(lpOverlapped),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PeerDistClientBlockRead(
hPeerDist: NativeInt; // INT_PTR
hContentHandle: NativeInt; // INT_PTR
cbMaxNumberOfBytes: DWORD; // DWORD
pBuffer: Pointer; // BYTE* optional, out
dwTimeoutInMilliseconds: DWORD; // DWORD
lpOverlapped: Pointer // OVERLAPPED*
): DWORD; stdcall;
external 'PeerDist.dll' name 'PeerDistClientBlockRead';result := DllCall("PeerDist\PeerDistClientBlockRead"
, "Ptr", hPeerDist ; INT_PTR
, "Ptr", hContentHandle ; INT_PTR
, "UInt", cbMaxNumberOfBytes ; DWORD
, "Ptr", pBuffer ; BYTE* optional, out
, "UInt", dwTimeoutInMilliseconds ; DWORD
, "Ptr", lpOverlapped ; OVERLAPPED*
, "UInt") ; return: DWORD●PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, pBuffer, dwTimeoutInMilliseconds, lpOverlapped) = DLL("PeerDist.dll", "dword PeerDistClientBlockRead(int, int, dword, void*, dword, void*)")
# 呼び出し: PeerDistClientBlockRead(hPeerDist, hContentHandle, cbMaxNumberOfBytes, pBuffer, dwTimeoutInMilliseconds, lpOverlapped)
# hPeerDist : INT_PTR -> "int"
# hContentHandle : INT_PTR -> "int"
# cbMaxNumberOfBytes : DWORD -> "dword"
# pBuffer : BYTE* optional, out -> "void*"
# dwTimeoutInMilliseconds : DWORD -> "dword"
# lpOverlapped : OVERLAPPED* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。