Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug › LocateXStateFeature

LocateXStateFeature

関数
コンテキスト内の指定XState機能のデータ位置と長さを取得する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

void* LocateXStateFeature(
    CONTEXT* Context,
    DWORD FeatureId,
    DWORD* Length   // optional
);

パラメーター

名前方向
ContextCONTEXT*in
FeatureIdDWORDin
LengthDWORD*outoptional

戻り値の型: void*

各言語での呼び出し定義

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

void* LocateXStateFeature(
    CONTEXT* Context,
    DWORD FeatureId,
    DWORD* Length   // optional
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern IntPtr LocateXStateFeature(
    IntPtr Context,   // CONTEXT*
    uint FeatureId,   // DWORD
    IntPtr Length   // DWORD* optional, out
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function LocateXStateFeature(
    Context As IntPtr,   ' CONTEXT*
    FeatureId As UInteger,   ' DWORD
    Length As IntPtr   ' DWORD* optional, out
) As IntPtr
End Function
' Context : CONTEXT*
' FeatureId : DWORD
' Length : DWORD* optional, out
Declare PtrSafe Function LocateXStateFeature Lib "kernel32" ( _
    ByVal Context As LongPtr, _
    ByVal FeatureId As Long, _
    ByVal Length As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

LocateXStateFeature = ctypes.windll.kernel32.LocateXStateFeature
LocateXStateFeature.restype = ctypes.c_void_p
LocateXStateFeature.argtypes = [
    ctypes.c_void_p,  # Context : CONTEXT*
    wintypes.DWORD,  # FeatureId : DWORD
    ctypes.POINTER(wintypes.DWORD),  # Length : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
LocateXStateFeature = Fiddle::Function.new(
  lib['LocateXStateFeature'],
  [
    Fiddle::TYPE_VOIDP,  # Context : CONTEXT*
    -Fiddle::TYPE_INT,  # FeatureId : DWORD
    Fiddle::TYPE_VOIDP,  # Length : DWORD* optional, out
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "kernel32")]
extern "system" {
    fn LocateXStateFeature(
        Context: *mut CONTEXT,  // CONTEXT*
        FeatureId: u32,  // DWORD
        Length: *mut u32  // DWORD* optional, out
    ) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern IntPtr LocateXStateFeature(IntPtr Context, uint FeatureId, IntPtr Length);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_LocateXStateFeature' -Namespace Win32 -PassThru
# $api::LocateXStateFeature(Context, FeatureId, Length)
#uselib "KERNEL32.dll"
#func global LocateXStateFeature "LocateXStateFeature" sptr, sptr, sptr
; LocateXStateFeature varptr(Context), FeatureId, varptr(Length)   ; 戻り値は stat
; Context : CONTEXT* -> "sptr"
; FeatureId : DWORD -> "sptr"
; Length : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "KERNEL32.dll"
#cfunc global LocateXStateFeature "LocateXStateFeature" var, int, var
; res = LocateXStateFeature(Context, FeatureId, Length)
; Context : CONTEXT* -> "var"
; FeatureId : DWORD -> "int"
; Length : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void* LocateXStateFeature(CONTEXT* Context, DWORD FeatureId, DWORD* Length)
#uselib "KERNEL32.dll"
#cfunc global LocateXStateFeature "LocateXStateFeature" var, int, var
; res = LocateXStateFeature(Context, FeatureId, Length)
; Context : CONTEXT* -> "var"
; FeatureId : DWORD -> "int"
; Length : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procLocateXStateFeature = kernel32.NewProc("LocateXStateFeature")
)

// Context (CONTEXT*), FeatureId (DWORD), Length (DWORD* optional, out)
r1, _, err := procLocateXStateFeature.Call(
	uintptr(Context),
	uintptr(FeatureId),
	uintptr(Length),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function LocateXStateFeature(
  Context: Pointer;   // CONTEXT*
  FeatureId: DWORD;   // DWORD
  Length: Pointer   // DWORD* optional, out
): Pointer; stdcall;
  external 'KERNEL32.dll' name 'LocateXStateFeature';
result := DllCall("KERNEL32\LocateXStateFeature"
    , "Ptr", Context   ; CONTEXT*
    , "UInt", FeatureId   ; DWORD
    , "Ptr", Length   ; DWORD* optional, out
    , "Ptr")   ; return: void*
●LocateXStateFeature(Context, FeatureId, Length) = DLL("KERNEL32.dll", "void* LocateXStateFeature(void*, dword, void*)")
# 呼び出し: LocateXStateFeature(Context, FeatureId, Length)
# Context : CONTEXT* -> "void*"
# FeatureId : DWORD -> "dword"
# Length : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。