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

PeerDistServerOpenContentInformationEx

関数
サーバー側でコンテンツの一部範囲のコンテンツ情報を非同期に開く。
DLLPeerDist.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD PeerDistServerOpenContentInformationEx(
    INT_PTR hPeerDist,
    DWORD cbContentIdentifier,
    BYTE* pContentIdentifier,
    ULONGLONG ullContentOffset,
    ULONGLONG cbContentLength,
    PEERDIST_RETRIEVAL_OPTIONS* pRetrievalOptions,
    HANDLE hCompletionPort,   // optional
    UINT_PTR ulCompletionKey,   // optional
    INT_PTR* phContentInfo
);

パラメーター

名前方向
hPeerDistINT_PTRin
cbContentIdentifierDWORDin
pContentIdentifierBYTE*in
ullContentOffsetULONGLONGin
cbContentLengthULONGLONGin
pRetrievalOptionsPEERDIST_RETRIEVAL_OPTIONS*in
hCompletionPortHANDLEinoptional
ulCompletionKeyUINT_PTRinoptional
phContentInfoINT_PTR*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PeerDistServerOpenContentInformationEx(
    INT_PTR hPeerDist,
    DWORD cbContentIdentifier,
    BYTE* pContentIdentifier,
    ULONGLONG ullContentOffset,
    ULONGLONG cbContentLength,
    PEERDIST_RETRIEVAL_OPTIONS* pRetrievalOptions,
    HANDLE hCompletionPort,   // optional
    UINT_PTR ulCompletionKey,   // optional
    INT_PTR* phContentInfo
);
[DllImport("PeerDist.dll", ExactSpelling = true)]
static extern uint PeerDistServerOpenContentInformationEx(
    IntPtr hPeerDist,   // INT_PTR
    uint cbContentIdentifier,   // DWORD
    IntPtr pContentIdentifier,   // BYTE*
    ulong ullContentOffset,   // ULONGLONG
    ulong cbContentLength,   // ULONGLONG
    IntPtr pRetrievalOptions,   // PEERDIST_RETRIEVAL_OPTIONS*
    IntPtr hCompletionPort,   // HANDLE optional
    UIntPtr ulCompletionKey,   // UINT_PTR optional
    out IntPtr phContentInfo   // INT_PTR* out
);
<DllImport("PeerDist.dll", ExactSpelling:=True)>
Public Shared Function PeerDistServerOpenContentInformationEx(
    hPeerDist As IntPtr,   ' INT_PTR
    cbContentIdentifier As UInteger,   ' DWORD
    pContentIdentifier As IntPtr,   ' BYTE*
    ullContentOffset As ULong,   ' ULONGLONG
    cbContentLength As ULong,   ' ULONGLONG
    pRetrievalOptions As IntPtr,   ' PEERDIST_RETRIEVAL_OPTIONS*
    hCompletionPort As IntPtr,   ' HANDLE optional
    ulCompletionKey As UIntPtr,   ' UINT_PTR optional
    <Out> ByRef phContentInfo As IntPtr   ' INT_PTR* out
) As UInteger
End Function
' hPeerDist : INT_PTR
' cbContentIdentifier : DWORD
' pContentIdentifier : BYTE*
' ullContentOffset : ULONGLONG
' cbContentLength : ULONGLONG
' pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS*
' hCompletionPort : HANDLE optional
' ulCompletionKey : UINT_PTR optional
' phContentInfo : INT_PTR* out
Declare PtrSafe Function PeerDistServerOpenContentInformationEx Lib "peerdist" ( _
    ByVal hPeerDist As LongPtr, _
    ByVal cbContentIdentifier As Long, _
    ByVal pContentIdentifier As LongPtr, _
    ByVal ullContentOffset As LongLong, _
    ByVal cbContentLength As LongLong, _
    ByVal pRetrievalOptions As LongPtr, _
    ByVal hCompletionPort As LongPtr, _
    ByVal ulCompletionKey As LongPtr, _
    ByRef phContentInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerDistServerOpenContentInformationEx = ctypes.windll.peerdist.PeerDistServerOpenContentInformationEx
PeerDistServerOpenContentInformationEx.restype = wintypes.DWORD
PeerDistServerOpenContentInformationEx.argtypes = [
    ctypes.c_ssize_t,  # hPeerDist : INT_PTR
    wintypes.DWORD,  # cbContentIdentifier : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pContentIdentifier : BYTE*
    ctypes.c_ulonglong,  # ullContentOffset : ULONGLONG
    ctypes.c_ulonglong,  # cbContentLength : ULONGLONG
    ctypes.c_void_p,  # pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS*
    wintypes.HANDLE,  # hCompletionPort : HANDLE optional
    ctypes.c_size_t,  # ulCompletionKey : UINT_PTR optional
    ctypes.POINTER(ctypes.c_ssize_t),  # phContentInfo : INT_PTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('PeerDist.dll')
PeerDistServerOpenContentInformationEx = Fiddle::Function.new(
  lib['PeerDistServerOpenContentInformationEx'],
  [
    Fiddle::TYPE_INTPTR_T,  # hPeerDist : INT_PTR
    -Fiddle::TYPE_INT,  # cbContentIdentifier : DWORD
    Fiddle::TYPE_VOIDP,  # pContentIdentifier : BYTE*
    -Fiddle::TYPE_LONG_LONG,  # ullContentOffset : ULONGLONG
    -Fiddle::TYPE_LONG_LONG,  # cbContentLength : ULONGLONG
    Fiddle::TYPE_VOIDP,  # pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS*
    Fiddle::TYPE_VOIDP,  # hCompletionPort : HANDLE optional
    Fiddle::TYPE_UINTPTR_T,  # ulCompletionKey : UINT_PTR optional
    Fiddle::TYPE_VOIDP,  # phContentInfo : INT_PTR* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "peerdist")]
extern "system" {
    fn PeerDistServerOpenContentInformationEx(
        hPeerDist: isize,  // INT_PTR
        cbContentIdentifier: u32,  // DWORD
        pContentIdentifier: *mut u8,  // BYTE*
        ullContentOffset: u64,  // ULONGLONG
        cbContentLength: u64,  // ULONGLONG
        pRetrievalOptions: *mut PEERDIST_RETRIEVAL_OPTIONS,  // PEERDIST_RETRIEVAL_OPTIONS*
        hCompletionPort: *mut core::ffi::c_void,  // HANDLE optional
        ulCompletionKey: usize,  // UINT_PTR optional
        phContentInfo: *mut isize  // INT_PTR* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("PeerDist.dll")]
public static extern uint PeerDistServerOpenContentInformationEx(IntPtr hPeerDist, uint cbContentIdentifier, IntPtr pContentIdentifier, ulong ullContentOffset, ulong cbContentLength, IntPtr pRetrievalOptions, IntPtr hCompletionPort, UIntPtr ulCompletionKey, out IntPtr phContentInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PeerDist_PeerDistServerOpenContentInformationEx' -Namespace Win32 -PassThru
# $api::PeerDistServerOpenContentInformationEx(hPeerDist, cbContentIdentifier, pContentIdentifier, ullContentOffset, cbContentLength, pRetrievalOptions, hCompletionPort, ulCompletionKey, phContentInfo)
#uselib "PeerDist.dll"
#func global PeerDistServerOpenContentInformationEx "PeerDistServerOpenContentInformationEx" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; PeerDistServerOpenContentInformationEx hPeerDist, cbContentIdentifier, varptr(pContentIdentifier), ullContentOffset, cbContentLength, varptr(pRetrievalOptions), hCompletionPort, ulCompletionKey, varptr(phContentInfo)   ; 戻り値は stat
; hPeerDist : INT_PTR -> "sptr"
; cbContentIdentifier : DWORD -> "sptr"
; pContentIdentifier : BYTE* -> "sptr"
; ullContentOffset : ULONGLONG -> "sptr"
; cbContentLength : ULONGLONG -> "sptr"
; pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS* -> "sptr"
; hCompletionPort : HANDLE optional -> "sptr"
; ulCompletionKey : UINT_PTR optional -> "sptr"
; phContentInfo : INT_PTR* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "PeerDist.dll"
#cfunc global PeerDistServerOpenContentInformationEx "PeerDistServerOpenContentInformationEx" sptr, int, var, int64, int64, var, sptr, sptr, var
; res = PeerDistServerOpenContentInformationEx(hPeerDist, cbContentIdentifier, pContentIdentifier, ullContentOffset, cbContentLength, pRetrievalOptions, hCompletionPort, ulCompletionKey, phContentInfo)
; hPeerDist : INT_PTR -> "sptr"
; cbContentIdentifier : DWORD -> "int"
; pContentIdentifier : BYTE* -> "var"
; ullContentOffset : ULONGLONG -> "int64"
; cbContentLength : ULONGLONG -> "int64"
; pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS* -> "var"
; hCompletionPort : HANDLE optional -> "sptr"
; ulCompletionKey : UINT_PTR optional -> "sptr"
; phContentInfo : INT_PTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; DWORD PeerDistServerOpenContentInformationEx(INT_PTR hPeerDist, DWORD cbContentIdentifier, BYTE* pContentIdentifier, ULONGLONG ullContentOffset, ULONGLONG cbContentLength, PEERDIST_RETRIEVAL_OPTIONS* pRetrievalOptions, HANDLE hCompletionPort, UINT_PTR ulCompletionKey, INT_PTR* phContentInfo)
#uselib "PeerDist.dll"
#cfunc global PeerDistServerOpenContentInformationEx "PeerDistServerOpenContentInformationEx" intptr, int, var, int64, int64, var, intptr, intptr, var
; res = PeerDistServerOpenContentInformationEx(hPeerDist, cbContentIdentifier, pContentIdentifier, ullContentOffset, cbContentLength, pRetrievalOptions, hCompletionPort, ulCompletionKey, phContentInfo)
; hPeerDist : INT_PTR -> "intptr"
; cbContentIdentifier : DWORD -> "int"
; pContentIdentifier : BYTE* -> "var"
; ullContentOffset : ULONGLONG -> "int64"
; cbContentLength : ULONGLONG -> "int64"
; pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS* -> "var"
; hCompletionPort : HANDLE optional -> "intptr"
; ulCompletionKey : UINT_PTR optional -> "intptr"
; phContentInfo : INT_PTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	peerdist = windows.NewLazySystemDLL("PeerDist.dll")
	procPeerDistServerOpenContentInformationEx = peerdist.NewProc("PeerDistServerOpenContentInformationEx")
)

// hPeerDist (INT_PTR), cbContentIdentifier (DWORD), pContentIdentifier (BYTE*), ullContentOffset (ULONGLONG), cbContentLength (ULONGLONG), pRetrievalOptions (PEERDIST_RETRIEVAL_OPTIONS*), hCompletionPort (HANDLE optional), ulCompletionKey (UINT_PTR optional), phContentInfo (INT_PTR* out)
r1, _, err := procPeerDistServerOpenContentInformationEx.Call(
	uintptr(hPeerDist),
	uintptr(cbContentIdentifier),
	uintptr(pContentIdentifier),
	uintptr(ullContentOffset),
	uintptr(cbContentLength),
	uintptr(pRetrievalOptions),
	uintptr(hCompletionPort),
	uintptr(ulCompletionKey),
	uintptr(phContentInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PeerDistServerOpenContentInformationEx(
  hPeerDist: NativeInt;   // INT_PTR
  cbContentIdentifier: DWORD;   // DWORD
  pContentIdentifier: Pointer;   // BYTE*
  ullContentOffset: UInt64;   // ULONGLONG
  cbContentLength: UInt64;   // ULONGLONG
  pRetrievalOptions: Pointer;   // PEERDIST_RETRIEVAL_OPTIONS*
  hCompletionPort: THandle;   // HANDLE optional
  ulCompletionKey: NativeUInt;   // UINT_PTR optional
  phContentInfo: Pointer   // INT_PTR* out
): DWORD; stdcall;
  external 'PeerDist.dll' name 'PeerDistServerOpenContentInformationEx';
result := DllCall("PeerDist\PeerDistServerOpenContentInformationEx"
    , "Ptr", hPeerDist   ; INT_PTR
    , "UInt", cbContentIdentifier   ; DWORD
    , "Ptr", pContentIdentifier   ; BYTE*
    , "Int64", ullContentOffset   ; ULONGLONG
    , "Int64", cbContentLength   ; ULONGLONG
    , "Ptr", pRetrievalOptions   ; PEERDIST_RETRIEVAL_OPTIONS*
    , "Ptr", hCompletionPort   ; HANDLE optional
    , "UPtr", ulCompletionKey   ; UINT_PTR optional
    , "Ptr", phContentInfo   ; INT_PTR* out
    , "UInt")   ; return: DWORD
●PeerDistServerOpenContentInformationEx(hPeerDist, cbContentIdentifier, pContentIdentifier, ullContentOffset, cbContentLength, pRetrievalOptions, hCompletionPort, ulCompletionKey, phContentInfo) = DLL("PeerDist.dll", "dword PeerDistServerOpenContentInformationEx(int, dword, void*, qword, qword, void*, void*, int, void*)")
# 呼び出し: PeerDistServerOpenContentInformationEx(hPeerDist, cbContentIdentifier, pContentIdentifier, ullContentOffset, cbContentLength, pRetrievalOptions, hCompletionPort, ulCompletionKey, phContentInfo)
# hPeerDist : INT_PTR -> "int"
# cbContentIdentifier : DWORD -> "dword"
# pContentIdentifier : BYTE* -> "void*"
# ullContentOffset : ULONGLONG -> "qword"
# cbContentLength : ULONGLONG -> "qword"
# pRetrievalOptions : PEERDIST_RETRIEVAL_OPTIONS* -> "void*"
# hCompletionPort : HANDLE optional -> "void*"
# ulCompletionKey : UINT_PTR optional -> "int"
# phContentInfo : INT_PTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。