ホーム › System.Rpc › RpcServerUnsubscribeForNotification
RpcServerUnsubscribeForNotification
関数RPCサーバーのイベント通知購読を解除する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcServerUnsubscribeForNotification(
void* Binding, // optional
RPC_NOTIFICATIONS Notification,
DWORD* NotificationsQueued
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Binding | void* | inoptional | 購読を解除する対象のサーバー側バインディングハンドル。 |
| Notification | RPC_NOTIFICATIONS | in | 解除する通知の種類を指定する値(RPC_NOTIFICATIONS)。 |
| NotificationsQueued | DWORD* | out | 未処理でキューに残っている通知数を受け取るDWORDへのポインタ。NULL可。 |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcServerUnsubscribeForNotification(
void* Binding, // optional
RPC_NOTIFICATIONS Notification,
DWORD* NotificationsQueued
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcServerUnsubscribeForNotification(
IntPtr Binding, // void* optional
int Notification, // RPC_NOTIFICATIONS
out uint NotificationsQueued // DWORD* out
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcServerUnsubscribeForNotification(
Binding As IntPtr, ' void* optional
Notification As Integer, ' RPC_NOTIFICATIONS
<Out> ByRef NotificationsQueued As UInteger ' DWORD* out
) As Integer
End Function' Binding : void* optional
' Notification : RPC_NOTIFICATIONS
' NotificationsQueued : DWORD* out
Declare PtrSafe Function RpcServerUnsubscribeForNotification Lib "rpcrt4" ( _
ByVal Binding As LongPtr, _
ByVal Notification As Long, _
ByRef NotificationsQueued As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcServerUnsubscribeForNotification = ctypes.windll.rpcrt4.RpcServerUnsubscribeForNotification
RpcServerUnsubscribeForNotification.restype = ctypes.c_int
RpcServerUnsubscribeForNotification.argtypes = [
ctypes.POINTER(None), # Binding : void* optional
ctypes.c_int, # Notification : RPC_NOTIFICATIONS
ctypes.POINTER(wintypes.DWORD), # NotificationsQueued : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcServerUnsubscribeForNotification = Fiddle::Function.new(
lib['RpcServerUnsubscribeForNotification'],
[
Fiddle::TYPE_VOIDP, # Binding : void* optional
Fiddle::TYPE_INT, # Notification : RPC_NOTIFICATIONS
Fiddle::TYPE_VOIDP, # NotificationsQueued : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcServerUnsubscribeForNotification(
Binding: *mut (), // void* optional
Notification: i32, // RPC_NOTIFICATIONS
NotificationsQueued: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcServerUnsubscribeForNotification(IntPtr Binding, int Notification, out uint NotificationsQueued);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcServerUnsubscribeForNotification' -Namespace Win32 -PassThru
# $api::RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued)#uselib "RPCRT4.dll"
#func global RpcServerUnsubscribeForNotification "RpcServerUnsubscribeForNotification" sptr, sptr, sptr
; RpcServerUnsubscribeForNotification Binding, Notification, varptr(NotificationsQueued) ; 戻り値は stat
; Binding : void* optional -> "sptr"
; Notification : RPC_NOTIFICATIONS -> "sptr"
; NotificationsQueued : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcServerUnsubscribeForNotification "RpcServerUnsubscribeForNotification" sptr, int, var ; res = RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued) ; Binding : void* optional -> "sptr" ; Notification : RPC_NOTIFICATIONS -> "int" ; NotificationsQueued : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcServerUnsubscribeForNotification "RpcServerUnsubscribeForNotification" sptr, int, sptr ; res = RpcServerUnsubscribeForNotification(Binding, Notification, varptr(NotificationsQueued)) ; Binding : void* optional -> "sptr" ; Notification : RPC_NOTIFICATIONS -> "int" ; NotificationsQueued : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcServerUnsubscribeForNotification(void* Binding, RPC_NOTIFICATIONS Notification, DWORD* NotificationsQueued) #uselib "RPCRT4.dll" #cfunc global RpcServerUnsubscribeForNotification "RpcServerUnsubscribeForNotification" intptr, int, var ; res = RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued) ; Binding : void* optional -> "intptr" ; Notification : RPC_NOTIFICATIONS -> "int" ; NotificationsQueued : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcServerUnsubscribeForNotification(void* Binding, RPC_NOTIFICATIONS Notification, DWORD* NotificationsQueued) #uselib "RPCRT4.dll" #cfunc global RpcServerUnsubscribeForNotification "RpcServerUnsubscribeForNotification" intptr, int, intptr ; res = RpcServerUnsubscribeForNotification(Binding, Notification, varptr(NotificationsQueued)) ; Binding : void* optional -> "intptr" ; Notification : RPC_NOTIFICATIONS -> "int" ; NotificationsQueued : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcServerUnsubscribeForNotification = rpcrt4.NewProc("RpcServerUnsubscribeForNotification")
)
// Binding (void* optional), Notification (RPC_NOTIFICATIONS), NotificationsQueued (DWORD* out)
r1, _, err := procRpcServerUnsubscribeForNotification.Call(
uintptr(Binding),
uintptr(Notification),
uintptr(NotificationsQueued),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcServerUnsubscribeForNotification(
Binding: Pointer; // void* optional
Notification: Integer; // RPC_NOTIFICATIONS
NotificationsQueued: Pointer // DWORD* out
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcServerUnsubscribeForNotification';result := DllCall("RPCRT4\RpcServerUnsubscribeForNotification"
, "Ptr", Binding ; void* optional
, "Int", Notification ; RPC_NOTIFICATIONS
, "Ptr", NotificationsQueued ; DWORD* out
, "Int") ; return: RPC_STATUS●RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued) = DLL("RPCRT4.dll", "int RpcServerUnsubscribeForNotification(void*, int, void*)")
# 呼び出し: RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued)
# Binding : void* optional -> "void*"
# Notification : RPC_NOTIFICATIONS -> "int"
# NotificationsQueued : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rpcrt4" fn RpcServerUnsubscribeForNotification(
Binding: ?*anyopaque, // void* optional
Notification: i32, // RPC_NOTIFICATIONS
NotificationsQueued: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;proc RpcServerUnsubscribeForNotification(
Binding: pointer, # void* optional
Notification: int32, # RPC_NOTIFICATIONS
NotificationsQueued: ptr uint32 # DWORD* out
): int32 {.importc: "RpcServerUnsubscribeForNotification", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int RpcServerUnsubscribeForNotification(
void* Binding, // void* optional
int Notification, // RPC_NOTIFICATIONS
uint* NotificationsQueued // DWORD* out
);ccall((:RpcServerUnsubscribeForNotification, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Int32, Ptr{UInt32}),
Binding, Notification, NotificationsQueued)
# Binding : void* optional -> Ptr{Cvoid}
# Notification : RPC_NOTIFICATIONS -> Int32
# NotificationsQueued : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcServerUnsubscribeForNotification(
void* Binding,
int32_t Notification,
uint32_t* NotificationsQueued);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued)
-- Binding : void* optional
-- Notification : RPC_NOTIFICATIONS
-- NotificationsQueued : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcServerUnsubscribeForNotification = lib.func('__stdcall', 'RpcServerUnsubscribeForNotification', 'int32_t', ['void *', 'int32_t', 'uint32_t *']);
// RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued)
// Binding : void* optional -> 'void *'
// Notification : RPC_NOTIFICATIONS -> 'int32_t'
// NotificationsQueued : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
RpcServerUnsubscribeForNotification: { parameters: ["pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued)
// Binding : void* optional -> "pointer"
// Notification : RPC_NOTIFICATIONS -> "i32"
// NotificationsQueued : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcServerUnsubscribeForNotification(
void* Binding,
int32_t Notification,
uint32_t* NotificationsQueued);
C, "RPCRT4.dll");
// $ffi->RpcServerUnsubscribeForNotification(Binding, Notification, NotificationsQueued);
// Binding : void* optional
// Notification : RPC_NOTIFICATIONS
// NotificationsQueued : DWORD* 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 Rpcrt4 extends StdCallLibrary {
Rpcrt4 INSTANCE = Native.load("rpcrt4", Rpcrt4.class);
int RpcServerUnsubscribeForNotification(
Pointer Binding, // void* optional
int Notification, // RPC_NOTIFICATIONS
IntByReference NotificationsQueued // DWORD* out
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun RpcServerUnsubscribeForNotification = RpcServerUnsubscribeForNotification(
Binding : Void*, # void* optional
Notification : Int32, # RPC_NOTIFICATIONS
NotificationsQueued : UInt32* # DWORD* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcServerUnsubscribeForNotificationNative = Int32 Function(Pointer<Void>, Int32, Pointer<Uint32>);
typedef RpcServerUnsubscribeForNotificationDart = int Function(Pointer<Void>, int, Pointer<Uint32>);
final RpcServerUnsubscribeForNotification = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<RpcServerUnsubscribeForNotificationNative, RpcServerUnsubscribeForNotificationDart>('RpcServerUnsubscribeForNotification');
// Binding : void* optional -> Pointer<Void>
// Notification : RPC_NOTIFICATIONS -> Int32
// NotificationsQueued : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RpcServerUnsubscribeForNotification(
Binding: Pointer; // void* optional
Notification: Integer; // RPC_NOTIFICATIONS
NotificationsQueued: Pointer // DWORD* out
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcServerUnsubscribeForNotification';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcServerUnsubscribeForNotification"
c_RpcServerUnsubscribeForNotification :: Ptr () -> Int32 -> Ptr Word32 -> IO Int32
-- Binding : void* optional -> Ptr ()
-- Notification : RPC_NOTIFICATIONS -> Int32
-- NotificationsQueued : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcserverunsubscribefornotification =
foreign "RpcServerUnsubscribeForNotification"
((ptr void) @-> int32_t @-> (ptr uint32_t) @-> returning int32_t)
(* Binding : void* optional -> (ptr void) *)
(* Notification : RPC_NOTIFICATIONS -> int32_t *)
(* NotificationsQueued : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("RpcServerUnsubscribeForNotification" rpc-server-unsubscribe-for-notification :convention :stdcall) :int32
(binding :pointer) ; void* optional
(notification :int32) ; RPC_NOTIFICATIONS
(notifications-queued :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcServerUnsubscribeForNotification = Win32::API::More->new('RPCRT4',
'int RpcServerUnsubscribeForNotification(LPVOID Binding, int Notification, LPVOID NotificationsQueued)');
# my $ret = $RpcServerUnsubscribeForNotification->Call($Binding, $Notification, $NotificationsQueued);
# Binding : void* optional -> LPVOID
# Notification : RPC_NOTIFICATIONS -> int
# NotificationsQueued : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。