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

ForcePagingMode

関数
仮想プロセッサのページングモードを強制設定する。
DLLVmSavedStateDumpProvider.dll呼出規約winapi

シグネチャ

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

HRESULT ForcePagingMode(
    void* vmSavedStateDumpHandle,
    DWORD vpId,
    PAGING_MODE pagingMode
);

パラメーター

名前方向
vmSavedStateDumpHandlevoid*inout
vpIdDWORDin
pagingModePAGING_MODEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ForcePagingMode(
    void* vmSavedStateDumpHandle,
    DWORD vpId,
    PAGING_MODE pagingMode
);
[DllImport("VmSavedStateDumpProvider.dll", ExactSpelling = true)]
static extern int ForcePagingMode(
    IntPtr vmSavedStateDumpHandle,   // void* in/out
    uint vpId,   // DWORD
    int pagingMode   // PAGING_MODE
);
<DllImport("VmSavedStateDumpProvider.dll", ExactSpelling:=True)>
Public Shared Function ForcePagingMode(
    vmSavedStateDumpHandle As IntPtr,   ' void* in/out
    vpId As UInteger,   ' DWORD
    pagingMode As Integer   ' PAGING_MODE
) As Integer
End Function
' vmSavedStateDumpHandle : void* in/out
' vpId : DWORD
' pagingMode : PAGING_MODE
Declare PtrSafe Function ForcePagingMode Lib "vmsavedstatedumpprovider" ( _
    ByVal vmSavedStateDumpHandle As LongPtr, _
    ByVal vpId As Long, _
    ByVal pagingMode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ForcePagingMode = ctypes.windll.vmsavedstatedumpprovider.ForcePagingMode
ForcePagingMode.restype = ctypes.c_int
ForcePagingMode.argtypes = [
    ctypes.POINTER(None),  # vmSavedStateDumpHandle : void* in/out
    wintypes.DWORD,  # vpId : DWORD
    ctypes.c_int,  # pagingMode : PAGING_MODE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	vmsavedstatedumpprovider = windows.NewLazySystemDLL("VmSavedStateDumpProvider.dll")
	procForcePagingMode = vmsavedstatedumpprovider.NewProc("ForcePagingMode")
)

// vmSavedStateDumpHandle (void* in/out), vpId (DWORD), pagingMode (PAGING_MODE)
r1, _, err := procForcePagingMode.Call(
	uintptr(vmSavedStateDumpHandle),
	uintptr(vpId),
	uintptr(pagingMode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ForcePagingMode(
  vmSavedStateDumpHandle: Pointer;   // void* in/out
  vpId: DWORD;   // DWORD
  pagingMode: Integer   // PAGING_MODE
): Integer; stdcall;
  external 'VmSavedStateDumpProvider.dll' name 'ForcePagingMode';
result := DllCall("VmSavedStateDumpProvider\ForcePagingMode"
    , "Ptr", vmSavedStateDumpHandle   ; void* in/out
    , "UInt", vpId   ; DWORD
    , "Int", pagingMode   ; PAGING_MODE
    , "Int")   ; return: HRESULT
●ForcePagingMode(vmSavedStateDumpHandle, vpId, pagingMode) = DLL("VmSavedStateDumpProvider.dll", "int ForcePagingMode(void*, dword, int)")
# 呼び出し: ForcePagingMode(vmSavedStateDumpHandle, vpId, pagingMode)
# vmSavedStateDumpHandle : void* in/out -> "void*"
# vpId : DWORD -> "dword"
# pagingMode : PAGING_MODE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。