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