ホーム › System.Hypervisor › ForceArchitecture
ForceArchitecture
関数指定仮想プロセッサのアーキテクチャを強制設定する。
シグネチャ
// VmSavedStateDumpProvider.dll
#include <windows.h>
HRESULT ForceArchitecture(
void* vmSavedStateDumpHandle,
DWORD vpId,
VIRTUAL_PROCESSOR_ARCH architecture
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| vmSavedStateDumpHandle | void* | inout |
| vpId | DWORD | in |
| architecture | VIRTUAL_PROCESSOR_ARCH | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// VmSavedStateDumpProvider.dll
#include <windows.h>
HRESULT ForceArchitecture(
void* vmSavedStateDumpHandle,
DWORD vpId,
VIRTUAL_PROCESSOR_ARCH architecture
);[DllImport("VmSavedStateDumpProvider.dll", ExactSpelling = true)]
static extern int ForceArchitecture(
IntPtr vmSavedStateDumpHandle, // void* in/out
uint vpId, // DWORD
int architecture // VIRTUAL_PROCESSOR_ARCH
);<DllImport("VmSavedStateDumpProvider.dll", ExactSpelling:=True)>
Public Shared Function ForceArchitecture(
vmSavedStateDumpHandle As IntPtr, ' void* in/out
vpId As UInteger, ' DWORD
architecture As Integer ' VIRTUAL_PROCESSOR_ARCH
) As Integer
End Function' vmSavedStateDumpHandle : void* in/out
' vpId : DWORD
' architecture : VIRTUAL_PROCESSOR_ARCH
Declare PtrSafe Function ForceArchitecture Lib "vmsavedstatedumpprovider" ( _
ByVal vmSavedStateDumpHandle As LongPtr, _
ByVal vpId As Long, _
ByVal architecture As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ForceArchitecture = ctypes.windll.vmsavedstatedumpprovider.ForceArchitecture
ForceArchitecture.restype = ctypes.c_int
ForceArchitecture.argtypes = [
ctypes.POINTER(None), # vmSavedStateDumpHandle : void* in/out
wintypes.DWORD, # vpId : DWORD
ctypes.c_int, # architecture : VIRTUAL_PROCESSOR_ARCH
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('VmSavedStateDumpProvider.dll')
ForceArchitecture = Fiddle::Function.new(
lib['ForceArchitecture'],
[
Fiddle::TYPE_VOIDP, # vmSavedStateDumpHandle : void* in/out
-Fiddle::TYPE_INT, # vpId : DWORD
Fiddle::TYPE_INT, # architecture : VIRTUAL_PROCESSOR_ARCH
],
Fiddle::TYPE_INT)#[link(name = "vmsavedstatedumpprovider")]
extern "system" {
fn ForceArchitecture(
vmSavedStateDumpHandle: *mut (), // void* in/out
vpId: u32, // DWORD
architecture: i32 // VIRTUAL_PROCESSOR_ARCH
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("VmSavedStateDumpProvider.dll")]
public static extern int ForceArchitecture(IntPtr vmSavedStateDumpHandle, uint vpId, int architecture);
"@
$api = Add-Type -MemberDefinition $sig -Name 'VmSavedStateDumpProvider_ForceArchitecture' -Namespace Win32 -PassThru
# $api::ForceArchitecture(vmSavedStateDumpHandle, vpId, architecture)#uselib "VmSavedStateDumpProvider.dll"
#func global ForceArchitecture "ForceArchitecture" sptr, sptr, sptr
; ForceArchitecture vmSavedStateDumpHandle, vpId, architecture ; 戻り値は stat
; vmSavedStateDumpHandle : void* in/out -> "sptr"
; vpId : DWORD -> "sptr"
; architecture : VIRTUAL_PROCESSOR_ARCH -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "VmSavedStateDumpProvider.dll"
#cfunc global ForceArchitecture "ForceArchitecture" sptr, int, int
; res = ForceArchitecture(vmSavedStateDumpHandle, vpId, architecture)
; vmSavedStateDumpHandle : void* in/out -> "sptr"
; vpId : DWORD -> "int"
; architecture : VIRTUAL_PROCESSOR_ARCH -> "int"; HRESULT ForceArchitecture(void* vmSavedStateDumpHandle, DWORD vpId, VIRTUAL_PROCESSOR_ARCH architecture)
#uselib "VmSavedStateDumpProvider.dll"
#cfunc global ForceArchitecture "ForceArchitecture" intptr, int, int
; res = ForceArchitecture(vmSavedStateDumpHandle, vpId, architecture)
; vmSavedStateDumpHandle : void* in/out -> "intptr"
; vpId : DWORD -> "int"
; architecture : VIRTUAL_PROCESSOR_ARCH -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vmsavedstatedumpprovider = windows.NewLazySystemDLL("VmSavedStateDumpProvider.dll")
procForceArchitecture = vmsavedstatedumpprovider.NewProc("ForceArchitecture")
)
// vmSavedStateDumpHandle (void* in/out), vpId (DWORD), architecture (VIRTUAL_PROCESSOR_ARCH)
r1, _, err := procForceArchitecture.Call(
uintptr(vmSavedStateDumpHandle),
uintptr(vpId),
uintptr(architecture),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ForceArchitecture(
vmSavedStateDumpHandle: Pointer; // void* in/out
vpId: DWORD; // DWORD
architecture: Integer // VIRTUAL_PROCESSOR_ARCH
): Integer; stdcall;
external 'VmSavedStateDumpProvider.dll' name 'ForceArchitecture';result := DllCall("VmSavedStateDumpProvider\ForceArchitecture"
, "Ptr", vmSavedStateDumpHandle ; void* in/out
, "UInt", vpId ; DWORD
, "Int", architecture ; VIRTUAL_PROCESSOR_ARCH
, "Int") ; return: HRESULT●ForceArchitecture(vmSavedStateDumpHandle, vpId, architecture) = DLL("VmSavedStateDumpProvider.dll", "int ForceArchitecture(void*, dword, int)")
# 呼び出し: ForceArchitecture(vmSavedStateDumpHandle, vpId, architecture)
# vmSavedStateDumpHandle : void* in/out -> "void*"
# vpId : DWORD -> "dword"
# architecture : VIRTUAL_PROCESSOR_ARCH -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。