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

CreateClusterResourceTypeEx

関数
理由付きでクラスターに新しいリソース種別を登録する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD CreateClusterResourceTypeEx(
    HCLUSTER hCluster,
    LPCWSTR lpszResourceTypeName,
    LPCWSTR lpszDisplayName,
    LPCWSTR lpszResourceTypeDll,
    DWORD dwLooksAlivePollInterval,
    DWORD dwIsAlivePollInterval,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向説明
hClusterHCLUSTERinリソースタイプを登録する対象クラスターのハンドル。
lpszResourceTypeNameLPCWSTRin登録するリソースタイプの内部名を示すワイド文字列。
lpszDisplayNameLPCWSTRin管理ツールに表示される表示名を示すワイド文字列。
lpszResourceTypeDllLPCWSTRinリソースタイプを実装するDLLのパスまたは名前を示すワイド文字列。
dwLooksAlivePollIntervalDWORDinLooksAlive検査の実行間隔。ミリ秒単位で指定する。
dwIsAlivePollIntervalDWORDinIsAlive検査の実行間隔。ミリ秒単位で指定する。
lpszReasonLPCWSTRinoptional操作の理由を示すワイド文字列。監査ログ用で、NULL可。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

CreateClusterResourceTypeEx = ctypes.windll.clusapi.CreateClusterResourceTypeEx
CreateClusterResourceTypeEx.restype = wintypes.DWORD
CreateClusterResourceTypeEx.argtypes = [
    ctypes.c_ssize_t,  # hCluster : HCLUSTER
    wintypes.LPCWSTR,  # lpszResourceTypeName : LPCWSTR
    wintypes.LPCWSTR,  # lpszDisplayName : LPCWSTR
    wintypes.LPCWSTR,  # lpszResourceTypeDll : LPCWSTR
    wintypes.DWORD,  # dwLooksAlivePollInterval : DWORD
    wintypes.DWORD,  # dwIsAlivePollInterval : DWORD
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procCreateClusterResourceTypeEx = clusapi.NewProc("CreateClusterResourceTypeEx")
)

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

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

foreign import stdcall safe "CreateClusterResourceTypeEx"
  c_CreateClusterResourceTypeEx :: CIntPtr -> CWString -> CWString -> CWString -> Word32 -> Word32 -> CWString -> IO Word32
-- hCluster : HCLUSTER -> CIntPtr
-- lpszResourceTypeName : LPCWSTR -> CWString
-- lpszDisplayName : LPCWSTR -> CWString
-- lpszResourceTypeDll : LPCWSTR -> CWString
-- dwLooksAlivePollInterval : DWORD -> Word32
-- dwIsAlivePollInterval : DWORD -> Word32
-- lpszReason : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let createclusterresourcetypeex =
  foreign "CreateClusterResourceTypeEx"
    (intptr_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> uint32_t @-> (ptr uint16_t) @-> returning uint32_t)
(* hCluster : HCLUSTER -> intptr_t *)
(* lpszResourceTypeName : LPCWSTR -> (ptr uint16_t) *)
(* lpszDisplayName : LPCWSTR -> (ptr uint16_t) *)
(* lpszResourceTypeDll : LPCWSTR -> (ptr uint16_t) *)
(* dwLooksAlivePollInterval : DWORD -> uint32_t *)
(* dwIsAlivePollInterval : DWORD -> uint32_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 ("CreateClusterResourceTypeEx" create-cluster-resource-type-ex :convention :stdcall) :uint32
  (h-cluster :int64)   ; HCLUSTER
  (lpsz-resource-type-name (:string :encoding :utf-16le))   ; LPCWSTR
  (lpsz-display-name (:string :encoding :utf-16le))   ; LPCWSTR
  (lpsz-resource-type-dll (:string :encoding :utf-16le))   ; LPCWSTR
  (dw-looks-alive-poll-interval :uint32)   ; DWORD
  (dw-is-alive-poll-interval :uint32)   ; DWORD
  (lpsz-reason (:string :encoding :utf-16le)))   ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CreateClusterResourceTypeEx = Win32::API::More->new('CLUSAPI',
    'DWORD CreateClusterResourceTypeEx(LPARAM hCluster, LPCWSTR lpszResourceTypeName, LPCWSTR lpszDisplayName, LPCWSTR lpszResourceTypeDll, DWORD dwLooksAlivePollInterval, DWORD dwIsAlivePollInterval, LPCWSTR lpszReason)');
# my $ret = $CreateClusterResourceTypeEx->Call($hCluster, $lpszResourceTypeName, $lpszDisplayName, $lpszResourceTypeDll, $dwLooksAlivePollInterval, $dwIsAlivePollInterval, $lpszReason);
# hCluster : HCLUSTER -> LPARAM
# lpszResourceTypeName : LPCWSTR -> LPCWSTR
# lpszDisplayName : LPCWSTR -> LPCWSTR
# lpszResourceTypeDll : LPCWSTR -> LPCWSTR
# dwLooksAlivePollInterval : DWORD -> DWORD
# dwIsAlivePollInterval : DWORD -> DWORD
# lpszReason : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API