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