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

CLRES_V4_FUNCTIONS

構造体
サイズx64: 112 バイト / x86: 56 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
OpenPOPEN_V2_ROUTINE8/4+0+0リソースを開くV2版Openルーチンへの関数ポインターである。
ClosePCLOSE_ROUTINE8/4+8+4リソースを閉じるCloseルーチンへの関数ポインターである。
OnlinePONLINE_V2_ROUTINE8/4+16+8リソースをオンラインにするV2版Onlineルーチンへの関数ポインターである。
OfflinePOFFLINE_V2_ROUTINE8/4+24+12リソースをオフラインにするV2版Offlineルーチンへの関数ポインターである。
TerminatePTERMINATE_ROUTINE8/4+32+16リソースを即時終了するTerminateルーチンへの関数ポインターである。
LooksAlivePLOOKS_ALIVE_ROUTINE8/4+40+20簡易生存確認を行うLooksAliveルーチンへの関数ポインターである。
IsAlivePIS_ALIVE_ROUTINE8/4+48+24詳細生存確認を行うIsAliveルーチンへの関数ポインターである。
ArbitratePARBITRATE_ROUTINE8/4+56+28クォーラム調停を行うArbitrateルーチンへの関数ポインターである。
ReleasePRELEASE_ROUTINE8/4+64+32クォーラム所有権を解放するReleaseルーチンへの関数ポインターである。
BeginResourceControlPBEGIN_RESCALL_ROUTINE8/4+72+36非同期のリソース制御を開始するBeginResourceControlルーチンへの関数ポインターである。
BeginResourceTypeControlPBEGIN_RESTYPECALL_ROUTINE8/4+80+40非同期のリソース種別制御を開始するBeginResourceTypeControlルーチンへの関数ポインターである。
CancelPCANCEL_ROUTINE8/4+88+44保留中の操作を取り消すCancelルーチンへの関数ポインターである。
BeginResourceControlAsUserPBEGIN_RESCALL_AS_USER_ROUTINE8/4+96+48ユーザー権限でリソース制御を開始するBeginResourceControlAsUserルーチンへの関数ポインターである。
BeginResourceTypeControlAsUserPBEGIN_RESTYPECALL_AS_USER_ROUTINE8/4+104+52ユーザー権限でリソース種別制御を開始するBeginResourceTypeControlAsUserルーチンへの関数ポインターである。

各言語での定義

#include <windows.h>

