ホーム › NetworkManagement.NetworkDiagnosticsFramework › NdfCreateGroupingIncident
NdfCreateGroupingIncident
関数ピアグループ化に関する診断インシデントを作成する。
シグネチャ
// NDFAPI.dll
#include <windows.h>
HRESULT NdfCreateGroupingIncident(
LPCWSTR CloudName, // optional
LPCWSTR GroupName, // optional
LPCWSTR Identity, // optional
LPCWSTR Invitation, // optional
SOCKET_ADDRESS_LIST* Addresses, // optional
LPCWSTR appId, // optional
void** handle
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| CloudName | LPCWSTR | inoptional | 診断対象のP2Pグループのクラウド名を指定する。NULL可。 |
| GroupName | LPCWSTR | inoptional | 診断対象のグループ名(ピア名)を指定する。 |
| Identity | LPCWSTR | inoptional | グループ参加に使うアイデンティティを指定する。NULL可。 |
| Invitation | LPCWSTR | inoptional | グループ招待文字列を指定する。NULL可。 |
| Addresses | SOCKET_ADDRESS_LIST* | inoptional | 接続先アドレス一覧SOCKET_ADDRESS_LIST構造体へのポインター。NULL可。 |
| appId | LPCWSTR | inoptional | 対象アプリケーションの識別子を指定する。NULL可。 |
| handle | void** | out | 作成された診断インシデントのハンドルを受け取るポインター。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// NDFAPI.dll
#include <windows.h>
HRESULT NdfCreateGroupingIncident(
LPCWSTR CloudName, // optional
LPCWSTR GroupName, // optional
LPCWSTR Identity, // optional
LPCWSTR Invitation, // optional
SOCKET_ADDRESS_LIST* Addresses, // optional
LPCWSTR appId, // optional
void** handle
);[DllImport("NDFAPI.dll", ExactSpelling = true)]
static extern int NdfCreateGroupingIncident(
[MarshalAs(UnmanagedType.LPWStr)] string CloudName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string GroupName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string Identity, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string Invitation, // LPCWSTR optional
IntPtr Addresses, // SOCKET_ADDRESS_LIST* optional
[MarshalAs(UnmanagedType.LPWStr)] string appId, // LPCWSTR optional
IntPtr handle // void** out
);<DllImport("NDFAPI.dll", ExactSpelling:=True)>
Public Shared Function NdfCreateGroupingIncident(
<MarshalAs(UnmanagedType.LPWStr)> CloudName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> GroupName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> Identity As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> Invitation As String, ' LPCWSTR optional
Addresses As IntPtr, ' SOCKET_ADDRESS_LIST* optional
<MarshalAs(UnmanagedType.LPWStr)> appId As String, ' LPCWSTR optional
handle As IntPtr ' void** out
) As Integer
End Function' CloudName : LPCWSTR optional
' GroupName : LPCWSTR optional
' Identity : LPCWSTR optional
' Invitation : LPCWSTR optional
' Addresses : SOCKET_ADDRESS_LIST* optional
' appId : LPCWSTR optional
' handle : void** out
Declare PtrSafe Function NdfCreateGroupingIncident Lib "ndfapi" ( _
ByVal CloudName As LongPtr, _
ByVal GroupName As LongPtr, _
ByVal Identity As LongPtr, _
ByVal Invitation As LongPtr, _
ByVal Addresses As LongPtr, _
ByVal appId As LongPtr, _
ByVal handle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NdfCreateGroupingIncident = ctypes.windll.ndfapi.NdfCreateGroupingIncident
NdfCreateGroupingIncident.restype = ctypes.c_int
NdfCreateGroupingIncident.argtypes = [
wintypes.LPCWSTR, # CloudName : LPCWSTR optional
wintypes.LPCWSTR, # GroupName : LPCWSTR optional
wintypes.LPCWSTR, # Identity : LPCWSTR optional
wintypes.LPCWSTR, # Invitation : LPCWSTR optional
ctypes.c_void_p, # Addresses : SOCKET_ADDRESS_LIST* optional
wintypes.LPCWSTR, # appId : LPCWSTR optional
ctypes.c_void_p, # handle : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NDFAPI.dll')
NdfCreateGroupingIncident = Fiddle::Function.new(
lib['NdfCreateGroupingIncident'],
[
Fiddle::TYPE_VOIDP, # CloudName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # GroupName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # Identity : LPCWSTR optional
Fiddle::TYPE_VOIDP, # Invitation : LPCWSTR optional
Fiddle::TYPE_VOIDP, # Addresses : SOCKET_ADDRESS_LIST* optional
Fiddle::TYPE_VOIDP, # appId : LPCWSTR optional
Fiddle::TYPE_VOIDP, # handle : void** out
],
Fiddle::TYPE_INT)#[link(name = "ndfapi")]
extern "system" {
fn NdfCreateGroupingIncident(
CloudName: *const u16, // LPCWSTR optional
GroupName: *const u16, // LPCWSTR optional
Identity: *const u16, // LPCWSTR optional
Invitation: *const u16, // LPCWSTR optional
Addresses: *mut SOCKET_ADDRESS_LIST, // SOCKET_ADDRESS_LIST* optional
appId: *const u16, // LPCWSTR optional
handle: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NDFAPI.dll")]
public static extern int NdfCreateGroupingIncident([MarshalAs(UnmanagedType.LPWStr)] string CloudName, [MarshalAs(UnmanagedType.LPWStr)] string GroupName, [MarshalAs(UnmanagedType.LPWStr)] string Identity, [MarshalAs(UnmanagedType.LPWStr)] string Invitation, IntPtr Addresses, [MarshalAs(UnmanagedType.LPWStr)] string appId, IntPtr handle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NDFAPI_NdfCreateGroupingIncident' -Namespace Win32 -PassThru
# $api::NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)#uselib "NDFAPI.dll"
#func global NdfCreateGroupingIncident "NdfCreateGroupingIncident" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; NdfCreateGroupingIncident CloudName, GroupName, Identity, Invitation, varptr(Addresses), appId, handle ; 戻り値は stat
; CloudName : LPCWSTR optional -> "sptr"
; GroupName : LPCWSTR optional -> "sptr"
; Identity : LPCWSTR optional -> "sptr"
; Invitation : LPCWSTR optional -> "sptr"
; Addresses : SOCKET_ADDRESS_LIST* optional -> "sptr"
; appId : LPCWSTR optional -> "sptr"
; handle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "NDFAPI.dll" #cfunc global NdfCreateGroupingIncident "NdfCreateGroupingIncident" wstr, wstr, wstr, wstr, var, wstr, sptr ; res = NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle) ; CloudName : LPCWSTR optional -> "wstr" ; GroupName : LPCWSTR optional -> "wstr" ; Identity : LPCWSTR optional -> "wstr" ; Invitation : LPCWSTR optional -> "wstr" ; Addresses : SOCKET_ADDRESS_LIST* optional -> "var" ; appId : LPCWSTR optional -> "wstr" ; handle : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "NDFAPI.dll" #cfunc global NdfCreateGroupingIncident "NdfCreateGroupingIncident" wstr, wstr, wstr, wstr, sptr, wstr, sptr ; res = NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, varptr(Addresses), appId, handle) ; CloudName : LPCWSTR optional -> "wstr" ; GroupName : LPCWSTR optional -> "wstr" ; Identity : LPCWSTR optional -> "wstr" ; Invitation : LPCWSTR optional -> "wstr" ; Addresses : SOCKET_ADDRESS_LIST* optional -> "sptr" ; appId : LPCWSTR optional -> "wstr" ; handle : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT NdfCreateGroupingIncident(LPCWSTR CloudName, LPCWSTR GroupName, LPCWSTR Identity, LPCWSTR Invitation, SOCKET_ADDRESS_LIST* Addresses, LPCWSTR appId, void** handle) #uselib "NDFAPI.dll" #cfunc global NdfCreateGroupingIncident "NdfCreateGroupingIncident" wstr, wstr, wstr, wstr, var, wstr, intptr ; res = NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle) ; CloudName : LPCWSTR optional -> "wstr" ; GroupName : LPCWSTR optional -> "wstr" ; Identity : LPCWSTR optional -> "wstr" ; Invitation : LPCWSTR optional -> "wstr" ; Addresses : SOCKET_ADDRESS_LIST* optional -> "var" ; appId : LPCWSTR optional -> "wstr" ; handle : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT NdfCreateGroupingIncident(LPCWSTR CloudName, LPCWSTR GroupName, LPCWSTR Identity, LPCWSTR Invitation, SOCKET_ADDRESS_LIST* Addresses, LPCWSTR appId, void** handle) #uselib "NDFAPI.dll" #cfunc global NdfCreateGroupingIncident "NdfCreateGroupingIncident" wstr, wstr, wstr, wstr, intptr, wstr, intptr ; res = NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, varptr(Addresses), appId, handle) ; CloudName : LPCWSTR optional -> "wstr" ; GroupName : LPCWSTR optional -> "wstr" ; Identity : LPCWSTR optional -> "wstr" ; Invitation : LPCWSTR optional -> "wstr" ; Addresses : SOCKET_ADDRESS_LIST* optional -> "intptr" ; appId : LPCWSTR optional -> "wstr" ; handle : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ndfapi = windows.NewLazySystemDLL("NDFAPI.dll")
procNdfCreateGroupingIncident = ndfapi.NewProc("NdfCreateGroupingIncident")
)
// CloudName (LPCWSTR optional), GroupName (LPCWSTR optional), Identity (LPCWSTR optional), Invitation (LPCWSTR optional), Addresses (SOCKET_ADDRESS_LIST* optional), appId (LPCWSTR optional), handle (void** out)
r1, _, err := procNdfCreateGroupingIncident.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(CloudName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(GroupName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Identity))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Invitation))),
uintptr(Addresses),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(appId))),
uintptr(handle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction NdfCreateGroupingIncident(
CloudName: PWideChar; // LPCWSTR optional
GroupName: PWideChar; // LPCWSTR optional
Identity: PWideChar; // LPCWSTR optional
Invitation: PWideChar; // LPCWSTR optional
Addresses: Pointer; // SOCKET_ADDRESS_LIST* optional
appId: PWideChar; // LPCWSTR optional
handle: Pointer // void** out
): Integer; stdcall;
external 'NDFAPI.dll' name 'NdfCreateGroupingIncident';result := DllCall("NDFAPI\NdfCreateGroupingIncident"
, "WStr", CloudName ; LPCWSTR optional
, "WStr", GroupName ; LPCWSTR optional
, "WStr", Identity ; LPCWSTR optional
, "WStr", Invitation ; LPCWSTR optional
, "Ptr", Addresses ; SOCKET_ADDRESS_LIST* optional
, "WStr", appId ; LPCWSTR optional
, "Ptr", handle ; void** out
, "Int") ; return: HRESULT●NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle) = DLL("NDFAPI.dll", "int NdfCreateGroupingIncident(char*, char*, char*, char*, void*, char*, void*)")
# 呼び出し: NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)
# CloudName : LPCWSTR optional -> "char*"
# GroupName : LPCWSTR optional -> "char*"
# Identity : LPCWSTR optional -> "char*"
# Invitation : LPCWSTR optional -> "char*"
# Addresses : SOCKET_ADDRESS_LIST* optional -> "void*"
# appId : LPCWSTR optional -> "char*"
# handle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ndfapi" fn NdfCreateGroupingIncident(
CloudName: [*c]const u16, // LPCWSTR optional
GroupName: [*c]const u16, // LPCWSTR optional
Identity: [*c]const u16, // LPCWSTR optional
Invitation: [*c]const u16, // LPCWSTR optional
Addresses: [*c]SOCKET_ADDRESS_LIST, // SOCKET_ADDRESS_LIST* optional
appId: [*c]const u16, // LPCWSTR optional
handle: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;proc NdfCreateGroupingIncident(
CloudName: WideCString, # LPCWSTR optional
GroupName: WideCString, # LPCWSTR optional
Identity: WideCString, # LPCWSTR optional
Invitation: WideCString, # LPCWSTR optional
Addresses: ptr SOCKET_ADDRESS_LIST, # SOCKET_ADDRESS_LIST* optional
appId: WideCString, # LPCWSTR optional
handle: pointer # void** out
): int32 {.importc: "NdfCreateGroupingIncident", stdcall, dynlib: "NDFAPI.dll".}pragma(lib, "ndfapi");
extern(Windows)
int NdfCreateGroupingIncident(
const(wchar)* CloudName, // LPCWSTR optional
const(wchar)* GroupName, // LPCWSTR optional
const(wchar)* Identity, // LPCWSTR optional
const(wchar)* Invitation, // LPCWSTR optional
SOCKET_ADDRESS_LIST* Addresses, // SOCKET_ADDRESS_LIST* optional
const(wchar)* appId, // LPCWSTR optional
void** handle // void** out
);ccall((:NdfCreateGroupingIncident, "NDFAPI.dll"), stdcall, Int32,
(Cwstring, Cwstring, Cwstring, Cwstring, Ptr{SOCKET_ADDRESS_LIST}, Cwstring, Ptr{Cvoid}),
CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)
# CloudName : LPCWSTR optional -> Cwstring
# GroupName : LPCWSTR optional -> Cwstring
# Identity : LPCWSTR optional -> Cwstring
# Invitation : LPCWSTR optional -> Cwstring
# Addresses : SOCKET_ADDRESS_LIST* optional -> Ptr{SOCKET_ADDRESS_LIST}
# appId : LPCWSTR optional -> Cwstring
# handle : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t NdfCreateGroupingIncident(
const uint16_t* CloudName,
const uint16_t* GroupName,
const uint16_t* Identity,
const uint16_t* Invitation,
void* Addresses,
const uint16_t* appId,
void** handle);
]]
local ndfapi = ffi.load("ndfapi")
-- ndfapi.NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)
-- CloudName : LPCWSTR optional
-- GroupName : LPCWSTR optional
-- Identity : LPCWSTR optional
-- Invitation : LPCWSTR optional
-- Addresses : SOCKET_ADDRESS_LIST* optional
-- appId : LPCWSTR optional
-- handle : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('NDFAPI.dll');
const NdfCreateGroupingIncident = lib.func('__stdcall', 'NdfCreateGroupingIncident', 'int32_t', ['str16', 'str16', 'str16', 'str16', 'void *', 'str16', 'void *']);
// NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)
// CloudName : LPCWSTR optional -> 'str16'
// GroupName : LPCWSTR optional -> 'str16'
// Identity : LPCWSTR optional -> 'str16'
// Invitation : LPCWSTR optional -> 'str16'
// Addresses : SOCKET_ADDRESS_LIST* optional -> 'void *'
// appId : LPCWSTR optional -> 'str16'
// handle : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("NDFAPI.dll", {
NdfCreateGroupingIncident: { parameters: ["buffer", "buffer", "buffer", "buffer", "pointer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle)
// CloudName : LPCWSTR optional -> "buffer"
// GroupName : LPCWSTR optional -> "buffer"
// Identity : LPCWSTR optional -> "buffer"
// Invitation : LPCWSTR optional -> "buffer"
// Addresses : SOCKET_ADDRESS_LIST* optional -> "pointer"
// appId : LPCWSTR optional -> "buffer"
// handle : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t NdfCreateGroupingIncident(
const uint16_t* CloudName,
const uint16_t* GroupName,
const uint16_t* Identity,
const uint16_t* Invitation,
void* Addresses,
const uint16_t* appId,
void** handle);
C, "NDFAPI.dll");
// $ffi->NdfCreateGroupingIncident(CloudName, GroupName, Identity, Invitation, Addresses, appId, handle);
// CloudName : LPCWSTR optional
// GroupName : LPCWSTR optional
// Identity : LPCWSTR optional
// Invitation : LPCWSTR optional
// Addresses : SOCKET_ADDRESS_LIST* optional
// appId : LPCWSTR optional
// handle : void** 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 Ndfapi extends StdCallLibrary {
Ndfapi INSTANCE = Native.load("ndfapi", Ndfapi.class);
int NdfCreateGroupingIncident(
WString CloudName, // LPCWSTR optional
WString GroupName, // LPCWSTR optional
WString Identity, // LPCWSTR optional
WString Invitation, // LPCWSTR optional
Pointer Addresses, // SOCKET_ADDRESS_LIST* optional
WString appId, // LPCWSTR optional
Pointer handle // void** out
);
}@[Link("ndfapi")]
lib LibNDFAPI
fun NdfCreateGroupingIncident = NdfCreateGroupingIncident(
CloudName : UInt16*, # LPCWSTR optional
GroupName : UInt16*, # LPCWSTR optional
Identity : UInt16*, # LPCWSTR optional
Invitation : UInt16*, # LPCWSTR optional
Addresses : SOCKET_ADDRESS_LIST*, # SOCKET_ADDRESS_LIST* optional
appId : UInt16*, # LPCWSTR optional
handle : Void** # void** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef NdfCreateGroupingIncidentNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
typedef NdfCreateGroupingIncidentDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
final NdfCreateGroupingIncident = DynamicLibrary.open('NDFAPI.dll')
.lookupFunction<NdfCreateGroupingIncidentNative, NdfCreateGroupingIncidentDart>('NdfCreateGroupingIncident');
// CloudName : LPCWSTR optional -> Pointer<Utf16>
// GroupName : LPCWSTR optional -> Pointer<Utf16>
// Identity : LPCWSTR optional -> Pointer<Utf16>
// Invitation : LPCWSTR optional -> Pointer<Utf16>
// Addresses : SOCKET_ADDRESS_LIST* optional -> Pointer<Void>
// appId : LPCWSTR optional -> Pointer<Utf16>
// handle : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function NdfCreateGroupingIncident(
CloudName: PWideChar; // LPCWSTR optional
GroupName: PWideChar; // LPCWSTR optional
Identity: PWideChar; // LPCWSTR optional
Invitation: PWideChar; // LPCWSTR optional
Addresses: Pointer; // SOCKET_ADDRESS_LIST* optional
appId: PWideChar; // LPCWSTR optional
handle: Pointer // void** out
): Integer; stdcall;
external 'NDFAPI.dll' name 'NdfCreateGroupingIncident';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "NdfCreateGroupingIncident"
c_NdfCreateGroupingIncident :: CWString -> CWString -> CWString -> CWString -> Ptr () -> CWString -> Ptr () -> IO Int32
-- CloudName : LPCWSTR optional -> CWString
-- GroupName : LPCWSTR optional -> CWString
-- Identity : LPCWSTR optional -> CWString
-- Invitation : LPCWSTR optional -> CWString
-- Addresses : SOCKET_ADDRESS_LIST* optional -> Ptr ()
-- appId : LPCWSTR optional -> CWString
-- handle : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ndfcreategroupingincident =
foreign "NdfCreateGroupingIncident"
((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* CloudName : LPCWSTR optional -> (ptr uint16_t) *)
(* GroupName : LPCWSTR optional -> (ptr uint16_t) *)
(* Identity : LPCWSTR optional -> (ptr uint16_t) *)
(* Invitation : LPCWSTR optional -> (ptr uint16_t) *)
(* Addresses : SOCKET_ADDRESS_LIST* optional -> (ptr void) *)
(* appId : LPCWSTR optional -> (ptr uint16_t) *)
(* handle : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ndfapi (t "NDFAPI.dll"))
(cffi:use-foreign-library ndfapi)
(cffi:defcfun ("NdfCreateGroupingIncident" ndf-create-grouping-incident :convention :stdcall) :int32
(cloud-name (:string :encoding :utf-16le)) ; LPCWSTR optional
(group-name (:string :encoding :utf-16le)) ; LPCWSTR optional
(identity (:string :encoding :utf-16le)) ; LPCWSTR optional
(invitation (:string :encoding :utf-16le)) ; LPCWSTR optional
(addresses :pointer) ; SOCKET_ADDRESS_LIST* optional
(app-id (:string :encoding :utf-16le)) ; LPCWSTR optional
(handle :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $NdfCreateGroupingIncident = Win32::API::More->new('NDFAPI',
'int NdfCreateGroupingIncident(LPCWSTR CloudName, LPCWSTR GroupName, LPCWSTR Identity, LPCWSTR Invitation, LPVOID Addresses, LPCWSTR appId, LPVOID handle)');
# my $ret = $NdfCreateGroupingIncident->Call($CloudName, $GroupName, $Identity, $Invitation, $Addresses, $appId, $handle);
# CloudName : LPCWSTR optional -> LPCWSTR
# GroupName : LPCWSTR optional -> LPCWSTR
# Identity : LPCWSTR optional -> LPCWSTR
# Invitation : LPCWSTR optional -> LPCWSTR
# Addresses : SOCKET_ADDRESS_LIST* optional -> LPVOID
# appId : LPCWSTR optional -> LPCWSTR
# handle : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。