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

HcsGetProcessorCompatibilityFromSavedState

関数
保存状態からプロセッサ互換性情報を取得する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsGetProcessorCompatibilityFromSavedState(
    LPCWSTR RuntimeFileName,
    LPCWSTR* ProcessorFeaturesString   // optional
);

パラメーター

名前方向
RuntimeFileNameLPCWSTRin
ProcessorFeaturesStringLPCWSTR*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsGetProcessorCompatibilityFromSavedState(
    LPCWSTR RuntimeFileName,
    LPCWSTR* ProcessorFeaturesString   // optional
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsGetProcessorCompatibilityFromSavedState(
    [MarshalAs(UnmanagedType.LPWStr)] string RuntimeFileName,   // LPCWSTR
    IntPtr ProcessorFeaturesString   // LPCWSTR* optional, out
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsGetProcessorCompatibilityFromSavedState(
    <MarshalAs(UnmanagedType.LPWStr)> RuntimeFileName As String,   ' LPCWSTR
    ProcessorFeaturesString As IntPtr   ' LPCWSTR* optional, out
) As Integer
End Function
' RuntimeFileName : LPCWSTR
' ProcessorFeaturesString : LPCWSTR* optional, out
Declare PtrSafe Function HcsGetProcessorCompatibilityFromSavedState Lib "computecore" ( _
    ByVal RuntimeFileName As LongPtr, _
    ByVal ProcessorFeaturesString As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcsGetProcessorCompatibilityFromSavedState = ctypes.windll.computecore.HcsGetProcessorCompatibilityFromSavedState
HcsGetProcessorCompatibilityFromSavedState.restype = ctypes.c_int
HcsGetProcessorCompatibilityFromSavedState.argtypes = [
    wintypes.LPCWSTR,  # RuntimeFileName : LPCWSTR
    ctypes.c_void_p,  # ProcessorFeaturesString : LPCWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsGetProcessorCompatibilityFromSavedState = computecore.NewProc("HcsGetProcessorCompatibilityFromSavedState")
)

// RuntimeFileName (LPCWSTR), ProcessorFeaturesString (LPCWSTR* optional, out)
r1, _, err := procHcsGetProcessorCompatibilityFromSavedState.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(RuntimeFileName))),
	uintptr(ProcessorFeaturesString),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function HcsGetProcessorCompatibilityFromSavedState(
  RuntimeFileName: PWideChar;   // LPCWSTR
  ProcessorFeaturesString: PPWideChar   // LPCWSTR* optional, out
): Integer; stdcall;
  external 'computecore.dll' name 'HcsGetProcessorCompatibilityFromSavedState';
result := DllCall("computecore\HcsGetProcessorCompatibilityFromSavedState"
    , "WStr", RuntimeFileName   ; LPCWSTR
    , "Ptr", ProcessorFeaturesString   ; LPCWSTR* optional, out
    , "Int")   ; return: HRESULT
●HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString) = DLL("computecore.dll", "int HcsGetProcessorCompatibilityFromSavedState(char*, void*)")
# 呼び出し: HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString)
# RuntimeFileName : LPCWSTR -> "char*"
# ProcessorFeaturesString : LPCWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。