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

AddClusterGroupSetDependencyEx

関数
理由を付与してグループセット間の依存関係を追加する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD AddClusterGroupSetDependencyEx(
    HGROUPSET hDependentGroupSet,
    HGROUPSET hProviderGroupSet,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向説明
hDependentGroupSetHGROUPSETin依存する側(従属)のグループセットへのハンドル。
hProviderGroupSetHGROUPSETin依存される側(プロバイダ)のグループセットへのハンドル。
lpszReasonLPCWSTRinoptional操作理由を記録するためのワイド文字列。監査用で不要ならNULL可。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD AddClusterGroupSetDependencyEx(
    HGROUPSET hDependentGroupSet,
    HGROUPSET hProviderGroupSet,
    LPCWSTR lpszReason   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint AddClusterGroupSetDependencyEx(
    IntPtr hDependentGroupSet,   // HGROUPSET
    IntPtr hProviderGroupSet,   // HGROUPSET
    [MarshalAs(UnmanagedType.LPWStr)] string lpszReason   // LPCWSTR optional
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function AddClusterGroupSetDependencyEx(
    hDependentGroupSet As IntPtr,   ' HGROUPSET
    hProviderGroupSet As IntPtr,   ' HGROUPSET
    <MarshalAs(UnmanagedType.LPWStr)> lpszReason As String   ' LPCWSTR optional
) As UInteger
End Function
' hDependentGroupSet : HGROUPSET
' hProviderGroupSet : HGROUPSET
' lpszReason : LPCWSTR optional
Declare PtrSafe Function AddClusterGroupSetDependencyEx Lib "clusapi" ( _
    ByVal hDependentGroupSet As LongPtr, _
    ByVal hProviderGroupSet 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

AddClusterGroupSetDependencyEx = ctypes.windll.clusapi.AddClusterGroupSetDependencyEx
AddClusterGroupSetDependencyEx.restype = wintypes.DWORD
AddClusterGroupSetDependencyEx.argtypes = [
    ctypes.c_ssize_t,  # hDependentGroupSet : HGROUPSET
    ctypes.c_ssize_t,  # hProviderGroupSet : HGROUPSET
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procAddClusterGroupSetDependencyEx = clusapi.NewProc("AddClusterGroupSetDependencyEx")
)

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

extern "clusapi" fn AddClusterGroupSetDependencyEx(
    hDependentGroupSet: isize, // HGROUPSET
    hProviderGroupSet: isize, // HGROUPSET
    lpszReason: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) u32;
proc AddClusterGroupSetDependencyEx(
    hDependentGroupSet: int,  # HGROUPSET
    hProviderGroupSet: int,  # HGROUPSET
    lpszReason: WideCString  # LPCWSTR optional
): uint32 {.importc: "AddClusterGroupSetDependencyEx", stdcall, dynlib: "CLUSAPI.dll".}
pragma(lib, "clusapi");
extern(Windows)
uint AddClusterGroupSetDependencyEx(
    ptrdiff_t hDependentGroupSet,   // HGROUPSET
    ptrdiff_t hProviderGroupSet,   // HGROUPSET
    const(wchar)* lpszReason   // LPCWSTR optional
);
ccall((:AddClusterGroupSetDependencyEx, "CLUSAPI.dll"), stdcall, UInt32,
      (Int, Int, Cwstring),
      hDependentGroupSet, hProviderGroupSet, lpszReason)
# hDependentGroupSet : HGROUPSET -> Int
# hProviderGroupSet : HGROUPSET -> Int
# lpszReason : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t AddClusterGroupSetDependencyEx(
    intptr_t hDependentGroupSet,
    intptr_t hProviderGroupSet,
    const uint16_t* lpszReason);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.AddClusterGroupSetDependencyEx(hDependentGroupSet, hProviderGroupSet, lpszReason)
-- hDependentGroupSet : HGROUPSET
-- hProviderGroupSet : HGROUPSET
-- lpszReason : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const AddClusterGroupSetDependencyEx = lib.func('__stdcall', 'AddClusterGroupSetDependencyEx', 'uint32_t', ['intptr_t', 'intptr_t', 'str16']);
// AddClusterGroupSetDependencyEx(hDependentGroupSet, hProviderGroupSet, lpszReason)
// hDependentGroupSet : HGROUPSET -> 'intptr_t'
// hProviderGroupSet : HGROUPSET -> 'intptr_t'
// lpszReason : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("CLUSAPI.dll", {
  AddClusterGroupSetDependencyEx: { parameters: ["isize", "isize", "buffer"], result: "u32" },
});
// lib.symbols.AddClusterGroupSetDependencyEx(hDependentGroupSet, hProviderGroupSet, lpszReason)
// hDependentGroupSet : HGROUPSET -> "isize"
// hProviderGroupSet : HGROUPSET -> "isize"
// lpszReason : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t AddClusterGroupSetDependencyEx(
    intptr_t hDependentGroupSet,
    intptr_t hProviderGroupSet,
    const uint16_t* lpszReason);
