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

PeerGraphSearchRecords

関数
条件に一致するレコードをピアグラフから検索する。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGraphSearchRecords(
    void* hGraph,
    LPCWSTR pwzCriteria,
    void** phPeerEnum
);

パラメーター

名前方向
hGraphvoid*in
pwzCriteriaLPCWSTRin
phPeerEnumvoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

PeerGraphSearchRecords = ctypes.windll.p2pgraph.PeerGraphSearchRecords
PeerGraphSearchRecords.restype = ctypes.c_int
PeerGraphSearchRecords.argtypes = [
    ctypes.POINTER(None),  # hGraph : void*
    wintypes.LPCWSTR,  # pwzCriteria : LPCWSTR
    ctypes.c_void_p,  # phPeerEnum : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphSearchRecords = Fiddle::Function.new(
  lib['PeerGraphSearchRecords'],
  [
    Fiddle::TYPE_VOIDP,  # hGraph : void*
    Fiddle::TYPE_VOIDP,  # pwzCriteria : LPCWSTR
    Fiddle::TYPE_VOIDP,  # phPeerEnum : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2pgraph")]
extern "system" {
    fn PeerGraphSearchRecords(
        hGraph: *mut (),  // void*
        pwzCriteria: *const u16,  // LPCWSTR
        phPeerEnum: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphSearchRecords(IntPtr hGraph, [MarshalAs(UnmanagedType.LPWStr)] string pwzCriteria, IntPtr phPeerEnum);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphSearchRecords' -Namespace Win32 -PassThru
# $api::PeerGraphSearchRecords(hGraph, pwzCriteria, phPeerEnum)
#uselib "P2PGRAPH.dll"
#func global PeerGraphSearchRecords "PeerGraphSearchRecords" sptr, sptr, sptr
; PeerGraphSearchRecords hGraph, pwzCriteria, phPeerEnum   ; 戻り値は stat
; hGraph : void* -> "sptr"
; pwzCriteria : LPCWSTR -> "sptr"
; phPeerEnum : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphSearchRecords "PeerGraphSearchRecords" sptr, wstr, sptr
; res = PeerGraphSearchRecords(hGraph, pwzCriteria, phPeerEnum)
; hGraph : void* -> "sptr"
; pwzCriteria : LPCWSTR -> "wstr"
; phPeerEnum : void** out -> "sptr"
; HRESULT PeerGraphSearchRecords(void* hGraph, LPCWSTR pwzCriteria, void** phPeerEnum)
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphSearchRecords "PeerGraphSearchRecords" intptr, wstr, intptr
; res = PeerGraphSearchRecords(hGraph, pwzCriteria, phPeerEnum)
; hGraph : void* -> "intptr"
; pwzCriteria : LPCWSTR -> "wstr"
; phPeerEnum : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphSearchRecords = p2pgraph.NewProc("PeerGraphSearchRecords")
)

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