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

WHvDeleteNotificationPort

関数
パーティションの通知ポートを削除する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvDeleteNotificationPort(
    WHV_PARTITION_HANDLE Partition,
    void* PortHandle
);

パラメーター

名前方向説明
PartitionWHV_PARTITION_HANDLEin対象パーティションのハンドルを指定する。
PortHandlevoid*in削除する通知ポートのハンドルを指定する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvDeleteNotificationPort = ctypes.windll.winhvplatform.WHvDeleteNotificationPort
WHvDeleteNotificationPort.restype = ctypes.c_int
WHvDeleteNotificationPort.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.POINTER(None),  # PortHandle : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvDeleteNotificationPort = Fiddle::Function.new(
  lib['WHvDeleteNotificationPort'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    Fiddle::TYPE_VOIDP,  # PortHandle : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvDeleteNotificationPort(
        Partition: isize,  // WHV_PARTITION_HANDLE
        PortHandle: *mut ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvDeleteNotificationPort(IntPtr Partition, IntPtr PortHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvDeleteNotificationPort' -Namespace Win32 -PassThru
# $api::WHvDeleteNotificationPort(Partition, PortHandle)
#uselib "WinHvPlatform.dll"
#func global WHvDeleteNotificationPort "WHvDeleteNotificationPort" sptr, sptr
; WHvDeleteNotificationPort Partition, PortHandle   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; PortHandle : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinHvPlatform.dll"
#cfunc global WHvDeleteNotificationPort "WHvDeleteNotificationPort" sptr, sptr
; res = WHvDeleteNotificationPort(Partition, PortHandle)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; PortHandle : void* -> "sptr"
; HRESULT WHvDeleteNotificationPort(WHV_PARTITION_HANDLE Partition, void* PortHandle)
#uselib "WinHvPlatform.dll"
#cfunc global WHvDeleteNotificationPort "WHvDeleteNotificationPort" intptr, intptr
; res = WHvDeleteNotificationPort(Partition, PortHandle)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; PortHandle : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvDeleteNotificationPort = winhvplatform.NewProc("WHvDeleteNotificationPort")
)

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

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

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

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

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

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