C, "CLUSAPI.dll");
// $ffi->AddClusterGroupSetDependencyEx(hDependentGroupSet, hProviderGroupSet, lpszReason);
// hDependentGroupSet : HGROUPSET
// hProviderGroupSet : HGROUPSET
// 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 AddClusterGroupSetDependencyEx(
        long hDependentGroupSet,   // HGROUPSET
        long hProviderGroupSet,   // HGROUPSET
        WString lpszReason   // LPCWSTR optional
    );
}
@[Link("clusapi")]
lib LibCLUSAPI
  fun AddClusterGroupSetDependencyEx = AddClusterGroupSetDependencyEx(
    hDependentGroupSet : LibC::SSizeT,   # HGROUPSET
    hProviderGroupSet : LibC::SSizeT,   # HGROUPSET
    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 AddClusterGroupSetDependencyExNative = Uint32 Function(IntPtr, IntPtr, Pointer<Utf16>);
typedef AddClusterGroupSetDependencyExDart = int Function(int, int, Pointer<Utf16>);
final AddClusterGroupSetDependencyEx = DynamicLibrary.open('CLUSAPI.dll')
    .lookupFunction<AddClusterGroupSetDependencyExNative, AddClusterGroupSetDependencyExDart>('AddClusterGroupSetDependencyEx');
// hDependentGroupSet : HGROUPSET -> IntPtr
// hProviderGroupSet : HGROUPSET -> IntPtr
// lpszReason : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function AddClusterGroupSetDependencyEx(
  hDependentGroupSet: NativeInt;   // HGROUPSET
  hProviderGroupSet: NativeInt;   // HGROUPSET
  lpszReason: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'AddClusterGroupSetDependencyEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "AddClusterGroupSetDependencyEx"
  c_AddClusterGroupSetDependencyEx :: CIntPtr -> CIntPtr -> CWString -> IO Word32
-- hDependentGroupSet : HGROUPSET -> CIntPtr
-- hProviderGroupSet : HGROUPSET -> CIntPtr
-- lpszReason : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let addclustergroupsetdependencyex =
  foreign "AddClusterGroupSetDependencyEx"
    (intptr_t @-> intptr_t @-> (ptr uint16_t) @-> returning uint32_t)
(* hDependentGroupSet : HGROUPSET -> intptr_t *)
(* hProviderGroupSet : HGROUPSET -> 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 ("AddClusterGroupSetDependencyEx" add-cluster-group-set-dependency-ex :convention :stdcall) :uint32
  (h-dependent-group-set :int64)   ; HGROUPSET
  (h-provider-group-set :int64)   ; HGROUPSET
  (lpsz-reason (:string :encoding :utf-16le)))   ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $AddClusterGroupSetDependencyEx = Win32::API::More->new('CLUSAPI',
    'DWORD AddClusterGroupSetDependencyEx(LPARAM hDependentGroupSet, LPARAM hProviderGroupSet, LPCWSTR lpszReason)');
# my $ret = $AddClusterGroupSetDependencyEx->Call($hDependentGroupSet, $hProviderGroupSet, $lpszReason);
# hDependentGroupSet : HGROUPSET -> LPARAM
# hProviderGroupSet : HGROUPSET -> LPARAM
# lpszReason : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API