Win32 API 日本語リファレンス
ホームSystem.Services › UnsubscribeServiceChangeNotifications

UnsubscribeServiceChangeNotifications

関数
購読したサービス変更通知を解除する。
DLLSecHost.dll呼出規約winapi

シグネチャ

// SecHost.dll
#include <windows.h>

void UnsubscribeServiceChangeNotifications(
    PSC_NOTIFICATION_REGISTRATION pSubscription
);

パラメーター

名前方向説明
pSubscriptionPSC_NOTIFICATION_REGISTRATIONinSubscribeServiceChangeNotificationsで取得した購読ハンドル。通知を解除する。

戻り値の型: void

各言語での呼び出し定義

// SecHost.dll
#include <windows.h>

void UnsubscribeServiceChangeNotifications(
    PSC_NOTIFICATION_REGISTRATION pSubscription
);
[DllImport("SecHost.dll", ExactSpelling = true)]
static extern void UnsubscribeServiceChangeNotifications(
    IntPtr pSubscription   // PSC_NOTIFICATION_REGISTRATION
);
<DllImport("SecHost.dll", ExactSpelling:=True)>
Public Shared Sub UnsubscribeServiceChangeNotifications(
    pSubscription As IntPtr   ' PSC_NOTIFICATION_REGISTRATION
)
End Sub
' pSubscription : PSC_NOTIFICATION_REGISTRATION
Declare PtrSafe Sub UnsubscribeServiceChangeNotifications Lib "sechost" ( _
    ByVal pSubscription As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UnsubscribeServiceChangeNotifications = ctypes.windll.sechost.UnsubscribeServiceChangeNotifications
UnsubscribeServiceChangeNotifications.restype = None
UnsubscribeServiceChangeNotifications.argtypes = [
    ctypes.c_ssize_t,  # pSubscription : PSC_NOTIFICATION_REGISTRATION
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SecHost.dll')
UnsubscribeServiceChangeNotifications = Fiddle::Function.new(
  lib['UnsubscribeServiceChangeNotifications'],
  [
    Fiddle::TYPE_INTPTR_T,  # pSubscription : PSC_NOTIFICATION_REGISTRATION
  ],
  Fiddle::TYPE_VOID)
#[link(name = "sechost")]
extern "system" {
    fn UnsubscribeServiceChangeNotifications(
        pSubscription: isize  // PSC_NOTIFICATION_REGISTRATION
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SecHost.dll")]
public static extern void UnsubscribeServiceChangeNotifications(IntPtr pSubscription);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SecHost_UnsubscribeServiceChangeNotifications' -Namespace Win32 -PassThru
# $api::UnsubscribeServiceChangeNotifications(pSubscription)
#uselib "SecHost.dll"
#func global UnsubscribeServiceChangeNotifications "UnsubscribeServiceChangeNotifications" sptr
; UnsubscribeServiceChangeNotifications pSubscription
; pSubscription : PSC_NOTIFICATION_REGISTRATION -> "sptr"
#uselib "SecHost.dll"
#func global UnsubscribeServiceChangeNotifications "UnsubscribeServiceChangeNotifications" sptr
; UnsubscribeServiceChangeNotifications pSubscription
; pSubscription : PSC_NOTIFICATION_REGISTRATION -> "sptr"
; void UnsubscribeServiceChangeNotifications(PSC_NOTIFICATION_REGISTRATION pSubscription)
#uselib "SecHost.dll"
#func global UnsubscribeServiceChangeNotifications "UnsubscribeServiceChangeNotifications" intptr
; UnsubscribeServiceChangeNotifications pSubscription
; pSubscription : PSC_NOTIFICATION_REGISTRATION -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	sechost = windows.NewLazySystemDLL("SecHost.dll")
	procUnsubscribeServiceChangeNotifications = sechost.NewProc("UnsubscribeServiceChangeNotifications")
)

// pSubscription (PSC_NOTIFICATION_REGISTRATION)
r1, _, err := procUnsubscribeServiceChangeNotifications.Call(
	uintptr(pSubscription),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure UnsubscribeServiceChangeNotifications(
  pSubscription: NativeInt   // PSC_NOTIFICATION_REGISTRATION
); stdcall;
  external 'SecHost.dll' name 'UnsubscribeServiceChangeNotifications';
result := DllCall("SecHost\UnsubscribeServiceChangeNotifications"
    , "Ptr", pSubscription   ; PSC_NOTIFICATION_REGISTRATION
    , "Int")   ; return: void
●UnsubscribeServiceChangeNotifications(pSubscription) = DLL("SecHost.dll", "int UnsubscribeServiceChangeNotifications(int)")
# 呼び出し: UnsubscribeServiceChangeNotifications(pSubscription)
# pSubscription : PSC_NOTIFICATION_REGISTRATION -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "sechost" fn UnsubscribeServiceChangeNotifications(
    pSubscription: isize // PSC_NOTIFICATION_REGISTRATION
) callconv(std.os.windows.WINAPI) void;
proc UnsubscribeServiceChangeNotifications(
    pSubscription: int  # PSC_NOTIFICATION_REGISTRATION
) {.importc: "UnsubscribeServiceChangeNotifications", stdcall, dynlib: "SecHost.dll".}
pragma(lib, "sechost");
extern(Windows)
void UnsubscribeServiceChangeNotifications(
    ptrdiff_t pSubscription   // PSC_NOTIFICATION_REGISTRATION
);
ccall((:UnsubscribeServiceChangeNotifications, "SecHost.dll"), stdcall, Cvoid,
      (Int,),
      pSubscription)
# pSubscription : PSC_NOTIFICATION_REGISTRATION -> Int
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void UnsubscribeServiceChangeNotifications(
    intptr_t pSubscription);
]]
local sechost = ffi.load("sechost")
-- sechost.UnsubscribeServiceChangeNotifications(pSubscription)
-- pSubscription : PSC_NOTIFICATION_REGISTRATION
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SecHost.dll');
const UnsubscribeServiceChangeNotifications = lib.func('__stdcall', 'UnsubscribeServiceChangeNotifications', 'void', ['intptr_t']);
// UnsubscribeServiceChangeNotifications(pSubscription)
// pSubscription : PSC_NOTIFICATION_REGISTRATION -> 'intptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SecHost.dll", {
  UnsubscribeServiceChangeNotifications: { parameters: ["isize"], result: "void" },
});
// lib.symbols.UnsubscribeServiceChangeNotifications(pSubscription)
// pSubscription : PSC_NOTIFICATION_REGISTRATION -> "isize"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void UnsubscribeServiceChangeNotifications(
    intptr_t pSubscription);
