ホーム › NetworkManagement.P2P › PeerPnrpStartResolve
PeerPnrpStartResolve
関数PNRPによるピア名の非同期解決を開始する。
シグネチャ
// P2P.dll
#include <windows.h>
HRESULT PeerPnrpStartResolve(
LPCWSTR pcwzPeerName,
LPCWSTR pcwzCloudName, // optional
DWORD cMaxEndpoints, // optional
HANDLE hEvent,
void** phResolve
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pcwzPeerName | LPCWSTR | in |
| pcwzCloudName | LPCWSTR | inoptional |
| cMaxEndpoints | DWORD | inoptional |
| hEvent | HANDLE | in |
| phResolve | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// P2P.dll
#include <windows.h>
HRESULT PeerPnrpStartResolve(
LPCWSTR pcwzPeerName,
LPCWSTR pcwzCloudName, // optional
DWORD cMaxEndpoints, // optional
HANDLE hEvent,
void** phResolve
);[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerPnrpStartResolve(
[MarshalAs(UnmanagedType.LPWStr)] string pcwzPeerName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pcwzCloudName, // LPCWSTR optional
uint cMaxEndpoints, // DWORD optional
IntPtr hEvent, // HANDLE
IntPtr phResolve // void** out
);<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerPnrpStartResolve(
<MarshalAs(UnmanagedType.LPWStr)> pcwzPeerName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pcwzCloudName As String, ' LPCWSTR optional
cMaxEndpoints As UInteger, ' DWORD optional
hEvent As IntPtr, ' HANDLE
phResolve As IntPtr ' void** out
) As Integer
End Function' pcwzPeerName : LPCWSTR
' pcwzCloudName : LPCWSTR optional
' cMaxEndpoints : DWORD optional
' hEvent : HANDLE
' phResolve : void** out
Declare PtrSafe Function PeerPnrpStartResolve Lib "p2p" ( _
ByVal pcwzPeerName As LongPtr, _
ByVal pcwzCloudName As LongPtr, _
ByVal cMaxEndpoints As Long, _
ByVal hEvent As LongPtr, _
ByVal phResolve As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PeerPnrpStartResolve = ctypes.windll.p2p.PeerPnrpStartResolve
PeerPnrpStartResolve.restype = ctypes.c_int
PeerPnrpStartResolve.argtypes = [
wintypes.LPCWSTR, # pcwzPeerName : LPCWSTR
wintypes.LPCWSTR, # pcwzCloudName : LPCWSTR optional
wintypes.DWORD, # cMaxEndpoints : DWORD optional
wintypes.HANDLE, # hEvent : HANDLE
ctypes.c_void_p, # phResolve : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('P2P.dll')
PeerPnrpStartResolve = Fiddle::Function.new(
lib['PeerPnrpStartResolve'],
[
Fiddle::TYPE_VOIDP, # pcwzPeerName : LPCWSTR
Fiddle::TYPE_VOIDP, # pcwzCloudName : LPCWSTR optional
-Fiddle::TYPE_INT, # cMaxEndpoints : DWORD optional
Fiddle::TYPE_VOIDP, # hEvent : HANDLE
Fiddle::TYPE_VOIDP, # phResolve : void** out
],
Fiddle::TYPE_INT)#[link(name = "p2p")]
extern "system" {
fn PeerPnrpStartResolve(
pcwzPeerName: *const u16, // LPCWSTR
pcwzCloudName: *const u16, // LPCWSTR optional
cMaxEndpoints: u32, // DWORD optional
hEvent: *mut core::ffi::c_void, // HANDLE
phResolve: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("P2P.dll")]
public static extern int PeerPnrpStartResolve([MarshalAs(UnmanagedType.LPWStr)] string pcwzPeerName, [MarshalAs(UnmanagedType.LPWStr)] string pcwzCloudName, uint cMaxEndpoints, IntPtr hEvent, IntPtr phResolve);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2P_PeerPnrpStartResolve' -Namespace Win32 -PassThru
# $api::PeerPnrpStartResolve(pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve)#uselib "P2P.dll"
#func global PeerPnrpStartResolve "PeerPnrpStartResolve" sptr, sptr, sptr, sptr, sptr
; PeerPnrpStartResolve pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve ; 戻り値は stat
; pcwzPeerName : LPCWSTR -> "sptr"
; pcwzCloudName : LPCWSTR optional -> "sptr"
; cMaxEndpoints : DWORD optional -> "sptr"
; hEvent : HANDLE -> "sptr"
; phResolve : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "P2P.dll"
#cfunc global PeerPnrpStartResolve "PeerPnrpStartResolve" wstr, wstr, int, sptr, sptr
; res = PeerPnrpStartResolve(pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve)
; pcwzPeerName : LPCWSTR -> "wstr"
; pcwzCloudName : LPCWSTR optional -> "wstr"
; cMaxEndpoints : DWORD optional -> "int"
; hEvent : HANDLE -> "sptr"
; phResolve : void** out -> "sptr"; HRESULT PeerPnrpStartResolve(LPCWSTR pcwzPeerName, LPCWSTR pcwzCloudName, DWORD cMaxEndpoints, HANDLE hEvent, void** phResolve)
#uselib "P2P.dll"
#cfunc global PeerPnrpStartResolve "PeerPnrpStartResolve" wstr, wstr, int, intptr, intptr
; res = PeerPnrpStartResolve(pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve)
; pcwzPeerName : LPCWSTR -> "wstr"
; pcwzCloudName : LPCWSTR optional -> "wstr"
; cMaxEndpoints : DWORD optional -> "int"
; hEvent : HANDLE -> "intptr"
; phResolve : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
p2p = windows.NewLazySystemDLL("P2P.dll")
procPeerPnrpStartResolve = p2p.NewProc("PeerPnrpStartResolve")
)
// pcwzPeerName (LPCWSTR), pcwzCloudName (LPCWSTR optional), cMaxEndpoints (DWORD optional), hEvent (HANDLE), phResolve (void** out)
r1, _, err := procPeerPnrpStartResolve.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcwzPeerName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcwzCloudName))),
uintptr(cMaxEndpoints),
uintptr(hEvent),
uintptr(phResolve),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PeerPnrpStartResolve(
pcwzPeerName: PWideChar; // LPCWSTR
pcwzCloudName: PWideChar; // LPCWSTR optional
cMaxEndpoints: DWORD; // DWORD optional
hEvent: THandle; // HANDLE
phResolve: Pointer // void** out
): Integer; stdcall;
external 'P2P.dll' name 'PeerPnrpStartResolve';result := DllCall("P2P\PeerPnrpStartResolve"
, "WStr", pcwzPeerName ; LPCWSTR
, "WStr", pcwzCloudName ; LPCWSTR optional
, "UInt", cMaxEndpoints ; DWORD optional
, "Ptr", hEvent ; HANDLE
, "Ptr", phResolve ; void** out
, "Int") ; return: HRESULT●PeerPnrpStartResolve(pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve) = DLL("P2P.dll", "int PeerPnrpStartResolve(char*, char*, dword, void*, void*)")
# 呼び出し: PeerPnrpStartResolve(pcwzPeerName, pcwzCloudName, cMaxEndpoints, hEvent, phResolve)
# pcwzPeerName : LPCWSTR -> "char*"
# pcwzCloudName : LPCWSTR optional -> "char*"
# cMaxEndpoints : DWORD optional -> "dword"
# hEvent : HANDLE -> "void*"
# phResolve : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。