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)。
const std = @import("std");

extern "computecore" fn HcsGetProcessorCompatibilityFromSavedState(
    RuntimeFileName: [*c]const u16, // LPCWSTR
    ProcessorFeaturesString: [*c][*c]u16 // LPCWSTR* optional, out
) callconv(std.os.windows.WINAPI) i32;
proc HcsGetProcessorCompatibilityFromSavedState(
    RuntimeFileName: WideCString,  # LPCWSTR
    ProcessorFeaturesString: ptr WideCString  # LPCWSTR* optional, out
): int32 {.importc: "HcsGetProcessorCompatibilityFromSavedState", stdcall, dynlib: "computecore.dll".}
pragma(lib, "computecore");
extern(Windows)
int HcsGetProcessorCompatibilityFromSavedState(
    const(wchar)* RuntimeFileName,   // LPCWSTR
    wchar** ProcessorFeaturesString   // LPCWSTR* optional, out
);
ccall((:HcsGetProcessorCompatibilityFromSavedState, "computecore.dll"), stdcall, Int32,
      (Cwstring, Ptr{Ptr{UInt16}}),
      RuntimeFileName, ProcessorFeaturesString)
# RuntimeFileName : LPCWSTR -> Cwstring
# ProcessorFeaturesString : LPCWSTR* optional, out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t HcsGetProcessorCompatibilityFromSavedState(
    const uint16_t* RuntimeFileName,
    uint16_t** ProcessorFeaturesString);
]]
local computecore = ffi.load("computecore")
-- computecore.HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString)
-- RuntimeFileName : LPCWSTR
-- ProcessorFeaturesString : LPCWSTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('computecore.dll');
const HcsGetProcessorCompatibilityFromSavedState = lib.func('__stdcall', 'HcsGetProcessorCompatibilityFromSavedState', 'int32_t', ['str16', 'void *']);
// HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString)
// RuntimeFileName : LPCWSTR -> 'str16'
// ProcessorFeaturesString : LPCWSTR* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("computecore.dll", {
  HcsGetProcessorCompatibilityFromSavedState: { parameters: ["buffer", "pointer"], result: "i32" },
});
// lib.symbols.HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString)
// RuntimeFileName : LPCWSTR -> "buffer"
// ProcessorFeaturesString : LPCWSTR* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t HcsGetProcessorCompatibilityFromSavedState(
    const uint16_t* RuntimeFileName,
    uint16_t** ProcessorFeaturesString);
C, "computecore.dll");
// $ffi->HcsGetProcessorCompatibilityFromSavedState(RuntimeFileName, ProcessorFeaturesString);
// RuntimeFileName : LPCWSTR
// ProcessorFeaturesString : LPCWSTR* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Computecore extends StdCallLibrary {
    Computecore INSTANCE = Native.load("computecore", Computecore.class);
    int HcsGetProcessorCompatibilityFromSavedState(
        WString RuntimeFileName,   // LPCWSTR
        PointerByReference ProcessorFeaturesString   // LPCWSTR* optional, out
    );
}
@[Link("computecore")]
lib Libcomputecore
  fun HcsGetProcessorCompatibilityFromSavedState = HcsGetProcessorCompatibilityFromSavedState(
    RuntimeFileName : UInt16*,   # LPCWSTR
    ProcessorFeaturesString : UInt16**   # LPCWSTR* optional, out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef HcsGetProcessorCompatibilityFromSavedStateNative = Int32 Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>);
typedef HcsGetProcessorCompatibilityFromSavedStateDart = int Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>);
final HcsGetProcessorCompatibilityFromSavedState = DynamicLibrary.open('computecore.dll')
    .lookupFunction<HcsGetProcessorCompatibilityFromSavedStateNative, HcsGetProcessorCompatibilityFromSavedStateDart>('HcsGetProcessorCompatibilityFromSavedState');
// RuntimeFileName : LPCWSTR -> Pointer<Utf16>
// ProcessorFeaturesString : LPCWSTR* optional, out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HcsGetProcessorCompatibilityFromSavedState(
  RuntimeFileName: PWideChar;   // LPCWSTR
  ProcessorFeaturesString: PPWideChar   // LPCWSTR* optional, out
): Integer; stdcall;
  external 'computecore.dll' name 'HcsGetProcessorCompatibilityFromSavedState';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "HcsGetProcessorCompatibilityFromSavedState"
  c_HcsGetProcessorCompatibilityFromSavedState :: CWString -> Ptr CWString -> IO Int32
-- RuntimeFileName : LPCWSTR -> CWString
-- ProcessorFeaturesString : LPCWSTR* optional, out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let hcsgetprocessorcompatibilityfromsavedstate =
  foreign "HcsGetProcessorCompatibilityFromSavedState"
    ((ptr uint16_t) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* RuntimeFileName : LPCWSTR -> (ptr uint16_t) *)
(* ProcessorFeaturesString : LPCWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library computecore (t "computecore.dll"))
(cffi:use-foreign-library computecore)

(cffi:defcfun ("HcsGetProcessorCompatibilityFromSavedState" hcs-get-processor-compatibility-from-saved-state :convention :stdcall) :int32
  (runtime-file-name (:string :encoding :utf-16le))   ; LPCWSTR
  (processor-features-string :pointer))   ; LPCWSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HcsGetProcessorCompatibilityFromSavedState = Win32::API::More->new('computecore',
    'int HcsGetProcessorCompatibilityFromSavedState(LPCWSTR RuntimeFileName, LPVOID ProcessorFeaturesString)');
# my $ret = $HcsGetProcessorCompatibilityFromSavedState->Call($RuntimeFileName, $ProcessorFeaturesString);
# RuntimeFileName : LPCWSTR -> LPCWSTR
# ProcessorFeaturesString : LPCWSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。