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