ホーム › Networking.Clustering › SetClusterGroupNodeList
SetClusterGroupNodeList
関数クラスターグループの優先ノード一覧を設定する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD SetClusterGroupNodeList(
HGROUP hGroup,
DWORD NodeCount,
HNODE* NodeList // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hGroup | HGROUP | in | ノードのリストを割り当てる対象のグループのハンドル。 |
| NodeCount | DWORD | in | NodeList で指定されるリスト内のノードの数。 |
| NodeList | HNODE* | inoptional | 優先順に並べたノードのハンドルの配列。最初のノードが最も優先度が高く、最後のノードが最も優先度が低くなります。NodeList 配列内のノードの数は NodeCount パラメーターで制御されます。 |
戻り値の型: DWORD
公式ドキュメント
グループの優先ノードリストを設定します。
戻り値
操作が成功した場合、この関数は ERROR_SUCCESS を返します。
操作が失敗した場合、 この関数は システムエラーコード を返します。
解説(Remarks)
リソース DLL から SetClusterGroupNodeList を呼び出さないでください。詳細については、Function Calls to Avoid in Resource DLLs を参照してください。
LPC ハンドルと RPC ハンドルを同じ関数呼び出しに渡さないでください。渡した場合、その呼び出しは RPC 例外を発生させ、さらに破壊的な影響を及ぼす可能性があります。LPC ハンドルと RPC ハンドルの作成方法については、Using Object Handles および OpenCluster を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
DWORD SetClusterGroupNodeList(
HGROUP hGroup,
DWORD NodeCount,
HNODE* NodeList // optional
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint SetClusterGroupNodeList(
IntPtr hGroup, // HGROUP
uint NodeCount, // DWORD
IntPtr NodeList // HNODE* optional
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function SetClusterGroupNodeList(
hGroup As IntPtr, ' HGROUP
NodeCount As UInteger, ' DWORD
NodeList As IntPtr ' HNODE* optional
) As UInteger
End Function' hGroup : HGROUP
' NodeCount : DWORD
' NodeList : HNODE* optional
Declare PtrSafe Function SetClusterGroupNodeList Lib "clusapi" ( _
ByVal hGroup As LongPtr, _
ByVal NodeCount As Long, _
ByVal NodeList As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetClusterGroupNodeList = ctypes.windll.clusapi.SetClusterGroupNodeList
SetClusterGroupNodeList.restype = wintypes.DWORD
SetClusterGroupNodeList.argtypes = [
ctypes.c_ssize_t, # hGroup : HGROUP
wintypes.DWORD, # NodeCount : DWORD
ctypes.c_void_p, # NodeList : HNODE* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
SetClusterGroupNodeList = Fiddle::Function.new(
lib['SetClusterGroupNodeList'],
[
Fiddle::TYPE_INTPTR_T, # hGroup : HGROUP
-Fiddle::TYPE_INT, # NodeCount : DWORD
Fiddle::TYPE_VOIDP, # NodeList : HNODE* optional
],
-Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn SetClusterGroupNodeList(
hGroup: isize, // HGROUP
NodeCount: u32, // DWORD
NodeList: *mut isize // HNODE* optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint SetClusterGroupNodeList(IntPtr hGroup, uint NodeCount, IntPtr NodeList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_SetClusterGroupNodeList' -Namespace Win32 -PassThru
# $api::SetClusterGroupNodeList(hGroup, NodeCount, NodeList)#uselib "CLUSAPI.dll"
#func global SetClusterGroupNodeList "SetClusterGroupNodeList" sptr, sptr, sptr
; SetClusterGroupNodeList hGroup, NodeCount, varptr(NodeList) ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; NodeCount : DWORD -> "sptr"
; NodeList : HNODE* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CLUSAPI.dll" #cfunc global SetClusterGroupNodeList "SetClusterGroupNodeList" sptr, int, var ; res = SetClusterGroupNodeList(hGroup, NodeCount, NodeList) ; hGroup : HGROUP -> "sptr" ; NodeCount : DWORD -> "int" ; NodeList : HNODE* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global SetClusterGroupNodeList "SetClusterGroupNodeList" sptr, int, sptr ; res = SetClusterGroupNodeList(hGroup, NodeCount, varptr(NodeList)) ; hGroup : HGROUP -> "sptr" ; NodeCount : DWORD -> "int" ; NodeList : HNODE* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD SetClusterGroupNodeList(HGROUP hGroup, DWORD NodeCount, HNODE* NodeList) #uselib "CLUSAPI.dll" #cfunc global SetClusterGroupNodeList "SetClusterGroupNodeList" intptr, int, var ; res = SetClusterGroupNodeList(hGroup, NodeCount, NodeList) ; hGroup : HGROUP -> "intptr" ; NodeCount : DWORD -> "int" ; NodeList : HNODE* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD SetClusterGroupNodeList(HGROUP hGroup, DWORD NodeCount, HNODE* NodeList) #uselib "CLUSAPI.dll" #cfunc global SetClusterGroupNodeList "SetClusterGroupNodeList" intptr, int, intptr ; res = SetClusterGroupNodeList(hGroup, NodeCount, varptr(NodeList)) ; hGroup : HGROUP -> "intptr" ; NodeCount : DWORD -> "int" ; NodeList : HNODE* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procSetClusterGroupNodeList = clusapi.NewProc("SetClusterGroupNodeList")
)
// hGroup (HGROUP), NodeCount (DWORD), NodeList (HNODE* optional)
r1, _, err := procSetClusterGroupNodeList.Call(
uintptr(hGroup),
uintptr(NodeCount),
uintptr(NodeList),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction SetClusterGroupNodeList(
hGroup: NativeInt; // HGROUP
NodeCount: DWORD; // DWORD
NodeList: Pointer // HNODE* optional
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'SetClusterGroupNodeList';result := DllCall("CLUSAPI\SetClusterGroupNodeList"
, "Ptr", hGroup ; HGROUP
, "UInt", NodeCount ; DWORD
, "Ptr", NodeList ; HNODE* optional
, "UInt") ; return: DWORD●SetClusterGroupNodeList(hGroup, NodeCount, NodeList) = DLL("CLUSAPI.dll", "dword SetClusterGroupNodeList(int, dword, void*)")
# 呼び出し: SetClusterGroupNodeList(hGroup, NodeCount, NodeList)
# hGroup : HGROUP -> "int"
# NodeCount : DWORD -> "dword"
# NodeList : HNODE* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clusapi" fn SetClusterGroupNodeList(
hGroup: isize, // HGROUP
NodeCount: u32, // DWORD
NodeList: [*c]isize // HNODE* optional
) callconv(std.os.windows.WINAPI) u32;proc SetClusterGroupNodeList(
hGroup: int, # HGROUP
NodeCount: uint32, # DWORD
NodeList: ptr int # HNODE* optional
): uint32 {.importc: "SetClusterGroupNodeList", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
uint SetClusterGroupNodeList(
ptrdiff_t hGroup, // HGROUP
uint NodeCount, // DWORD
ptrdiff_t* NodeList // HNODE* optional
);ccall((:SetClusterGroupNodeList, "CLUSAPI.dll"), stdcall, UInt32,
(Int, UInt32, Ptr{Int}),
hGroup, NodeCount, NodeList)
# hGroup : HGROUP -> Int
# NodeCount : DWORD -> UInt32
# NodeList : HNODE* optional -> Ptr{Int}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t SetClusterGroupNodeList(
intptr_t hGroup,
uint32_t NodeCount,
intptr_t* NodeList);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.SetClusterGroupNodeList(hGroup, NodeCount, NodeList)
-- hGroup : HGROUP
-- NodeCount : DWORD
-- NodeList : HNODE* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const SetClusterGroupNodeList = lib.func('__stdcall', 'SetClusterGroupNodeList', 'uint32_t', ['intptr_t', 'uint32_t', 'intptr_t *']);
// SetClusterGroupNodeList(hGroup, NodeCount, NodeList)
// hGroup : HGROUP -> 'intptr_t'
// NodeCount : DWORD -> 'uint32_t'
// NodeList : HNODE* optional -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
SetClusterGroupNodeList: { parameters: ["isize", "u32", "pointer"], result: "u32" },
});
// lib.symbols.SetClusterGroupNodeList(hGroup, NodeCount, NodeList)
// hGroup : HGROUP -> "isize"
// NodeCount : DWORD -> "u32"
// NodeList : HNODE* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t SetClusterGroupNodeList(
intptr_t hGroup,
uint32_t NodeCount,
intptr_t* NodeList);
C, "CLUSAPI.dll");
// $ffi->SetClusterGroupNodeList(hGroup, NodeCount, NodeList);
// hGroup : HGROUP
// NodeCount : DWORD
// NodeList : HNODE* 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 SetClusterGroupNodeList(
long hGroup, // HGROUP
int NodeCount, // DWORD
LongByReference NodeList // HNODE* optional
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun SetClusterGroupNodeList = SetClusterGroupNodeList(
hGroup : LibC::SSizeT, # HGROUP
NodeCount : UInt32, # DWORD
NodeList : LibC::SSizeT* # HNODE* optional
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetClusterGroupNodeListNative = Uint32 Function(IntPtr, Uint32, Pointer<IntPtr>);
typedef SetClusterGroupNodeListDart = int Function(int, int, Pointer<IntPtr>);
final SetClusterGroupNodeList = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<SetClusterGroupNodeListNative, SetClusterGroupNodeListDart>('SetClusterGroupNodeList');
// hGroup : HGROUP -> IntPtr
// NodeCount : DWORD -> Uint32
// NodeList : HNODE* optional -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetClusterGroupNodeList(
hGroup: NativeInt; // HGROUP
NodeCount: DWORD; // DWORD
NodeList: Pointer // HNODE* optional
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'SetClusterGroupNodeList';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetClusterGroupNodeList"
c_SetClusterGroupNodeList :: CIntPtr -> Word32 -> Ptr CIntPtr -> IO Word32
-- hGroup : HGROUP -> CIntPtr
-- NodeCount : DWORD -> Word32
-- NodeList : HNODE* optional -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setclustergroupnodelist =
foreign "SetClusterGroupNodeList"
(intptr_t @-> uint32_t @-> (ptr intptr_t) @-> returning uint32_t)
(* hGroup : HGROUP -> intptr_t *)
(* NodeCount : DWORD -> uint32_t *)
(* NodeList : HNODE* optional -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("SetClusterGroupNodeList" set-cluster-group-node-list :convention :stdcall) :uint32
(h-group :int64) ; HGROUP
(node-count :uint32) ; DWORD
(node-list :pointer)) ; HNODE* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetClusterGroupNodeList = Win32::API::More->new('CLUSAPI',
'DWORD SetClusterGroupNodeList(LPARAM hGroup, DWORD NodeCount, LPVOID NodeList)');
# my $ret = $SetClusterGroupNodeList->Call($hGroup, $NodeCount, $NodeList);
# hGroup : HGROUP -> LPARAM
# NodeCount : DWORD -> DWORD
# NodeList : HNODE* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f SetClusterGroupNodeListEx — 理由付きでクラスターグループの優先ノード一覧を設定する。
公式の関連項目
- f OpenCluster — 指定名のクラスターを開きハンドルを返す。
- f OpenClusterGroup — 指定名のクラスターグループを開いてハンドルを取得する。
- f OpenClusterNode — 指定名のクラスターノードを開きハンドルを返す。