ホーム › Networking.Clustering › ClusapiSetReasonHandler
ClusapiSetReasonHandler
関数クラスターAPIの操作理由を記録するハンドラーを設定する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
CLUSAPI_REASON_HANDLER* ClusapiSetReasonHandler(
CLUSAPI_REASON_HANDLER* lpHandler
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpHandler | CLUSAPI_REASON_HANDLER* | in | クラスタ操作の理由文字列を供給するコールバックハンドラへのポインタ。設定すると以前のハンドラを返す。 |
戻り値の型: CLUSAPI_REASON_HANDLER*
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
CLUSAPI_REASON_HANDLER* ClusapiSetReasonHandler(
CLUSAPI_REASON_HANDLER* lpHandler
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern IntPtr ClusapiSetReasonHandler(
IntPtr lpHandler // CLUSAPI_REASON_HANDLER*
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusapiSetReasonHandler(
lpHandler As IntPtr ' CLUSAPI_REASON_HANDLER*
) As IntPtr
End Function' lpHandler : CLUSAPI_REASON_HANDLER*
Declare PtrSafe Function ClusapiSetReasonHandler Lib "clusapi" ( _
ByVal lpHandler As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusapiSetReasonHandler = ctypes.windll.clusapi.ClusapiSetReasonHandler
ClusapiSetReasonHandler.restype = ctypes.c_void_p
ClusapiSetReasonHandler.argtypes = [
ctypes.c_void_p, # lpHandler : CLUSAPI_REASON_HANDLER*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusapiSetReasonHandler = Fiddle::Function.new(
lib['ClusapiSetReasonHandler'],
[
Fiddle::TYPE_VOIDP, # lpHandler : CLUSAPI_REASON_HANDLER*
],
Fiddle::TYPE_VOIDP)#[link(name = "clusapi")]
extern "system" {
fn ClusapiSetReasonHandler(
lpHandler: *mut CLUSAPI_REASON_HANDLER // CLUSAPI_REASON_HANDLER*
) -> *mut CLUSAPI_REASON_HANDLER;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern IntPtr ClusapiSetReasonHandler(IntPtr lpHandler);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusapiSetReasonHandler' -Namespace Win32 -PassThru
# $api::ClusapiSetReasonHandler(lpHandler)#uselib "CLUSAPI.dll"
#func global ClusapiSetReasonHandler "ClusapiSetReasonHandler" sptr
; ClusapiSetReasonHandler varptr(lpHandler) ; 戻り値は stat
; lpHandler : CLUSAPI_REASON_HANDLER* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CLUSAPI.dll" #cfunc global ClusapiSetReasonHandler "ClusapiSetReasonHandler" var ; res = ClusapiSetReasonHandler(lpHandler) ; lpHandler : CLUSAPI_REASON_HANDLER* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global ClusapiSetReasonHandler "ClusapiSetReasonHandler" sptr ; res = ClusapiSetReasonHandler(varptr(lpHandler)) ; lpHandler : CLUSAPI_REASON_HANDLER* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; CLUSAPI_REASON_HANDLER* ClusapiSetReasonHandler(CLUSAPI_REASON_HANDLER* lpHandler) #uselib "CLUSAPI.dll" #cfunc global ClusapiSetReasonHandler "ClusapiSetReasonHandler" var ; res = ClusapiSetReasonHandler(lpHandler) ; lpHandler : CLUSAPI_REASON_HANDLER* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; CLUSAPI_REASON_HANDLER* ClusapiSetReasonHandler(CLUSAPI_REASON_HANDLER* lpHandler) #uselib "CLUSAPI.dll" #cfunc global ClusapiSetReasonHandler "ClusapiSetReasonHandler" intptr ; res = ClusapiSetReasonHandler(varptr(lpHandler)) ; lpHandler : CLUSAPI_REASON_HANDLER* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusapiSetReasonHandler = clusapi.NewProc("ClusapiSetReasonHandler")
)
// lpHandler (CLUSAPI_REASON_HANDLER*)
r1, _, err := procClusapiSetReasonHandler.Call(
uintptr(lpHandler),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CLUSAPI_REASON_HANDLER*function ClusapiSetReasonHandler(
lpHandler: Pointer // CLUSAPI_REASON_HANDLER*
): Pointer; stdcall;
external 'CLUSAPI.dll' name 'ClusapiSetReasonHandler';result := DllCall("CLUSAPI\ClusapiSetReasonHandler"
, "Ptr", lpHandler ; CLUSAPI_REASON_HANDLER*
, "Ptr") ; return: CLUSAPI_REASON_HANDLER*●ClusapiSetReasonHandler(lpHandler) = DLL("CLUSAPI.dll", "void* ClusapiSetReasonHandler(void*)")
# 呼び出し: ClusapiSetReasonHandler(lpHandler)
# lpHandler : CLUSAPI_REASON_HANDLER* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clusapi" fn ClusapiSetReasonHandler(
lpHandler: [*c]CLUSAPI_REASON_HANDLER // CLUSAPI_REASON_HANDLER*
) callconv(std.os.windows.WINAPI) [*c]CLUSAPI_REASON_HANDLER;proc ClusapiSetReasonHandler(
lpHandler: ptr CLUSAPI_REASON_HANDLER # CLUSAPI_REASON_HANDLER*
): ptr CLUSAPI_REASON_HANDLER {.importc: "ClusapiSetReasonHandler", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
CLUSAPI_REASON_HANDLER* ClusapiSetReasonHandler(
CLUSAPI_REASON_HANDLER* lpHandler // CLUSAPI_REASON_HANDLER*
);ccall((:ClusapiSetReasonHandler, "CLUSAPI.dll"), stdcall, Ptr{CLUSAPI_REASON_HANDLER},
(Ptr{CLUSAPI_REASON_HANDLER},),
lpHandler)
# lpHandler : CLUSAPI_REASON_HANDLER* -> Ptr{CLUSAPI_REASON_HANDLER}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* ClusapiSetReasonHandler(
void* lpHandler);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusapiSetReasonHandler(lpHandler)
-- lpHandler : CLUSAPI_REASON_HANDLER*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusapiSetReasonHandler = lib.func('__stdcall', 'ClusapiSetReasonHandler', 'void *', ['void *']);
// ClusapiSetReasonHandler(lpHandler)
// lpHandler : CLUSAPI_REASON_HANDLER* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
ClusapiSetReasonHandler: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.ClusapiSetReasonHandler(lpHandler)
// lpHandler : CLUSAPI_REASON_HANDLER* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* ClusapiSetReasonHandler(
void* lpHandler);
C, "CLUSAPI.dll");
// $ffi->ClusapiSetReasonHandler(lpHandler);
// lpHandler : CLUSAPI_REASON_HANDLER*
// 構造体/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);
Pointer ClusapiSetReasonHandler(
Pointer lpHandler // CLUSAPI_REASON_HANDLER*
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun ClusapiSetReasonHandler = ClusapiSetReasonHandler(
lpHandler : CLUSAPI_REASON_HANDLER* # CLUSAPI_REASON_HANDLER*
) : CLUSAPI_REASON_HANDLER*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ClusapiSetReasonHandlerNative = Pointer<Void> Function(Pointer<Void>);
typedef ClusapiSetReasonHandlerDart = Pointer<Void> Function(Pointer<Void>);
final ClusapiSetReasonHandler = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<ClusapiSetReasonHandlerNative, ClusapiSetReasonHandlerDart>('ClusapiSetReasonHandler');
// lpHandler : CLUSAPI_REASON_HANDLER* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ClusapiSetReasonHandler(
lpHandler: Pointer // CLUSAPI_REASON_HANDLER*
): Pointer; stdcall;
external 'CLUSAPI.dll' name 'ClusapiSetReasonHandler';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ClusapiSetReasonHandler"
c_ClusapiSetReasonHandler :: Ptr () -> IO (Ptr ())
-- lpHandler : CLUSAPI_REASON_HANDLER* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clusapisetreasonhandler =
foreign "ClusapiSetReasonHandler"
((ptr void) @-> returning (ptr void))
(* lpHandler : CLUSAPI_REASON_HANDLER* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("ClusapiSetReasonHandler" clusapi-set-reason-handler :convention :stdcall) :pointer
(lp-handler :pointer)) ; CLUSAPI_REASON_HANDLER*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ClusapiSetReasonHandler = Win32::API::More->new('CLUSAPI',
'LPVOID ClusapiSetReasonHandler(LPVOID lpHandler)');
# my $ret = $ClusapiSetReasonHandler->Call($lpHandler);
# lpHandler : CLUSAPI_REASON_HANDLER* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。