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