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

SetClusterGroupSetDependencyExpression

関数
グループセットの依存関係式を設定する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2016

シグネチャ

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

DWORD SetClusterGroupSetDependencyExpression(
    HGROUPSET hGroupSet,
    LPCWSTR lpszDependencyExprssion
);

パラメーター

名前方向
hGroupSetHGROUPSETin
lpszDependencyExprssionLPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

SetClusterGroupSetDependencyExpression = ctypes.windll.clusapi.SetClusterGroupSetDependencyExpression
SetClusterGroupSetDependencyExpression.restype = wintypes.DWORD
SetClusterGroupSetDependencyExpression.argtypes = [
    ctypes.c_ssize_t,  # hGroupSet : HGROUPSET
    wintypes.LPCWSTR,  # lpszDependencyExprssion : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procSetClusterGroupSetDependencyExpression = clusapi.NewProc("SetClusterGroupSetDependencyExpression")
)

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