// CLRES_V4_FUNCTIONS  (x64 112 / x86 56 バイト)
typedef struct CLRES_V4_FUNCTIONS {
    POPEN_V2_ROUTINE Open;
    PCLOSE_ROUTINE Close;
    PONLINE_V2_ROUTINE Online;
    POFFLINE_V2_ROUTINE Offline;
    PTERMINATE_ROUTINE Terminate;
    PLOOKS_ALIVE_ROUTINE LooksAlive;
    PIS_ALIVE_ROUTINE IsAlive;
    PARBITRATE_ROUTINE Arbitrate;
    PRELEASE_ROUTINE Release;
    PBEGIN_RESCALL_ROUTINE BeginResourceControl;
    PBEGIN_RESTYPECALL_ROUTINE BeginResourceTypeControl;
    PCANCEL_ROUTINE Cancel;
    PBEGIN_RESCALL_AS_USER_ROUTINE BeginResourceControlAsUser;
    PBEGIN_RESTYPECALL_AS_USER_ROUTINE BeginResourceTypeControlAsUser;
} CLRES_V4_FUNCTIONS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLRES_V4_FUNCTIONS
{
    public IntPtr Open;
    public IntPtr Close;
    public IntPtr Online;
    public IntPtr Offline;
    public IntPtr Terminate;
    public IntPtr LooksAlive;
    public IntPtr IsAlive;
    public IntPtr Arbitrate;
    public IntPtr Release;
    public IntPtr BeginResourceControl;
    public IntPtr BeginResourceTypeControl;
    public IntPtr Cancel;
    public IntPtr BeginResourceControlAsUser;
    public IntPtr BeginResourceTypeControlAsUser;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLRES_V4_FUNCTIONS
    Public Open As IntPtr
    Public Close As IntPtr
    Public Online As IntPtr
    Public Offline As IntPtr
    Public Terminate As IntPtr
    Public LooksAlive As IntPtr
    Public IsAlive As IntPtr
    Public Arbitrate As IntPtr
    Public Release As IntPtr
    Public BeginResourceControl As IntPtr
    Public BeginResourceTypeControl As IntPtr
    Public Cancel As IntPtr
    Public BeginResourceControlAsUser As IntPtr
    Public BeginResourceTypeControlAsUser As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CLRES_V4_FUNCTIONS(ctypes.Structure):
    _fields_ = [
        ("Open", ctypes.c_void_p),
        ("Close", ctypes.c_void_p),
        ("Online", ctypes.c_void_p),
        ("Offline", ctypes.c_void_p),
        ("Terminate", ctypes.c_void_p),
        ("LooksAlive", ctypes.c_void_p),
        ("IsAlive", ctypes.c_void_p),
        ("Arbitrate", ctypes.c_void_p),
        ("Release", ctypes.c_void_p),
        ("BeginResourceControl", ctypes.c_void_p),
        ("BeginResourceTypeControl", ctypes.c_void_p),
        ("Cancel", ctypes.c_void_p),
        ("BeginResourceControlAsUser", ctypes.c_void_p),
        ("BeginResourceTypeControlAsUser", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CLRES_V4_FUNCTIONS {
    pub Open: *mut core::ffi::c_void,
    pub Close: *mut core::ffi::c_void,
    pub Online: *mut core::ffi::c_void,
    pub Offline: *mut core::ffi::c_void,
    pub Terminate: *mut core::ffi::c_void,
    pub LooksAlive: *mut core::ffi::c_void,
    pub IsAlive: *mut core::ffi::c_void,
    pub Arbitrate: *mut core::ffi::c_void,
    pub Release: *mut core::ffi::c_void,
    pub BeginResourceControl: *mut core::ffi::c_void,
    pub BeginResourceTypeControl: *mut core::ffi::c_void,
    pub Cancel: *mut core::ffi::c_void,
    pub BeginResourceControlAsUser: *mut core::ffi::c_void,
    pub BeginResourceTypeControlAsUser: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CLRES_V4_FUNCTIONS struct {
	Open uintptr
	Close uintptr
	Online uintptr
	Offline uintptr
	Terminate uintptr
	LooksAlive uintptr
	IsAlive uintptr
	Arbitrate uintptr
	Release uintptr
	BeginResourceControl uintptr
	BeginResourceTypeControl uintptr
	Cancel uintptr
	BeginResourceControlAsUser uintptr
	BeginResourceTypeControlAsUser uintptr
}
type
  CLRES_V4_FUNCTIONS = record
    Open: Pointer;
    Close: Pointer;
    Online: Pointer;
    Offline: Pointer;
    Terminate: Pointer;
    LooksAlive: Pointer;
    IsAlive: Pointer;
    Arbitrate: Pointer;
    Release: Pointer;
    BeginResourceControl: Pointer;
    BeginResourceTypeControl: Pointer;
    Cancel: Pointer;
    BeginResourceControlAsUser: Pointer;
    BeginResourceTypeControlAsUser: Pointer;
  end;
const CLRES_V4_FUNCTIONS = extern struct {
    Open: ?*anyopaque,
    Close: ?*anyopaque,
    Online: ?*anyopaque,
    Offline: ?*anyopaque,
    Terminate: ?*anyopaque,
    LooksAlive: ?*anyopaque,
    IsAlive: ?*anyopaque,
    Arbitrate: ?*anyopaque,
    Release: ?*anyopaque,
    BeginResourceControl: ?*anyopaque,
    BeginResourceTypeControl: ?*anyopaque,
    Cancel: ?*anyopaque,
    BeginResourceControlAsUser: ?*anyopaque,
    BeginResourceTypeControlAsUser: ?*anyopaque,
};
type
  CLRES_V4_FUNCTIONS {.bycopy.} = object
    Open: pointer
    Close: pointer
    Online: pointer
    Offline: pointer
    Terminate: pointer
    LooksAlive: pointer
    IsAlive: pointer
    Arbitrate: pointer
    Release: pointer
    BeginResourceControl: pointer
    BeginResourceTypeControl: pointer
    Cancel: pointer
    BeginResourceControlAsUser: pointer
    BeginResourceTypeControlAsUser: pointer
struct CLRES_V4_FUNCTIONS
{
    void* Open;
    void* Close;
    void* Online;
    void* Offline;
    void* Terminate;
    void* LooksAlive;
    void* IsAlive;
    void* Arbitrate;
    void* Release;
    void* BeginResourceControl;
    void* BeginResourceTypeControl;
    void* Cancel;
    void* BeginResourceControlAsUser;
    void* BeginResourceTypeControlAsUser;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CLRES_V4_FUNCTIONS サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Open : POPEN_V2_ROUTINE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Close : PCLOSE_ROUTINE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Online : PONLINE_V2_ROUTINE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Offline : POFFLINE_V2_ROUTINE (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Terminate : PTERMINATE_ROUTINE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; LooksAlive : PLOOKS_ALIVE_ROUTINE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; IsAlive : PIS_ALIVE_ROUTINE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Arbitrate : PARBITRATE_ROUTINE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Release : PRELEASE_ROUTINE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; BeginResourceControl : PBEGIN_RESCALL_ROUTINE (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; BeginResourceTypeControl : PBEGIN_RESTYPECALL_ROUTINE (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Cancel : PCANCEL_ROUTINE (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; BeginResourceControlAsUser : PBEGIN_RESCALL_AS_USER_ROUTINE (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; BeginResourceTypeControlAsUser : PBEGIN_RESTYPECALL_AS_USER_ROUTINE (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLRES_V4_FUNCTIONS サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; Open : POPEN_V2_ROUTINE (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Close : PCLOSE_ROUTINE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Online : PONLINE_V2_ROUTINE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Offline : POFFLINE_V2_ROUTINE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Terminate : PTERMINATE_ROUTINE (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; LooksAlive : PLOOKS_ALIVE_ROUTINE (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; IsAlive : PIS_ALIVE_ROUTINE (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Arbitrate : PARBITRATE_ROUTINE (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; Release : PRELEASE_ROUTINE (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; BeginResourceControl : PBEGIN_RESCALL_ROUTINE (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; BeginResourceTypeControl : PBEGIN_RESTYPECALL_ROUTINE (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; Cancel : PCANCEL_ROUTINE (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; BeginResourceControlAsUser : PBEGIN_RESCALL_AS_USER_ROUTINE (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; BeginResourceTypeControlAsUser : PBEGIN_RESTYPECALL_AS_USER_ROUTINE (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CLRES_V4_FUNCTIONS
    #field intptr Open
    #field intptr Close
    #field intptr Online
    #field intptr Offline
    #field intptr Terminate
    #field intptr LooksAlive
    #field intptr IsAlive
    #field intptr Arbitrate
    #field intptr Release
    #field intptr BeginResourceControl
    #field intptr BeginResourceTypeControl
    #field intptr Cancel
    #field intptr BeginResourceControlAsUser
    #field intptr BeginResourceTypeControlAsUser
#endstruct

stdim st, CLRES_V4_FUNCTIONS        ; NSTRUCT 変数を確保