ホーム › Networking.Clustering › CreateClusterResourceEx
CreateClusterResourceEx
関数理由付きでグループ内にクラスターリソースを作成する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
HRESOURCE CreateClusterResourceEx(
HGROUP hGroup,
LPCWSTR lpszResourceName,
LPCWSTR lpszResourceType,
DWORD dwFlags,
LPCWSTR lpszReason // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hGroup | HGROUP | in |
| lpszResourceName | LPCWSTR | in |
| lpszResourceType | LPCWSTR | in |
| dwFlags | DWORD | in |
| lpszReason | LPCWSTR | inoptional |
戻り値の型: HRESOURCE
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
HRESOURCE CreateClusterResourceEx(
HGROUP hGroup,
LPCWSTR lpszResourceName,
LPCWSTR lpszResourceType,
DWORD dwFlags,
LPCWSTR lpszReason // optional
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern IntPtr CreateClusterResourceEx(
IntPtr hGroup, // HGROUP
[MarshalAs(UnmanagedType.LPWStr)] string lpszResourceName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpszResourceType, // LPCWSTR
uint dwFlags, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string lpszReason // LPCWSTR optional
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function CreateClusterResourceEx(
hGroup As IntPtr, ' HGROUP
<MarshalAs(UnmanagedType.LPWStr)> lpszResourceName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpszResourceType As String, ' LPCWSTR
dwFlags As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpszReason As String ' LPCWSTR optional
) As IntPtr
End Function' hGroup : HGROUP
' lpszResourceName : LPCWSTR
' lpszResourceType : LPCWSTR
' dwFlags : DWORD
' lpszReason : LPCWSTR optional
Declare PtrSafe Function CreateClusterResourceEx Lib "clusapi" ( _
ByVal hGroup As LongPtr, _
ByVal lpszResourceName As LongPtr, _
ByVal lpszResourceType As LongPtr, _
ByVal dwFlags As Long, _
ByVal lpszReason As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateClusterResourceEx = ctypes.windll.clusapi.CreateClusterResourceEx
CreateClusterResourceEx.restype = ctypes.c_ssize_t
CreateClusterResourceEx.argtypes = [
ctypes.c_ssize_t, # hGroup : HGROUP
wintypes.LPCWSTR, # lpszResourceName : LPCWSTR
wintypes.LPCWSTR, # lpszResourceType : LPCWSTR
wintypes.DWORD, # dwFlags : DWORD
wintypes.LPCWSTR, # lpszReason : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
CreateClusterResourceEx = Fiddle::Function.new(
lib['CreateClusterResourceEx'],
[
Fiddle::TYPE_INTPTR_T, # hGroup : HGROUP
Fiddle::TYPE_VOIDP, # lpszResourceName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpszResourceType : LPCWSTR
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # lpszReason : LPCWSTR optional
],
Fiddle::TYPE_INTPTR_T)#[link(name = "clusapi")]
extern "system" {
fn CreateClusterResourceEx(
hGroup: isize, // HGROUP
lpszResourceName: *const u16, // LPCWSTR
lpszResourceType: *const u16, // LPCWSTR
dwFlags: u32, // DWORD
lpszReason: *const u16 // LPCWSTR optional
) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern IntPtr CreateClusterResourceEx(IntPtr hGroup, [MarshalAs(UnmanagedType.LPWStr)] string lpszResourceName, [MarshalAs(UnmanagedType.LPWStr)] string lpszResourceType, uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string lpszReason);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_CreateClusterResourceEx' -Namespace Win32 -PassThru
# $api::CreateClusterResourceEx(hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason)#uselib "CLUSAPI.dll"
#func global CreateClusterResourceEx "CreateClusterResourceEx" sptr, sptr, sptr, sptr, sptr
; CreateClusterResourceEx hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; lpszResourceName : LPCWSTR -> "sptr"
; lpszResourceType : LPCWSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; lpszReason : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global CreateClusterResourceEx "CreateClusterResourceEx" sptr, wstr, wstr, int, wstr
; res = CreateClusterResourceEx(hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason)
; hGroup : HGROUP -> "sptr"
; lpszResourceName : LPCWSTR -> "wstr"
; lpszResourceType : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"; HRESOURCE CreateClusterResourceEx(HGROUP hGroup, LPCWSTR lpszResourceName, LPCWSTR lpszResourceType, DWORD dwFlags, LPCWSTR lpszReason)
#uselib "CLUSAPI.dll"
#cfunc global CreateClusterResourceEx "CreateClusterResourceEx" intptr, wstr, wstr, int, wstr
; res = CreateClusterResourceEx(hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason)
; hGroup : HGROUP -> "intptr"
; lpszResourceName : LPCWSTR -> "wstr"
; lpszResourceType : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procCreateClusterResourceEx = clusapi.NewProc("CreateClusterResourceEx")
)
// hGroup (HGROUP), lpszResourceName (LPCWSTR), lpszResourceType (LPCWSTR), dwFlags (DWORD), lpszReason (LPCWSTR optional)
r1, _, err := procCreateClusterResourceEx.Call(
uintptr(hGroup),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszResourceName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszResourceType))),
uintptr(dwFlags),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszReason))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESOURCEfunction CreateClusterResourceEx(
hGroup: NativeInt; // HGROUP
lpszResourceName: PWideChar; // LPCWSTR
lpszResourceType: PWideChar; // LPCWSTR
dwFlags: DWORD; // DWORD
lpszReason: PWideChar // LPCWSTR optional
): NativeInt; stdcall;
external 'CLUSAPI.dll' name 'CreateClusterResourceEx';result := DllCall("CLUSAPI\CreateClusterResourceEx"
, "Ptr", hGroup ; HGROUP
, "WStr", lpszResourceName ; LPCWSTR
, "WStr", lpszResourceType ; LPCWSTR
, "UInt", dwFlags ; DWORD
, "WStr", lpszReason ; LPCWSTR optional
, "Ptr") ; return: HRESOURCE●CreateClusterResourceEx(hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason) = DLL("CLUSAPI.dll", "int CreateClusterResourceEx(int, char*, char*, dword, char*)")
# 呼び出し: CreateClusterResourceEx(hGroup, lpszResourceName, lpszResourceType, dwFlags, lpszReason)
# hGroup : HGROUP -> "int"
# lpszResourceName : LPCWSTR -> "char*"
# lpszResourceType : LPCWSTR -> "char*"
# dwFlags : DWORD -> "dword"
# lpszReason : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。