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

WHvUnregisterPartitionDoorbellEvent

関数
パーティションのドアベルイベント登録を解除する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvUnregisterPartitionDoorbellEvent(
    WHV_PARTITION_HANDLE Partition,
    const WHV_DOORBELL_MATCH_DATA* MatchData
);

パラメーター

名前方向説明
PartitionWHV_PARTITION_HANDLEin対象パーティションのハンドルを指定する。
MatchDataWHV_DOORBELL_MATCH_DATA*in登録時に指定した一致条件と同一の構造体へのポインタを指定する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WHvUnregisterPartitionDoorbellEvent(
    WHV_PARTITION_HANDLE Partition,
    const WHV_DOORBELL_MATCH_DATA* MatchData
);
[DllImport("WinHvPlatform.dll", ExactSpelling = true)]
static extern int WHvUnregisterPartitionDoorbellEvent(
    IntPtr Partition,   // WHV_PARTITION_HANDLE
    IntPtr MatchData   // WHV_DOORBELL_MATCH_DATA*
);
<DllImport("WinHvPlatform.dll", ExactSpelling:=True)>
Public Shared Function WHvUnregisterPartitionDoorbellEvent(
    Partition As IntPtr,   ' WHV_PARTITION_HANDLE
    MatchData As IntPtr   ' WHV_DOORBELL_MATCH_DATA*
) As Integer
End Function
' Partition : WHV_PARTITION_HANDLE
' MatchData : WHV_DOORBELL_MATCH_DATA*
Declare PtrSafe Function WHvUnregisterPartitionDoorbellEvent Lib "winhvplatform" ( _
    ByVal Partition As LongPtr, _
    ByVal MatchData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WHvUnregisterPartitionDoorbellEvent = ctypes.windll.winhvplatform.WHvUnregisterPartitionDoorbellEvent
WHvUnregisterPartitionDoorbellEvent.restype = ctypes.c_int
WHvUnregisterPartitionDoorbellEvent.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_void_p,  # MatchData : WHV_DOORBELL_MATCH_DATA*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvUnregisterPartitionDoorbellEvent = Fiddle::Function.new(
  lib['WHvUnregisterPartitionDoorbellEvent'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    Fiddle::TYPE_VOIDP,  # MatchData : WHV_DOORBELL_MATCH_DATA*
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvUnregisterPartitionDoorbellEvent(
        Partition: isize,  // WHV_PARTITION_HANDLE
        MatchData: *const WHV_DOORBELL_MATCH_DATA  // WHV_DOORBELL_MATCH_DATA*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvUnregisterPartitionDoorbellEvent(IntPtr Partition, IntPtr MatchData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvUnregisterPartitionDoorbellEvent' -Namespace Win32 -PassThru
# $api::WHvUnregisterPartitionDoorbellEvent(Partition, MatchData)
#uselib "WinHvPlatform.dll"
#func global WHvUnregisterPartitionDoorbellEvent "WHvUnregisterPartitionDoorbellEvent" sptr, sptr
; WHvUnregisterPartitionDoorbellEvent Partition, varptr(MatchData)   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; MatchData : WHV_DOORBELL_MATCH_DATA* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WinHvPlatform.dll"
#cfunc global WHvUnregisterPartitionDoorbellEvent "WHvUnregisterPartitionDoorbellEvent" sptr, var
; res = WHvUnregisterPartitionDoorbellEvent(Partition, MatchData)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; MatchData : WHV_DOORBELL_MATCH_DATA* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WHvUnregisterPartitionDoorbellEvent(WHV_PARTITION_HANDLE Partition, WHV_DOORBELL_MATCH_DATA* MatchData)
#uselib "WinHvPlatform.dll"
#cfunc global WHvUnregisterPartitionDoorbellEvent "WHvUnregisterPartitionDoorbellEvent" intptr, var
; res = WHvUnregisterPartitionDoorbellEvent(Partition, MatchData)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; MatchData : WHV_DOORBELL_MATCH_DATA* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvUnregisterPartitionDoorbellEvent = winhvplatform.NewProc("WHvUnregisterPartitionDoorbellEvent")
)

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

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

typedef WHvUnregisterPartitionDoorbellEventNative = Int32 Function(IntPtr, Pointer<Void>);
typedef WHvUnregisterPartitionDoorbellEventDart = int Function(int, Pointer<Void>);
final WHvUnregisterPartitionDoorbellEvent = DynamicLibrary.open('WinHvPlatform.dll')
    .lookupFunction<WHvUnregisterPartitionDoorbellEventNative, WHvUnregisterPartitionDoorbellEventDart>('WHvUnregisterPartitionDoorbellEvent');
// Partition : WHV_PARTITION_HANDLE -> IntPtr
// MatchData : WHV_DOORBELL_MATCH_DATA* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WHvUnregisterPartitionDoorbellEvent(
  Partition: NativeInt;   // WHV_PARTITION_HANDLE
  MatchData: Pointer   // WHV_DOORBELL_MATCH_DATA*
): Integer; stdcall;
  external 'WinHvPlatform.dll' name 'WHvUnregisterPartitionDoorbellEvent';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WHvUnregisterPartitionDoorbellEvent"
  c_WHvUnregisterPartitionDoorbellEvent :: CIntPtr -> Ptr () -> IO Int32
-- Partition : WHV_PARTITION_HANDLE -> CIntPtr
-- MatchData : WHV_DOORBELL_MATCH_DATA* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let whvunregisterpartitiondoorbellevent =
  foreign "WHvUnregisterPartitionDoorbellEvent"
    (intptr_t @-> (ptr void) @-> returning int32_t)
(* Partition : WHV_PARTITION_HANDLE -> intptr_t *)
(* MatchData : WHV_DOORBELL_MATCH_DATA* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library winhvplatform (t "WinHvPlatform.dll"))
(cffi:use-foreign-library winhvplatform)

(cffi:defcfun ("WHvUnregisterPartitionDoorbellEvent" whv-unregister-partition-doorbell-event :convention :stdcall) :int32
  (partition :int64)   ; WHV_PARTITION_HANDLE
  (match-data :pointer))   ; WHV_DOORBELL_MATCH_DATA*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WHvUnregisterPartitionDoorbellEvent = Win32::API::More->new('WinHvPlatform',
    'int WHvUnregisterPartitionDoorbellEvent(LPARAM Partition, LPVOID MatchData)');
# my $ret = $WHvUnregisterPartitionDoorbellEvent->Call($Partition, $MatchData);
# Partition : WHV_PARTITION_HANDLE -> LPARAM
# MatchData : WHV_DOORBELL_MATCH_DATA* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型