C, "SecHost.dll");
// $ffi->UnsubscribeServiceChangeNotifications(pSubscription);
// pSubscription : PSC_NOTIFICATION_REGISTRATION
// 構造体/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 Sechost extends StdCallLibrary {
    Sechost INSTANCE = Native.load("sechost", Sechost.class);
    void UnsubscribeServiceChangeNotifications(
        long pSubscription   // PSC_NOTIFICATION_REGISTRATION
    );
}
@[Link("sechost")]
lib LibSecHost
  fun UnsubscribeServiceChangeNotifications = UnsubscribeServiceChangeNotifications(
    pSubscription : LibC::SSizeT   # PSC_NOTIFICATION_REGISTRATION
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef UnsubscribeServiceChangeNotificationsNative = Void Function(IntPtr);
typedef UnsubscribeServiceChangeNotificationsDart = void Function(int);
final UnsubscribeServiceChangeNotifications = DynamicLibrary.open('SecHost.dll')
    .lookupFunction<UnsubscribeServiceChangeNotificationsNative, UnsubscribeServiceChangeNotificationsDart>('UnsubscribeServiceChangeNotifications');
// pSubscription : PSC_NOTIFICATION_REGISTRATION -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure UnsubscribeServiceChangeNotifications(
  pSubscription: NativeInt   // PSC_NOTIFICATION_REGISTRATION
); stdcall;
  external 'SecHost.dll' name 'UnsubscribeServiceChangeNotifications';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "UnsubscribeServiceChangeNotifications"
  c_UnsubscribeServiceChangeNotifications :: CIntPtr -> IO ()
-- pSubscription : PSC_NOTIFICATION_REGISTRATION -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let unsubscribeservicechangenotifications =
  foreign "UnsubscribeServiceChangeNotifications"
    (intptr_t @-> returning void)
(* pSubscription : PSC_NOTIFICATION_REGISTRATION -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library sechost (t "SecHost.dll"))
(cffi:use-foreign-library sechost)

(cffi:defcfun ("UnsubscribeServiceChangeNotifications" unsubscribe-service-change-notifications :convention :stdcall) :void
  (p-subscription :int64))   ; PSC_NOTIFICATION_REGISTRATION
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UnsubscribeServiceChangeNotifications = Win32::API::More->new('SecHost',
    'void UnsubscribeServiceChangeNotifications(LPARAM pSubscription)');
# my $ret = $UnsubscribeServiceChangeNotifications->Call($pSubscription);
# pSubscription : PSC_NOTIFICATION_REGISTRATION -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。