ホーム › System.Hypervisor › ResolveSavedStateGlobalVariableAddress
ResolveSavedStateGlobalVariableAddress
関数保存状態のグローバル変数の仮想アドレスを解決する。
シグネチャ
// VmSavedStateDumpProvider.dll
#include <windows.h>
HRESULT ResolveSavedStateGlobalVariableAddress(
void* vmSavedStateDumpHandle,
DWORD vpId,
LPCSTR globalName,
ULONGLONG* virtualAddress,
DWORD* size // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| vmSavedStateDumpHandle | void* | inout |
| vpId | DWORD | in |
| globalName | LPCSTR | in |
| virtualAddress | ULONGLONG* | inout |
| size | DWORD* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// VmSavedStateDumpProvider.dll
#include <windows.h>
HRESULT ResolveSavedStateGlobalVariableAddress(
void* vmSavedStateDumpHandle,
DWORD vpId,
LPCSTR globalName,
ULONGLONG* virtualAddress,
DWORD* size // optional
);[DllImport("VmSavedStateDumpProvider.dll", ExactSpelling = true)]
static extern int ResolveSavedStateGlobalVariableAddress(
IntPtr vmSavedStateDumpHandle, // void* in/out
uint vpId, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string globalName, // LPCSTR
ref ulong virtualAddress, // ULONGLONG* in/out
IntPtr size // DWORD* optional, out
);<DllImport("VmSavedStateDumpProvider.dll", ExactSpelling:=True)>
Public Shared Function ResolveSavedStateGlobalVariableAddress(
vmSavedStateDumpHandle As IntPtr, ' void* in/out
vpId As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> globalName As String, ' LPCSTR
ByRef virtualAddress As ULong, ' ULONGLONG* in/out
size As IntPtr ' DWORD* optional, out
) As Integer
End Function' vmSavedStateDumpHandle : void* in/out
' vpId : DWORD
' globalName : LPCSTR
' virtualAddress : ULONGLONG* in/out
' size : DWORD* optional, out
Declare PtrSafe Function ResolveSavedStateGlobalVariableAddress Lib "vmsavedstatedumpprovider" ( _
ByVal vmSavedStateDumpHandle As LongPtr, _
ByVal vpId As Long, _
ByVal globalName As String, _
ByRef virtualAddress As LongLong, _
ByVal size As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResolveSavedStateGlobalVariableAddress = ctypes.windll.vmsavedstatedumpprovider.ResolveSavedStateGlobalVariableAddress
ResolveSavedStateGlobalVariableAddress.restype = ctypes.c_int
ResolveSavedStateGlobalVariableAddress.argtypes = [
ctypes.POINTER(None), # vmSavedStateDumpHandle : void* in/out
wintypes.DWORD, # vpId : DWORD
wintypes.LPCSTR, # globalName : LPCSTR
ctypes.POINTER(ctypes.c_ulonglong), # virtualAddress : ULONGLONG* in/out
ctypes.POINTER(wintypes.DWORD), # size : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('VmSavedStateDumpProvider.dll')
ResolveSavedStateGlobalVariableAddress = Fiddle::Function.new(
lib['ResolveSavedStateGlobalVariableAddress'],
[
Fiddle::TYPE_VOIDP, # vmSavedStateDumpHandle : void* in/out
-Fiddle::TYPE_INT, # vpId : DWORD
Fiddle::TYPE_VOIDP, # globalName : LPCSTR
Fiddle::TYPE_VOIDP, # virtualAddress : ULONGLONG* in/out
Fiddle::TYPE_VOIDP, # size : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "vmsavedstatedumpprovider")]
extern "system" {
fn ResolveSavedStateGlobalVariableAddress(
vmSavedStateDumpHandle: *mut (), // void* in/out
vpId: u32, // DWORD
globalName: *const u8, // LPCSTR
virtualAddress: *mut u64, // ULONGLONG* in/out
size: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("VmSavedStateDumpProvider.dll")]
public static extern int ResolveSavedStateGlobalVariableAddress(IntPtr vmSavedStateDumpHandle, uint vpId, [MarshalAs(UnmanagedType.LPStr)] string globalName, ref ulong virtualAddress, IntPtr size);
"@
$api = Add-Type -MemberDefinition $sig -Name 'VmSavedStateDumpProvider_ResolveSavedStateGlobalVariableAddress' -Namespace Win32 -PassThru
# $api::ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, virtualAddress, size)#uselib "VmSavedStateDumpProvider.dll"
#func global ResolveSavedStateGlobalVariableAddress "ResolveSavedStateGlobalVariableAddress" sptr, sptr, sptr, sptr, sptr
; ResolveSavedStateGlobalVariableAddress vmSavedStateDumpHandle, vpId, globalName, varptr(virtualAddress), varptr(size) ; 戻り値は stat
; vmSavedStateDumpHandle : void* in/out -> "sptr"
; vpId : DWORD -> "sptr"
; globalName : LPCSTR -> "sptr"
; virtualAddress : ULONGLONG* in/out -> "sptr"
; size : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "VmSavedStateDumpProvider.dll" #cfunc global ResolveSavedStateGlobalVariableAddress "ResolveSavedStateGlobalVariableAddress" sptr, int, str, var, var ; res = ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, virtualAddress, size) ; vmSavedStateDumpHandle : void* in/out -> "sptr" ; vpId : DWORD -> "int" ; globalName : LPCSTR -> "str" ; virtualAddress : ULONGLONG* in/out -> "var" ; size : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "VmSavedStateDumpProvider.dll" #cfunc global ResolveSavedStateGlobalVariableAddress "ResolveSavedStateGlobalVariableAddress" sptr, int, str, sptr, sptr ; res = ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, varptr(virtualAddress), varptr(size)) ; vmSavedStateDumpHandle : void* in/out -> "sptr" ; vpId : DWORD -> "int" ; globalName : LPCSTR -> "str" ; virtualAddress : ULONGLONG* in/out -> "sptr" ; size : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT ResolveSavedStateGlobalVariableAddress(void* vmSavedStateDumpHandle, DWORD vpId, LPCSTR globalName, ULONGLONG* virtualAddress, DWORD* size) #uselib "VmSavedStateDumpProvider.dll" #cfunc global ResolveSavedStateGlobalVariableAddress "ResolveSavedStateGlobalVariableAddress" intptr, int, str, var, var ; res = ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, virtualAddress, size) ; vmSavedStateDumpHandle : void* in/out -> "intptr" ; vpId : DWORD -> "int" ; globalName : LPCSTR -> "str" ; virtualAddress : ULONGLONG* in/out -> "var" ; size : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT ResolveSavedStateGlobalVariableAddress(void* vmSavedStateDumpHandle, DWORD vpId, LPCSTR globalName, ULONGLONG* virtualAddress, DWORD* size) #uselib "VmSavedStateDumpProvider.dll" #cfunc global ResolveSavedStateGlobalVariableAddress "ResolveSavedStateGlobalVariableAddress" intptr, int, str, intptr, intptr ; res = ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, varptr(virtualAddress), varptr(size)) ; vmSavedStateDumpHandle : void* in/out -> "intptr" ; vpId : DWORD -> "int" ; globalName : LPCSTR -> "str" ; virtualAddress : ULONGLONG* in/out -> "intptr" ; size : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vmsavedstatedumpprovider = windows.NewLazySystemDLL("VmSavedStateDumpProvider.dll")
procResolveSavedStateGlobalVariableAddress = vmsavedstatedumpprovider.NewProc("ResolveSavedStateGlobalVariableAddress")
)
// vmSavedStateDumpHandle (void* in/out), vpId (DWORD), globalName (LPCSTR), virtualAddress (ULONGLONG* in/out), size (DWORD* optional, out)
r1, _, err := procResolveSavedStateGlobalVariableAddress.Call(
uintptr(vmSavedStateDumpHandle),
uintptr(vpId),
uintptr(unsafe.Pointer(windows.BytePtrFromString(globalName))),
uintptr(virtualAddress),
uintptr(size),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ResolveSavedStateGlobalVariableAddress(
vmSavedStateDumpHandle: Pointer; // void* in/out
vpId: DWORD; // DWORD
globalName: PAnsiChar; // LPCSTR
virtualAddress: Pointer; // ULONGLONG* in/out
size: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'VmSavedStateDumpProvider.dll' name 'ResolveSavedStateGlobalVariableAddress';result := DllCall("VmSavedStateDumpProvider\ResolveSavedStateGlobalVariableAddress"
, "Ptr", vmSavedStateDumpHandle ; void* in/out
, "UInt", vpId ; DWORD
, "AStr", globalName ; LPCSTR
, "Ptr", virtualAddress ; ULONGLONG* in/out
, "Ptr", size ; DWORD* optional, out
, "Int") ; return: HRESULT●ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, virtualAddress, size) = DLL("VmSavedStateDumpProvider.dll", "int ResolveSavedStateGlobalVariableAddress(void*, dword, char*, void*, void*)")
# 呼び出し: ResolveSavedStateGlobalVariableAddress(vmSavedStateDumpHandle, vpId, globalName, virtualAddress, size)
# vmSavedStateDumpHandle : void* in/out -> "void*"
# vpId : DWORD -> "dword"
# globalName : LPCSTR -> "char*"
# virtualAddress : ULONGLONG* in/out -> "void*"
# size : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。