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

ClusterGroupSetEnum

関数
グループセット列挙からインデックス指定で名前を取得する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2016

シグネチャ

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

DWORD ClusterGroupSetEnum(
    HGROUPSETENUM hGroupSetEnum,
    DWORD dwIndex,
    LPWSTR lpszName,
    DWORD* lpcchName
);

パラメーター

名前方向
hGroupSetEnumHGROUPSETENUMin
dwIndexDWORDin
lpszNameLPWSTRout
lpcchNameDWORD*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ClusterGroupSetEnum(
    HGROUPSETENUM hGroupSetEnum,
    DWORD dwIndex,
    LPWSTR lpszName,
    DWORD* lpcchName
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterGroupSetEnum(
    IntPtr hGroupSetEnum,   // HGROUPSETENUM
    uint dwIndex,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszName,   // LPWSTR out
    ref uint lpcchName   // DWORD* in/out
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterGroupSetEnum(
    hGroupSetEnum As IntPtr,   ' HGROUPSETENUM
    dwIndex As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> lpszName As System.Text.StringBuilder,   ' LPWSTR out
    ByRef lpcchName As UInteger   ' DWORD* in/out
) As UInteger
End Function
' hGroupSetEnum : HGROUPSETENUM
' dwIndex : DWORD
' lpszName : LPWSTR out
' lpcchName : DWORD* in/out
Declare PtrSafe Function ClusterGroupSetEnum Lib "clusapi" ( _
    ByVal hGroupSetEnum As LongPtr, _
    ByVal dwIndex As Long, _
    ByVal lpszName As LongPtr, _
    ByRef lpcchName As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterGroupSetEnum = ctypes.windll.clusapi.ClusterGroupSetEnum
ClusterGroupSetEnum.restype = wintypes.DWORD
ClusterGroupSetEnum.argtypes = [
    ctypes.c_ssize_t,  # hGroupSetEnum : HGROUPSETENUM
    wintypes.DWORD,  # dwIndex : DWORD
    wintypes.LPWSTR,  # lpszName : LPWSTR out
    ctypes.POINTER(wintypes.DWORD),  # lpcchName : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterGroupSetEnum = clusapi.NewProc("ClusterGroupSetEnum")
)

// hGroupSetEnum (HGROUPSETENUM), dwIndex (DWORD), lpszName (LPWSTR out), lpcchName (DWORD* in/out)
r1, _, err := procClusterGroupSetEnum.Call(
	uintptr(hGroupSetEnum),
	uintptr(dwIndex),
	uintptr(lpszName),
	uintptr(lpcchName),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ClusterGroupSetEnum(
  hGroupSetEnum: NativeInt;   // HGROUPSETENUM
  dwIndex: DWORD;   // DWORD
  lpszName: PWideChar;   // LPWSTR out
  lpcchName: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'ClusterGroupSetEnum';
result := DllCall("CLUSAPI\ClusterGroupSetEnum"
    , "Ptr", hGroupSetEnum   ; HGROUPSETENUM
    , "UInt", dwIndex   ; DWORD
    , "Ptr", lpszName   ; LPWSTR out
    , "Ptr", lpcchName   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●ClusterGroupSetEnum(hGroupSetEnum, dwIndex, lpszName, lpcchName) = DLL("CLUSAPI.dll", "dword ClusterGroupSetEnum(int, dword, char*, void*)")
# 呼び出し: ClusterGroupSetEnum(hGroupSetEnum, dwIndex, lpszName, lpcchName)
# hGroupSetEnum : HGROUPSETENUM -> "int"
# dwIndex : DWORD -> "dword"
# lpszName : LPWSTR out -> "char*"
# lpcchName : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。