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

HdvDestroyGuestMemoryAperture

関数
ゲストメモリのアパーチャマッピングを破棄する。
DLLvmdevicehost.dll呼出規約winapi

シグネチャ

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

HRESULT HdvDestroyGuestMemoryAperture(
    void* requestor,
    void* mappedAddress
);

パラメーター

名前方向説明
requestorvoid*in操作を要求するデバイス等を表すリクエスタコンテキストへのポインタ。
mappedAddressvoid*inHdvCreateGuestMemoryApertureで取得したマップ先アドレスを指定する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

HdvDestroyGuestMemoryAperture = ctypes.windll.vmdevicehost.HdvDestroyGuestMemoryAperture
HdvDestroyGuestMemoryAperture.restype = ctypes.c_int
HdvDestroyGuestMemoryAperture.argtypes = [
    ctypes.POINTER(None),  # requestor : void*
    ctypes.POINTER(None),  # mappedAddress : void*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	vmdevicehost = windows.NewLazySystemDLL("vmdevicehost.dll")
	procHdvDestroyGuestMemoryAperture = vmdevicehost.NewProc("HdvDestroyGuestMemoryAperture")
)

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

extern "vmdevicehost" fn HdvDestroyGuestMemoryAperture(
    requestor: ?*anyopaque, // void*
    mappedAddress: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;
proc HdvDestroyGuestMemoryAperture(
    requestor: pointer,  # void*
    mappedAddress: pointer  # void*
): int32 {.importc: "HdvDestroyGuestMemoryAperture", stdcall, dynlib: "vmdevicehost.dll".}
pragma(lib, "vmdevicehost");
extern(Windows)
int HdvDestroyGuestMemoryAperture(
    void* requestor,   // void*
    void* mappedAddress   // void*
);
ccall((:HdvDestroyGuestMemoryAperture, "vmdevicehost.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}),
      requestor, mappedAddress)
# requestor : void* -> Ptr{Cvoid}
# mappedAddress : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t HdvDestroyGuestMemoryAperture(
    void* requestor,
    void* mappedAddress);
]]
local vmdevicehost = ffi.load("vmdevicehost")
-- vmdevicehost.HdvDestroyGuestMemoryAperture(requestor, mappedAddress)
-- requestor : void*
-- mappedAddress : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('vmdevicehost.dll');
const HdvDestroyGuestMemoryAperture = lib.func('__stdcall', 'HdvDestroyGuestMemoryAperture', 'int32_t', ['void *', 'void *']);
// HdvDestroyGuestMemoryAperture(requestor, mappedAddress)
// requestor : void* -> 'void *'
// mappedAddress : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("vmdevicehost.dll", {
  HdvDestroyGuestMemoryAperture: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.HdvDestroyGuestMemoryAperture(requestor, mappedAddress)
// requestor : void* -> "pointer"
// mappedAddress : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t HdvDestroyGuestMemoryAperture(
    void* requestor,
    void* mappedAddress);
C, "vmdevicehost.dll");
// $ffi->HdvDestroyGuestMemoryAperture(requestor, mappedAddress);
// requestor : void*
// mappedAddress : 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 Vmdevicehost extends StdCallLibrary {
    Vmdevicehost INSTANCE = Native.load("vmdevicehost", Vmdevicehost.class);
    int HdvDestroyGuestMemoryAperture(
        Pointer requestor,   // void*
        Pointer mappedAddress   // void*
    );
}
@[Link("vmdevicehost")]
lib Libvmdevicehost
  fun HdvDestroyGuestMemoryAperture = HdvDestroyGuestMemoryAperture(
    requestor : Void*,   # void*
    mappedAddress : 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 HdvDestroyGuestMemoryApertureNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef HdvDestroyGuestMemoryApertureDart = int Function(Pointer<Void>, Pointer<Void>);
final HdvDestroyGuestMemoryAperture = DynamicLibrary.open('vmdevicehost.dll')
    .lookupFunction<HdvDestroyGuestMemoryApertureNative, HdvDestroyGuestMemoryApertureDart>('HdvDestroyGuestMemoryAperture');
// requestor : void* -> Pointer<Void>
// mappedAddress : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HdvDestroyGuestMemoryAperture(
  requestor: Pointer;   // void*
  mappedAddress: Pointer   // void*
): Integer; stdcall;
  external 'vmdevicehost.dll' name 'HdvDestroyGuestMemoryAperture';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let hdvdestroyguestmemoryaperture =
  foreign "HdvDestroyGuestMemoryAperture"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* requestor : void* -> (ptr void) *)
(* mappedAddress : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library vmdevicehost (t "vmdevicehost.dll"))
(cffi:use-foreign-library vmdevicehost)

(cffi:defcfun ("HdvDestroyGuestMemoryAperture" hdv-destroy-guest-memory-aperture :convention :stdcall) :int32
  (requestor :pointer)   ; void*
  (mapped-address :pointer))   ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HdvDestroyGuestMemoryAperture = Win32::API::More->new('vmdevicehost',
    'int HdvDestroyGuestMemoryAperture(LPVOID requestor, LPVOID mappedAddress)');
# my $ret = $HdvDestroyGuestMemoryAperture->Call($requestor, $mappedAddress);
# requestor : void* -> LPVOID
# mappedAddress : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。