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

DeleteClusterResourceTypeEx

関数
理由付きでクラスターからリソース種別を削除する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD DeleteClusterResourceTypeEx(
    HCLUSTER hCluster,
    LPCWSTR lpszTypeName,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hClusterHCLUSTERin
lpszTypeNameLPCWSTRin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DeleteClusterResourceTypeEx = ctypes.windll.clusapi.DeleteClusterResourceTypeEx
DeleteClusterResourceTypeEx.restype = wintypes.DWORD
DeleteClusterResourceTypeEx.argtypes = [
    ctypes.c_ssize_t,  # hCluster : HCLUSTER
    wintypes.LPCWSTR,  # lpszTypeName : LPCWSTR
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procDeleteClusterResourceTypeEx = clusapi.NewProc("DeleteClusterResourceTypeEx")
)

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