ホーム › Networking.Clustering › ClusterNetInterfaceControl
ClusterNetInterfaceControl
関数ネットワークインターフェイスに制御コードを発行する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterNetInterfaceControl(
HNETINTERFACE hNetInterface,
HNODE hHostNode, // optional
DWORD dwControlCode,
void* lpInBuffer, // optional
DWORD nInBufferSize,
void* lpOutBuffer, // optional
DWORD nOutBufferSize,
DWORD* lpBytesReturned // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hNetInterface | HNETINTERFACE | in | 制御操作の対象となるネットワークインターフェイスハンドル。 |
| hHostNode | HNODE | inoptional | 操作を実行するノードのハンドル。NULL可で既定ノードを使う。 |
| dwControlCode | DWORD | in | 実行する制御操作を示すコントロールコード(CLUSCTL_NETINTERFACE_*)。 |
| lpInBuffer | void* | inoptional | 入力データを格納するバッファ。不要ならNULL可。 |
| nInBufferSize | DWORD | in | lpInBufferのサイズ(バイト)。 |
| lpOutBuffer | void* | outoptional | 出力データを受け取るバッファ。不要ならNULL可。 |
| nOutBufferSize | DWORD | in | lpOutBufferのサイズ(バイト)。 |
| lpBytesReturned | DWORD* | outoptional | 出力に書き込まれた実バイト数を受け取るDWORDポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterNetInterfaceControl(
HNETINTERFACE hNetInterface,
HNODE hHostNode, // optional
DWORD dwControlCode,
void* lpInBuffer, // optional
DWORD nInBufferSize,
void* lpOutBuffer, // optional
DWORD nOutBufferSize,
DWORD* lpBytesReturned // optional
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterNetInterfaceControl(
IntPtr hNetInterface, // HNETINTERFACE
IntPtr hHostNode, // HNODE optional
uint dwControlCode, // DWORD
IntPtr lpInBuffer, // void* optional
uint nInBufferSize, // DWORD
IntPtr lpOutBuffer, // void* optional, out
uint nOutBufferSize, // DWORD
IntPtr lpBytesReturned // DWORD* optional, out
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterNetInterfaceControl(
hNetInterface As IntPtr, ' HNETINTERFACE
hHostNode As IntPtr, ' HNODE optional
dwControlCode As UInteger, ' DWORD
lpInBuffer As IntPtr, ' void* optional
nInBufferSize As UInteger, ' DWORD
lpOutBuffer As IntPtr, ' void* optional, out
nOutBufferSize As UInteger, ' DWORD
lpBytesReturned As IntPtr ' DWORD* optional, out
) As UInteger
End Function' hNetInterface : HNETINTERFACE
' hHostNode : HNODE optional
' dwControlCode : DWORD
' lpInBuffer : void* optional
' nInBufferSize : DWORD
' lpOutBuffer : void* optional, out
' nOutBufferSize : DWORD
' lpBytesReturned : DWORD* optional, out
Declare PtrSafe Function ClusterNetInterfaceControl Lib "clusapi" ( _
ByVal hNetInterface As LongPtr, _
ByVal hHostNode As LongPtr, _
ByVal dwControlCode As Long, _
ByVal lpInBuffer As LongPtr, _
ByVal nInBufferSize As Long, _
ByVal lpOutBuffer As LongPtr, _
ByVal nOutBufferSize As Long, _
ByVal lpBytesReturned As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusterNetInterfaceControl = ctypes.windll.clusapi.ClusterNetInterfaceControl
ClusterNetInterfaceControl.restype = wintypes.DWORD
ClusterNetInterfaceControl.argtypes = [
ctypes.c_ssize_t, # hNetInterface : HNETINTERFACE
ctypes.c_ssize_t, # hHostNode : HNODE optional
wintypes.DWORD, # dwControlCode : DWORD
ctypes.POINTER(None), # lpInBuffer : void* optional
wintypes.DWORD, # nInBufferSize : DWORD
ctypes.POINTER(None), # lpOutBuffer : void* optional, out
wintypes.DWORD, # nOutBufferSize : DWORD
ctypes.POINTER(wintypes.DWORD), # lpBytesReturned : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterNetInterfaceControl = Fiddle::Function.new(
lib['ClusterNetInterfaceControl'],
[
Fiddle::TYPE_INTPTR_T, # hNetInterface : HNETINTERFACE
Fiddle::TYPE_INTPTR_T, # hHostNode : HNODE optional
-Fiddle::TYPE_INT, # dwControlCode : DWORD
Fiddle::TYPE_VOIDP, # lpInBuffer : void* optional
-Fiddle::TYPE_INT, # nInBufferSize : DWORD
Fiddle::TYPE_VOIDP, # lpOutBuffer : void* optional, out
-Fiddle::TYPE_INT, # nOutBufferSize : DWORD
Fiddle::TYPE_VOIDP, # lpBytesReturned : DWORD* optional, out
],
-Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn ClusterNetInterfaceControl(
hNetInterface: isize, // HNETINTERFACE
hHostNode: isize, // HNODE optional
dwControlCode: u32, // DWORD
lpInBuffer: *mut (), // void* optional
nInBufferSize: u32, // DWORD
lpOutBuffer: *mut (), // void* optional, out
nOutBufferSize: u32, // DWORD
lpBytesReturned: *mut u32 // DWORD* optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterNetInterfaceControl(IntPtr hNetInterface, IntPtr hHostNode, uint dwControlCode, IntPtr lpInBuffer, uint nInBufferSize, IntPtr lpOutBuffer, uint nOutBufferSize, IntPtr lpBytesReturned);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterNetInterfaceControl' -Namespace Win32 -PassThru
# $api::ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)#uselib "CLUSAPI.dll"
#func global ClusterNetInterfaceControl "ClusterNetInterfaceControl" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ClusterNetInterfaceControl hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, varptr(lpBytesReturned) ; 戻り値は stat
; hNetInterface : HNETINTERFACE -> "sptr"
; hHostNode : HNODE optional -> "sptr"
; dwControlCode : DWORD -> "sptr"
; lpInBuffer : void* optional -> "sptr"
; nInBufferSize : DWORD -> "sptr"
; lpOutBuffer : void* optional, out -> "sptr"
; nOutBufferSize : DWORD -> "sptr"
; lpBytesReturned : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CLUSAPI.dll" #cfunc global ClusterNetInterfaceControl "ClusterNetInterfaceControl" sptr, sptr, int, sptr, int, sptr, int, var ; res = ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned) ; hNetInterface : HNETINTERFACE -> "sptr" ; hHostNode : HNODE optional -> "sptr" ; dwControlCode : DWORD -> "int" ; lpInBuffer : void* optional -> "sptr" ; nInBufferSize : DWORD -> "int" ; lpOutBuffer : void* optional, out -> "sptr" ; nOutBufferSize : DWORD -> "int" ; lpBytesReturned : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global ClusterNetInterfaceControl "ClusterNetInterfaceControl" sptr, sptr, int, sptr, int, sptr, int, sptr ; res = ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, varptr(lpBytesReturned)) ; hNetInterface : HNETINTERFACE -> "sptr" ; hHostNode : HNODE optional -> "sptr" ; dwControlCode : DWORD -> "int" ; lpInBuffer : void* optional -> "sptr" ; nInBufferSize : DWORD -> "int" ; lpOutBuffer : void* optional, out -> "sptr" ; nOutBufferSize : DWORD -> "int" ; lpBytesReturned : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ClusterNetInterfaceControl(HNETINTERFACE hNetInterface, HNODE hHostNode, DWORD dwControlCode, void* lpInBuffer, DWORD nInBufferSize, void* lpOutBuffer, DWORD nOutBufferSize, DWORD* lpBytesReturned) #uselib "CLUSAPI.dll" #cfunc global ClusterNetInterfaceControl "ClusterNetInterfaceControl" intptr, intptr, int, intptr, int, intptr, int, var ; res = ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned) ; hNetInterface : HNETINTERFACE -> "intptr" ; hHostNode : HNODE optional -> "intptr" ; dwControlCode : DWORD -> "int" ; lpInBuffer : void* optional -> "intptr" ; nInBufferSize : DWORD -> "int" ; lpOutBuffer : void* optional, out -> "intptr" ; nOutBufferSize : DWORD -> "int" ; lpBytesReturned : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ClusterNetInterfaceControl(HNETINTERFACE hNetInterface, HNODE hHostNode, DWORD dwControlCode, void* lpInBuffer, DWORD nInBufferSize, void* lpOutBuffer, DWORD nOutBufferSize, DWORD* lpBytesReturned) #uselib "CLUSAPI.dll" #cfunc global ClusterNetInterfaceControl "ClusterNetInterfaceControl" intptr, intptr, int, intptr, int, intptr, int, intptr ; res = ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, varptr(lpBytesReturned)) ; hNetInterface : HNETINTERFACE -> "intptr" ; hHostNode : HNODE optional -> "intptr" ; dwControlCode : DWORD -> "int" ; lpInBuffer : void* optional -> "intptr" ; nInBufferSize : DWORD -> "int" ; lpOutBuffer : void* optional, out -> "intptr" ; nOutBufferSize : DWORD -> "int" ; lpBytesReturned : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusterNetInterfaceControl = clusapi.NewProc("ClusterNetInterfaceControl")
)
// hNetInterface (HNETINTERFACE), hHostNode (HNODE optional), dwControlCode (DWORD), lpInBuffer (void* optional), nInBufferSize (DWORD), lpOutBuffer (void* optional, out), nOutBufferSize (DWORD), lpBytesReturned (DWORD* optional, out)
r1, _, err := procClusterNetInterfaceControl.Call(
uintptr(hNetInterface),
uintptr(hHostNode),
uintptr(dwControlCode),
uintptr(lpInBuffer),
uintptr(nInBufferSize),
uintptr(lpOutBuffer),
uintptr(nOutBufferSize),
uintptr(lpBytesReturned),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ClusterNetInterfaceControl(
hNetInterface: NativeInt; // HNETINTERFACE
hHostNode: NativeInt; // HNODE optional
dwControlCode: DWORD; // DWORD
lpInBuffer: Pointer; // void* optional
nInBufferSize: DWORD; // DWORD
lpOutBuffer: Pointer; // void* optional, out
nOutBufferSize: DWORD; // DWORD
lpBytesReturned: Pointer // DWORD* optional, out
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'ClusterNetInterfaceControl';result := DllCall("CLUSAPI\ClusterNetInterfaceControl"
, "Ptr", hNetInterface ; HNETINTERFACE
, "Ptr", hHostNode ; HNODE optional
, "UInt", dwControlCode ; DWORD
, "Ptr", lpInBuffer ; void* optional
, "UInt", nInBufferSize ; DWORD
, "Ptr", lpOutBuffer ; void* optional, out
, "UInt", nOutBufferSize ; DWORD
, "Ptr", lpBytesReturned ; DWORD* optional, out
, "UInt") ; return: DWORD●ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned) = DLL("CLUSAPI.dll", "dword ClusterNetInterfaceControl(int, int, dword, void*, dword, void*, dword, void*)")
# 呼び出し: ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)
# hNetInterface : HNETINTERFACE -> "int"
# hHostNode : HNODE optional -> "int"
# dwControlCode : DWORD -> "dword"
# lpInBuffer : void* optional -> "void*"
# nInBufferSize : DWORD -> "dword"
# lpOutBuffer : void* optional, out -> "void*"
# nOutBufferSize : DWORD -> "dword"
# lpBytesReturned : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clusapi" fn ClusterNetInterfaceControl(
hNetInterface: isize, // HNETINTERFACE
hHostNode: isize, // HNODE optional
dwControlCode: u32, // DWORD
lpInBuffer: ?*anyopaque, // void* optional
nInBufferSize: u32, // DWORD
lpOutBuffer: ?*anyopaque, // void* optional, out
nOutBufferSize: u32, // DWORD
lpBytesReturned: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) u32;proc ClusterNetInterfaceControl(
hNetInterface: int, # HNETINTERFACE
hHostNode: int, # HNODE optional
dwControlCode: uint32, # DWORD
lpInBuffer: pointer, # void* optional
nInBufferSize: uint32, # DWORD
lpOutBuffer: pointer, # void* optional, out
nOutBufferSize: uint32, # DWORD
lpBytesReturned: ptr uint32 # DWORD* optional, out
): uint32 {.importc: "ClusterNetInterfaceControl", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
uint ClusterNetInterfaceControl(
ptrdiff_t hNetInterface, // HNETINTERFACE
ptrdiff_t hHostNode, // HNODE optional
uint dwControlCode, // DWORD
void* lpInBuffer, // void* optional
uint nInBufferSize, // DWORD
void* lpOutBuffer, // void* optional, out
uint nOutBufferSize, // DWORD
uint* lpBytesReturned // DWORD* optional, out
);ccall((:ClusterNetInterfaceControl, "CLUSAPI.dll"), stdcall, UInt32,
(Int, Int, UInt32, Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)
# hNetInterface : HNETINTERFACE -> Int
# hHostNode : HNODE optional -> Int
# dwControlCode : DWORD -> UInt32
# lpInBuffer : void* optional -> Ptr{Cvoid}
# nInBufferSize : DWORD -> UInt32
# lpOutBuffer : void* optional, out -> Ptr{Cvoid}
# nOutBufferSize : DWORD -> UInt32
# lpBytesReturned : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t ClusterNetInterfaceControl(
intptr_t hNetInterface,
intptr_t hHostNode,
uint32_t dwControlCode,
void* lpInBuffer,
uint32_t nInBufferSize,
void* lpOutBuffer,
uint32_t nOutBufferSize,
uint32_t* lpBytesReturned);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)
-- hNetInterface : HNETINTERFACE
-- hHostNode : HNODE optional
-- dwControlCode : DWORD
-- lpInBuffer : void* optional
-- nInBufferSize : DWORD
-- lpOutBuffer : void* optional, out
-- nOutBufferSize : DWORD
-- lpBytesReturned : DWORD* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterNetInterfaceControl = lib.func('__stdcall', 'ClusterNetInterfaceControl', 'uint32_t', ['intptr_t', 'intptr_t', 'uint32_t', 'void *', 'uint32_t', 'void *', 'uint32_t', 'uint32_t *']);
// ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)
// hNetInterface : HNETINTERFACE -> 'intptr_t'
// hHostNode : HNODE optional -> 'intptr_t'
// dwControlCode : DWORD -> 'uint32_t'
// lpInBuffer : void* optional -> 'void *'
// nInBufferSize : DWORD -> 'uint32_t'
// lpOutBuffer : void* optional, out -> 'void *'
// nOutBufferSize : DWORD -> 'uint32_t'
// lpBytesReturned : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
ClusterNetInterfaceControl: { parameters: ["isize", "isize", "u32", "pointer", "u32", "pointer", "u32", "pointer"], result: "u32" },
});
// lib.symbols.ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned)
// hNetInterface : HNETINTERFACE -> "isize"
// hHostNode : HNODE optional -> "isize"
// dwControlCode : DWORD -> "u32"
// lpInBuffer : void* optional -> "pointer"
// nInBufferSize : DWORD -> "u32"
// lpOutBuffer : void* optional, out -> "pointer"
// nOutBufferSize : DWORD -> "u32"
// lpBytesReturned : DWORD* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ClusterNetInterfaceControl(
intptr_t hNetInterface,
intptr_t hHostNode,
uint32_t dwControlCode,
void* lpInBuffer,
uint32_t nInBufferSize,
void* lpOutBuffer,
uint32_t nOutBufferSize,
uint32_t* lpBytesReturned);
C, "CLUSAPI.dll");
// $ffi->ClusterNetInterfaceControl(hNetInterface, hHostNode, dwControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned);
// hNetInterface : HNETINTERFACE
// hHostNode : HNODE optional
// dwControlCode : DWORD
// lpInBuffer : void* optional
// nInBufferSize : DWORD
// lpOutBuffer : void* optional, out
// nOutBufferSize : DWORD
// lpBytesReturned : DWORD* optional, 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 Clusapi extends StdCallLibrary {
Clusapi INSTANCE = Native.load("clusapi", Clusapi.class);
int ClusterNetInterfaceControl(
long hNetInterface, // HNETINTERFACE
long hHostNode, // HNODE optional
int dwControlCode, // DWORD
Pointer lpInBuffer, // void* optional
int nInBufferSize, // DWORD
Pointer lpOutBuffer, // void* optional, out
int nOutBufferSize, // DWORD
IntByReference lpBytesReturned // DWORD* optional, out
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun ClusterNetInterfaceControl = ClusterNetInterfaceControl(
hNetInterface : LibC::SSizeT, # HNETINTERFACE
hHostNode : LibC::SSizeT, # HNODE optional
dwControlCode : UInt32, # DWORD
lpInBuffer : Void*, # void* optional
nInBufferSize : UInt32, # DWORD
lpOutBuffer : Void*, # void* optional, out
nOutBufferSize : UInt32, # DWORD
lpBytesReturned : UInt32* # DWORD* optional, out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ClusterNetInterfaceControlNative = Uint32 Function(IntPtr, IntPtr, Uint32, Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef ClusterNetInterfaceControlDart = int Function(int, int, int, Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>);
final ClusterNetInterfaceControl = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<ClusterNetInterfaceControlNative, ClusterNetInterfaceControlDart>('ClusterNetInterfaceControl');
// hNetInterface : HNETINTERFACE -> IntPtr
// hHostNode : HNODE optional -> IntPtr
// dwControlCode : DWORD -> Uint32
// lpInBuffer : void* optional -> Pointer<Void>
// nInBufferSize : DWORD -> Uint32
// lpOutBuffer : void* optional, out -> Pointer<Void>
// nOutBufferSize : DWORD -> Uint32
// lpBytesReturned : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ClusterNetInterfaceControl(
hNetInterface: NativeInt; // HNETINTERFACE
hHostNode: NativeInt; // HNODE optional
dwControlCode: DWORD; // DWORD
lpInBuffer: Pointer; // void* optional
nInBufferSize: DWORD; // DWORD
lpOutBuffer: Pointer; // void* optional, out
nOutBufferSize: DWORD; // DWORD
lpBytesReturned: Pointer // DWORD* optional, out
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'ClusterNetInterfaceControl';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ClusterNetInterfaceControl"
c_ClusterNetInterfaceControl :: CIntPtr -> CIntPtr -> Word32 -> Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr Word32 -> IO Word32
-- hNetInterface : HNETINTERFACE -> CIntPtr
-- hHostNode : HNODE optional -> CIntPtr
-- dwControlCode : DWORD -> Word32
-- lpInBuffer : void* optional -> Ptr ()
-- nInBufferSize : DWORD -> Word32
-- lpOutBuffer : void* optional, out -> Ptr ()
-- nOutBufferSize : DWORD -> Word32
-- lpBytesReturned : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clusternetinterfacecontrol =
foreign "ClusterNetInterfaceControl"
(intptr_t @-> intptr_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning uint32_t)
(* hNetInterface : HNETINTERFACE -> intptr_t *)
(* hHostNode : HNODE optional -> intptr_t *)
(* dwControlCode : DWORD -> uint32_t *)
(* lpInBuffer : void* optional -> (ptr void) *)
(* nInBufferSize : DWORD -> uint32_t *)
(* lpOutBuffer : void* optional, out -> (ptr void) *)
(* nOutBufferSize : DWORD -> uint32_t *)
(* lpBytesReturned : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("ClusterNetInterfaceControl" cluster-net-interface-control :convention :stdcall) :uint32
(h-net-interface :int64) ; HNETINTERFACE
(h-host-node :int64) ; HNODE optional
(dw-control-code :uint32) ; DWORD
(lp-in-buffer :pointer) ; void* optional
(n-in-buffer-size :uint32) ; DWORD
(lp-out-buffer :pointer) ; void* optional, out
(n-out-buffer-size :uint32) ; DWORD
(lp-bytes-returned :pointer)) ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ClusterNetInterfaceControl = Win32::API::More->new('CLUSAPI',
'DWORD ClusterNetInterfaceControl(LPARAM hNetInterface, LPARAM hHostNode, DWORD dwControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPVOID lpBytesReturned)');
# my $ret = $ClusterNetInterfaceControl->Call($hNetInterface, $hHostNode, $dwControlCode, $lpInBuffer, $nInBufferSize, $lpOutBuffer, $nOutBufferSize, $lpBytesReturned);
# hNetInterface : HNETINTERFACE -> LPARAM
# hHostNode : HNODE optional -> LPARAM
# dwControlCode : DWORD -> DWORD
# lpInBuffer : void* optional -> LPVOID
# nInBufferSize : DWORD -> DWORD
# lpOutBuffer : void* optional, out -> LPVOID
# nOutBufferSize : DWORD -> DWORD
# lpBytesReturned : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f ClusterNetInterfaceControlEx — 理由付きでネットワークインターフェイスに制御コードを発行する。