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