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

PeerGraphGetRecord

関数
ピアグラフから指定したレコードを取得する。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGraphGetRecord(
    void* hGraph,
    const GUID* pRecordId,
    PEER_RECORD** ppRecord
);

パラメーター

名前方向
hGraphvoid*in
pRecordIdGUID*in
ppRecordPEER_RECORD**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerGraphGetRecord(
    void* hGraph,
    const GUID* pRecordId,
    PEER_RECORD** ppRecord
);
[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphGetRecord(
    IntPtr hGraph,   // void*
    ref Guid pRecordId,   // GUID*
    IntPtr ppRecord   // PEER_RECORD** out
);
<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphGetRecord(
    hGraph As IntPtr,   ' void*
    ByRef pRecordId As Guid,   ' GUID*
    ppRecord As IntPtr   ' PEER_RECORD** out
) As Integer
End Function
' hGraph : void*
' pRecordId : GUID*
' ppRecord : PEER_RECORD** out
Declare PtrSafe Function PeerGraphGetRecord Lib "p2pgraph" ( _
    ByVal hGraph As LongPtr, _
    ByVal pRecordId As LongPtr, _
    ByVal ppRecord As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerGraphGetRecord = ctypes.windll.p2pgraph.PeerGraphGetRecord
PeerGraphGetRecord.restype = ctypes.c_int
PeerGraphGetRecord.argtypes = [
    ctypes.POINTER(None),  # hGraph : void*
    ctypes.c_void_p,  # pRecordId : GUID*
    ctypes.c_void_p,  # ppRecord : PEER_RECORD** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphGetRecord = Fiddle::Function.new(
  lib['PeerGraphGetRecord'],
  [
    Fiddle::TYPE_VOIDP,  # hGraph : void*
    Fiddle::TYPE_VOIDP,  # pRecordId : GUID*
    Fiddle::TYPE_VOIDP,  # ppRecord : PEER_RECORD** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2pgraph")]
extern "system" {
    fn PeerGraphGetRecord(
        hGraph: *mut (),  // void*
        pRecordId: *const GUID,  // GUID*
        ppRecord: *mut *mut PEER_RECORD  // PEER_RECORD** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphGetRecord(IntPtr hGraph, ref Guid pRecordId, IntPtr ppRecord);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphGetRecord' -Namespace Win32 -PassThru
# $api::PeerGraphGetRecord(hGraph, pRecordId, ppRecord)
#uselib "P2PGRAPH.dll"
#func global PeerGraphGetRecord "PeerGraphGetRecord" sptr, sptr, sptr
; PeerGraphGetRecord hGraph, varptr(pRecordId), varptr(ppRecord)   ; 戻り値は stat
; hGraph : void* -> "sptr"
; pRecordId : GUID* -> "sptr"
; ppRecord : PEER_RECORD** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphGetRecord "PeerGraphGetRecord" sptr, var, var
; res = PeerGraphGetRecord(hGraph, pRecordId, ppRecord)
; hGraph : void* -> "sptr"
; pRecordId : GUID* -> "var"
; ppRecord : PEER_RECORD** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT PeerGraphGetRecord(void* hGraph, GUID* pRecordId, PEER_RECORD** ppRecord)
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphGetRecord "PeerGraphGetRecord" intptr, var, var
; res = PeerGraphGetRecord(hGraph, pRecordId, ppRecord)
; hGraph : void* -> "intptr"
; pRecordId : GUID* -> "var"
; ppRecord : PEER_RECORD** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphGetRecord = p2pgraph.NewProc("PeerGraphGetRecord")
)

// hGraph (void*), pRecordId (GUID*), ppRecord (PEER_RECORD** out)
r1, _, err := procPeerGraphGetRecord.Call(
	uintptr(hGraph),
	uintptr(pRecordId),
	uintptr(ppRecord),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PeerGraphGetRecord(
  hGraph: Pointer;   // void*
  pRecordId: PGUID;   // GUID*
  ppRecord: Pointer   // PEER_RECORD** out
): Integer; stdcall;
  external 'P2PGRAPH.dll' name 'PeerGraphGetRecord';
result := DllCall("P2PGRAPH\PeerGraphGetRecord"
    , "Ptr", hGraph   ; void*
    , "Ptr", pRecordId   ; GUID*
    , "Ptr", ppRecord   ; PEER_RECORD** out
    , "Int")   ; return: HRESULT
●PeerGraphGetRecord(hGraph, pRecordId, ppRecord) = DLL("P2PGRAPH.dll", "int PeerGraphGetRecord(void*, void*, void*)")
# 呼び出し: PeerGraphGetRecord(hGraph, pRecordId, ppRecord)
# hGraph : void* -> "void*"
# pRecordId : GUID* -> "void*"
# ppRecord : PEER_RECORD** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。