Win32 API 日本語リファレンス
ホームNetworkManagement.P2P › PeerIdentityGetXML

PeerIdentityGetXML

関数
ピアアイデンティティの情報をXML形式で取得する。
DLLP2P.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// P2P.dll
#include <windows.h>

HRESULT PeerIdentityGetXML(
    LPCWSTR pwzIdentity,   // optional
    LPWSTR* ppwzIdentityXML
);

パラメーター

名前方向
pwzIdentityLPCWSTRinoptional
ppwzIdentityXMLLPWSTR*out

戻り値の型: HRESULT

各言語での呼び出し定義

// P2P.dll
#include <windows.h>

HRESULT PeerIdentityGetXML(
    LPCWSTR pwzIdentity,   // optional
    LPWSTR* ppwzIdentityXML
);
[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerIdentityGetXML(
    [MarshalAs(UnmanagedType.LPWStr)] string pwzIdentity,   // LPCWSTR optional
    IntPtr ppwzIdentityXML   // LPWSTR* out
);
<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerIdentityGetXML(
    <MarshalAs(UnmanagedType.LPWStr)> pwzIdentity As String,   ' LPCWSTR optional
    ppwzIdentityXML As IntPtr   ' LPWSTR* out
) As Integer
End Function
' pwzIdentity : LPCWSTR optional
' ppwzIdentityXML : LPWSTR* out
Declare PtrSafe Function PeerIdentityGetXML Lib "p2p" ( _
    ByVal pwzIdentity As LongPtr, _
    ByVal ppwzIdentityXML As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerIdentityGetXML = ctypes.windll.p2p.PeerIdentityGetXML
PeerIdentityGetXML.restype = ctypes.c_int
PeerIdentityGetXML.argtypes = [
    wintypes.LPCWSTR,  # pwzIdentity : LPCWSTR optional
    ctypes.c_void_p,  # ppwzIdentityXML : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2P.dll')
PeerIdentityGetXML = Fiddle::Function.new(
  lib['PeerIdentityGetXML'],
  [
    Fiddle::TYPE_VOIDP,  # pwzIdentity : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # ppwzIdentityXML : LPWSTR* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2p")]
extern "system" {
    fn PeerIdentityGetXML(
        pwzIdentity: *const u16,  // LPCWSTR optional
        ppwzIdentityXML: *mut *mut u16  // LPWSTR* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2P.dll")]
public static extern int PeerIdentityGetXML([MarshalAs(UnmanagedType.LPWStr)] string pwzIdentity, IntPtr ppwzIdentityXML);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2P_PeerIdentityGetXML' -Namespace Win32 -PassThru
# $api::PeerIdentityGetXML(pwzIdentity, ppwzIdentityXML)
#uselib "P2P.dll"
#func global PeerIdentityGetXML "PeerIdentityGetXML" sptr, sptr
; PeerIdentityGetXML pwzIdentity, varptr(ppwzIdentityXML)   ; 戻り値は stat
; pwzIdentity : LPCWSTR optional -> "sptr"
; ppwzIdentityXML : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "P2P.dll"
#cfunc global PeerIdentityGetXML "PeerIdentityGetXML" wstr, var
; res = PeerIdentityGetXML(pwzIdentity, ppwzIdentityXML)
; pwzIdentity : LPCWSTR optional -> "wstr"
; ppwzIdentityXML : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT PeerIdentityGetXML(LPCWSTR pwzIdentity, LPWSTR* ppwzIdentityXML)
#uselib "P2P.dll"
#cfunc global PeerIdentityGetXML "PeerIdentityGetXML" wstr, var
; res = PeerIdentityGetXML(pwzIdentity, ppwzIdentityXML)
; pwzIdentity : LPCWSTR optional -> "wstr"
; ppwzIdentityXML : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerIdentityGetXML = p2p.NewProc("PeerIdentityGetXML")
)

// pwzIdentity (LPCWSTR optional), ppwzIdentityXML (LPWSTR* out)
r1, _, err := procPeerIdentityGetXML.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzIdentity))),
	uintptr(ppwzIdentityXML),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PeerIdentityGetXML(
  pwzIdentity: PWideChar;   // LPCWSTR optional
  ppwzIdentityXML: PPWideChar   // LPWSTR* out
): Integer; stdcall;
  external 'P2P.dll' name 'PeerIdentityGetXML';
result := DllCall("P2P\PeerIdentityGetXML"
    , "WStr", pwzIdentity   ; LPCWSTR optional
    , "Ptr", ppwzIdentityXML   ; LPWSTR* out
    , "Int")   ; return: HRESULT
●PeerIdentityGetXML(pwzIdentity, ppwzIdentityXML) = DLL("P2P.dll", "int PeerIdentityGetXML(char*, void*)")
# 呼び出し: PeerIdentityGetXML(pwzIdentity, ppwzIdentityXML)
# pwzIdentity : LPCWSTR optional -> "char*"
# ppwzIdentityXML : LPWSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。