ホーム › System.Hypervisor › HdvDestroySectionBackedMmioRange
HdvDestroySectionBackedMmioRange
関数セクションを基にしたMMIO範囲を破棄する。
シグネチャ
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvDestroySectionBackedMmioRange(
void* requestor,
HDV_PCI_BAR_SELECTOR barIndex,
ULONGLONG offsetInPages
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| requestor | void* | in | 操作を要求するデバイス等を表すリクエスタコンテキストへのポインタ。 |
| barIndex | HDV_PCI_BAR_SELECTOR | in | 破棄する範囲が属する対象PCI BARを選択する列挙値を指定する。 |
| offsetInPages | ULONGLONG | in | 破棄する範囲のBAR内開始位置をページ単位のオフセットで指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvDestroySectionBackedMmioRange(
void* requestor,
HDV_PCI_BAR_SELECTOR barIndex,
ULONGLONG offsetInPages
);[DllImport("vmdevicehost.dll", ExactSpelling = true)]
static extern int HdvDestroySectionBackedMmioRange(
IntPtr requestor, // void*
int barIndex, // HDV_PCI_BAR_SELECTOR
ulong offsetInPages // ULONGLONG
);<DllImport("vmdevicehost.dll", ExactSpelling:=True)>
Public Shared Function HdvDestroySectionBackedMmioRange(
requestor As IntPtr, ' void*
barIndex As Integer, ' HDV_PCI_BAR_SELECTOR
offsetInPages As ULong ' ULONGLONG
) As Integer
End Function' requestor : void*
' barIndex : HDV_PCI_BAR_SELECTOR
' offsetInPages : ULONGLONG
Declare PtrSafe Function HdvDestroySectionBackedMmioRange Lib "vmdevicehost" ( _
ByVal requestor As LongPtr, _
ByVal barIndex As Long, _
ByVal offsetInPages As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HdvDestroySectionBackedMmioRange = ctypes.windll.vmdevicehost.HdvDestroySectionBackedMmioRange
HdvDestroySectionBackedMmioRange.restype = ctypes.c_int
HdvDestroySectionBackedMmioRange.argtypes = [
ctypes.POINTER(None), # requestor : void*
ctypes.c_int, # barIndex : HDV_PCI_BAR_SELECTOR
ctypes.c_ulonglong, # offsetInPages : ULONGLONG
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('vmdevicehost.dll')
HdvDestroySectionBackedMmioRange = Fiddle::Function.new(
lib['HdvDestroySectionBackedMmioRange'],
[
Fiddle::TYPE_VOIDP, # requestor : void*
Fiddle::TYPE_INT, # barIndex : HDV_PCI_BAR_SELECTOR
-Fiddle::TYPE_LONG_LONG, # offsetInPages : ULONGLONG
],
Fiddle::TYPE_INT)#[link(name = "vmdevicehost")]
extern "system" {
fn HdvDestroySectionBackedMmioRange(
requestor: *mut (), // void*
barIndex: i32, // HDV_PCI_BAR_SELECTOR
offsetInPages: u64 // ULONGLONG
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("vmdevicehost.dll")]
public static extern int HdvDestroySectionBackedMmioRange(IntPtr requestor, int barIndex, ulong offsetInPages);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vmdevicehost_HdvDestroySectionBackedMmioRange' -Namespace Win32 -PassThru
# $api::HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)#uselib "vmdevicehost.dll"
#func global HdvDestroySectionBackedMmioRange "HdvDestroySectionBackedMmioRange" sptr, sptr, sptr
; HdvDestroySectionBackedMmioRange requestor, barIndex, offsetInPages ; 戻り値は stat
; requestor : void* -> "sptr"
; barIndex : HDV_PCI_BAR_SELECTOR -> "sptr"
; offsetInPages : ULONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "vmdevicehost.dll"
#cfunc global HdvDestroySectionBackedMmioRange "HdvDestroySectionBackedMmioRange" sptr, int, int64
; res = HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
; requestor : void* -> "sptr"
; barIndex : HDV_PCI_BAR_SELECTOR -> "int"
; offsetInPages : ULONGLONG -> "int64"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; HRESULT HdvDestroySectionBackedMmioRange(void* requestor, HDV_PCI_BAR_SELECTOR barIndex, ULONGLONG offsetInPages)
#uselib "vmdevicehost.dll"
#cfunc global HdvDestroySectionBackedMmioRange "HdvDestroySectionBackedMmioRange" intptr, int, int64
; res = HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
; requestor : void* -> "intptr"
; barIndex : HDV_PCI_BAR_SELECTOR -> "int"
; offsetInPages : ULONGLONG -> "int64"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vmdevicehost = windows.NewLazySystemDLL("vmdevicehost.dll")
procHdvDestroySectionBackedMmioRange = vmdevicehost.NewProc("HdvDestroySectionBackedMmioRange")
)
// requestor (void*), barIndex (HDV_PCI_BAR_SELECTOR), offsetInPages (ULONGLONG)
r1, _, err := procHdvDestroySectionBackedMmioRange.Call(
uintptr(requestor),
uintptr(barIndex),
uintptr(offsetInPages),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HdvDestroySectionBackedMmioRange(
requestor: Pointer; // void*
barIndex: Integer; // HDV_PCI_BAR_SELECTOR
offsetInPages: UInt64 // ULONGLONG
): Integer; stdcall;
external 'vmdevicehost.dll' name 'HdvDestroySectionBackedMmioRange';result := DllCall("vmdevicehost\HdvDestroySectionBackedMmioRange"
, "Ptr", requestor ; void*
, "Int", barIndex ; HDV_PCI_BAR_SELECTOR
, "Int64", offsetInPages ; ULONGLONG
, "Int") ; return: HRESULT●HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages) = DLL("vmdevicehost.dll", "int HdvDestroySectionBackedMmioRange(void*, int, qword)")
# 呼び出し: HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
# requestor : void* -> "void*"
# barIndex : HDV_PCI_BAR_SELECTOR -> "int"
# offsetInPages : ULONGLONG -> "qword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "vmdevicehost" fn HdvDestroySectionBackedMmioRange(
requestor: ?*anyopaque, // void*
barIndex: i32, // HDV_PCI_BAR_SELECTOR
offsetInPages: u64 // ULONGLONG
) callconv(std.os.windows.WINAPI) i32;proc HdvDestroySectionBackedMmioRange(
requestor: pointer, # void*
barIndex: int32, # HDV_PCI_BAR_SELECTOR
offsetInPages: uint64 # ULONGLONG
): int32 {.importc: "HdvDestroySectionBackedMmioRange", stdcall, dynlib: "vmdevicehost.dll".}pragma(lib, "vmdevicehost");
extern(Windows)
int HdvDestroySectionBackedMmioRange(
void* requestor, // void*
int barIndex, // HDV_PCI_BAR_SELECTOR
ulong offsetInPages // ULONGLONG
);ccall((:HdvDestroySectionBackedMmioRange, "vmdevicehost.dll"), stdcall, Int32,
(Ptr{Cvoid}, Int32, UInt64),
requestor, barIndex, offsetInPages)
# requestor : void* -> Ptr{Cvoid}
# barIndex : HDV_PCI_BAR_SELECTOR -> Int32
# offsetInPages : ULONGLONG -> UInt64
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HdvDestroySectionBackedMmioRange(
void* requestor,
int32_t barIndex,
uint64_t offsetInPages);
]]
local vmdevicehost = ffi.load("vmdevicehost")
-- vmdevicehost.HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
-- requestor : void*
-- barIndex : HDV_PCI_BAR_SELECTOR
-- offsetInPages : ULONGLONG
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('vmdevicehost.dll');
const HdvDestroySectionBackedMmioRange = lib.func('__stdcall', 'HdvDestroySectionBackedMmioRange', 'int32_t', ['void *', 'int32_t', 'uint64_t']);
// HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
// requestor : void* -> 'void *'
// barIndex : HDV_PCI_BAR_SELECTOR -> 'int32_t'
// offsetInPages : ULONGLONG -> 'uint64_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("vmdevicehost.dll", {
HdvDestroySectionBackedMmioRange: { parameters: ["pointer", "i32", "u64"], result: "i32" },
});
// lib.symbols.HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages)
// requestor : void* -> "pointer"
// barIndex : HDV_PCI_BAR_SELECTOR -> "i32"
// offsetInPages : ULONGLONG -> "u64"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HdvDestroySectionBackedMmioRange(
void* requestor,
int32_t barIndex,
uint64_t offsetInPages);
C, "vmdevicehost.dll");
// $ffi->HdvDestroySectionBackedMmioRange(requestor, barIndex, offsetInPages);
// requestor : void*
// barIndex : HDV_PCI_BAR_SELECTOR
// offsetInPages : ULONGLONG
// 構造体/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 Vmdevicehost extends StdCallLibrary {
Vmdevicehost INSTANCE = Native.load("vmdevicehost", Vmdevicehost.class);
int HdvDestroySectionBackedMmioRange(
Pointer requestor, // void*
int barIndex, // HDV_PCI_BAR_SELECTOR
long offsetInPages // ULONGLONG
);
}@[Link("vmdevicehost")]
lib Libvmdevicehost
fun HdvDestroySectionBackedMmioRange = HdvDestroySectionBackedMmioRange(
requestor : Void*, # void*
barIndex : Int32, # HDV_PCI_BAR_SELECTOR
offsetInPages : UInt64 # ULONGLONG
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HdvDestroySectionBackedMmioRangeNative = Int32 Function(Pointer<Void>, Int32, Uint64);
typedef HdvDestroySectionBackedMmioRangeDart = int Function(Pointer<Void>, int, int);
final HdvDestroySectionBackedMmioRange = DynamicLibrary.open('vmdevicehost.dll')
.lookupFunction<HdvDestroySectionBackedMmioRangeNative, HdvDestroySectionBackedMmioRangeDart>('HdvDestroySectionBackedMmioRange');
// requestor : void* -> Pointer<Void>
// barIndex : HDV_PCI_BAR_SELECTOR -> Int32
// offsetInPages : ULONGLONG -> Uint64
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HdvDestroySectionBackedMmioRange(
requestor: Pointer; // void*
barIndex: Integer; // HDV_PCI_BAR_SELECTOR
offsetInPages: UInt64 // ULONGLONG
): Integer; stdcall;
external 'vmdevicehost.dll' name 'HdvDestroySectionBackedMmioRange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HdvDestroySectionBackedMmioRange"
c_HdvDestroySectionBackedMmioRange :: Ptr () -> Int32 -> Word64 -> IO Int32
-- requestor : void* -> Ptr ()
-- barIndex : HDV_PCI_BAR_SELECTOR -> Int32
-- offsetInPages : ULONGLONG -> Word64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let hdvdestroysectionbackedmmiorange =
foreign "HdvDestroySectionBackedMmioRange"
((ptr void) @-> int32_t @-> uint64_t @-> returning int32_t)
(* requestor : void* -> (ptr void) *)
(* barIndex : HDV_PCI_BAR_SELECTOR -> int32_t *)
(* offsetInPages : ULONGLONG -> uint64_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library vmdevicehost (t "vmdevicehost.dll"))
(cffi:use-foreign-library vmdevicehost)
(cffi:defcfun ("HdvDestroySectionBackedMmioRange" hdv-destroy-section-backed-mmio-range :convention :stdcall) :int32
(requestor :pointer) ; void*
(bar-index :int32) ; HDV_PCI_BAR_SELECTOR
(offset-in-pages :uint64)) ; ULONGLONG
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HdvDestroySectionBackedMmioRange = Win32::API::More->new('vmdevicehost',
'int HdvDestroySectionBackedMmioRange(LPVOID requestor, int barIndex, UINT64 offsetInPages)');
# my $ret = $HdvDestroySectionBackedMmioRange->Call($requestor, $barIndex, $offsetInPages);
# requestor : void* -> LPVOID
# barIndex : HDV_PCI_BAR_SELECTOR -> int
# offsetInPages : ULONGLONG -> UINT64
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。