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

EnableProcessOptionalXStateFeatures

関数
プロセスで任意のXStateフィーチャーを有効化する。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL EnableProcessOptionalXStateFeatures(
    ULONGLONG Features
);

パラメーター

名前方向
FeaturesULONGLONGin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL EnableProcessOptionalXStateFeatures(
    ULONGLONG Features
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool EnableProcessOptionalXStateFeatures(
    ulong Features   // ULONGLONG
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function EnableProcessOptionalXStateFeatures(
    Features As ULong   ' ULONGLONG
) As Boolean
End Function
' Features : ULONGLONG
Declare PtrSafe Function EnableProcessOptionalXStateFeatures Lib "kernel32" ( _
    ByVal Features As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EnableProcessOptionalXStateFeatures = ctypes.windll.kernel32.EnableProcessOptionalXStateFeatures
EnableProcessOptionalXStateFeatures.restype = wintypes.BOOL
EnableProcessOptionalXStateFeatures.argtypes = [
    ctypes.c_ulonglong,  # Features : ULONGLONG
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
EnableProcessOptionalXStateFeatures = Fiddle::Function.new(
  lib['EnableProcessOptionalXStateFeatures'],
  [
    -Fiddle::TYPE_LONG_LONG,  # Features : ULONGLONG
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn EnableProcessOptionalXStateFeatures(
        Features: u64  // ULONGLONG
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool EnableProcessOptionalXStateFeatures(ulong Features);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_EnableProcessOptionalXStateFeatures' -Namespace Win32 -PassThru
# $api::EnableProcessOptionalXStateFeatures(Features)
#uselib "KERNEL32.dll"
#func global EnableProcessOptionalXStateFeatures "EnableProcessOptionalXStateFeatures" sptr
; EnableProcessOptionalXStateFeatures Features   ; 戻り値は stat
; Features : ULONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global EnableProcessOptionalXStateFeatures "EnableProcessOptionalXStateFeatures" int64
; res = EnableProcessOptionalXStateFeatures(Features)
; Features : ULONGLONG -> "int64"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; BOOL EnableProcessOptionalXStateFeatures(ULONGLONG Features)
#uselib "KERNEL32.dll"
#cfunc global EnableProcessOptionalXStateFeatures "EnableProcessOptionalXStateFeatures" int64
; res = EnableProcessOptionalXStateFeatures(Features)
; Features : ULONGLONG -> "int64"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procEnableProcessOptionalXStateFeatures = kernel32.NewProc("EnableProcessOptionalXStateFeatures")
)

// Features (ULONGLONG)
r1, _, err := procEnableProcessOptionalXStateFeatures.Call(
	uintptr(Features),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function EnableProcessOptionalXStateFeatures(
  Features: UInt64   // ULONGLONG
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'EnableProcessOptionalXStateFeatures';
result := DllCall("KERNEL32\EnableProcessOptionalXStateFeatures"
    , "Int64", Features   ; ULONGLONG
    , "Int")   ; return: BOOL
●EnableProcessOptionalXStateFeatures(Features) = DLL("KERNEL32.dll", "bool EnableProcessOptionalXStateFeatures(qword)")
# 呼び出し: EnableProcessOptionalXStateFeatures(Features)
# Features : ULONGLONG -> "qword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。