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

PeerCollabGetPresenceInfo

関数
エンドポイントのプレゼンス情報を取得する。
DLLP2P.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT PeerCollabGetPresenceInfo(
    PEER_ENDPOINT* pcEndpoint,   // optional
    PEER_PRESENCE_INFO** ppPresenceInfo
);

パラメーター

名前方向説明
pcEndpointPEER_ENDPOINT*inoptionalプレゼンス情報を取得する対象のエンドポイントを示すPEER_ENDPOINT構造体へのポインター。
ppPresenceInfoPEER_PRESENCE_INFO**out取得したPEER_PRESENCE_INFO構造体を受け取る出力。PeerFreeDataで解放する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerCollabGetPresenceInfo(
    PEER_ENDPOINT* pcEndpoint,   // optional
    PEER_PRESENCE_INFO** ppPresenceInfo
);
[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerCollabGetPresenceInfo(
    IntPtr pcEndpoint,   // PEER_ENDPOINT* optional
    IntPtr ppPresenceInfo   // PEER_PRESENCE_INFO** out
);
<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerCollabGetPresenceInfo(
    pcEndpoint As IntPtr,   ' PEER_ENDPOINT* optional
    ppPresenceInfo As IntPtr   ' PEER_PRESENCE_INFO** out
) As Integer
End Function
' pcEndpoint : PEER_ENDPOINT* optional
' ppPresenceInfo : PEER_PRESENCE_INFO** out
Declare PtrSafe Function PeerCollabGetPresenceInfo Lib "p2p" ( _
    ByVal pcEndpoint As LongPtr, _
    ByVal ppPresenceInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerCollabGetPresenceInfo = ctypes.windll.p2p.PeerCollabGetPresenceInfo
PeerCollabGetPresenceInfo.restype = ctypes.c_int
PeerCollabGetPresenceInfo.argtypes = [
    ctypes.c_void_p,  # pcEndpoint : PEER_ENDPOINT* optional
    ctypes.c_void_p,  # ppPresenceInfo : PEER_PRESENCE_INFO** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerCollabGetPresenceInfo = p2p.NewProc("PeerCollabGetPresenceInfo")
)

// pcEndpoint (PEER_ENDPOINT* optional), ppPresenceInfo (PEER_PRESENCE_INFO** out)
r1, _, err := procPeerCollabGetPresenceInfo.Call(
	uintptr(pcEndpoint),
	uintptr(ppPresenceInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PeerCollabGetPresenceInfo(
  pcEndpoint: Pointer;   // PEER_ENDPOINT* optional
  ppPresenceInfo: Pointer   // PEER_PRESENCE_INFO** out
): Integer; stdcall;
  external 'P2P.dll' name 'PeerCollabGetPresenceInfo';
result := DllCall("P2P\PeerCollabGetPresenceInfo"
    , "Ptr", pcEndpoint   ; PEER_ENDPOINT* optional
    , "Ptr", ppPresenceInfo   ; PEER_PRESENCE_INFO** out
    , "Int")   ; return: HRESULT
●PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo) = DLL("P2P.dll", "int PeerCollabGetPresenceInfo(void*, void*)")
# 呼び出し: PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo)
# pcEndpoint : PEER_ENDPOINT* optional -> "void*"
# ppPresenceInfo : PEER_PRESENCE_INFO** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "p2p" fn PeerCollabGetPresenceInfo(
    pcEndpoint: [*c]PEER_ENDPOINT, // PEER_ENDPOINT* optional
    ppPresenceInfo: [*c][*c]PEER_PRESENCE_INFO // PEER_PRESENCE_INFO** out
) callconv(std.os.windows.WINAPI) i32;
proc PeerCollabGetPresenceInfo(
    pcEndpoint: ptr PEER_ENDPOINT,  # PEER_ENDPOINT* optional
    ppPresenceInfo: ptr PEER_PRESENCE_INFO  # PEER_PRESENCE_INFO** out
): int32 {.importc: "PeerCollabGetPresenceInfo", stdcall, dynlib: "P2P.dll".}
pragma(lib, "p2p");
extern(Windows)
int PeerCollabGetPresenceInfo(
    PEER_ENDPOINT* pcEndpoint,   // PEER_ENDPOINT* optional
    PEER_PRESENCE_INFO** ppPresenceInfo   // PEER_PRESENCE_INFO** out
);
ccall((:PeerCollabGetPresenceInfo, "P2P.dll"), stdcall, Int32,
      (Ptr{PEER_ENDPOINT}, Ptr{PEER_PRESENCE_INFO}),
      pcEndpoint, ppPresenceInfo)
# pcEndpoint : PEER_ENDPOINT* optional -> Ptr{PEER_ENDPOINT}
# ppPresenceInfo : PEER_PRESENCE_INFO** out -> Ptr{PEER_PRESENCE_INFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t PeerCollabGetPresenceInfo(
    void* pcEndpoint,
    void* ppPresenceInfo);
]]
local p2p = ffi.load("p2p")
-- p2p.PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo)
-- pcEndpoint : PEER_ENDPOINT* optional
-- ppPresenceInfo : PEER_PRESENCE_INFO** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('P2P.dll');
const PeerCollabGetPresenceInfo = lib.func('__stdcall', 'PeerCollabGetPresenceInfo', 'int32_t', ['void *', 'void *']);
// PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo)
// pcEndpoint : PEER_ENDPOINT* optional -> 'void *'
// ppPresenceInfo : PEER_PRESENCE_INFO** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("P2P.dll", {
  PeerCollabGetPresenceInfo: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo)
