Win32 API 日本語リファレンス
ホームNetworking.Clustering › SetClusterGroupNodeListEx

SetClusterGroupNodeListEx

関数
理由付きでクラスターグループの優先ノード一覧を設定する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD SetClusterGroupNodeListEx(
    HGROUP hGroup,
    DWORD NodeCount,
    HNODE* NodeList,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向説明
hGroupHGROUPin優先所有者リストを設定する対象クラスターグループのハンドル。
NodeCountDWORDinNodeList配列に含まれるノード数。
NodeListHNODE*in優先所有者となるノードハンドルの配列へのポインタ。
lpszReasonLPCWSTRinoptional操作の理由を示すワイド文字列。監査ログ用で、NULL可。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD SetClusterGroupNodeListEx(
    HGROUP hGroup,
    DWORD NodeCount,
    HNODE* NodeList,
    LPCWSTR lpszReason   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint SetClusterGroupNodeListEx(
    IntPtr hGroup,   // HGROUP
    uint NodeCount,   // DWORD
    ref IntPtr NodeList,   // HNODE*
    [MarshalAs(UnmanagedType.LPWStr)] string lpszReason   // LPCWSTR optional
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function SetClusterGroupNodeListEx(
    hGroup As IntPtr,   ' HGROUP
    NodeCount As UInteger,   ' DWORD
    ByRef NodeList As IntPtr,   ' HNODE*
    <MarshalAs(UnmanagedType.LPWStr)> lpszReason As String   ' LPCWSTR optional
) As UInteger
End Function
' hGroup : HGROUP
' NodeCount : DWORD
' NodeList : HNODE*
' lpszReason : LPCWSTR optional
Declare PtrSafe Function SetClusterGroupNodeListEx Lib "clusapi" ( _
    ByVal hGroup As LongPtr, _
    ByVal NodeCount As Long, _
    ByRef NodeList As LongPtr, _
    ByVal lpszReason As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetClusterGroupNodeListEx = ctypes.windll.clusapi.SetClusterGroupNodeListEx
SetClusterGroupNodeListEx.restype = wintypes.DWORD
SetClusterGroupNodeListEx.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    wintypes.DWORD,  # NodeCount : DWORD
    ctypes.c_void_p,  # NodeList : HNODE*
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procSetClusterGroupNodeListEx = clusapi.NewProc("SetClusterGroupNodeListEx")
)

// hGroup (HGROUP), NodeCount (DWORD), NodeList (HNODE*), lpszReason (LPCWSTR optional)
r1, _, err := procSetClusterGroupNodeListEx.Call(
	uintptr(hGroup),
	uintptr(NodeCount),
	uintptr(NodeList),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszReason))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SetClusterGroupNodeListEx(
  hGroup: NativeInt;   // HGROUP
  NodeCount: DWORD;   // DWORD
  NodeList: Pointer;   // HNODE*
  lpszReason: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'SetClusterGroupNodeListEx';
result := DllCall("CLUSAPI\SetClusterGroupNodeListEx"
    , "Ptr", hGroup   ; HGROUP
    , "UInt", NodeCount   ; DWORD
    , "Ptr", NodeList   ; HNODE*
    , "WStr", lpszReason   ; LPCWSTR optional
    , "UInt")   ; return: DWORD
●SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason) = DLL("CLUSAPI.dll", "dword SetClusterGroupNodeListEx(int, dword, void*, char*)")
# 呼び出し: SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason)
# hGroup : HGROUP -> "int"
# NodeCount : DWORD -> "dword"
# NodeList : HNODE* -> "void*"
# lpszReason : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "clusapi" fn SetClusterGroupNodeListEx(
    hGroup: isize, // HGROUP
    NodeCount: u32, // DWORD
    NodeList: [*c]isize, // HNODE*
    lpszReason: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) u32;
proc SetClusterGroupNodeListEx(
    hGroup: int,  # HGROUP
    NodeCount: uint32,  # DWORD
    NodeList: ptr int,  # HNODE*
    lpszReason: WideCString  # LPCWSTR optional
): uint32 {.importc: "SetClusterGroupNodeListEx", stdcall, dynlib: "CLUSAPI.dll".}
pragma(lib, "clusapi");
extern(Windows)
uint SetClusterGroupNodeListEx(
    ptrdiff_t hGroup,   // HGROUP
    uint NodeCount,   // DWORD
    ptrdiff_t* NodeList,   // HNODE*
    const(wchar)* lpszReason   // LPCWSTR optional
);
ccall((:SetClusterGroupNodeListEx, "CLUSAPI.dll"), stdcall, UInt32,
      (Int, UInt32, Ptr{Int}, Cwstring),
      hGroup, NodeCount, NodeList, lpszReason)
# hGroup : HGROUP -> Int
# NodeCount : DWORD -> UInt32
# NodeList : HNODE* -> Ptr{Int}
# lpszReason : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t SetClusterGroupNodeListEx(
    intptr_t hGroup,
    uint32_t NodeCount,
    intptr_t* NodeList,
    const uint16_t* lpszReason);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason)
