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