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