-- hGroup : HGROUP
-- NodeCount : DWORD
-- NodeList : HNODE*
-- lpszReason : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const SetClusterGroupNodeListEx = lib.func('__stdcall', 'SetClusterGroupNodeListEx', 'uint32_t', ['intptr_t', 'uint32_t', 'intptr_t *', 'str16']);
// SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason)
// hGroup : HGROUP -> 'intptr_t'
// NodeCount : DWORD -> 'uint32_t'
// NodeList : HNODE* -> 'intptr_t *'
// lpszReason : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("CLUSAPI.dll", {
  SetClusterGroupNodeListEx: { parameters: ["isize", "u32", "pointer", "buffer"], result: "u32" },
});
// lib.symbols.SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason)
// hGroup : HGROUP -> "isize"
// NodeCount : DWORD -> "u32"
// NodeList : HNODE* -> "pointer"
// lpszReason : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t SetClusterGroupNodeListEx(
    intptr_t hGroup,
    uint32_t NodeCount,
    intptr_t* NodeList,
    const uint16_t* lpszReason);
C, "CLUSAPI.dll");
// $ffi->SetClusterGroupNodeListEx(hGroup, NodeCount, NodeList, lpszReason);
// hGroup : HGROUP
// NodeCount : DWORD
// NodeList : HNODE*
// lpszReason : LPCWSTR optional
// 構造体/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 SetClusterGroupNodeListEx(
        long hGroup,   // HGROUP
        int NodeCount,   // DWORD
        LongByReference NodeList,   // HNODE*
        WString lpszReason   // LPCWSTR optional
    );
}
@[Link("clusapi")]
lib LibCLUSAPI
  fun SetClusterGroupNodeListEx = SetClusterGroupNodeListEx(
    hGroup : LibC::SSizeT,   # HGROUP
    NodeCount : UInt32,   # DWORD
    NodeList : LibC::SSizeT*,   # HNODE*
    lpszReason : UInt16*   # LPCWSTR optional
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SetClusterGroupNodeListExNative = Uint32 Function(IntPtr, Uint32, Pointer<IntPtr>, Pointer<Utf16>);
typedef SetClusterGroupNodeListExDart = int Function(int, int, Pointer<IntPtr>, Pointer<Utf16>);
final SetClusterGroupNodeListEx = DynamicLibrary.open('CLUSAPI.dll')
    .lookupFunction<SetClusterGroupNodeListExNative, SetClusterGroupNodeListExDart>('SetClusterGroupNodeListEx');
// hGroup : HGROUP -> IntPtr
// NodeCount : DWORD -> Uint32
// NodeList : HNODE* -> Pointer<IntPtr>
// lpszReason : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SetClusterGroupNodeListEx(
  hGroup: NativeInt;   // HGROUP
  NodeCount: DWORD;   // DWORD
  NodeList: Pointer;   // HNODE*
  lpszReason: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'SetClusterGroupNodeListEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SetClusterGroupNodeListEx"
  c_SetClusterGroupNodeListEx :: CIntPtr -> Word32 -> Ptr CIntPtr -> CWString -> IO Word32
-- hGroup : HGROUP -> CIntPtr
-- NodeCount : DWORD -> Word32
-- NodeList : HNODE* -> Ptr CIntPtr
-- lpszReason : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let setclustergroupnodelistex =
  foreign "SetClusterGroupNodeListEx"
    (intptr_t @-> uint32_t @-> (ptr intptr_t) @-> (ptr uint16_t) @-> returning uint32_t)
(* hGroup : HGROUP -> intptr_t *)
(* NodeCount : DWORD -> uint32_t *)
(* NodeList : HNODE* -> (ptr intptr_t) *)
(* lpszReason : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)

(cffi:defcfun ("SetClusterGroupNodeListEx" set-cluster-group-node-list-ex :convention :stdcall) :uint32
  (h-group :int64)   ; HGROUP
  (node-count :uint32)   ; DWORD
  (node-list :pointer)   ; HNODE*
  (lpsz-reason (:string :encoding :utf-16le)))   ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SetClusterGroupNodeListEx = Win32::API::More->new('CLUSAPI',
    'DWORD SetClusterGroupNodeListEx(LPARAM hGroup, DWORD NodeCount, LPVOID NodeList, LPCWSTR lpszReason)');
# my $ret = $SetClusterGroupNodeListEx->Call($hGroup, $NodeCount, $NodeList, $lpszReason);
# hGroup : HGROUP -> LPARAM
# NodeCount : DWORD -> DWORD
# NodeList : HNODE* -> LPVOID
# lpszReason : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API