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