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

PeerGroupIssueCredentials

関数
指定IDに対してグループ参加資格情報を発行する。
DLLP2P.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGroupIssueCredentials(
    void* hGroup,
    LPCWSTR pwzSubjectIdentity,
    PEER_CREDENTIAL_INFO* pCredentialInfo,   // optional
    DWORD dwFlags,
    LPWSTR* ppwzInvitation   // optional
);

パラメーター

名前方向
hGroupvoid*in
pwzSubjectIdentityLPCWSTRin
pCredentialInfoPEER_CREDENTIAL_INFO*inoptional
dwFlagsDWORDin
ppwzInvitationLPWSTR*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

PeerGroupIssueCredentials = ctypes.windll.p2p.PeerGroupIssueCredentials
PeerGroupIssueCredentials.restype = ctypes.c_int
PeerGroupIssueCredentials.argtypes = [
    ctypes.POINTER(None),  # hGroup : void*
    wintypes.LPCWSTR,  # pwzSubjectIdentity : LPCWSTR
    ctypes.c_void_p,  # pCredentialInfo : PEER_CREDENTIAL_INFO* optional
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.c_void_p,  # ppwzInvitation : LPWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerGroupIssueCredentials = p2p.NewProc("PeerGroupIssueCredentials")
)

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