ホーム › NetworkManagement.P2P › PeerGraphEnumRecords
PeerGraphEnumRecords
関数ピアグラフ内のレコードを種別ごとに列挙する。
シグネチャ
// P2PGRAPH.dll
#include <windows.h>
HRESULT PeerGraphEnumRecords(
void* hGraph,
const GUID* pRecordType, // optional
LPCWSTR pwzPeerId, // optional
void** phPeerEnum
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hGraph | void* | in |
| pRecordType | GUID* | inoptional |
| pwzPeerId | LPCWSTR | inoptional |
| phPeerEnum | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// P2PGRAPH.dll
#include <windows.h>
HRESULT PeerGraphEnumRecords(
void* hGraph,
const GUID* pRecordType, // optional
LPCWSTR pwzPeerId, // optional
void** phPeerEnum
);[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphEnumRecords(
IntPtr hGraph, // void*
IntPtr pRecordType, // GUID* optional
[MarshalAs(UnmanagedType.LPWStr)] string pwzPeerId, // LPCWSTR optional
IntPtr phPeerEnum // void** out
);<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphEnumRecords(
hGraph As IntPtr, ' void*
pRecordType As IntPtr, ' GUID* optional
<MarshalAs(UnmanagedType.LPWStr)> pwzPeerId As String, ' LPCWSTR optional
phPeerEnum As IntPtr ' void** out
) As Integer
End Function' hGraph : void*
' pRecordType : GUID* optional
' pwzPeerId : LPCWSTR optional
' phPeerEnum : void** out
Declare PtrSafe Function PeerGraphEnumRecords Lib "p2pgraph" ( _
ByVal hGraph As LongPtr, _
ByVal pRecordType As LongPtr, _
ByVal pwzPeerId As LongPtr, _
ByVal phPeerEnum As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PeerGraphEnumRecords = ctypes.windll.p2pgraph.PeerGraphEnumRecords
PeerGraphEnumRecords.restype = ctypes.c_int
PeerGraphEnumRecords.argtypes = [
ctypes.POINTER(None), # hGraph : void*
ctypes.c_void_p, # pRecordType : GUID* optional
wintypes.LPCWSTR, # pwzPeerId : LPCWSTR optional
ctypes.c_void_p, # phPeerEnum : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphEnumRecords = Fiddle::Function.new(
lib['PeerGraphEnumRecords'],
[
Fiddle::TYPE_VOIDP, # hGraph : void*
Fiddle::TYPE_VOIDP, # pRecordType : GUID* optional
Fiddle::TYPE_VOIDP, # pwzPeerId : LPCWSTR optional
Fiddle::TYPE_VOIDP, # phPeerEnum : void** out
],
Fiddle::TYPE_INT)#[link(name = "p2pgraph")]
extern "system" {
fn PeerGraphEnumRecords(
hGraph: *mut (), // void*
pRecordType: *const GUID, // GUID* optional
pwzPeerId: *const u16, // LPCWSTR optional
phPeerEnum: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphEnumRecords(IntPtr hGraph, IntPtr pRecordType, [MarshalAs(UnmanagedType.LPWStr)] string pwzPeerId, IntPtr phPeerEnum);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphEnumRecords' -Namespace Win32 -PassThru
# $api::PeerGraphEnumRecords(hGraph, pRecordType, pwzPeerId, phPeerEnum)#uselib "P2PGRAPH.dll"
#func global PeerGraphEnumRecords "PeerGraphEnumRecords" sptr, sptr, sptr, sptr
; PeerGraphEnumRecords hGraph, varptr(pRecordType), pwzPeerId, phPeerEnum ; 戻り値は stat
; hGraph : void* -> "sptr"
; pRecordType : GUID* optional -> "sptr"
; pwzPeerId : LPCWSTR optional -> "sptr"
; phPeerEnum : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "P2PGRAPH.dll" #cfunc global PeerGraphEnumRecords "PeerGraphEnumRecords" sptr, var, wstr, sptr ; res = PeerGraphEnumRecords(hGraph, pRecordType, pwzPeerId, phPeerEnum) ; hGraph : void* -> "sptr" ; pRecordType : GUID* optional -> "var" ; pwzPeerId : LPCWSTR optional -> "wstr" ; phPeerEnum : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "P2PGRAPH.dll" #cfunc global PeerGraphEnumRecords "PeerGraphEnumRecords" sptr, sptr, wstr, sptr ; res = PeerGraphEnumRecords(hGraph, varptr(pRecordType), pwzPeerId, phPeerEnum) ; hGraph : void* -> "sptr" ; pRecordType : GUID* optional -> "sptr" ; pwzPeerId : LPCWSTR optional -> "wstr" ; phPeerEnum : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT PeerGraphEnumRecords(void* hGraph, GUID* pRecordType, LPCWSTR pwzPeerId, void** phPeerEnum) #uselib "P2PGRAPH.dll" #cfunc global PeerGraphEnumRecords "PeerGraphEnumRecords" intptr, var, wstr, intptr ; res = PeerGraphEnumRecords(hGraph, pRecordType, pwzPeerId, phPeerEnum) ; hGraph : void* -> "intptr" ; pRecordType : GUID* optional -> "var" ; pwzPeerId : LPCWSTR optional -> "wstr" ; phPeerEnum : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT PeerGraphEnumRecords(void* hGraph, GUID* pRecordType, LPCWSTR pwzPeerId, void** phPeerEnum) #uselib "P2PGRAPH.dll" #cfunc global PeerGraphEnumRecords "PeerGraphEnumRecords" intptr, intptr, wstr, intptr ; res = PeerGraphEnumRecords(hGraph, varptr(pRecordType), pwzPeerId, phPeerEnum) ; hGraph : void* -> "intptr" ; pRecordType : GUID* optional -> "intptr" ; pwzPeerId : LPCWSTR optional -> "wstr" ; phPeerEnum : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
procPeerGraphEnumRecords = p2pgraph.NewProc("PeerGraphEnumRecords")
)
// hGraph (void*), pRecordType (GUID* optional), pwzPeerId (LPCWSTR optional), phPeerEnum (void** out)
r1, _, err := procPeerGraphEnumRecords.Call(
uintptr(hGraph),
uintptr(pRecordType),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzPeerId))),
uintptr(phPeerEnum),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PeerGraphEnumRecords(
hGraph: Pointer; // void*
pRecordType: PGUID; // GUID* optional
pwzPeerId: PWideChar; // LPCWSTR optional
phPeerEnum: Pointer // void** out
): Integer; stdcall;
external 'P2PGRAPH.dll' name 'PeerGraphEnumRecords';result := DllCall("P2PGRAPH\PeerGraphEnumRecords"
, "Ptr", hGraph ; void*
, "Ptr", pRecordType ; GUID* optional
, "WStr", pwzPeerId ; LPCWSTR optional
, "Ptr", phPeerEnum ; void** out
, "Int") ; return: HRESULT●PeerGraphEnumRecords(hGraph, pRecordType, pwzPeerId, phPeerEnum) = DLL("P2PGRAPH.dll", "int PeerGraphEnumRecords(void*, void*, char*, void*)")
# 呼び出し: PeerGraphEnumRecords(hGraph, pRecordType, pwzPeerId, phPeerEnum)
# hGraph : void* -> "void*"
# pRecordType : GUID* optional -> "void*"
# pwzPeerId : LPCWSTR optional -> "char*"
# phPeerEnum : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。