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