// pcEndpoint : PEER_ENDPOINT* optional -> "pointer"
// ppPresenceInfo : PEER_PRESENCE_INFO** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t PeerCollabGetPresenceInfo(
    void* pcEndpoint,
    void* ppPresenceInfo);
C, "P2P.dll");
// $ffi->PeerCollabGetPresenceInfo(pcEndpoint, ppPresenceInfo);
// pcEndpoint : PEER_ENDPOINT* optional
// ppPresenceInfo : PEER_PRESENCE_INFO** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface P2p extends StdCallLibrary {
    P2p INSTANCE = Native.load("p2p", P2p.class);
    int PeerCollabGetPresenceInfo(
        Pointer pcEndpoint,   // PEER_ENDPOINT* optional
        Pointer ppPresenceInfo   // PEER_PRESENCE_INFO** out
    );
}
@[Link("p2p")]
lib LibP2P
  fun PeerCollabGetPresenceInfo = PeerCollabGetPresenceInfo(
    pcEndpoint : PEER_ENDPOINT*,   # PEER_ENDPOINT* optional
    ppPresenceInfo : PEER_PRESENCE_INFO**   # PEER_PRESENCE_INFO** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PeerCollabGetPresenceInfoNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef PeerCollabGetPresenceInfoDart = int Function(Pointer<Void>, Pointer<Void>);
final PeerCollabGetPresenceInfo = DynamicLibrary.open('P2P.dll')
    .lookupFunction<PeerCollabGetPresenceInfoNative, PeerCollabGetPresenceInfoDart>('PeerCollabGetPresenceInfo');
// pcEndpoint : PEER_ENDPOINT* optional -> Pointer<Void>
// ppPresenceInfo : PEER_PRESENCE_INFO** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PeerCollabGetPresenceInfo(
  pcEndpoint: Pointer;   // PEER_ENDPOINT* optional
  ppPresenceInfo: Pointer   // PEER_PRESENCE_INFO** out
): Integer; stdcall;
  external 'P2P.dll' name 'PeerCollabGetPresenceInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PeerCollabGetPresenceInfo"
  c_PeerCollabGetPresenceInfo :: Ptr () -> Ptr () -> IO Int32
-- pcEndpoint : PEER_ENDPOINT* optional -> Ptr ()
-- ppPresenceInfo : PEER_PRESENCE_INFO** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let peercollabgetpresenceinfo =
  foreign "PeerCollabGetPresenceInfo"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* pcEndpoint : PEER_ENDPOINT* optional -> (ptr void) *)
(* ppPresenceInfo : PEER_PRESENCE_INFO** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library p2p (t "P2P.dll"))
(cffi:use-foreign-library p2p)

(cffi:defcfun ("PeerCollabGetPresenceInfo" peer-collab-get-presence-info :convention :stdcall) :int32
  (pc-endpoint :pointer)   ; PEER_ENDPOINT* optional
  (pp-presence-info :pointer))   ; PEER_PRESENCE_INFO** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PeerCollabGetPresenceInfo = Win32::API::More->new('P2P',
    'int PeerCollabGetPresenceInfo(LPVOID pcEndpoint, LPVOID ppPresenceInfo)');
# my $ret = $PeerCollabGetPresenceInfo->Call($pcEndpoint, $ppPresenceInfo);
# pcEndpoint : PEER_ENDPOINT* optional -> LPVOID
# ppPresenceInfo : PEER_PRESENCE_INFO** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型