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

ClusterRemoveGroupFromAffinityRule

関数
アフィニティルールからクラスターグループを削除する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD ClusterRemoveGroupFromAffinityRule(
    HCLUSTER hCluster,
    LPCWSTR ruleName,
    HGROUP hGroup
);

パラメーター

名前方向
hClusterHCLUSTERin
ruleNameLPCWSTRin
hGroupHGROUPin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ClusterRemoveGroupFromAffinityRule = ctypes.windll.clusapi.ClusterRemoveGroupFromAffinityRule
ClusterRemoveGroupFromAffinityRule.restype = wintypes.DWORD
ClusterRemoveGroupFromAffinityRule.argtypes = [
    ctypes.c_ssize_t,  # hCluster : HCLUSTER
    wintypes.LPCWSTR,  # ruleName : LPCWSTR
    ctypes.c_ssize_t,  # hGroup : HGROUP
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRemoveGroupFromAffinityRule = Fiddle::Function.new(
  lib['ClusterRemoveGroupFromAffinityRule'],
  [
    Fiddle::TYPE_INTPTR_T,  # hCluster : HCLUSTER
    Fiddle::TYPE_VOIDP,  # ruleName : LPCWSTR
    Fiddle::TYPE_INTPTR_T,  # hGroup : HGROUP
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterRemoveGroupFromAffinityRule(
        hCluster: isize,  // HCLUSTER
        ruleName: *const u16,  // LPCWSTR
        hGroup: isize  // HGROUP
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterRemoveGroupFromAffinityRule(IntPtr hCluster, [MarshalAs(UnmanagedType.LPWStr)] string ruleName, IntPtr hGroup);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRemoveGroupFromAffinityRule' -Namespace Win32 -PassThru
# $api::ClusterRemoveGroupFromAffinityRule(hCluster, ruleName, hGroup)
#uselib "CLUSAPI.dll"
#func global ClusterRemoveGroupFromAffinityRule "ClusterRemoveGroupFromAffinityRule" sptr, sptr, sptr
; ClusterRemoveGroupFromAffinityRule hCluster, ruleName, hGroup   ; 戻り値は stat
; hCluster : HCLUSTER -> "sptr"
; ruleName : LPCWSTR -> "sptr"
; hGroup : HGROUP -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global ClusterRemoveGroupFromAffinityRule "ClusterRemoveGroupFromAffinityRule" sptr, wstr, sptr
; res = ClusterRemoveGroupFromAffinityRule(hCluster, ruleName, hGroup)
; hCluster : HCLUSTER -> "sptr"
; ruleName : LPCWSTR -> "wstr"
; hGroup : HGROUP -> "sptr"
; DWORD ClusterRemoveGroupFromAffinityRule(HCLUSTER hCluster, LPCWSTR ruleName, HGROUP hGroup)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRemoveGroupFromAffinityRule "ClusterRemoveGroupFromAffinityRule" intptr, wstr, intptr
; res = ClusterRemoveGroupFromAffinityRule(hCluster, ruleName, hGroup)
; hCluster : HCLUSTER -> "intptr"
; ruleName : LPCWSTR -> "wstr"
; hGroup : HGROUP -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRemoveGroupFromAffinityRule = clusapi.NewProc("ClusterRemoveGroupFromAffinityRule")
)

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